Source Code Cross Referenced for SystemSetupContext.java in  » Workflow-Engines » JFolder » org » jfolder » console » base » 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 » JFolder » org.jfolder.console.base 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JFolder, Copyright 2001-2006 Gary Steinmetz
003:         *
004:         * Distributable under LGPL license.
005:         * See terms of license at gnu.org.
006:         */
007:
008:        package org.jfolder.console.base;
009:
010:        //base classes
011:        import java.io.IOException;
012:        import java.net.InetAddress;
013:        import java.util.ArrayList;
014:        import java.util.HashMap;
015:
016:        //project specific classes
017:        import org.jfolder.common.UnexpectedSystemException;
018:        import org.jfolder.common.web.template.ConsoleParameterContext;
019:        import org.jfolder.common.web.template.ConsoleTemplateContext;
020:        import org.jfolder.common.web.template.SubmitActionContext;
021:        import org.jfolder.common.web.template.SubmitActionParameters;
022:        import org.jfolder.platforms.servers.instances.jboss.JBossServer;
023:        import org.jfolder.platforms.servers.instances.tomcat.TomcatServer;
024:        import org.jfolder.platforms.stores.instances.hsql.HSQLStore;
025:        import org.jfolder.platforms.stores.instances.mysql.MySQLStore;
026:
027:        //other classes
028:
029:        public class SystemSetupContext extends ConsoleTemplateContext {
030:
031:            protected final static String DATABASE = "DATABASE";
032:            protected final static String DATABASE_CLASS = "DATABASE_CLASS";
033:            protected final static String APPLICATION_SERVER = "APPLICATION_SERVER";
034:            protected final static String APPLICATION_SERVER_CLASS = "APPLICATION_SERVER_CLASS";
035:            protected final static String SESSION_LOCATION = "SESSION_LOCATION";
036:            protected final static String WRONG_DEPLOYS = "WRONG_DEPLOYS";
037:            protected final static String ADMIN_CONTEXT_PATH = "ADMIN_CONTEXT_PATH";
038:            protected final static String MACH_OF_ORIG = "MACH_OF_ORIG";
039:            protected final static String PERM_DIR = "PERM_DIR";
040:            protected final static String CONFIG_RESET = "CONFIG_RESET";
041:            protected final static String UNDERSTAND = "UNDERSTAND";
042:
043:            protected SystemSetupContext() {
044:
045:                //super(inCs);
046:                super ();
047:            }
048:
049:            public String getFromPage() {
050:                return ConsolePageParameters.SERVLET_CONSOLE;
051:            }
052:
053:            public String getHandle() {
054:                return NULL_HANDLE;
055:            }
056:
057:            public String getHandleExtension() {
058:                throw new UnexpectedSystemException(
059:                        "This function should not be called in this class");
060:            }
061:
062:            protected void renderConsolePage() throws IOException {
063:
064:                //
065:                ArrayList understandLabels = new ArrayList();
066:                understandLabels.add("I Do Not Understand");
067:                understandLabels.add("I Understand");
068:                //
069:                ArrayList understandValues = new ArrayList();
070:                understandValues.add(SubmitActionParameters.I_DO_NOT_ACCEPT);
071:                understandValues.add(SubmitActionParameters.I_ACCEPT);
072:                //
073:                String understandBox = createDropDownBox(UNDERSTAND,
074:                        understandLabels, understandValues, null,
075:                        getFontStyleAsStyles(9, COURIER, BLACK), 0, null, null,
076:                        null);
077:
078:                //
079:                startCommonPage();
080:                startEnclosingTableAndRowAndCell(alignCenter(null));
081:                //
082:                startAndEndStretchTableAndRowAndCell("<hr/>");
083:                //
084:                startTable(3);
085:                startRow();
086:                startAndEndCell(3, "System Setup", alignCenter(getFontStyle(16,
087:                        ARIAL, BLACK)));
088:                endRow();
089:                endTable();
090:                //
091:                startAndEndStretchTableAndRowAndCell("<hr/>");
092:                //
093:                createDatabaseDropDownBox();
094:                //
095:                startAndEndStretchTableAndRowAndCell("<hr/>");
096:                //
097:                createApplicationServerDropDownBox();
098:                //
099:                //
100:                //
101:                String sessionLocationTextBox = createTextBox(SESSION_LOCATION,
102:                        "JFOLDER_SESSION", null,
103:                        appendSelectStyles(getFontStyleAsStyles(9, COURIER,
104:                                BLACK)), null, null, null);
105:                //
106:                startAndEndStretchTableAndRowAndCell("<hr/>");
107:                //
108:                startTable(3);
109:                startRow();
110:                //
111:                startCell(1, getFontStyle(12, ARIAL, BLACK));
112:                simpleAndPrint("Session Location");
113:                endCell();
114:                startCell(1);
115:                simpleAndPrint(padNbsp(1));
116:                endCell();
117:                startCell(1);
118:                simpleAndPrint(sessionLocationTextBox);
119:                endCell();
120:                //
121:                endRow();
122:                endTable();
123:                //
124:                //
125:                //
126:                String wrongDeploysTextBox = createTextBox(WRONG_DEPLOYS,
127:                        "jfolder", null,
128:                        appendSelectStyles(getFontStyleAsStyles(9, COURIER,
129:                                BLACK)), null, null, null);
130:                //
131:                startAndEndStretchTableAndRowAndCell("<hr/>");
132:                //
133:                startTable(3);
134:                startRow();
135:                //
136:                startCell(2, getFontStyle(12, ARIAL, BLACK));
137:                simpleAndPrint("Forbidden Deploy Locations");
138:                endCell();
139:                //startCell(1);
140:                //simpleAndPrint(padNbsp(1));
141:                //endCell();
142:                startCell(1);
143:                simpleAndPrint(wrongDeploysTextBox);
144:                endCell();
145:                //
146:                endRow();
147:                endTable();
148:                //
149:                //
150:                //
151:                String adminContextPathTextBox = createTextBox(
152:                        ADMIN_CONTEXT_PATH, "/jfolder", null,
153:                        appendSelectStyles(getFontStyleAsStyles(9, COURIER,
154:                                BLACK)), null, null, null);
155:                //
156:                startAndEndStretchTableAndRowAndCell("<hr/>");
157:                //
158:                startTable(3);
159:                startRow();
160:                //
161:                startCell(2, getFontStyle(12, ARIAL, BLACK));
162:                simpleAndPrint("Administrative Context Path");
163:                endCell();
164:                //startCell(1);
165:                //simpleAndPrint(padNbsp(1));
166:                //endCell();
167:                startCell(1);
168:                simpleAndPrint(adminContextPathTextBox);
169:                endCell();
170:                //
171:                endRow();
172:                endTable();
173:                //
174:                //
175:                //
176:                String machOfOrigTextBox = createTextBox(MACH_OF_ORIG,
177:                        InetAddress.getLocalHost().getHostName(), null,
178:                        appendSelectStyles(getFontStyleAsStyles(9, COURIER,
179:                                BLACK)), null, null, null);
180:                //
181:                startAndEndStretchTableAndRowAndCell("<hr/>");
182:                //
183:                startTable(3);
184:                startRow();
185:                //
186:                startCell(2, getFontStyle(12, ARIAL, BLACK));
187:                simpleAndPrint("Machine Of Origin");
188:                endCell();
189:                //startCell(1);
190:                //simpleAndPrint(padNbsp(1));
191:                //endCell();
192:                startCell(1);
193:                simpleAndPrint(machOfOrigTextBox);
194:                endCell();
195:                //
196:                endRow();
197:                endTable();
198:                //
199:                //
200:                //
201:                String permDirTextBox = createTextBox(PERM_DIR,
202:                        "../jfolder_dir", null,
203:                        appendSelectStyles(getFontStyleAsStyles(9, COURIER,
204:                                BLACK)), null, null, null);
205:                //
206:                startAndEndStretchTableAndRowAndCell("<hr/>");
207:                //
208:                startTable(3);
209:                startRow();
210:                //
211:                startCell(2, getFontStyle(12, ARIAL, BLACK));
212:                simpleAndPrint("Permissible Directories To Access");
213:                endCell();
214:                //startCell(1);
215:                //simpleAndPrint(padNbsp(1));
216:                //endCell();
217:                startCell(1);
218:                simpleAndPrint(permDirTextBox);
219:                endCell();
220:                //
221:                endRow();
222:                endTable();
223:                //
224:                //
225:                //
226:                //
227:                ArrayList configResetLabels = new ArrayList();
228:                configResetLabels.add("Allow Config Reset");
229:                configResetLabels.add("Disable Config Reset");
230:                //
231:                ArrayList configResetValues = new ArrayList();
232:                configResetValues.add(true + "");
233:                configResetValues.add(false + "");
234:                //
235:                String configResetBox = createDropDownBox(CONFIG_RESET,
236:                        configResetLabels, configResetValues, null,
237:                        getFontStyleAsStyles(9, COURIER, BLACK), 1, null, null,
238:                        null);
239:                //
240:                //
241:                //startAndEndStretchTableAndRowAndCell("<hr/>");
242:                //
243:                startAndEndStretchTableAndRowAndCell("<hr/>");
244:                //
245:                startTable(3);
246:                startRow();
247:                //
248:                startCell(2, getFontStyle(12, ARIAL, BLACK));
249:                simpleAndPrint("Config Reset");
250:                endCell();
251:                startCell(1);
252:                simpleAndPrint(configResetBox);
253:                endCell();
254:                //
255:                endRow();
256:                endTable();
257:                //
258:                //
259:                //
260:                //
261:                startAndEndStretchTableAndRowAndCell("<hr/>");
262:                //
263:                startTable(3);
264:                startRow();
265:                //
266:                startCell(1);
267:                simpleAndPrint(understandBox);
268:                endCell();
269:                startCell(2, getFontStyle(9, ARIAL, BLACK));
270:                simpleAndPrint("I understand that undoing these settings will require "
271:                        + "someone to delete them directly from the database");
272:                endCell();
273:                //
274:                endRow();
275:                endTable();
276:                //
277:                //int previousMargin = getLeftMargin();
278:                //setLeftMargin(previousMargin + 1);
279:                //
280:                startAndEndStretchTableAndRowAndCell("<hr/>");
281:                //
282:                //setLeftMargin(previousMargin);
283:                //
284:                startTable(3);
285:                startRow();
286:                //
287:                SubmitActionContext sacConfigureSystem = SubmitActionContext
288:                        .newInstance(this );
289:                sacConfigureSystem
290:                        .setGoToPage(ConsolePageParameters.SERVLET_CONSOLE);
291:                //
292:                sacConfigureSystem.addAction(
293:                        ConsoleParameterContext.FIRST_INPUT,
294:                        singleQuotes(SubmitActionParameters.CONFIGURE_SYSTEM));
295:                //
296:                //sacConfigureSystem.addParameter(
297:                //    sacConfigureSystem.FIRST_INPUT,
298:                //    "getPageComponent('" + DATABASE + "').value");
299:                //sacConfigureSystem.addParameter(
300:                //    sacConfigureSystem.SECOND_INPUT,
301:                //    "getPageComponent('"
302:                //        + DATABASE_CLASS + "').value");
303:                //sacConfigureSystem.addParameter(
304:                //    sacConfigureSystem.THIRD_INPUT,
305:                //    "getPageComponent('"
306:                //        + APPLICATION_SERVER + "').value");
307:                //sacConfigureSystem.addParameter(
308:                //    sacConfigureSystem.FOURTH_INPUT,
309:                //    "getPageComponent('"
310:                //        + APPLICATION_SERVER_CLASS + "').value");
311:                //sacConfigureSystem.addParameter(
312:                //    sacConfigureSystem.FIFTH_INPUT,
313:                //    "getPageComponent('"
314:                //        + SESSION_LOCATION + "').value");
315:                //sacConfigureSystem.addParameter(
316:                //    sacConfigureSystem.SIXTH_INPUT,
317:                //    "getPageComponent('"
318:                //        + WRONG_DEPLOYS + "').value");
319:                //sacConfigureSystem.addParameter(
320:                //    sacConfigureSystem.SEVENTH_INPUT,
321:                //    "getPageComponent('"
322:                //        + ADMIN_CONTEXT_PATH + "').value");
323:                //sacConfigureSystem.addParameter(
324:                //    sacConfigureSystem.EIGHTH_INPUT,
325:                //    "getPageComponent('"
326:                //        + MACH_OF_ORIG + "').value");
327:                //sacConfigureSystem.addParameter(
328:                //    sacConfigureSystem.NINTH_INPUT,
329:                //    "getPageComponent('"
330:                //        + PERM_DIR + "').value");
331:                //sacConfigureSystem.addParameter(
332:                //    sacConfigureSystem.TENTH_INPUT,
333:                //    "getPageComponent('"
334:                //        + UNDERSTAND + "').value");
335:                //
336:                startCell(3, alignCenter(getFontStyle(16, ARIAL, BLACK)));
337:                createButton(null, "Configure System",
338:                        ((2 * getColumnWidth()) - 10),
339:                        submitActionCall(sacConfigureSystem), null, null, null,
340:                        null);
341:                endCell();
342:                //
343:                endRow();
344:                endTable();
345:                //
346:                startAndEndStretchTableAndRowAndCell("<hr/>");
347:                //
348:                endEnclosingTableAndRowAndCell();
349:                endCommonPage();
350:            }
351:
352:            private void createDatabaseDropDownBox() throws IOException {
353:
354:                //
355:                ArrayList databaseLabels = new ArrayList();
356:                //databaseLabels.add("--------");
357:                databaseLabels.add(HSQLStore.getDisplayName());
358:                databaseLabels.add(MySQLStore.getDisplayName());
359:                databaseLabels.add("Custom (Specify Below)");
360:                //
361:                ArrayList databaseValues = new ArrayList();
362:                //databaseValues.add(SubmitActionParameters.BLANK);
363:                databaseValues.add(HSQLStore.class.getName());
364:                databaseValues.add(MySQLStore.class.getName());
365:                databaseValues.add(SubmitActionParameters.BLANK);
366:                //
367:                createSection(databaseLabels, databaseValues, "Database",
368:                        DATABASE, DATABASE_CLASS);
369:                //
370:
371:                //String databaseDropDownBox = createDropDownBox(
372:                //    DATABASE, databaseLabels, databaseValues,
373:                //    appendSelectStyles(getFontStyleAsStyles(9, COURIER, BLACK)),
374:                //    0, null, null);
375:                //
376:                //String databaseClassTextBox = createTextBox(
377:                //    DATABASE_CLASS, "custom.database.class",
378:                //    appendSelectStyles(getFontStyleAsStyles(9, COURIER, BLACK)),
379:                //    null, null, null);
380:                //
381:                //startTable(3);
382:                //startRow();
383:                //
384:                //startAndEndCell(2, "Database", getFontStyle(12, ARIAL, BLACK));
385:                //
386:                //startCell(1, alignCenter(null));
387:                //simpleAndPrint(databaseDropDownBox);
388:                //endCell();
389:                //
390:                //endRow();
391:                //endTable();
392:                //
393:                //int previousMargin = getLeftMargin();
394:                //setLeftMargin(previousMargin + 1);
395:                //
396:                //startAndEndStretchTableAndRowAndCell("<hr/>");
397:                //
398:                //startTable(2);
399:                //startRow();
400:                //
401:                //startAndEndCell(1, "Custom Class", getFontStyle(10, ARIAL, BLACK));
402:                //
403:                //startCell(1, alignCenter(null));
404:                //simpleAndPrint(databaseClassTextBox);
405:                //endCell();
406:                //
407:                //endRow();
408:                //endTable();
409:                //
410:                //startAndEndStretchTableAndRowAndCell("<hr/>");
411:                //
412:                //setLeftMargin(previousMargin);
413:            }
414:
415:            private void createApplicationServerDropDownBox()
416:                    throws IOException {
417:
418:                //
419:                ArrayList applicationServerLabels = new ArrayList();
420:                //applicationServerLabels.add("--------");
421:                applicationServerLabels.add(TomcatServer.getDisplayName());
422:                applicationServerLabels.add(JBossServer.getDisplayName());
423:                //applicationServerLabels.add("Tomcat");
424:                applicationServerLabels.add("Custom (Specify Below)");
425:                //
426:                ArrayList applicationServerValues = new ArrayList();
427:                //applicationServerValues.add(SubmitActionParameters.BLANK);
428:                applicationServerValues.add(TomcatServer.class.getName());
429:                applicationServerValues.add(JBossServer.class.getName());
430:                //applicationServerValues.add("Tomcat");
431:                applicationServerValues.add(SubmitActionParameters.BLANK);
432:                //
433:                createSection(applicationServerLabels, applicationServerValues,
434:                        "Application Server", APPLICATION_SERVER,
435:                        APPLICATION_SERVER_CLASS);
436:                //
437:                //String applicationServerDropDownBox = createDropDownBox(
438:                //    APPLICATION_SERVER, applicationServerLabels,
439:                //    applicationServerValues,
440:                //    appendSelectStyles(getFontStyleAsStyles(9, COURIER, BLACK)),
441:                //    0, null, null);
442:                //
443:                //
444:                //startTable(3);
445:                //startRow();
446:                //startAndEndCell(2, "Application Server",
447:                //    getFontStyle(12, ARIAL, BLACK));
448:                //startCell(1, alignCenter(null));
449:                //
450:                //simpleAndPrint(applicationServerDropDownBox);
451:                //
452:                //endCell();
453:                //endRow();
454:                //endTable();
455:            }
456:
457:            private void createSection(ArrayList inLabels, ArrayList inValues,
458:                    String inTypeLabel, String inNormalName, String inCustomName)
459:                    throws IOException {
460:
461:                //
462:                String dropDownBox = createDropDownBox(inNormalName, inLabels,
463:                        inValues, null,
464:                        appendSelectStyles(getFontStyleAsStyles(9, COURIER,
465:                                BLACK)), 0, null, null, null);
466:                //
467:                String classTextBox = createTextBox(inCustomName,
468:                        "custom.class.name", null,
469:                        appendSelectStyles(getFontStyleAsStyles(9, COURIER,
470:                                BLACK)), null, null, null);
471:                //
472:                startTable(3);
473:                startRow();
474:                //
475:                startAndEndCell(2, inTypeLabel, getFontStyle(12, ARIAL, BLACK));
476:                //
477:                startCell(1, alignCenter(null));
478:                simpleAndPrint(dropDownBox);
479:                endCell();
480:                //
481:                endRow();
482:                endTable();
483:
484:                int previousMargin = getLeftMargin();
485:                setLeftMargin(previousMargin + 1);
486:                //
487:                startAndEndStretchTableAndRowAndCell("<hr/>");
488:                //
489:                startTable(2);
490:                startRow();
491:                //
492:                startAndEndCell(1, "Custom Class", getFontStyle(10, ARIAL,
493:                        BLACK));
494:                //
495:                startCell(1, alignCenter(null));
496:                simpleAndPrint(classTextBox);
497:                endCell();
498:                //
499:                endRow();
500:                endTable();
501:                //
502:                //startAndEndStretchTableAndRowAndCell("<hr/>");
503:                //
504:                setLeftMargin(previousMargin);
505:            }
506:
507:            private HashMap appendSelectStyles(HashMap inStyles) {
508:
509:                HashMap outValue = inStyles;
510:
511:                if (outValue == null) {
512:                    outValue = new HashMap();
513:                }
514:
515:                outValue.put("width", (getColumnWidth() - 10) + "");
516:
517:                return outValue;
518:            }
519:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.