Source Code Cross Referenced for UBTSettingsBean.java in  » Portal » Open-Portal » com » sun » portal » admin » console » ubt » bean » 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 » Portal » Open Portal » com.sun.portal.admin.console.ubt.bean 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Copyright 2005 Sun Microsystems, Inc. All
003:         * rights reserved. Use of this product is subject
004:         * to license terms. Federal Acquisitions:
005:         * Commercial Software -- Government Users
006:         * Subject to Standard License Terms and
007:         * Conditions.
008:         *
009:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
010:         * are trademarks or registered trademarks of Sun Microsystems,
011:         * Inc. in the United States and other countries.
012:         */package com.sun.portal.admin.console.ubt.bean;
013:
014:        import com.sun.portal.admin.console.logging.bean.PortalInstancesDropDownOptionsBean;
015:        import com.sun.portal.admin.console.logging.data.LoggingResourceBundle;
016:        import com.sun.portal.admin.console.logging.data.PortalViewUtility;
017:        import com.sun.portal.admin.console.ubt.data.UBTViewUtility;
018:        import com.sun.portal.admin.console.ubt.data.UBTConstants;
019:        import com.sun.portal.admin.console.ubt.data.UBTResourceBundle;
020:        import com.sun.portal.log.common.PortalLogger;
021:        import com.sun.data.provider.impl.ObjectListDataProvider;
022:        import com.sun.data.provider.RowKey;
023:        import com.sun.data.provider.DataProvider;
024:        import com.sun.web.ui.component.Checkbox;
025:
026:        import javax.faces.event.ValueChangeEvent;
027:        import javax.faces.context.FacesContext;
028:        import javax.management.MalformedObjectNameException;
029:        import javax.management.ReflectionException;
030:        import javax.management.InstanceNotFoundException;
031:        import javax.management.MBeanException;
032:        import java.util.*;
033:        import java.util.logging.Level;
034:        import java.util.logging.Logger;
035:        import java.util.logging.LogRecord;
036:        import java.lang.reflect.Field;
037:        import java.io.IOException;
038:        import java.text.MessageFormat;
039:
040:        /**
041:         *
042:         */
043:        public class UBTSettingsBean {
044:            private static Logger logger = PortalLogger
045:                    .getLogger(UBTSettingsBean.class);
046:            private static Set excludeSet = new HashSet();
047:            static {
048:                Field[] fields = UBTConstants.class.getFields();
049:
050:                try {
051:                    for (int i = 0; i < fields.length; i++)
052:                        excludeSet.add(fields[i].get(UBTConstants.class));
053:                } catch (IllegalAccessException e) {
054:                    //dropthrough!
055:                }
056:            }
057:            String currentInstance;
058:
059:            boolean enable;
060:            String level = "OFF";
061:
062:            boolean logUserID;
063:
064:            boolean fileHandler;
065:            String filehandlerName;
066:            String filehandlerPattern;
067:            String filehandlerLimit;
068:            String filehandlerCount;
069:            String filehandlerAppend = "true";
070:            String filehandlerFilter;
071:            String filehandlerFormatter;
072:
073:            boolean jdbcHandler;
074:            String jdbchandlerName;
075:            String jdbchandlerDriver;
076:            String jdbchandlerConnection;
077:
078:            boolean customHandler;
079:            String customhandlerName;
080:            boolean customeHandlerPropertySelected;
081:            String customeHandlerPropertyName;
082:            String customeHandlerPropertyValue;
083:
084:            boolean noInstance = true;
085:
086:            ObjectListDataProvider customHandlerProperties;
087:
088:            ObjectListDataProvider eventDetails;
089:
090:            private boolean alert;
091:            private String alertSummary;
092:            private String alertDetail;
093:            private String alertType;
094:
095:            public boolean isAlert() {
096:                boolean temp = alert;
097:                alert = false;
098:                return temp;
099:            }
100:
101:            public void setAlert(boolean alert) {
102:                this .alert = alert;
103:            }
104:
105:            public String getAlertSummary() {
106:                return alertSummary;
107:            }
108:
109:            public void setAlertSummary(String alertSummary) {
110:                this .alertSummary = alertSummary;
111:            }
112:
113:            public String getAlertDetail() {
114:                return alertDetail;
115:            }
116:
117:            public void setAlertDetail(String alertDetail) {
118:                this .alertDetail = alertDetail;
119:            }
120:
121:            public String getAlertType() {
122:                return alertType;
123:            }
124:
125:            public void setAlertType(String alertType) {
126:                this .alertType = alertType;
127:            }
128:
129:            public boolean isSheetVisible() {
130:                return !noInstance;
131:            }
132:
133:            public boolean isButtonDisabled() {
134:                return noInstance;
135:            }
136:
137:            public boolean isInfoVisible() {
138:                return noInstance;
139:            }
140:
141:            private void initCustomProp() {
142:                LinkedList list = new LinkedList();
143:                customHandlerProperties = new ObjectListDataProvider(list);
144:                customHandlerProperties.setObjectType(CustomPropertyBean.class);
145:            }
146:
147:            public UBTSettingsBean() {
148:                initCustomProp();
149:                loadEventDetails(new Hashtable());
150:            }
151:
152:            public ObjectListDataProvider getCustomHandlerProperties() {
153:                return customHandlerProperties;
154:            }
155:
156:            public void setCustomHandlerProperties(
157:                    DataProvider customHandlerProperties) {
158:                this .customHandlerProperties = (ObjectListDataProvider) customHandlerProperties;
159:            }
160:
161:            private void loadCustomHandlerProperties(Hashtable values) {
162:                LinkedList propList = new LinkedList();
163:                Iterator valIt = values.keySet().iterator();
164:                while (valIt.hasNext()) {
165:                    String key = (String) valIt.next();
166:                    if (!excludeSet.contains(key)) {
167:                        propList.add(new CustomPropertyBean(key,
168:                                (String) values.get(key)));
169:                    }
170:                }
171:                customHandlerProperties = new ObjectListDataProvider(propList);
172:                customHandlerProperties.setObjectType(CustomPropertyBean.class);
173:            }
174:
175:            public String getFilehandlerName() {
176:                return filehandlerName;
177:            }
178:
179:            public void setFilehandlerName(String filehandlerName) {
180:            }
181:
182:            public ObjectListDataProvider getEventDetails() {
183:                return eventDetails;
184:            }
185:
186:            public void setEventDetails(ObjectListDataProvider eventDetails) {
187:                this .eventDetails = eventDetails;
188:            }
189:
190:            private void loadEventDetails(Hashtable values) {
191:                LinkedList eventDetailsList = new LinkedList();
192:                String[] supportedEventProps = UBTEventBean
193:                        .getSupportedEventProps();
194:                for (int i = 0; i < supportedEventProps.length; i++) {
195:                    eventDetailsList
196:                            .add(values.containsKey(supportedEventProps[i]) ? UBTEventBean
197:                                    .getInstance(
198:                                            getEventIdFromProp(supportedEventProps[i]),
199:                                            (String) values
200:                                                    .get(supportedEventProps[i]))
201:                                    : UBTEventBean
202:                                            .getInstance(
203:                                                    getEventIdFromProp(supportedEventProps[i]),
204:                                                    this .level));
205:                }
206:                eventDetails = new ObjectListDataProvider(eventDetailsList);
207:                eventDetails.setObjectType(UBTEventBean.class);
208:            }
209:
210:            private String getEventIdFromProp(String supportedEventProp) {
211:                return supportedEventProp.substring(
212:                        UBTEventBean.EVENT_LEVEL_PROP_PREFIX.length(),
213:                        supportedEventProp
214:                                .indexOf(UBTEventBean.EVENT_LEVEL_PROP_SUFFIX));
215:            }
216:
217:            public boolean getCustomHandler() {
218:                return customHandler;
219:            }
220:
221:            public void setCustomHandler(boolean customHandler) {
222:
223:            }
224:
225:            public String getCustomhandlerName() {
226:                return customhandlerName;
227:            }
228:
229:            public void setCustomhandlerName(String customhandlerName) {
230:            }
231:
232:            public boolean getCustomeHandlerPropertySelected() {
233:                return customeHandlerPropertySelected;
234:            }
235:
236:            public void setCustomeHandlerPropertySelected(
237:                    boolean customeHandlerPropertySelected) {
238:
239:            }
240:
241:            public String getCustomeHandlerPropertyName() {
242:                return customeHandlerPropertyName;
243:            }
244:
245:            public void setCustomeHandlerPropertyName(
246:                    String customeHandlerPropertyName) {
247:
248:            }
249:
250:            public String getCustomeHandlerPropertyValue() {
251:                return customeHandlerPropertyValue;
252:            }
253:
254:            public void setCustomeHandlerPropertyValue(
255:                    String customeHandlerPropertyValue) {
256:
257:            }
258:
259:            public ObjectListDataProvider getDummyList() {
260:                List list = new LinkedList();
261:                list.add(new DummyBean());
262:                ObjectListDataProvider oldp = new ObjectListDataProvider(list);
263:                oldp.setObjectType(DummyBean.class);
264:                return oldp;
265:            }
266:
267:            public String apply() {
268:                clearAlert();
269:                if (!shouldApply())
270:                    return "success";
271:                try {
272:                    store(this .currentInstance);
273:                    loadDetails(this .currentInstance);
274:                } catch (Exception e) {
275:                    if (logger.isLoggable(Level.SEVERE)) {
276:                        LogRecord record = new LogRecord(Level.SEVERE,
277:                                "PSAUI_CSPACUBB0002");
278:                        record
279:                                .setParameters(new Object[] { this .currentInstance });
280:                        record.setThrown(e);
281:                        record.setLoggerName(logger.getName());
282:                        logger.log(record);
283:                    }
284:                    setupError("ubtsettings.errortext.store.single", "'"
285:                            + this .currentInstance + "'");
286:                    return "failure";
287:                }
288:                return "success";
289:            }
290:
291:            private void setupError(String message, String tokens) {
292:                String formattedMsg = MessageFormat.format(UBTResourceBundle
293:                        .getProperty(message), new Object[] { tokens });
294:                if (getAlertSummary() != null)
295:                    formattedMsg = getAlertSummary() + " " + formattedMsg;
296:                setAlertSummary(formattedMsg);
297:                setAlertType("error");
298:                setAlert(true);
299:            }
300:
301:            private void store(String instance) throws ReflectionException,
302:                    InstanceNotFoundException, IOException, MBeanException,
303:                    MalformedObjectNameException {
304:                Hashtable values = new Hashtable();
305:                values.put(UBTConstants.UBT_ENABLE_PROP, enable + "");
306:                values.put(UBTConstants.UBT_LEVEL_PROP, this .level);
307:                values.put(UBTConstants.UBT_HANDLER_PROP, getHandlerValue());
308:                values.put(UBTConstants.UBT_FILE_PATTERN_PROP,
309:                        this .filehandlerPattern);
310:                values.put(UBTConstants.UBT_FILE_APPEND_PROP,
311:                        this .filehandlerAppend);
312:                if (this .filehandlerCount != null)
313:                    values.put(UBTConstants.UBT_FILE_COUNT_PROP,
314:                            this .filehandlerCount);
315:                if (this .filehandlerFilter != null)
316:                    values.put(UBTConstants.UBT_FILE_FILTER_PROP,
317:                            this .filehandlerFilter);
318:                if (this .filehandlerLimit != null)
319:                    values.put(UBTConstants.UBT_FILE_LIMIT_PROP,
320:                            this .filehandlerLimit);
321:                values.put(UBTConstants.UBT_FILE_FORMATTER_PROP,
322:                        this .filehandlerFormatter);
323:                values.put(UBTConstants.UBT_USER_PROP, this .logUserID + "");
324:                putEventDetails(values);
325:                if (this .jdbchandlerConnection != null)
326:                    values.put(UBTConstants.UBT_JDBC_CONNECTION_PROP,
327:                            this .jdbchandlerConnection);
328:                if (this .jdbchandlerDriver != null)
329:                    values.put(UBTConstants.UBT_JDBC_DRIVER_PROP,
330:                            this .jdbchandlerDriver);
331:                putCustomHandlerProperties(values);
332:                UBTViewUtility uvu = new UBTViewUtility();
333:                uvu.setUBTSettings(values, instance);
334:            }
335:
336:            private boolean shouldApply() {
337:                if (LoggingResourceBundle
338:                        .getProperty(
339:                                PortalInstancesDropDownOptionsBean.INSTANCE_SELECT_OPTION)
340:                        .equals(currentInstance))
341:                    return false;
342:                else
343:                    return true;
344:            }
345:
346:            private void putCustomHandlerProperties(Hashtable values) {
347:                customHandlerProperties.commitChanges();
348:                Object[] propsArray = customHandlerProperties.getList()
349:                        .toArray();
350:                for (int i = 0; i < propsArray.length; i++) {
351:                    if (((CustomPropertyBean) propsArray[i]).getName() != null
352:                            && !"".equals(((CustomPropertyBean) propsArray[i])
353:                                    .getName()))
354:                        values.put(((CustomPropertyBean) propsArray[i])
355:                                .getName(),
356:                                ((CustomPropertyBean) propsArray[i]).getVal());
357:                }
358:            }
359:
360:            private void putEventDetails(Hashtable values) {
361:                eventDetails.commitChanges();
362:                Object[] eventArray = this .eventDetails.getList().toArray();
363:                for (int i = 0; i < eventArray.length; i++) {
364:                    values.put(((UBTEventBean) eventArray[i]).getEventProp(),
365:                            ((UBTEventBean) eventArray[i]).getLevel());
366:                }
367:            }
368:
369:            private String getHandlerValue() {
370:                String handlers = "";
371:                if (this .fileHandler)
372:                    handlers = handlers + this .filehandlerName;
373:                if (this .jdbcHandler)
374:                    handlers = handlers.equals("") ? handlers
375:                            + this .jdbchandlerName : handlers + ","
376:                            + this .jdbchandlerName;
377:                if (this .customHandler)
378:                    handlers = handlers.equals("") ? handlers
379:                            + this .customhandlerName : handlers + ","
380:                            + this .customhandlerName;
381:                return handlers;
382:            }
383:
384:            public String applyAll() {
385:                clearAlert();
386:                if (!shouldApply())
387:                    return "success";
388:                List instances = new PortalViewUtility().getInstanceNames();
389:                int i = 0;
390:                boolean error = false;
391:                String instancesWithError = null;
392:                for (i = 0; i < instances.size(); i++) {
393:                    try {
394:                        store((String) instances.get(i));
395:                    } catch (Exception e) {
396:                        if (logger.isLoggable(Level.SEVERE)) {
397:                            LogRecord record = new LogRecord(Level.SEVERE,
398:                                    "PSAUI_CSPACUBB0002");
399:                            record
400:                                    .setParameters(new Object[] { (String) instances
401:                                            .get(i) });
402:                            record.setThrown(e);
403:                            record.setLoggerName(logger.getName());
404:                            logger.log(record);
405:                        }
406:                        error = true;
407:                        if (instancesWithError == null)
408:                            instancesWithError = "'"
409:                                    + ((String) instances.get(i)) + "'";
410:                        else
411:                            instancesWithError = instancesWithError + ", '"
412:                                    + ((String) instances.get(i)) + "'";
413:                    }
414:                }
415:                if (error) {
416:                    setupError("ubtsettings.errortext.store.multi",
417:                            instancesWithError);
418:                }
419:                loadDetails(this .currentInstance);
420:                return "success";
421:            }
422:
423:            public String addProperty() {
424:                if (customHandlerProperties.canAppendRow()) {
425:                    RowKey rkey = customHandlerProperties.appendRow();
426:                }
427:                customHandlerProperties.commitChanges();
428:                return "";
429:            }
430:
431:            public String deleteProperty() {
432:                RowKey[] rkey = customHandlerProperties.getRowKeys(1000, null);
433:                List selectedcbs = Checkbox.getSelected("propertySelect");
434:                List l = customHandlerProperties.getList();
435:                for (int index = 0; index < l.size(); index++) {
436:                    CustomPropertyBean uid = (CustomPropertyBean) l.get(index);
437:                    if (selectedcbs != null && !selectedcbs.isEmpty()
438:                            && selectedcbs.contains(uid.getName())) {
439:                        customHandlerProperties.removeRow(rkey[index]);
440:                    }
441:                }
442:                customHandlerProperties.commitChanges();
443:                return "";
444:            }
445:
446:            public String modifyProperty() {
447:                return "success";
448:            }
449:
450:            public boolean getFileHandler() {
451:                return fileHandler;
452:            }
453:
454:            public void setFileHandler(boolean fileHandler) {
455:
456:            }
457:
458:            public boolean getJdbcHandler() {
459:                return jdbcHandler;
460:            }
461:
462:            public void setJdbcHandler(boolean jdbcHandler) {
463:
464:            }
465:
466:            public String getJdbchandlerName() {
467:                return jdbchandlerName;
468:            }
469:
470:            public void setJdbchandlerName(String jdbchandlerName) {
471:
472:            }
473:
474:            public String getJdbchandlerDriver() {
475:                return jdbchandlerDriver;
476:            }
477:
478:            public void setJdbchandlerDriver(String jdbchandlerDriver) {
479:
480:            }
481:
482:            public String getJdbchandlerConnection() {
483:                return jdbchandlerConnection;
484:            }
485:
486:            public void setJdbchandlerConnection(String jdbchandlerConnection) {
487:
488:            }
489:
490:            public String getCurrentInstance() {
491:                return currentInstance;
492:            }
493:
494:            public void setCurrentInstance(String currentInstance) {
495:            }
496:
497:            public String getFilehandlerPattern() {
498:                return filehandlerPattern;
499:            }
500:
501:            public void setFilehandlerPattern(String filehandlerPattern) {
502:
503:            }
504:
505:            public String getFilehandlerLimit() {
506:                return filehandlerLimit;
507:            }
508:
509:            public void setFilehandlerLimit(String filehandlerLimit) {
510:
511:            }
512:
513:            public String getFilehandlerCount() {
514:                return filehandlerCount;
515:            }
516:
517:            public String getFilehandlerFilter() {
518:                return filehandlerFilter;
519:            }
520:
521:            public void setFilehandlerFilter(String filehandlerFilter) {
522:
523:            }
524:
525:            public void setFilehandlerCount(String filehandlerCount) {
526:
527:            }
528:
529:            public String getFilehandlerAppend() {
530:                return filehandlerAppend;
531:            }
532:
533:            public void setFilehandlerAppend(String filehandlerAppend) {
534:
535:            }
536:
537:            public String getFilehandlerFormatter() {
538:                return filehandlerFormatter;
539:            }
540:
541:            private void loadDetails(String currentInstance) {
542:                UBTViewUtility uvu = new UBTViewUtility();
543:                try {
544:                    Hashtable values = uvu.getUBTSettings(currentInstance);
545:                    this .enable = Boolean.valueOf(
546:                            ((String) values.get(UBTConstants.UBT_ENABLE_PROP))
547:                                    .trim()).booleanValue();
548:                    this .level = (String) values
549:                            .get(UBTConstants.UBT_LEVEL_PROP);
550:                    this .fileHandler = isHandlerChecked((String) values
551:                            .get(UBTConstants.UBT_HANDLER_PROP),
552:                            UBTConstants.UBT_FILE_HANDLER);
553:                    filehandlerName = UBTConstants.UBT_FILE_HANDLER;
554:                    this .filehandlerPattern = (String) values
555:                            .get(UBTConstants.UBT_FILE_PATTERN_PROP);
556:                    this .filehandlerAppend = values
557:                            .containsKey(UBTConstants.UBT_FILE_APPEND_PROP) ? (String) values
558:                            .get(UBTConstants.UBT_FILE_APPEND_PROP)
559:                            : "true";
560:                    this .filehandlerCount = (String) values
561:                            .get(UBTConstants.UBT_FILE_COUNT_PROP);
562:                    this .filehandlerFilter = (String) values
563:                            .get(UBTConstants.UBT_FILE_FILTER_PROP);
564:                    this .filehandlerLimit = (String) values
565:                            .get(UBTConstants.UBT_FILE_LIMIT_PROP);
566:                    this .filehandlerFormatter = (String) values
567:                            .get(UBTConstants.UBT_FILE_FORMATTER_PROP);
568:                    this .logUserID = Boolean.valueOf(
569:                            ((String) values.get(UBTConstants.UBT_USER_PROP))
570:                                    .trim()).booleanValue();
571:                    this .loadEventDetails(values);
572:                    this .jdbcHandler = isHandlerChecked((String) values
573:                            .get(UBTConstants.UBT_HANDLER_PROP),
574:                            UBTConstants.UBT_JDBC_HANDLER);
575:                    this .jdbchandlerConnection = (String) values
576:                            .get(UBTConstants.UBT_JDBC_CONNECTION_PROP);
577:                    this .jdbchandlerDriver = (String) values
578:                            .get(UBTConstants.UBT_JDBC_DRIVER_PROP);
579:                    this .jdbchandlerName = UBTConstants.UBT_JDBC_HANDLER;
580:                    this .customHandler = isCustomHandlerCheckedAlsoSet((String) values
581:                            .get(UBTConstants.UBT_HANDLER_PROP));
582:                    //this.customhandlerName is set in the isCustomHandlerCheckedAlsoSet call
583:                    loadCustomHandlerProperties(values);
584:                } catch (Exception e) {
585:                    if (logger.isLoggable(Level.SEVERE)) {
586:                        LogRecord record = new LogRecord(Level.SEVERE,
587:                                "PSAUI_CSPACUBB0003");
588:                        record.setParameters(new Object[] { currentInstance });
589:                        record.setThrown(e);
590:                        record.setLoggerName(logger.getName());
591:                        logger.log(record);
592:                    }
593:                    setupError("ubtsettings.errortext.load", "'"
594:                            + currentInstance + "'");
595:                    noInstance = true;
596:                }
597:            }
598:
599:            private boolean isCustomHandlerCheckedAlsoSet(String s) {
600:                StringTokenizer tokens = new StringTokenizer(s, " ,"); //space or comma
601:                boolean checked = false;
602:                while (tokens.hasMoreTokens()) {
603:                    String token = tokens.nextToken();
604:                    if (!token.equals(UBTConstants.UBT_FILE_HANDLER)
605:                            && !token.equals(UBTConstants.UBT_JDBC_HANDLER)) {
606:                        this .customhandlerName = token;
607:                        checked = true;
608:                        break;
609:                    }
610:                }
611:                return checked;
612:            }
613:
614:            private boolean isHandlerChecked(String s, String handler) {
615:                StringTokenizer tokens = new StringTokenizer(s, " ,"); //space or comma
616:                boolean checked = false;
617:                while (tokens.hasMoreTokens()) {
618:                    if (handler.equals(tokens.nextToken())) {
619:                        checked = true;
620:                        break;
621:                    }
622:                }
623:                return checked;
624:            }
625:
626:            public boolean getEnable() {
627:                return enable;
628:            }
629:
630:            public void setEnable(boolean enable) {
631:            }
632:
633:            public boolean getDisable() {
634:                return !enable;
635:            }
636:
637:            public void setDisable(boolean disable) {
638:            }
639:
640:            public boolean getFinest() {
641:                return level.equals(Level.FINEST.getName());
642:            }
643:
644:            public void setFinest(boolean finest) {
645:
646:            }
647:
648:            public boolean getFiner() {
649:                return level.equals(Level.FINER.getName());
650:            }
651:
652:            public void setFiner(boolean finer) {
653:            }
654:
655:            public boolean getFine() {
656:                return level.equals(Level.FINE.getName());
657:            }
658:
659:            public void setFine(boolean fine) {
660:            }
661:
662:            public boolean getInfo() {
663:                return level.equals(Level.INFO.getName());
664:            }
665:
666:            public void setInfo(boolean info) {
667:            }
668:
669:            public boolean getLogUserID() {
670:                return logUserID;
671:            }
672:
673:            public void setLogUserID(boolean logUserID) {
674:
675:            }
676:
677:            public boolean getNoLogUserID() {
678:                return !logUserID;
679:            }
680:
681:            public void setNoLogUserID(boolean noLogUserID) {
682:            }
683:
684:            public void processEnable(ValueChangeEvent evt) {
685:                this .enable = (Boolean.valueOf(evt.getNewValue().toString()
686:                        .trim()).booleanValue());
687:            }
688:
689:            public void processFinest(ValueChangeEvent evt) {
690:                if (Boolean.valueOf(evt.getNewValue().toString().trim())
691:                        .booleanValue())
692:                    this .level = Level.FINEST.getName();
693:            }
694:
695:            public void processFiner(ValueChangeEvent evt) {
696:                if (Boolean.valueOf(evt.getNewValue().toString().trim())
697:                        .booleanValue())
698:                    this .level = Level.FINER.getName();
699:            }
700:
701:            public void processFine(ValueChangeEvent evt) {
702:                if (Boolean.valueOf(evt.getNewValue().toString().trim())
703:                        .booleanValue())
704:                    this .level = Level.FINE.getName();
705:            }
706:
707:            public void processInfo(ValueChangeEvent evt) {
708:                if (Boolean.valueOf(evt.getNewValue().toString().trim())
709:                        .booleanValue())
710:                    this .level = Level.INFO.getName();
711:            }
712:
713:            public void processDisable(ValueChangeEvent evt) {
714:                this .enable = !(Boolean.valueOf(evt.getNewValue().toString()
715:                        .trim()).booleanValue());
716:            }
717:
718:            public void processLogUserID(ValueChangeEvent evt) {
719:                this .logUserID = (Boolean.valueOf(evt.getNewValue().toString()
720:                        .trim()).booleanValue());
721:            }
722:
723:            public void processNoLogUserID(ValueChangeEvent evt) {
724:                this .logUserID = !(Boolean.valueOf(evt.getNewValue().toString()
725:                        .trim()).booleanValue());
726:            }
727:
728:            public void processFilehandlerCount(ValueChangeEvent evt) {
729:                this .filehandlerCount = (evt.getNewValue().toString());
730:            }
731:
732:            public void processFilehandlerLimit(ValueChangeEvent evt) {
733:                this .filehandlerLimit = (evt.getNewValue().toString());
734:            }
735:
736:            public void processFilehandlerAppend(ValueChangeEvent evt) {
737:                this .filehandlerAppend = (evt.getNewValue().toString());
738:            }
739:
740:            public void processJdbchandlerDriver(ValueChangeEvent evt) {
741:                this .jdbchandlerDriver = (evt.getNewValue().toString());
742:            }
743:
744:            public void processJdbchandlerConnection(ValueChangeEvent evt) {
745:                this .jdbchandlerConnection = (evt.getNewValue().toString());
746:            }
747:
748:            public void processFilehandlerFilter(ValueChangeEvent evt) {
749:                this .filehandlerFilter = (evt.getNewValue().toString());
750:            }
751:
752:            public void processPropertyName(ValueChangeEvent evt) {
753:                this .customeHandlerPropertyName = (evt.getNewValue().toString());
754:            }
755:
756:            public void processPropertyVal(ValueChangeEvent evt) {
757:                this .customeHandlerPropertyValue = (evt.getNewValue()
758:                        .toString());
759:            }
760:
761:            public void processCurrentInstance(ValueChangeEvent evt) {
762:                clearAlert();
763:                String currentInstance = (evt.getNewValue().toString());
764:                if (!LoggingResourceBundle
765:                        .getProperty(
766:                                PortalInstancesDropDownOptionsBean.INSTANCE_SELECT_OPTION)
767:                        .equals(currentInstance)
768:                        && !currentInstance.equals(this .currentInstance)) {
769:                    resetVariables();
770:                    noInstance = false;
771:                    loadDetails(currentInstance);
772:                } else {
773:                    noInstance = true;
774:                    resetVariables();
775:                }
776:                this .currentInstance = currentInstance;
777:            }
778:
779:            public void processEventLevel(ValueChangeEvent evt) {
780:                String eventID = FacesContext.getCurrentInstance()
781:                        .getApplication().createValueBinding(
782:                                "#{event.value.id}").getValue(
783:                                FacesContext.getCurrentInstance()).toString();
784:                String newVal = evt.getNewValue().toString();
785:                Object[] eventList = this .eventDetails.getList().toArray();
786:                for (int i = 0; i < eventList.length; i++) {
787:                    if (((UBTEventBean) eventList[i]).getId().equals(eventID)) {
788:                        ((UBTEventBean) eventList[i]).setLevel(newVal);
789:                        break;
790:                    }
791:                }
792:            }
793:
794:            public void processFileHandler(ValueChangeEvent evt) {
795:                this .fileHandler = Boolean.valueOf(
796:                        evt.getNewValue().toString().trim()).booleanValue();
797:
798:            }
799:
800:            public void processJDBCHandler(ValueChangeEvent evt) {
801:                this .jdbcHandler = Boolean.valueOf(
802:                        evt.getNewValue().toString().trim()).booleanValue();
803:            }
804:
805:            public void processCustomHandler(ValueChangeEvent evt) {
806:                this .customHandler = Boolean.valueOf(
807:                        evt.getNewValue().toString().trim()).booleanValue();
808:            }
809:
810:            public void processCustomHandlerName(ValueChangeEvent evt) {
811:                this .customhandlerName = evt.getNewValue().toString();
812:            }
813:
814:            public void resetVariables() {
815:                currentInstance = null;
816:                enable = false;
817:                level = "OFF";
818:                logUserID = false;
819:                fileHandler = false;
820:                filehandlerName = null;
821:                filehandlerPattern = null;
822:                filehandlerLimit = null;
823:                filehandlerCount = null;
824:                filehandlerAppend = "true";
825:                filehandlerFilter = null;
826:                filehandlerFormatter = null;
827:
828:                jdbcHandler = false;
829:                jdbchandlerName = null;
830:                jdbchandlerDriver = null;
831:                jdbchandlerConnection = null;
832:
833:                customHandler = false;
834:                customhandlerName = null;
835:                customeHandlerPropertySelected = false;
836:                customeHandlerPropertyName = null;
837:                customeHandlerPropertyValue = null;
838:
839:                initCustomProp();
840:                loadEventDetails(new Hashtable());
841:            }
842:
843:            private void clearAlert() {
844:                setAlert(false);
845:                setAlertSummary(null);
846:                setAlertDetail(null);
847:                setAlertType(null);
848:            }
849:        }
w__w___w.j_a___v___a__2___s___.__c_om | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.