Source Code Cross Referenced for BeanUtilities.java in  » ESB » open-esb » com » sun » jbi » jsf » util » 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 » ESB » open esb » com.sun.jbi.jsf.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         *  Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         *  The contents of this file are subject to the terms of either the GNU
007:         *  General Public License Version 2 only ("GPL") or the Common Development
008:         *  and Distribution License("CDDL") (collectively, the "License").  You
009:         *  may not use this file except in compliance with the License. You can obtain
010:         *  a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
011:         *  or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
012:         *  language governing permissions and limitations under the License.
013:         *
014:         *  When distributing the software, include this License Header Notice in each
015:         *  file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
016:         *  Sun designates this particular file as subject to the "Classpath" exception
017:         *  as provided by Sun in the GPL Version 2 section of the License file that
018:         *  accompanied this code.  If applicable, add the following below the License
019:         *  Header, with the fields enclosed by brackets [] replaced by your own
020:         *  identifying information: "Portions Copyrighted [year]
021:         *  [name of copyright owner]"
022:         *
023:         *  Contributor(s):
024:         *
025:         *  If you wish your version of this file to be governed by only the CDDL or
026:         *  only the GPL Version 2, indicate your decision by adding "[Contributor]
027:         *  elects to include this software in this distribution under the [CDDL or GPL
028:         *  Version 2] license."  If you don't indicate a single choice of license, a
029:         *  recipient has the option to distribute your version of this file under
030:         *  either the CDDL, the GPL Version 2 or to extend the choice of license to
031:         *  its licensees as provided above.  However, if you add GPL Version 2 code
032:         *  and therefore, elected the GPL Version 2 license, then the option applies
033:         *  only if the new code is made subject to such option by the copyright
034:         *  holder.
035:         */
036:        /*
037:         *  BeanUtilities.java
038:         *
039:         */
040:        package com.sun.jbi.jsf.util;
041:
042:        import com.sun.jbi.jsf.bean.AlertBean;
043:        import com.sun.jbi.jsf.bean.ArchiveBean;
044:        import com.sun.jbi.jsf.bean.CompConfigBean;
045:        import com.sun.jbi.jsf.bean.DeletionBean;
046:        import com.sun.jbi.jsf.bean.InstallationBean;
047:        import com.sun.jbi.jsf.bean.JBIConfigBean;
048:        import com.sun.jbi.jsf.bean.ListBean;
049:        import com.sun.jbi.jsf.bean.LoggingBean;
050:        import com.sun.jbi.jsf.bean.OperationBean;
051:        import com.sun.jbi.jsf.bean.RuntimeConfigurationBean;
052:        import com.sun.jbi.jsf.bean.RuntimeStatsBean;
053:        import com.sun.jbi.jsf.bean.ServiceUnitBean;
054:        import com.sun.jbi.jsf.bean.ShowBean;
055:        import com.sun.jbi.jsf.bean.TargetBean;
056:        import com.sun.jbi.jsf.bean.UploadCopyRadioBean;
057:        import com.sun.jbi.ui.common.JBIAdminCommands;
058:        import com.sun.jbi.ui.common.JBIComponentInfo;
059:        import com.sun.jbi.ui.common.JBIManagementMessage;
060:        import com.sun.jbi.ui.common.JBIRemoteException;
061:        import java.util.ArrayList;
062:        import java.util.List;
063:        import java.util.logging.Level;
064:        import java.util.logging.Logger;
065:        import javax.el.ELContext;
066:        import javax.el.ExpressionFactory;
067:        import javax.el.ValueExpression;
068:        import javax.faces.context.FacesContext;
069:
070:        /**
071:         * This class is used to provide utilities function for JBI related tasks
072:         *
073:         * @author   Sun Microsystems Inc.
074:         */
075:
076:        public final class BeanUtilities {
077:
078:            /**
079:             * Gets the AlertBean attribute of the BeanUtilities class
080:             *
081:             * @return   The AlertBean value
082:             */
083:            public static AlertBean getAlertBean() {
084:                initBeans();
085:                AlertBean result = null;
086:                FacesContext fCtx = FacesContext.getCurrentInstance();
087:                ELContext elCtx = fCtx.getELContext();
088:                ExpressionFactory ef = fCtx.getApplication()
089:                        .getExpressionFactory();
090:                ValueExpression ve = ef.createValueExpression(elCtx,
091:                        "#{AlertBean}", AlertBean.class);
092:                result = (AlertBean) ve.getValue(elCtx);
093:                return result;
094:            }
095:
096:            /**
097:             * Gets the DeletionBean attribute of the BeanUtilities class
098:             *
099:             * @return   The DeletionBean value
100:             */
101:            public static DeletionBean getDeletionBean() {
102:                DeletionBean result = null;
103:                FacesContext fCtx = FacesContext.getCurrentInstance();
104:                ELContext elCtx = fCtx.getELContext();
105:                ExpressionFactory ef = fCtx.getApplication()
106:                        .getExpressionFactory();
107:                ValueExpression ve = ef.createValueExpression(elCtx,
108:                        "#{DeletionBean}", DeletionBean.class);
109:                result = (DeletionBean) ve.getValue(elCtx);
110:                return result;
111:            }
112:
113:            /**
114:             * Gets the InstallationBean attribute of the BeanUtilities class
115:             *
116:             * @return   The InstallationBean value
117:             */
118:            public static InstallationBean getInstallationBean() {
119:                InstallationBean result = null;
120:                FacesContext fCtx = FacesContext.getCurrentInstance();
121:                ELContext elCtx = fCtx.getELContext();
122:                ExpressionFactory ef = fCtx.getApplication()
123:                        .getExpressionFactory();
124:                ValueExpression ve = ef.createValueExpression(elCtx,
125:                        "#{InstallationBean}", InstallationBean.class);
126:                result = (InstallationBean) ve.getValue(elCtx);
127:                return result;
128:            }
129:
130:            /**
131:             * Gets the JBIConfigBean attribute of the BeanUtilities class
132:             *
133:             * @return   The JBIConfigBean value
134:             */
135:            public static JBIConfigBean getJBIConfigBean() {
136:                JBIConfigBean result = null;
137:                FacesContext fCtx = FacesContext.getCurrentInstance();
138:                ELContext elCtx = fCtx.getELContext();
139:                ExpressionFactory ef = fCtx.getApplication()
140:                        .getExpressionFactory();
141:                ValueExpression ve = ef.createValueExpression(elCtx,
142:                        "#{JBIConfigBean}", JBIConfigBean.class);
143:                result = (JBIConfigBean) ve.getValue(elCtx);
144:                return result;
145:            }
146:
147:            /**
148:             * Gets the OperationBean attribute of the BeanUtilities class
149:             *
150:             * @return   The OperationBean value
151:             */
152:            public static OperationBean getOperationBean() {
153:                OperationBean result = null;
154:                FacesContext fCtx = FacesContext.getCurrentInstance();
155:                ELContext elCtx = fCtx.getELContext();
156:                ExpressionFactory ef = fCtx.getApplication()
157:                        .getExpressionFactory();
158:                ValueExpression ve = ef.createValueExpression(elCtx,
159:                        "#{OperationBean}", OperationBean.class);
160:                result = (OperationBean) ve.getValue(elCtx);
161:                return result;
162:            }
163:
164:            /*
165:             *  @return static copy of UploadCopyRadioBean Bean's instance
166:             */
167:            /**
168:             * Gets the UploadCopyRadioBean attribute of the BeanUtilities class
169:             *
170:             * @return   The UploadCopyRadioBean value
171:             */
172:            public static UploadCopyRadioBean getUploadCopyRadioBean() {
173:                UploadCopyRadioBean result = null;
174:                FacesContext fCtx = FacesContext.getCurrentInstance();
175:                ELContext elCtx = fCtx.getELContext();
176:                ExpressionFactory ef = fCtx.getApplication()
177:                        .getExpressionFactory();
178:                ValueExpression ve = ef.createValueExpression(elCtx,
179:                        "#{UploadCopyRadioBean}", UploadCopyRadioBean.class);
180:                result = (UploadCopyRadioBean) ve.getValue(elCtx);
181:                return result;
182:            }
183:
184:            /**
185:             * Gets the ArchiveBean attribute of the BeanUtilities class
186:             *
187:             * @return   The ArchiveBean value
188:             */
189:            public static ArchiveBean getArchiveBean() {
190:                ArchiveBean result = null;
191:                FacesContext fCtx = FacesContext.getCurrentInstance();
192:                ELContext elCtx = fCtx.getELContext();
193:                ExpressionFactory ef = fCtx.getApplication()
194:                        .getExpressionFactory();
195:                ValueExpression ve = ef.createValueExpression(elCtx,
196:                        "#{ArchiveBean}", ArchiveBean.class);
197:                result = (ArchiveBean) ve.getValue(elCtx);
198:                return result;
199:            }
200:
201:            /**
202:             * Gets the LoggingBean attribute of the BeanUtilities class
203:             *
204:             * @return   The LoggingBean value
205:             */
206:            public static LoggingBean getLoggingBean() {
207:                LoggingBean result = null;
208:                FacesContext fCtx = FacesContext.getCurrentInstance();
209:                ELContext elCtx = fCtx.getELContext();
210:                ExpressionFactory ef = fCtx.getApplication()
211:                        .getExpressionFactory();
212:                ValueExpression ve = ef.createValueExpression(elCtx,
213:                        "#{LoggingBean}", LoggingBean.class);
214:                result = (LoggingBean) ve.getValue(elCtx);
215:                return result;
216:            }
217:
218:            //    public static ConfigurationBean getConfigurationBean()
219:            //{
220:            //   ConfigurationBean result = null;
221:            //   FacesContext fCtx = FacesContext.getCurrentInstance();
222:            //   ELContext elCtx = fCtx.getELContext();
223:            //ExpressionFactory ef = fCtx.getApplication().getExpressionFactory();
224:            //ValueExpression ve =
225:            //ef.createValueExpression(elCtx, "#{ConfigurationBean}", ConfigurationBean.class);
226:            //result = (ConfigurationBean) ve.getValue(elCtx);
227:            //return result;
228:            //
229:
230:            /**
231:             * Gets the RuntimeConfigurationBean attribute of the BeanUtilities class
232:             *
233:             * @return   The RuntimeConfigurationBean value
234:             */
235:            public static RuntimeConfigurationBean getRuntimeConfigurationBean() {
236:                RuntimeConfigurationBean result = null;
237:                FacesContext fCtx = FacesContext.getCurrentInstance();
238:                ELContext elCtx = fCtx.getELContext();
239:                ExpressionFactory ef = fCtx.getApplication()
240:                        .getExpressionFactory();
241:                ValueExpression ve = ef.createValueExpression(elCtx,
242:                        "#{RuntimeConfigurationBean}",
243:                        RuntimeConfigurationBean.class);
244:                result = (RuntimeConfigurationBean) ve.getValue(elCtx);
245:                return result;
246:            }
247:
248:            /**
249:             * Gets the RuntimeStatsBean attribute of the BeanUtilities class
250:             *
251:             * @return   The RuntimeStatsBean value
252:             */
253:            public static RuntimeStatsBean getRuntimeStatsBean() {
254:                RuntimeStatsBean result = null;
255:                FacesContext fCtx = FacesContext.getCurrentInstance();
256:                ELContext elCtx = fCtx.getELContext();
257:                ExpressionFactory ef = fCtx.getApplication()
258:                        .getExpressionFactory();
259:                ValueExpression ve = ef.createValueExpression(elCtx,
260:                        "#{RuntimeStatsBean}", RuntimeStatsBean.class);
261:                result = (RuntimeStatsBean) ve.getValue(elCtx);
262:                return result;
263:            }
264:
265:            /**
266:             * Gets the ListBean attribute of the BeanUtilities class
267:             *
268:             * @return   The ListBean value
269:             */
270:            public static ListBean getListBean() {
271:                initBeans();
272:                ListBean result = null;
273:                FacesContext fCtx = FacesContext.getCurrentInstance();
274:                ELContext elCtx = fCtx.getELContext();
275:                ExpressionFactory ef = fCtx.getApplication()
276:                        .getExpressionFactory();
277:                ValueExpression ve = ef.createValueExpression(elCtx,
278:                        "#{ListBean}", ListBean.class);
279:                result = (ListBean) ve.getValue(elCtx);
280:                return result;
281:            }
282:
283:            /**
284:             * Gets the ServiceUnitBean attribute of the BeanUtilities class
285:             *
286:             * @return   The ServiceUnitBean value
287:             */
288:            public static ServiceUnitBean getServiceUnitBean() {
289:                ServiceUnitBean result = null;
290:                FacesContext fCtx = FacesContext.getCurrentInstance();
291:                ELContext elCtx = fCtx.getELContext();
292:                ExpressionFactory ef = fCtx.getApplication()
293:                        .getExpressionFactory();
294:                ValueExpression ve = ef.createValueExpression(elCtx,
295:                        "#{ServiceUnitBean}", ServiceUnitBean.class);
296:                result = (ServiceUnitBean) ve.getValue(elCtx);
297:                return result;
298:            }
299:
300:            /**
301:             * Gets the ShowBean attribute of the BeanUtilities class
302:             *
303:             * @return   The ShowBean value
304:             */
305:            public static ShowBean getShowBean() {
306:                ShowBean result = null;
307:                FacesContext fCtx = FacesContext.getCurrentInstance();
308:                ELContext elCtx = fCtx.getELContext();
309:                ExpressionFactory ef = fCtx.getApplication()
310:                        .getExpressionFactory();
311:                ValueExpression ve = ef.createValueExpression(elCtx,
312:                        "#{ShowBean}", ShowBean.class);
313:                result = (ShowBean) ve.getValue(elCtx);
314:                return result;
315:            }
316:
317:            /**
318:             * Gets the TargetBean attribute of the BeanUtilities class
319:             *
320:             * @return   The TargetBean value
321:             */
322:            public static TargetBean getTargetBean() {
323:                TargetBean result = null;
324:                FacesContext fCtx = FacesContext.getCurrentInstance();
325:                ELContext elCtx = fCtx.getELContext();
326:                ExpressionFactory ef = fCtx.getApplication()
327:                        .getExpressionFactory();
328:                ValueExpression ve = ef.createValueExpression(elCtx,
329:                        "#{TargetBean}", TargetBean.class);
330:                result = (TargetBean) ve.getValue(elCtx);
331:                sLog.fine("BeanUtitlies.getTargetBean() result=" + result);
332:                return result;
333:            }
334:
335:            /**
336:             * Gets the Client attribute of the BeanUtilities class
337:             *
338:             * @return   The Client value
339:             */
340:            public static JBIAdminCommands getClient() {
341:                JBIAdminCommands result = null;
342:                if (null == sClient) {
343:                    sClient = (new ConnectionUtilities()).getClient();
344:                }
345:                result = sClient;
346:                sLog.fine("BeanUtitlies.getClient() result=" + result);
347:                return result;
348:            }
349:
350:            /**
351:             * Gets the ComponentType attribute of the BeanUtilities class
352:             *
353:             * @param aComponentName  Description of Parameter
354:             * @param aTargetName     Description of Parameter
355:             * @return                The ComponentType value
356:             */
357:            public static String getComponentType(String aComponentName,
358:                    String aTargetName) {
359:                String componentType = "";
360:                String result = "";
361:                try {
362:                    JBIAdminCommands mJac = BeanUtilities.getClient();
363:                    componentType = JBIConstants.JBI_BINDING_COMPONENT_TYPE;
364:                    result = mJac.showBindingComponent(aComponentName, "", "",
365:                            "", aTargetName);
366:                    List list = JBIComponentInfo.readFromXmlText(result);
367:                    if (list.size() == 0) {
368:                        componentType = JBIConstants.JBI_SERVICE_ENGINE_TYPE;
369:                        result = mJac.showServiceEngine(aComponentName, "", "",
370:                                "", aTargetName);
371:                        list = JBIComponentInfo.readFromXmlText(result);
372:                        if (list.size() == 0) {
373:                            componentType = "";
374:                        }
375:                    }
376:                } catch (Exception e) {
377:                }
378:                return componentType;
379:            }
380:
381:            /**
382:             * Gets the StringPropertyUsingExpression attribute of the BeanUtilities
383:             * class
384:             *
385:             * @param anExpression  Description of Parameter
386:             * @return              The StringPropertyUsingExpression value
387:             */
388:            public static String getStringPropertyUsingExpression(
389:                    String anExpression) {
390:                String result = null;
391:                FacesContext fCtx = FacesContext.getCurrentInstance();
392:                ELContext elCtx = fCtx.getELContext();
393:                ExpressionFactory ef = fCtx.getApplication()
394:                        .getExpressionFactory();
395:                ValueExpression ve = ef.createValueExpression(elCtx,
396:                        anExpression, String.class);
397:                result = (String) ve.getValue(elCtx);
398:                return result;
399:            }
400:
401:            /**
402:             * Gets the CompConfigBean attribute of the BeanUtilities class
403:             *
404:             * @return   The CompConfigBean value
405:             */
406:            public static CompConfigBean getCompConfigBean() {
407:                CompConfigBean result = null;
408:                FacesContext fCtx = FacesContext.getCurrentInstance();
409:                ELContext elCtx = fCtx.getELContext();
410:                ExpressionFactory ef = fCtx.getApplication()
411:                        .getExpressionFactory();
412:                ValueExpression ve = ef.createValueExpression(elCtx,
413:                        "#{CompConfigBean}", CompConfigBean.class);
414:                result = (CompConfigBean) ve.getValue(elCtx);
415:                return result;
416:            }
417:
418:            /**
419:             * Sets the StringPropertyUsingExpression attribute of the BeanUtilities
420:             * class
421:             *
422:             * @param aStringValue  The new StringPropertyUsingExpression value
423:             * @param anExpression  The new StringPropertyUsingExpression value
424:             */
425:            public static void setStringPropertyUsingExpression(
426:                    String aStringValue, String anExpression) {
427:                FacesContext fCtx = FacesContext.getCurrentInstance();
428:                ELContext elCtx = fCtx.getELContext();
429:                ExpressionFactory ef = fCtx.getApplication()
430:                        .getExpressionFactory();
431:                ValueExpression ve = ef.createValueExpression(elCtx,
432:                        anExpression, String.class);
433:                ve.setValue(elCtx, aStringValue);
434:            }
435:
436:            /**
437:             * Description of the Method
438:             */
439:            public static void initBeans() {
440:
441:                FacesContext facesContext = FacesContext.getCurrentInstance();
442:                Object alreadyRegisteredBean = facesContext
443:                        .getExternalContext().getSessionMap().get(BEAN_NAME);
444:
445:                // check for bean already in session
446:                if (null != alreadyRegisteredBean) {
447:                    // nothing to do
448:                }
449:                // create bean if needed (e.g. after a console logout)
450:                else {
451:                    // need to init (re-init) bean(s) (e.g. for a new session)
452:                    try {
453:                        Class beanClass = Class.forName(CLASS_NAME);
454:                        Object bean = beanClass.newInstance();
455:                        // this inits all JBI session beans
456:                        facesContext.getExternalContext().getSessionMap().put(
457:                                BEAN_NAME, bean);
458:                        sLog.fine("BeanUtilities.initBeans() BEAN_NAME="
459:                                + BEAN_NAME + ", beanClass=" + beanClass
460:                                + ", bean=" + bean);
461:                    } catch (Exception ex) {
462:                        sLog.log(Level.FINE,
463:                                "BeanUtilities.initBeans() caught Exception",
464:                                ex);
465:                    }
466:                }
467:            }
468:
469:            /**
470:             * Description of the Method
471:             *
472:             * @param aComponentState  Description of Parameter
473:             * @param aFilterState     Description of Parameter
474:             * @param optionList       Description of Parameter
475:             * @return                 Description of the Returned Value
476:             */
477:            public static boolean checkFilterOptions(String aComponentState,
478:                    String aFilterState, ArrayList optionList) {
479:                boolean flag = true;
480:                if (null != aFilterState) {
481:                    if (SharedConstants.DROP_DOWN_TYPE_SHOW_ALL
482:                            .equals(aFilterState)) {
483:                        //no-op --include all states
484:                    } else {
485:                        //filter state is not all
486:
487:                        flag = false;
488:                        if (null != optionList) {
489:                            int index = optionList.indexOf(aFilterState);
490:                            if (index != -1) {
491:                                flag = containsIgnoreCase(aComponentState,
492:                                        (String) optionList.get(index));
493:                            }
494:                        }
495:                    }
496:                }
497:                return flag;
498:            }
499:
500:            /**
501:             * Will extract the JBIManagementMessage from the Remote exception. or
502:             * create a new management message from the exception
503:             *
504:             * @param ex  the exception to process
505:             * @return    Description of the Returned Value
506:             */
507:            public static JBIManagementMessage extractJBIManagementMessage(
508:                    Exception ex) {
509:                JBIManagementMessage mgmtMsg = null;
510:                if (ex instanceof  JBIRemoteException) {
511:                    JBIRemoteException rEx = (JBIRemoteException) ex;
512:                    mgmtMsg = rEx.extractJBIManagementMessage();
513:                    sLog.fine("BeanUtitlies.extractJBIManagementMessage()"
514:                            + ", rEx.getClass()=" + rEx.getClass()
515:                            + ", mgmtMsg=" + mgmtMsg);
516:                }
517:
518:                if (null == mgmtMsg) {
519:                    String exMessage = ex.getMessage();
520:                    sLog.fine("BeanUtitlies.extractJBIManagementMessage()"
521:                            + ", ex.getClass()=" + ex.getClass()
522:                            + ", exMessage=" + exMessage);
523:                    if (null == exMessage) {
524:                        exMessage = ex.toString();
525:                        sLog.fine("BeanUtitlies.extractJBIManagementMessage()"
526:                                + ", ex.getClass()=" + ex.getClass()
527:                                + ", exMessage=" + exMessage);
528:
529:                    }
530:                    mgmtMsg = JBIManagementMessage
531:                            .createJBIManagementMessage(exMessage);
532:                }
533:                sLog.fine("BeanUtitlies.extractJBIManagementMessage()"
534:                        + ", ex.getClass()=" + ex.getClass() + ", mgmtMsg="
535:                        + mgmtMsg);
536:                return mgmtMsg;
537:            }
538:
539:            /**
540:             * @param jbiResultXml  - a common client result that may contain zero or
541:             *      more warnings
542:             * @return              Description of the Returned Value
543:             * @returns             JBIManagementMessage - null if no warnings,
544:             *      otherwise a message to be displayed
545:             */
546:            public static JBIManagementMessage extractJBIManagementMessage(
547:                    String jbiResultXml) {
548:                JBIManagementMessage mgmtMsg = JBIManagementMessage
549:                        .createJBIManagementMessage(jbiResultXml);
550:
551:                sLog
552:                        .fine("BeanUtilities.extractJBIManagementMessage(String jbiResultXml), mgmtMsg="
553:                                + mgmtMsg);
554:                if (mgmtMsg == null) {
555:                    // normal case: no-op (return null)
556:                } else {
557:                    // now format the jbi result xml according to the esb result format
558:                    String formattedJbiResult = jbiResultXml;
559:                    // actual formatting TBD
560:
561:                    // check the mgmt msg is a success --or-- warning or error
562:                    if (!mgmtMsg.isFailedMsg()) {
563:                        sLog.fine("BeanUtilities.extractJBIManagementMessage()"
564:                                + ", happy: isFailedMsg()=false");
565:                    } else {
566:                        sLog.fine("BeanUtilities.extractJBIManagementMessage()"
567:                                + ", error: isFailedMsg()=true");
568:                    }
569:                }
570:                return mgmtMsg;
571:            }
572:
573:            /**
574:             * Will add the alert footer message to the provided alert message string
575:             *
576:             * @param aAlertMsg  The feature to be added to the AlertFooterMessage
577:             *      attribute
578:             * @return           the alert message with the appended footer message
579:             */
580:            public static String addAlertFooterMessage(String aAlertMsg) {
581:                String footerMsg = I18nUtilities
582:                        .getResourceString("jbi.alert.footer.see.log.message");
583:                aAlertMsg += "<br>" + footerMsg;
584:                return aAlertMsg;
585:            }
586:
587:            /**
588:             * Description of the Method
589:             *
590:             * @param str1  Description of Parameter
591:             * @param str2  Description of Parameter
592:             * @return      Description of the Returned Value
593:             */
594:            private static boolean containsIgnoreCase(String str1, String str2) {
595:                String str1Upper = str1.toUpperCase();
596:                String str2Upper = str2.toUpperCase();
597:                return (str1Upper.contains(str2Upper));
598:            }
599:
600:            /**
601:             * prevents instantiation
602:             */
603:            private BeanUtilities() {
604:            }
605:
606:            private static final String BEAN_NAME = "JBIConfigBean";
607:            private static final String CLASS_NAME = "com.sun.jbi.jsf.bean.JBIConfigBean";
608:
609:            /**
610:             * Controls printing of diagnostic messages to the log
611:             */
612:            private static Logger sLog = JBILogger.getInstance();
613:
614:            private static JBIAdminCommands sClient = null;
615:
616:            static {
617:                sLog.fine("BeanUtilities.<clinit>()");
618:                initBeans();
619:            }
620:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.