Source Code Cross Referenced for JSFUtils.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) 


0001:        /*
0002:         *  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0003:         *
0004:         *  Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
0005:         *
0006:         *  The contents of this file are subject to the terms of either the GNU
0007:         *  General Public License Version 2 only ("GPL") or the Common Development
0008:         *  and Distribution License("CDDL") (collectively, the "License").  You
0009:         *  may not use this file except in compliance with the License. You can obtain
0010:         *  a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
0011:         *  or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
0012:         *  language governing permissions and limitations under the License.
0013:         *
0014:         *  When distributing the software, include this License Header Notice in each
0015:         *  file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
0016:         *  Sun designates this particular file as subject to the "Classpath" exception
0017:         *  as provided by Sun in the GPL Version 2 section of the License file that
0018:         *  accompanied this code.  If applicable, add the following below the License
0019:         *  Header, with the fields enclosed by brackets [] replaced by your own
0020:         *  identifying information: "Portions Copyrighted [year]
0021:         *  [name of copyright owner]"
0022:         *
0023:         *  Contributor(s):
0024:         *
0025:         *  If you wish your version of this file to be governed by only the CDDL or
0026:         *  only the GPL Version 2, indicate your decision by adding "[Contributor]
0027:         *  elects to include this software in this distribution under the [CDDL or GPL
0028:         *  Version 2] license."  If you don't indicate a single choice of license, a
0029:         *  recipient has the option to distribute your version of this file under
0030:         *  either the CDDL, the GPL Version 2 or to extend the choice of license to
0031:         *  its licensees as provided above.  However, if you add GPL Version 2 code
0032:         *  and therefore, elected the GPL Version 2 license, then the option applies
0033:         *  only if the new code is made subject to such option by the copyright
0034:         *  holder.
0035:         */
0036:        /*
0037:         *  JSFUtils.java
0038:         */
0039:        package com.sun.jbi.jsf.util;
0040:
0041:        import com.sun.data.provider.impl.ObjectListDataProvider;
0042:        import com.sun.enterprise.tools.admingui.util.GuiUtil;
0043:        import com.sun.jbi.jsf.bean.AppConfigField;
0044:        import com.sun.jbi.jsf.bean.ConfigProperty;
0045:        import com.sun.jbi.jsf.bean.ConfigPropertyGroup;
0046:        import com.sun.jbi.jsf.bean.EndpointStatsBean;
0047:        import com.sun.jbi.jsf.bean.Row;
0048:        import com.sun.jbi.ui.common.JBIStatisticsItemNames;
0049:        import com.sun.webui.jsf.component.Checkbox;
0050:        import com.sun.webui.jsf.component.DropDown;
0051:        import com.sun.webui.jsf.component.HelpInline;
0052:        import com.sun.webui.jsf.component.HiddenField;
0053:        import com.sun.webui.jsf.component.Label;
0054:        import com.sun.webui.jsf.component.PasswordField;
0055:        import com.sun.webui.jsf.component.Property;
0056:        import com.sun.webui.jsf.component.PropertySheet;
0057:        import com.sun.webui.jsf.component.PropertySheetSection;
0058:        import com.sun.webui.jsf.component.StaticText;
0059:        import com.sun.webui.jsf.component.Table;
0060:        import com.sun.webui.jsf.component.TableColumn;
0061:        import com.sun.webui.jsf.component.TableRowGroup;
0062:        import com.sun.webui.jsf.component.TextField;
0063:        import com.sun.webui.jsf.model.Option;
0064:        import java.text.DateFormat;
0065:        import java.util.ArrayList;
0066:        import java.util.Date;
0067:        import java.util.List;
0068:        import java.util.Properties;
0069:        import java.util.logging.Logger;
0070:        import javax.el.ValueExpression;
0071:        import javax.faces.component.UIComponent;
0072:        import javax.faces.context.FacesContext;
0073:        import javax.management.openmbean.CompositeData;
0074:        import javax.management.openmbean.TabularData;
0075:
0076:        /**
0077:         * Provides JavaServer Faces and JSFTemplating related utility methods.
0078:         *
0079:         * @author   Sun Microsystems Inc.
0080:         */
0081:        public final class JSFUtils {
0082:
0083:            /**
0084:             * Dynamically populates a <code>sun:propertySheet</code> element for the
0085:             * Component Application Configuration creation or viewing/editing
0086:             * use-cases.
0087:             *
0088:             * @param anAction       one of: <code>create</code> or <code>edit</code>
0089:             * @param aListOfFields  with zero or more <code>AppConfigField</code>
0090:             *      elements to produce dynamic <code>sun:property</code> elements.
0091:             * @return               a property sheet for viewing/editing an existing
0092:             *      Component Application Configuration (i.e. the name is known and
0093:             *      not changeable) or for creating a new one (the name is not known
0094:             *      and is a required input).
0095:             */
0096:            @SuppressWarnings("unchecked")
0097:            public static PropertySheet getCompAppConfigPropertySheet(
0098:                    String anAction, List<AppConfigField> aListOfFields) {
0099:                sLog.fine("JSFUtils.getEditCompAppConfigPropertySheet("
0100:                        + anAction + ")");
0101:
0102:                FacesContext facesContext = FacesContext.getCurrentInstance();
0103:
0104:                PropertySheet propertySheet = new PropertySheet();
0105:                propertySheet.setId("editCompAppConfigPropertySheet");
0106:
0107:                // Property sheet section for selection of instance/component/configuration
0108:                List propertySectionList = propertySheet.getChildren();
0109:
0110:                PropertySheetSection propertySheetSection1 = new PropertySheetSection();
0111:                propertySheetSection1.setId("editCompAppConfigPss1");
0112:                String propsPss1Label = I18nUtilities
0113:                        .getResourceString("jbi.edit.comp.app.config.props.pss.selection.label");
0114:                propertySheetSection1.setLabel(propsPss1Label);
0115:
0116:                propertySectionList.add(propertySheetSection1);
0117:
0118:                List propertyList1 = propertySheetSection1.getChildren();
0119:
0120:                //
0121:                if (IS_CLUSTER_PROFILE) {
0122:                    Property instanceNameProperty = createTextProperty(
0123:                            "instanceName",
0124:                            "jbi.edit.comp.app.config.instance.label",
0125:                            "#{jbiSelectedInstanceValue}", false);
0126:                    propertyList1.add(instanceNameProperty);
0127:                }
0128:
0129:                //
0130:                Property componentNameProperty = createTextProperty("compName",
0131:                        "jbi.edit.comp.app.config.component.label",
0132:                        "#{sharedShowName}", false);
0133:                propertyList1.add(componentNameProperty);
0134:
0135:                //
0136:                boolean isEditable = PS_CREATE.equals(anAction);
0137:
0138:                Property configurationNameProperty = createTextProperty(
0139:                        "configName", "jbi.edit.comp.app.config.name.label",
0140:                        "#{appConfigName}", isEditable);
0141:                propertyList1.add(configurationNameProperty);
0142:
0143:                //
0144:                // property sheet section for creating/editing properties
0145:                //
0146:
0147:                PropertySheetSection propertySheetSection2 = new PropertySheetSection();
0148:                propertySheetSection2.setId("editCompAppConfigPss2");
0149:                String propsPss2Label = I18nUtilities
0150:                        .getResourceString("jbi.edit.comp.app.config.props.pss.properties.label");
0151:                propertySheetSection2.setLabel(propsPss2Label);
0152:
0153:                propertySectionList.add(propertySheetSection2);
0154:
0155:                List propertyList2 = propertySheetSection2.getChildren();
0156:
0157:                if (null != aListOfFields) {
0158:                    for (int i = 0; i < aListOfFields.size(); ++i) {
0159:                        Property property = new Property();
0160:                        property.setId("editCompAppConfigProp" + i);
0161:
0162:                        AppConfigField field = (AppConfigField) aListOfFields
0163:                                .get(i);
0164:
0165:                        String fieldName = field.getName();
0166:
0167:                        List propSubElts = property.getChildren();
0168:
0169:                        Label label = new Label();
0170:                        label.setId(fieldName + "Label");
0171:
0172:                        String labelStr = field.getDisplayName();
0173:                        property.setLabel(labelStr);
0174:
0175:                        // label.setText(labelStr);
0176:                        if (field.isRequired()) {
0177:                            label.setRequiredIndicator(true);
0178:                        }
0179:                        propSubElts.add(label);
0180:
0181:                        HiddenField hiddenField = new HiddenField();
0182:                        hiddenField.setId(fieldName + "HiddenField");
0183:                        hiddenField.setText(fieldName);
0184:                        propSubElts.add(hiddenField);
0185:
0186:                        String toolTip = field.getDisplayDescription();
0187:
0188:                        if (!field.isPassword()) {
0189:                            TextField text = new TextField();
0190:                            text.setId("editCompAppConfigProp" + i
0191:                                    + "TextField");
0192:                            text.setColumns(DEFAULT_TEXT_COLUMNS);
0193:
0194:                            text.setToolTip(toolTip);
0195:
0196:                            if (field.isRequired()) {
0197:                                // TBD if required integer...
0198:                                text.setStyleClass(FIELD_REQUIRED);
0199:                            }
0200:
0201:                            Object value = field.getValue();
0202:                            if (value instanceof  String) {
0203:                                text.setText((String) value);
0204:                                propSubElts.add(text);
0205:                            } else {
0206:                                Table table = new Table();
0207:                                table.setLite(true);
0208:                                String propTableTitle = I18nUtilities
0209:                                        .getResourceString("jbi.edit.comp.app.config.prop.table.title");
0210:
0211:                                table.setTitle(propTableTitle);
0212:                                table.setWidth(DEFAULT_TABLE_WIDTH);
0213:
0214:                                TableRowGroup trg = new TableRowGroup();
0215:                                trg.setSourceVar("sourceVar");
0216:
0217:                                TableColumn selectTableColumn = new TableColumn();
0218:                                Checkbox selectCheckbox = new Checkbox();
0219:                                selectCheckbox.setId("selectCheckbox" + i);
0220:
0221:                                selectCheckbox
0222:                                        .setSelected("#{sourceVar.value.selected}");
0223:                                selectCheckbox.setSelectedValue(true);
0224:                                selectTableColumn.getChildren().add(
0225:                                        selectCheckbox);
0226:
0227:                                trg.getChildren().add(selectTableColumn);
0228:
0229:                                TableColumn nameTableColumn = new TableColumn();
0230:                                nameTableColumn.setId("nameTableColumn" + i);
0231:                                TextField nameTextField = new TextField();
0232:                                nameTextField.setId("nameTextField" + i);
0233:
0234:                                String vExprNameStr = "#{sourceVar.value.name}";
0235:                                ValueExpression nameVe = facesContext
0236:                                        .getApplication()
0237:                                        .getExpressionFactory()
0238:                                        .createValueExpression(
0239:                                                facesContext.getELContext(),
0240:                                                vExprNameStr, Object.class);
0241:                                nameTextField
0242:                                        .setValueExpression("text", nameVe);
0243:
0244:                                nameTableColumn.getChildren()
0245:                                        .add(nameTextField);
0246:
0247:                                trg.getChildren().add(nameTableColumn);
0248:
0249:                                TableColumn valueTableColumn = new TableColumn();
0250:                                nameTableColumn.setId("valueTableColumn" + i);
0251:                                TextField valueTextField = new TextField();
0252:                                valueTextField.setId("valueTextField" + i);
0253:
0254:                                String vExprValueStr = "#{sourceVar.value.value}";
0255:                                ValueExpression valueVe = facesContext
0256:                                        .getApplication()
0257:                                        .getExpressionFactory()
0258:                                        .createValueExpression(
0259:                                                facesContext.getELContext(),
0260:                                                vExprValueStr, Object.class);
0261:                                valueTextField.setValueExpression("text",
0262:                                        valueVe);
0263:
0264:                                valueTableColumn.getChildren().add(
0265:                                        valueTextField);
0266:
0267:                                trg.getChildren().add(valueTableColumn);
0268:
0269:                                ArrayList rows = new ArrayList();
0270:
0271:                                Row oneRow = new Row();
0272:                                oneRow.setDisabled(false);
0273:                                oneRow.setName("key1");
0274:                                oneRow.setRendered(true);
0275:                                oneRow.setSelected(false);
0276:                                oneRow.setValue("value1");
0277:                                rows.add(oneRow);
0278:
0279:                                oneRow = new Row();
0280:                                oneRow.setDisabled(false);
0281:                                oneRow.setName("key2");
0282:                                oneRow.setRendered(true);
0283:                                oneRow.setSelected(false);
0284:                                oneRow.setValue("value2");
0285:                                rows.add(oneRow);
0286:
0287:                                ObjectListDataProvider oldp = new ObjectListDataProvider(
0288:                                        rows);
0289:
0290:                                trg.setSourceData(oldp);
0291:
0292:                                table.getChildren().add(trg);
0293:
0294:                                propSubElts.add(table);
0295:                            }
0296:                        } else {
0297:                            // field.isPassword()
0298:
0299:                            PasswordField pass = createPasswordField(
0300:                                    ("editCompAppConfigProp" + i),
0301:                                    DEFAULT_TEXT_COLUMNS, toolTip, field
0302:                                            .isRequired(), ((String) field
0303:                                            .getValue()), propSubElts);
0304:                        }
0305:                        // don't display redundant field (already in title, error-prone to edit)
0306:                        if ("configurationName".equals(fieldName)) {
0307:                            property.setRendered(false);
0308:                        }
0309:                        propertyList2.add(property);
0310:                    }
0311:                } else {
0312:                    // TBD "global" alert processing...
0313:                }
0314:
0315:                return propertySheet;
0316:            }
0317:
0318:            /**
0319:             * Dynamically populates a <code>sun:propertySheet</code> element for
0320:             * component installation configuration properties
0321:             *
0322:             * @param aCompName              the component name
0323:             * @param aCompType              Description of Parameter
0324:             * @param aListOfPropertyGroups  Description of Parameter
0325:             * @return                       a property sheet with editable
0326:             *      installation configuration properties
0327:             */
0328:            @SuppressWarnings("unchecked")
0329:            public static PropertySheet getCompInstallationConfigPS(
0330:                    String aCompName,
0331:                    // TBD remove unused args
0332:                    String aCompType,
0333:                    List<ConfigPropertyGroup> aListOfPropertyGroups) {
0334:                PropertySheet result = createPS("compInstallationConfig");
0335:
0336:                //         Property compName =
0337:                //             createStaticTextProperty("compName",
0338:                //                                      "jbi.xyz.name.label",
0339:                //                                      aCompName,
0340:                //                                      sum);
0341:
0342:                if (null != aListOfPropertyGroups) {
0343:                    for (int i = 0; i < aListOfPropertyGroups.size(); ++i) {
0344:                        ConfigPropertyGroup currentGroup = aListOfPropertyGroups
0345:                                .get(i);
0346:
0347:                        Object[] args = { currentGroup.getDisplayName(),
0348:                                currentGroup.getDisplayDescription(), };
0349:
0350:                        String sectionTitle = GuiUtil
0351:                                .getMessage(
0352:                                        I18nUtilities
0353:                                                .getResourceString("jbi.config.props.section.title"),
0354:                                        args);
0355:
0356:                        PropertySheetSection sum = createPSS(("sum" + i),
0357:                                sectionTitle, result);
0358:
0359:                        List<ConfigProperty> currentGroupProperties = currentGroup
0360:                                .getConfigProperties();
0361:                        if (null != currentGroupProperties) {
0362:                            for (int j = 0; j < currentGroupProperties.size(); ++j) {
0363:                                Property propWithInputWidget = null;
0364:                                String value = null;
0365:                                ConfigProperty currentProp = currentGroupProperties
0366:                                        .get(j);
0367:                                if (null != currentProp.getValue()) {
0368:                                    value = currentProp.getValue().toString();
0369:                                }
0370:                                String xsdType = currentProp.getXSDType();
0371:                                if (ESBConstants.XSD_TYPE_STRING
0372:                                        .equals(xsdType)) {
0373:                                    boolean isEncrypted = currentProp
0374:                                            .getIsEncrypted();
0375:                                    if (!isEncrypted) {
0376:                                        List<String> constrainedStrings = currentProp
0377:                                                .getConstraintEnumeration();
0378:                                        // if no enumeration, prompt for text
0379:                                        if (null == constrainedStrings) {
0380:                                            propWithInputWidget = createTextInputProperty(
0381:                                                    (PROP_PREFIX + j),
0382:                                                    currentProp.getName(),
0383:                                                    currentProp
0384:                                                            .getDisplayName(),
0385:                                                    currentProp.getIsRequired(),
0386:                                                    value, sum);
0387:                                        }
0388:                                        // if enumeration, display selection list (choosing default)
0389:                                        else {
0390:                                            propWithInputWidget = createDropDownProperty(
0391:                                                    (PROP_PREFIX + j),
0392:                                                    currentProp.getName(),
0393:                                                    currentProp
0394:                                                            .getDisplayName(),
0395:                                                    constrainedStrings, value,
0396:                                                    IS_NOT_SUBMIT_FORM, sum);
0397:                                        }
0398:                                    } else {
0399:                                        propWithInputWidget = createPasswordInputProperty(
0400:                                                (PROP_PREFIX + j), currentProp
0401:                                                        .getName(), currentProp
0402:                                                        .getDisplayName(),
0403:                                                currentProp.getIsRequired(),
0404:                                                value, sum);
0405:                                    }
0406:                                } else if (ESBConstants.XSD_TYPE_INT
0407:                                        .equals(xsdType)) {
0408:                                    propWithInputWidget = createNumericInputProperty(
0409:                                            (PROP_PREFIX + j), currentProp
0410:                                                    .getName(), currentProp
0411:                                                    .getDisplayName(),
0412:                                            currentProp.getIsRequired(), value,
0413:                                            sum);
0414:                                } else if (ESBConstants.XSD_TYPE_BOOLEAN
0415:                                        .equals(xsdType)) {
0416:                                    propWithInputWidget = createBooleanInputProperty(
0417:                                            (PROP_PREFIX + j), currentProp
0418:                                                    .getName(), currentProp
0419:                                                    .getDisplayName(), value,
0420:                                            sum);
0421:                                } else {
0422:                                    // TBD log unsupported type
0423:                                }
0424:
0425:                                // if no supported type widget created yet,
0426:                                // create default
0427:                                if (null == propWithInputWidget) {
0428:                                    // TBD possibly try TextField and pass through as string prop?
0429:                                    propWithInputWidget = createStaticTextProperty(
0430:                                            (PROP_PREFIX + j),
0431:                                            currentProp.getDisplayName(),
0432:                                            "this type not yet supported by console",
0433:                                            sum);
0434:                                }
0435:                                HelpInline fieldHelp = createFieldHelp(
0436:                                        ("propFldHelp" + j), currentProp
0437:                                                .getDisplayDescription(),
0438:                                        propWithInputWidget);
0439:                            }
0440:                        }
0441:                    }
0442:
0443:                }
0444:                return result;
0445:            }
0446:
0447:            /**
0448:             * Dynamically populates a <code>sun:propertySheet</code> element for
0449:             * component runtime component configuration properties
0450:             *
0451:             * @param anInstanceName   the instance
0452:             * @param aCompName        the component name
0453:             * @param aCompType        Description of Parameter
0454:             * @param aSummaryMessage  tbd
0455:             * @return                 a property sheet with editable component
0456:             *      runtime component configuration properties
0457:             */
0458:            @SuppressWarnings("unchecked")
0459:            public static PropertySheet getCompRuntimeCompConfigPS(
0460:                    String anInstanceName, String aCompName, String aCompType,
0461:                    String aSummaryMessage) {
0462:                final String[][] COMP_RUNTIME_COMP_CONFIG_MATRIX = {
0463:                        { "instanceName", "jbi.xyz.instance.name.label",
0464:                                anInstanceName },
0465:                        { "compName", "jbi.xyz.comp.name.label", aCompName },
0466:                        { "compType", "jbi.xyz.comp.type.label", aCompType },
0467:                        { "summaryMessage", "jbi.xyz.summary.message.label",
0468:                                aSummaryMessage }, };
0469:
0470:                PropertySheet result = getPS("compRuntimeCompConfig", "sum",
0471:                        "jbi.xyz.summary.pss.label",
0472:                        COMP_RUNTIME_COMP_CONFIG_MATRIX);
0473:
0474:                return result;
0475:            }
0476:
0477:            /**
0478:             * Dynamically populates a <code>sun:propertySheet</code> element for
0479:             * component installation configuration properties
0480:             *
0481:             * @param aConfigType      Description of Parameter
0482:             * @param aCompName        the component name
0483:             * @param aCompType        Description of Parameter
0484:             * @return                 a property sheet with editable installation
0485:             *      configuration properties
0486:             */
0487:            @SuppressWarnings("unchecked")
0488:            public static PropertySheet getNoConfigPS(String aConfigType,
0489:                    String aCompName, String aCompType) {
0490:                PropertySheet result = createPS("noConfigAvail");
0491:
0492:                String displayName = I18nUtilities
0493:                        .getResourceString("jbi.config.props.general.section.display.name");
0494:
0495:                String displayDescription = I18nUtilities
0496:                        .getResourceString("jbi.config.props.general.section.display.description");
0497:
0498:                Object[] titleArgs = { displayName, displayDescription, };
0499:
0500:                String sectionTitle = GuiUtil.getMessage(I18nUtilities
0501:                        .getResourceString("jbi.config.props.section.title"),
0502:                        titleArgs);
0503:
0504:                PropertySheetSection sum = createPSS("sum", sectionTitle,
0505:                        result);
0506:
0507:                String configTypeInsert = I18nUtilities
0508:                        .getResourceString("jbi.config.props.type.runtime");
0509:
0510:                if (CompConfigUtils.CONFIG_TYPE_INSTALLATION
0511:                        .equals(aConfigType)) {
0512:                    configTypeInsert = I18nUtilities
0513:                            .getResourceString("jbi.config.props.type.install");
0514:                }
0515:
0516:                Object[] propArgs = { aCompName, configTypeInsert, };
0517:
0518:                String noConfigProps = I18nUtilities
0519:                        .getResourceString("jbi.config.props.no.config.props");
0520:
0521:                String propNotApplicable = GuiUtil
0522:                        .getMessage(
0523:                                I18nUtilities
0524:                                        .getResourceString("jbi.config.props.not.applicable.prop"),
0525:                                propArgs);
0526:
0527:                Property info = createStaticTextProperty("info", noConfigProps,
0528:                        propNotApplicable, sum);
0529:                return result;
0530:            }
0531:
0532:            /**
0533:             * Dynamically populates a <code>sun:propertySheet</code> element for the
0534:             * Component Statistics
0535:             *
0536:             * @param aTableOfCompStats         a table of component statistics
0537:             * @param aListOfEndpointsStatsCDs  Description of Parameter
0538:             * @param aCompName                 the component name for these
0539:             *      statistics
0540:             * @param anInstanceName            display statistics only for this
0541:             *      instance
0542:             * @return                          a property sheet for viewing the
0543:             *      Component Statistics
0544:             */
0545:            @SuppressWarnings("unchecked")
0546:            public static PropertySheet getCompStatsPS(
0547:                    TabularData aTableOfCompStats,
0548:                    List aListOfEndpointsStatsCDs, String aCompName,
0549:                    String anInstanceName) {
0550:                sLog.fine("JSFUtils.getCompStatsPS(" + aTableOfCompStats + ", "
0551:                        + aListOfEndpointsStatsCDs + ", " + aCompName + ", "
0552:                        + anInstanceName + ")");
0553:
0554:                PropertySheet result = createPS("compStatsPS");
0555:
0556:                CompositeData compData = CompositeDataUtils.getDataForInstance(
0557:                        aTableOfCompStats, anInstanceName);
0558:                if (null != compData) {
0559:
0560:                    FacesContext facesContext = FacesContext
0561:                            .getCurrentInstance();
0562:
0563:                    //
0564:                    // property sheet section for Summary Statistics
0565:                    //
0566:                    PropertySheetSection pss1 = createPSS("compStatsPss1",
0567:                            "jbi.comp.stats.props.summary.pss.label", result);
0568:
0569:                    Property compName = createStaticTextProperty("compName",
0570:                            "jbi.comp.stats.props.comp.name.label", aCompName,
0571:                            pss1);
0572:                    Property instanceName = createStaticTextProperty(
0573:                            "instanceName",
0574:                            "jbi.comp.stats.props.comp.instance.name.label",
0575:                            anInstanceName, pss1);
0576:
0577:                    Object[] componentUpTime = CompositeDataUtils
0578:                            .findCompositeUpTime(compData,
0579:                                    JBIStatisticsItemNames.COMPONENT_UPTIME);
0580:                    String upTimeValue = GuiUtil
0581:                            .getMessage(
0582:                                    I18nUtilities
0583:                                            .getResourceString("jbi.stats.uptime.format.dd.hh.mm.ss"),
0584:                                    componentUpTime);
0585:
0586:                    Property compUpTimeProperty = createStaticTextProperty(
0587:                            "compUpTime",
0588:                            "jbi.comp.stats.props.comp.uptime.label",
0589:                            upTimeValue, pss1);
0590:
0591:                    String activeEndpoints = CompositeDataUtils
0592:                            .findCompositeItem(
0593:                                    compData,
0594:                                    JBIStatisticsItemNames.NUMBER_OF_ACTIVATED_ENDPOINTS);
0595:                    Property compActiveEndpoints = createStaticTextProperty(
0596:                            "compActiveEndpoints",
0597:                            "jbi.comp.stats.props.comp.active.endpoints.label",
0598:                            activeEndpoints, pss1);
0599:
0600:                    String completedExchanges = CompositeDataUtils
0601:                            .findCompositeItem(
0602:                                    compData,
0603:                                    JBIStatisticsItemNames.NUMBER_OF_COMPLETED_EXCHANGES);
0604:
0605:                    Property compCompletedExchanges = createStaticTextProperty(
0606:                            "compCompletedExchanges",
0607:                            "jbi.comp.stats.props.comp.completed.exchanges.label",
0608:                            completedExchanges, pss1);
0609:                    String activeExchanges = CompositeDataUtils
0610:                            .findCompositeItem(
0611:                                    compData,
0612:                                    JBIStatisticsItemNames.NUMBER_OF_ACTIVE_EXCHANGES);
0613:                    Property compActiveExchanges = createStaticTextProperty(
0614:                            "compActiveExchanges",
0615:                            "jbi.comp.stats.props.comp.active.exchanges.label",
0616:                            activeExchanges, pss1);
0617:                    String errorExchanges = CompositeDataUtils
0618:                            .findCompositeItem(
0619:                                    compData,
0620:                                    JBIStatisticsItemNames.NUMBER_OF_ERROR_EXCHANGES);
0621:                    Property compErrorExchanges = createStaticTextProperty(
0622:                            "compErrorExchanges",
0623:                            "jbi.comp.stats.props.comp.error.exchanges.label",
0624:                            errorExchanges, pss1);
0625:
0626:                    //
0627:                    // property sheet section for Message Exchange Statistics
0628:                    //
0629:                    PropertySheetSection pss2 = createPSS("compStatsPss2",
0630:                            "jbi.comp.stats.props.msg.exchange.pss.label",
0631:                            result);
0632:
0633:                    Object[] compMEResponseTimeArray = CompositeDataUtils
0634:                            .findCompositeResponseTime(
0635:                                    compData,
0636:                                    JBIStatisticsItemNames.MESSAGE_EXCHANGE_RESPONSE_TIME);
0637:
0638:                    String compMEResponseTimeValue = "I18n TBD n/a";
0639:
0640:                    if ((null != compMEResponseTimeArray)
0641:                            && (0 < compMEResponseTimeArray.length)
0642:                            && (!((Double) compMEResponseTimeArray[0]).isNaN())) {
0643:                        compMEResponseTimeValue = GuiUtil
0644:                                .getMessage(
0645:                                        I18nUtilities
0646:                                                .getResourceString("jbi.stats.response.time.format.nanoseconds"),
0647:                                        compMEResponseTimeArray);
0648:                    }
0649:
0650:                    Property compMEResponseTime = createStaticTextProperty(
0651:                            "compMEResponseTime",
0652:                            "jbi.comp.stats.props.comp.me.response.time.label",
0653:                            compMEResponseTimeValue, pss2);
0654:
0655:                    String compMEResponseTimeHelpText = compData
0656:                            .getCompositeType()
0657:                            .getDescription(
0658:                                    JBIStatisticsItemNames.MESSAGE_EXCHANGE_RESPONSE_TIME);
0659:
0660:                    compMEResponseTime.setHelpText(compMEResponseTimeHelpText);
0661:
0662:                    Object[] compMEInCompTimeArray = CompositeDataUtils
0663:                            .findCompositeResponseTime(
0664:                                    compData,
0665:                                    JBIStatisticsItemNames.MESSAGE_EXCHANGE_COMPONENT_TIME);
0666:
0667:                    String compMEInCompTimeValue = "I18n TBD n/a";
0668:
0669:                    if ((null != compMEInCompTimeArray)
0670:                            && (0 < compMEInCompTimeArray.length)
0671:                            && (!((Double) compMEInCompTimeArray[0]).isNaN())) {
0672:                        compMEInCompTimeValue = GuiUtil
0673:                                .getMessage(
0674:                                        I18nUtilities
0675:                                                .getResourceString("jbi.stats.response.time.format.nanoseconds"),
0676:                                        compMEInCompTimeArray);
0677:                    }
0678:
0679:                    Property compMEInCompTime = createStaticTextProperty(
0680:                            "compMEInCompTime",
0681:                            "jbi.comp.stats.props.comp.me.in.component.label",
0682:                            compMEInCompTimeValue, pss2);
0683:
0684:                    String compMEInCompTimeHelpText = compData
0685:                            .getCompositeType()
0686:                            .getDescription(
0687:                                    JBIStatisticsItemNames.MESSAGE_EXCHANGE_COMPONENT_TIME);
0688:
0689:                    compMEInCompTime.setHelpText(compMEInCompTimeHelpText);
0690:
0691:                    Object[] compMEInDeliveryChannelTimeArray = CompositeDataUtils
0692:                            .findCompositeResponseTime(
0693:                                    compData,
0694:                                    JBIStatisticsItemNames.MESSAGE_EXCHANGE_DELIVERY_CHANNEL_TIME);
0695:
0696:                    String compMEInDeliveryChannelTimeValue = "I18n TBD n/a";
0697:
0698:                    if ((null != compMEInDeliveryChannelTimeArray)
0699:                            && (0 < compMEInDeliveryChannelTimeArray.length)
0700:                            && (!((Double) compMEInDeliveryChannelTimeArray[0])
0701:                                    .isNaN())) {
0702:                        compMEInDeliveryChannelTimeValue = GuiUtil
0703:                                .getMessage(
0704:                                        I18nUtilities
0705:                                                .getResourceString("jbi.stats.response.time.format.nanoseconds"),
0706:                                        compMEInDeliveryChannelTimeArray);
0707:                    }
0708:
0709:                    Property compMEInDeliveryChannelTime = createStaticTextProperty(
0710:                            "compMEInDeliveryChannelTime",
0711:                            "jbi.comp.stats.props.comp.me.in.delivery.channel.label",
0712:                            compMEInDeliveryChannelTimeValue, pss2);
0713:
0714:                    String compMEInDeliveryChannelTimeHelpText = compData
0715:                            .getCompositeType()
0716:                            .getDescription(
0717:                                    JBIStatisticsItemNames.MESSAGE_EXCHANGE_DELIVERY_CHANNEL_TIME);
0718:
0719:                    compMEInDeliveryChannelTime
0720:                            .setHelpText(compMEInDeliveryChannelTimeHelpText);
0721:
0722:                    Object[] compMEInMessageServiceTimeArray = CompositeDataUtils
0723:                            .findCompositeResponseTime(
0724:                                    compData,
0725:                                    JBIStatisticsItemNames.MESSAGE_EXCHANGE_NMR_TIME);
0726:
0727:                    String compMEInMessageServiceTimeValue = "I18n TBD n/a";
0728:
0729:                    if ((null != compMEInMessageServiceTimeArray)
0730:                            && (0 < compMEInMessageServiceTimeArray.length)
0731:                            && (!((Double) compMEInMessageServiceTimeArray[0])
0732:                                    .isNaN())) {
0733:                        compMEInMessageServiceTimeValue = GuiUtil
0734:                                .getMessage(
0735:                                        I18nUtilities
0736:                                                .getResourceString("jbi.stats.response.time.format.nanoseconds"),
0737:                                        compMEInMessageServiceTimeArray);
0738:                    }
0739:
0740:                    Property compMEInMessageServiceTime = createStaticTextProperty(
0741:                            "compMEInMessageServiceTime",
0742:                            "jbi.comp.stats.props.comp.me.in.message.service.label",
0743:                            compMEInMessageServiceTimeValue, pss2);
0744:
0745:                    String compMEInMessageServiceTimeHelpText = compData
0746:                            .getCompositeType()
0747:                            .getDescription(
0748:                                    JBIStatisticsItemNames.MESSAGE_EXCHANGE_NMR_TIME);
0749:
0750:                    compMEInMessageServiceTime
0751:                            .setHelpText(compMEInMessageServiceTimeHelpText);
0752:
0753:                    //
0754:                    // property sheet section for Endpoint Statistics
0755:                    //
0756:                    PropertySheetSection pss3 = createPSS("compStatsPss3",
0757:                            "jbi.comp.stats.props.endpoint.pss.label", result);
0758:
0759:                    Property endpointStats = createProperty("endpointStats",
0760:                            null, "", false, pss3);
0761:
0762:                    endpointStats.getChildren().add(
0763:                            addEndpointStatisticsTable(aTableOfCompStats,
0764:                                    aListOfEndpointsStatsCDs, aCompName,
0765:                                    anInstanceName));
0766:                }
0767:
0768:                return result;
0769:            }
0770:
0771:            /**
0772:             * Dynamically populates a <code>sun:propertySheet</code> element for the
0773:             * Service Assembly Statistics
0774:             *
0775:             * @param aTableOfSaStats        a table of Service Asssemly statistics
0776:             * @param aTableOfEndpointStats  a table of Endpoint statistics
0777:             * @param anInstanceName         display statistics only for this instance
0778:             * @param anSaName               the Service Assembly name for these
0779:             *      statistics
0780:             * @return                       a property sheet for viewing the Service
0781:             *      Unit Statistics
0782:             */
0783:            @SuppressWarnings("unchecked")
0784:            public static PropertySheet getSaStatsPS(
0785:                    TabularData aTableOfSaStats,
0786:                    TabularData aTableOfEndpointStats, String anInstanceName,
0787:                    String anSaName) {
0788:                sLog.fine("JSFUtils.getSaStatsPS(" + aTableOfSaStats + ", "
0789:                        + aTableOfEndpointStats + ", " + anInstanceName + ", "
0790:                        + anSaName + ")");
0791:
0792:                PropertySheet result = createPS("monSa");
0793:                CompositeData compData = CompositeDataUtils.getDataForInstance(
0794:                        aTableOfSaStats, anInstanceName);
0795:                if (null != compData) {
0796:                    //
0797:                    // Summary
0798:                    //
0799:                    PropertySheetSection sum = createPSS("sum",
0800:                            "jbi.monitor.service.assembly.summary.pss.label",
0801:                            result);
0802:
0803:                    Property instanceName = createStaticTextProperty(
0804:                            "instanceName",
0805:                            "jbi.monitor.service.assembly.instance.name.label",
0806:                            anInstanceName, sum);
0807:                    Property saName = createStaticTextProperty("saName",
0808:                            "jbi.monitor.service.assembly.name.label",
0809:                            anSaName, sum);
0810:
0811:                    //
0812:                    // Lifecycle statistics
0813:                    //
0814:                    PropertySheetSection lc = createPSS(
0815:                            "lc",
0816:                            "jbi.monitor.service.assembly.life.cycle.pss.label",
0817:                            result);
0818:
0819:                    String saLastStartUpTimeValue = formatDate(
0820:                            compData,
0821:                            JBIStatisticsItemNames.SERVICE_ASSEMBLY_LAST_STARTUP_TIME,
0822:                            "I18n TBD n/a");
0823:
0824:                    Property saLastStartUpTime = createStaticTextProperty(
0825:                            "lastStartUpTime",
0826:                            "jbi.monitor.service.assembly.last.start.time.label",
0827:                            saLastStartUpTimeValue, lc);
0828:
0829:                    String saStartUpTimeValue = formatTime(
0830:                            compData,
0831:                            JBIStatisticsItemNames.SERVICE_ASSEMBLY_STARTUP_TIME,
0832:                            "I18n TBD n/a");
0833:
0834:                    Property saStartTime = createStaticTextProperty(
0835:                            "avgStartUpTime",
0836:                            "jbi.monitor.service.assembly.start.time.label",
0837:                            saStartUpTimeValue, lc);
0838:                    String saStopTimeValue = formatTime(compData,
0839:                            JBIStatisticsItemNames.SERVICE_ASSEMBLY_STOP_TIME,
0840:                            "I18n TBD n/a");
0841:
0842:                    Property saStopTime = createStaticTextProperty(
0843:                            "avgStopTime",
0844:                            "jbi.monitor.service.assembly.stop.time.label",
0845:                            saStopTimeValue, lc);
0846:
0847:                    String saShutDownTimeValue = formatTime(
0848:                            compData,
0849:                            JBIStatisticsItemNames.SERVICE_ASSEMBLY_SHUTDOWN_TIME,
0850:                            "I18n TBD n/a");
0851:
0852:                    Property saShutDownTime = createStaticTextProperty(
0853:                            "avgShutDownTime",
0854:                            "jbi.monitor.service.assembly.shut.down.time.label",
0855:                            saShutDownTimeValue, lc);
0856:                }
0857:                sLog.fine("JSFUtils.getSaStatsPS(), result=" + result);
0858:                return result;
0859:            }
0860:
0861:            /**
0862:             * Dynamically populates a <code>sun:propertySheet</code> element for the
0863:             * Service Unit Statistics
0864:             *
0865:             * @param aTableOfSaStats        a table of Service Asssemly statistics
0866:             * @param aTableOfEndpointStats  a table of Endpoint statistics
0867:             * @param anInstanceName         display statistics only for this instance
0868:             * @param anSaName               the Service Assembly name for these
0869:             *      statistics
0870:             * @param anSuName               the Service Unit name for these
0871:             *      statistics
0872:             * @return                       a property sheet for viewing the Service
0873:             *      Unit Statistics
0874:             */
0875:            @SuppressWarnings("unchecked")
0876:            public static PropertySheet getSuStatsPS(
0877:                    TabularData aTableOfSaStats,
0878:                    TabularData aTableOfEndpointStats, String anInstanceName,
0879:                    String anSaName, String anSuName) {
0880:                sLog.fine("JSFUtils.getSuStatsPS(" + aTableOfSaStats + ", "
0881:                        + aTableOfEndpointStats + ", " + anInstanceName + ", "
0882:                        + anSaName + ", " + anSuName + ")");
0883:
0884:                PropertySheet result = createPS("monSu");
0885:                CompositeData compData = CompositeDataUtils.getDataForInstance(
0886:                        aTableOfSaStats, anInstanceName);
0887:                if (null != compData) {
0888:                    //
0889:                    // Summary
0890:                    //
0891:                    PropertySheetSection sum = createPSS("sum",
0892:                            "jbi.monitor.service.unit.summary.pss.label",
0893:                            result);
0894:
0895:                    Property instanceName = createStaticTextProperty(
0896:                            "instanceName",
0897:                            "jbi.monitor.service.unit.instance.name.label",
0898:                            anInstanceName, sum);
0899:                    Property saName = createStaticTextProperty(
0900:                            "saName",
0901:                            "jbi.monitor.service.unit.service.assembly.name.label",
0902:                            anSaName, sum);
0903:                    Property suName = createStaticTextProperty("suName",
0904:                            "jbi.monitor.service.unit.name.label", anSuName,
0905:                            sum);
0906:
0907:                    String epCountValue = "TBD";
0908:                    Property epCount = createStaticTextProperty("epCount",
0909:                            "jbi.monitor.service.unit.endpoint.count.label",
0910:                            epCountValue, sum);
0911:
0912:                    //
0913:                    // Lifecycle statistics
0914:                    //
0915:                    PropertySheetSection lc = createPSS("lc",
0916:                            "jbi.monitor.service.unit.life.cycle.pss.label",
0917:                            result);
0918:
0919:                    CompositeData[] suStatsData = CompositeDataUtils
0920:                            .findCompositeArrayItem(
0921:                                    compData,
0922:                                    JBIStatisticsItemNames.SERVICE_ASSEMBLY_SU_STATISTICS);
0923:                    serviceUnitsLoop: for (int i = 0; i < suStatsData.length; ++i) {
0924:                        String suNameI = CompositeDataUtils.findCompositeItem(
0925:                                suStatsData[i],
0926:                                JBIStatisticsItemNames.SERVICE_UNIT_NAME);
0927:                        if (!anSuName.equals(suNameI)) {
0928:                            continue serviceUnitsLoop;
0929:                        }
0930:
0931:                        String suStartUpTimeValue = formatTime(
0932:                                suStatsData[i],
0933:                                JBIStatisticsItemNames.SERVICE_UNIT_STARTUP_TIME,
0934:                                "I18n TBD n/a");
0935:
0936:                        Property suStartTime = createStaticTextProperty(
0937:                                "startTime",
0938:                                "jbi.monitor.service.unit.start.time.label",
0939:                                suStartUpTimeValue, lc);
0940:
0941:                        String suStopTimeValue = formatTime(suStatsData[i],
0942:                                JBIStatisticsItemNames.SERVICE_UNIT_STOP_TIME,
0943:                                "I18n TBD n/a");
0944:
0945:                        Property suStopTime = createStaticTextProperty(
0946:                                "stopTime",
0947:                                "jbi.monitor.service.unit.stop.time.label",
0948:                                suStopTimeValue, lc);
0949:
0950:                        String suShutDownTimeValue = formatTime(
0951:                                suStatsData[i],
0952:                                JBIStatisticsItemNames.SERVICE_UNIT_SHUTDOWN_TIME,
0953:                                "I18n TBD n/a");
0954:
0955:                        Property suShutDownTime = createStaticTextProperty(
0956:                                "shutDownTime",
0957:                                "jbi.monitor.service.unit.shut.down.time.label",
0958:                                suShutDownTimeValue, lc);
0959:                    }
0960:                    //
0961:                    // Endpoints
0962:                    //
0963:                    PropertySheetSection ep = createPSS("ep",
0964:                            "jbi.monitor.service.unit.endpoints.pss.label",
0965:                            result);
0966:
0967:                    Property endpoints = createStaticTextProperty("endpoints",
0968:                            "jbi.monitor.service.unit.endpoints.label",
0969:                            "placeholder",
0970:                            // TBD replace with table/links
0971:                            ep);
0972:
0973:                }
0974:                sLog.fine("JSFUtils.getSuStatsPS(), result=" + result);
0975:                return result;
0976:            }
0977:
0978:            /**
0979:             * create a labeled property with a read-only or editable text property
0980:             *
0981:             * @param anIdPrefix      String used to create unique element IDs
0982:             * @param anI18nLabelKey  String used to lookup an I18n String for the
0983:             *      label
0984:             * @param aTextValueExpr  String used to set the text value
0985:             * @param isEditable      boolean if true, creates editable TextField,
0986:             *      otherwise creates read-only StaticText
0987:             * @return                Property containing a label and either a
0988:             *      TextField or a StaticText
0989:             */
0990:            public static Property createTextProperty(String anIdPrefix,
0991:                    String anI18nLabelKey, String aTextValueExpr,
0992:                    boolean isEditable) {
0993:                Property result = new Property();
0994:                result.setId(anIdPrefix + "Property");
0995:
0996:                String labelStr = I18nUtilities
0997:                        .getResourceString(anI18nLabelKey);
0998:
0999:                Label label = createLabel(anIdPrefix, isEditable, labelStr,
1000:                        result);
1001:
1002:                if (!isEditable) {
1003:                    StaticText staticText = new StaticText();
1004:                    staticText.setId(anIdPrefix + "StaticText");
1005:
1006:                    String staticTextStr = "";
1007:
1008:                    if (null != aTextValueExpr) {
1009:                        staticTextStr = BeanUtilities
1010:                                .getStringPropertyUsingExpression(aTextValueExpr);
1011:                    }
1012:
1013:                    staticText.setText(staticTextStr);
1014:                    result.getChildren().add(staticText);
1015:                } else {
1016:                    TextField textField = new TextField();
1017:                    textField.setId(anIdPrefix + "TextField");
1018:                    textField.setStyleClass(FIELD_REQUIRED);
1019:
1020:                    String textFieldStr = "";
1021:
1022:                    if (null != aTextValueExpr) {
1023:                        textFieldStr = BeanUtilities
1024:                                .getStringPropertyUsingExpression(aTextValueExpr);
1025:                    }
1026:
1027:                    textField.setText(textFieldStr);
1028:                    result.getChildren().add(textField);
1029:                }
1030:                return result;
1031:            }
1032:
1033:            /**
1034:             * @param anInstallConfigPS  Description of Parameter
1035:             * @param aConfigProperties  Description of Parameter
1036:             */
1037:            public static void decodeCompInstallationConfigProperties(
1038:                    PropertySheet anInstallConfigPS,
1039:                    Properties aConfigProperties) {
1040:                sLog
1041:                        .fine("JSFUtils.decodeCompInstallationConfigProperties(), anInstallConfigPS="
1042:                                + anInstallConfigPS);
1043:                List sections = anInstallConfigPS.getChildren();
1044:                for (int i = 0; i < sections.size(); ++i) {
1045:                    PropertySheetSection section = (PropertySheetSection) sections
1046:                            .get(i);
1047:                    sLog
1048:                            .fine("JSFUtils.decodeCompInstallationConfigProperties(), section="
1049:                                    + section);
1050:
1051:                    List properties = section.getChildren();
1052:                    for (int j = 0; j < properties.size(); ++j) {
1053:                        Property property = (Property) properties.get(j);
1054:                        sLog
1055:                                .fine("JSFUtils.decodeCompInstallationConfigProperties(), property="
1056:                                        + property);
1057:
1058:                        String propKey = null;
1059:                        String propValue = null;
1060:                        List widgets = property.getChildren();
1061:                        for (int k = 0; k < widgets.size(); ++k) {
1062:                            UIComponent widget = (UIComponent) widgets.get(k);
1063:                            sLog
1064:                                    .fine("JSFUtils.decodeCompInstallationConfigProperties(), widget="
1065:                                            + widget);
1066:                            // Note: order of checks is important
1067:                            if (widget instanceof  Label) {
1068:                                sLog
1069:                                        .fine("JSFUtils.decodeCompInstallationConfigProperties(), skip label="
1070:                                                + (String) ((Label) widget)
1071:                                                        .getText());
1072:                            } else if (widget instanceof  DropDown) {
1073:                                propValue = (String) ((DropDown) widget)
1074:                                        .getValue();
1075:                                sLog
1076:                                        .fine("JSFUtils.decodeCompInstallationConfigProperties()"
1077:                                                + ", DropDown propValue="
1078:                                                + propValue);
1079:                            } else if (widget instanceof  PasswordField) {
1080:                                propValue = (String) ((PasswordField) widget)
1081:                                        .getValue();
1082:                                sLog
1083:                                        .fine("JSFUtils.decodeCompInstallationConfigProperties()"
1084:                                                + ", PasswordField propValue="
1085:                                                + propValue);
1086:                            } else if (widget instanceof  TextField) {
1087:                                propValue = (String) ((TextField) widget)
1088:                                        .getText();
1089:                                sLog
1090:                                        .fine("JSFUtils.decodeCompInstallationConfigProperties()"
1091:                                                + ", TextField propValue="
1092:                                                + propValue);
1093:                            } else if (widget instanceof  HiddenField) {
1094:                                propKey = (String) ((HiddenField) widget)
1095:                                        .getText();
1096:                                sLog
1097:                                        .fine("JSFUtils.decodeCompInstallationConfigProperties()"
1098:                                                + ", propKey=" + propKey);
1099:                            }
1100:                        }
1101:                        if ((null != propKey) && (null != propValue)) {
1102:                            sLog
1103:                                    .fine("JSFUtils.decodeCompInstallationConfigProperties()"
1104:                                            + ", aConfigProperties.put("
1105:                                            + propKey + ", " + propValue + ")");
1106:                            aConfigProperties.put(propKey, propValue);
1107:                        }
1108:                    }
1109:                }
1110:                sLog
1111:                        .fine("JSFUtils.decodeCompInstallationConfigProperties(), aConfigProperties="
1112:                                + aConfigProperties);
1113:            }
1114:
1115:            /**
1116:             * Input parameter for <code>getCompAppConfigPropertySheet</code> when
1117:             * creating a new Component Application Configuration.
1118:             */
1119:            public static final String PS_CREATE = "create";
1120:
1121:            /**
1122:             * Input parameter for <code>getCompAppConfigPropertySheet</code> when
1123:             * viewing/editing an existing Component Application Configuration.
1124:             */
1125:            public static final String PS_EDIT = "edit";
1126:
1127:            /**
1128:             * Gets the PS attribute of the JSFUtils class
1129:             *
1130:             * @param aPsName          Description of Parameter
1131:             * @param aPssName         Description of Parameter
1132:             * @param aPssLabelKey     Description of Parameter
1133:             * @param aPropertyMatrix  Description of Parameter
1134:             * @return                 The PS value
1135:             */
1136:            private static PropertySheet getPS(String aPsName, String aPssName,
1137:                    String aPssLabelKey, String[][] aPropertyMatrix) {
1138:                PropertySheet result = createPS(aPsName);
1139:
1140:                PropertySheetSection pss = createPSS(aPssName, aPssLabelKey,
1141:                        result);
1142:
1143:                for (int i = 0; i < aPropertyMatrix.length; ++i) {
1144:                    Property p = createStaticTextProperty(
1145:                            aPropertyMatrix[i][0], aPropertyMatrix[i][1],
1146:                            aPropertyMatrix[i][2], pss);
1147:                }
1148:                return result;
1149:            }
1150:
1151:            /**
1152:             * adds columns to a group so that the fields in the columns get the data
1153:             * from a provider built from the supplied data
1154:             *
1155:             * @param aSelector           The new ColumnData value
1156:             * @param aGroup              to add the columns to
1157:             * @param aCompositeDataList  The new ColumnData value
1158:             */
1159:            private static void setColumnData(String aSelector,
1160:                    TableRowGroup aGroup, List aCompositeDataList) {
1161:                final String[][] IDS_EXPRS = {
1162:                        { "endPoint", "#{sourceVar.value.endpointName}" },
1163:                        { "receivedRequests",
1164:                                "#{sourceVar.value.receivedRequests}" },
1165:                        { "receivedReplies",
1166:                                "#{sourceVar.value.receivedReplies}" },
1167:                        { "receivedErrors", "#{sourceVar.value.receivedErrors}" },
1168:                        { "receivedDones", "#{sourceVar.value.receivedDones}" },
1169:                        { "sentRequests", "#{sourceVar.value.sentRequests}" },
1170:                        { "sentReplies", "#{sourceVar.value.sentReplies}" },
1171:                        { "sentErrors", "#{sourceVar.value.sentErrors}" },
1172:                        { "sentDones", "#{sourceVar.value.sentDones}" }, };
1173:
1174:                sLog.fine("JSFUtils.setColumnData(" + aSelector + ", " + aGroup
1175:                        + ", " + aCompositeDataList + ")");
1176:
1177:                aGroup.setSourceVar("sourceVar");
1178:
1179:                List children = aGroup.getChildren();
1180:
1181:                for (int i = 0; i < IDS_EXPRS.length; ++i) {
1182:
1183:                    children
1184:                            .add(addTableColumnData(aSelector
1185:                                    + IDS_EXPRS[i][INDEX_ID],
1186:                                    IDS_EXPRS[i][INDEX_EXPR]));
1187:                }
1188:
1189:                ArrayList rows = new ArrayList();
1190:
1191:                // TBD add data (was addTestData(rows);
1192:                // TBD use aCompositeList and aSelector
1193:                addTestData(rows);
1194:
1195:                ObjectListDataProvider oldp = new ObjectListDataProvider(rows);
1196:
1197:                aGroup.setSourceData(oldp);
1198:            }
1199:
1200:            /**
1201:             * Sets a value expression on a <code>StaticText</code> element.
1202:             *
1203:             * @param aValueExpression  used to fetch data from provider
1204:             * @param aTextField        where to set the value expression
1205:             */
1206:            private static void setValueExpression(String aValueExpression,
1207:                    StaticText aTextField) {
1208:                FacesContext facesContext = FacesContext.getCurrentInstance();
1209:                ValueExpression ve = facesContext.getApplication()
1210:                        .getExpressionFactory().createValueExpression(
1211:                                facesContext.getELContext(), aValueExpression,
1212:                                Object.class);
1213:                aTextField.setValueExpression("text", ve);
1214:            }
1215:
1216:            /**
1217:             * Description of the Method
1218:             *
1219:             * @param anIdPrefix     Description of Parameter
1220:             * @param isRequired     Description of Parameter
1221:             * @param aDisplayLabel  Description of Parameter
1222:             * @param aParent        Description of Parameter
1223:             * @return               Description of the Returned Value
1224:             */
1225:            private static Label createLabel(String anIdPrefix,
1226:                    boolean isRequired, String aDisplayLabel, Property aParent) {
1227:                Label result = new Label();
1228:                result.setId(anIdPrefix + "Label");
1229:                result.setRequiredIndicator(isRequired);
1230:                aParent.getChildren().add(result);
1231:                aParent.setLabel(aDisplayLabel);
1232:                return result;
1233:            }
1234:
1235:            /**
1236:             * Description of the Method
1237:             *
1238:             * @param anIdPrefix       Description of Parameter
1239:             * @param aColumnWidth     Description of Parameter
1240:             * @param aToolTip         Description of Parameter
1241:             * @param isRequiredField  Description of Parameter
1242:             * @param aValue           Description of Parameter
1243:             * @param aSiblingsList    Description of Parameter
1244:             * @return                 Description of the Returned Value
1245:             */
1246:            private static PasswordField createPasswordField(String anIdPrefix,
1247:                    int aColumnWidth, String aToolTip, boolean isRequiredField,
1248:                    String aValue, List aSiblingsList) {
1249:                PasswordField result = new PasswordField();
1250:                result.setId(anIdPrefix + "PasswordField");
1251:                result.setColumns(aColumnWidth);
1252:                result.setToolTip(aToolTip);
1253:                if (isRequiredField) {
1254:                    result.setStyleClass(FIELD_REQUIRED);
1255:                }
1256:                result.setText(aValue);
1257:                aSiblingsList.add(result);
1258:                return result;
1259:            }
1260:
1261:            /**
1262:             * Description of the Method
1263:             *
1264:             * @param anId           Description of Parameter
1265:             * @param anI18nMessage  Description of Parameter
1266:             * @param aParent        Description of Parameter
1267:             * @return               Description of the Returned Value
1268:             */
1269:            private static HelpInline createFieldHelp(String anId,
1270:                    String anI18nMessage, UIComponent aParent) {
1271:
1272:                HelpInline result = new HelpInline();
1273:                result.setText(anI18nMessage);
1274:                result.setType(HELP_INLINE_TYPE_FIELD);
1275:                aParent.getChildren().add(result);
1276:                return result;
1277:            }
1278:
1279:            /**
1280:             * @param aTableOfEndpointStats     The feature to be added to the
1281:             *      EndpointStatisticsTable attribute
1282:             * @param aListOfEndpointsStatsCDs  The feature to be added to the
1283:             *      EndpointStatisticsTable attribute
1284:             * @param aCompName                 The feature to be added to the
1285:             *      EndpointStatisticsTable attribute
1286:             * @param anInstanceName            The feature to be added to the
1287:             *      EndpointStatisticsTable attribute
1288:             * @return                          Description of the Returned Value
1289:             */
1290:            private static Table addEndpointStatisticsTable(
1291:                    TabularData aTableOfEndpointStats,
1292:                    List aListOfEndpointsStatsCDs, String aCompName,
1293:                    String anInstanceName) {
1294:                Table result = new Table();
1295:
1296:                CompositeData compositeData = CompositeDataUtils
1297:                        .getDataForInstance(aTableOfEndpointStats,
1298:                                anInstanceName);
1299:                if (null != compositeData) {
1300:                    TableRowGroup headerGroup = addHeadersGroup();
1301:                    result.getChildren().add(headerGroup);
1302:
1303:                    TableRowGroup providingEndpointsGroup = addProvidingEndpointsGroup(aListOfEndpointsStatsCDs);
1304:                    result.getChildren().add(providingEndpointsGroup);
1305:
1306:                    TableRowGroup consumingEndpointsGroup = addConsumingEndpointsGroup(aListOfEndpointsStatsCDs);
1307:                    result.getChildren().add(consumingEndpointsGroup);
1308:
1309:                    TableRowGroup totalsGroup = addTotalsGroup(aListOfEndpointsStatsCDs);
1310:                    result.getChildren().add(totalsGroup);
1311:                }
1312:
1313:                return result;
1314:            }
1315:
1316:            /**
1317:             * @return   Description of the Returned Value
1318:             */
1319:            private static TableRowGroup addHeadersGroup() {
1320:                final String[][] IDS_HEADINGS = {
1321:                        { "endPoint", "jbi.statistics.endpoint" },
1322:                        { "receivedRequests", "jbi.statistics.receivedRequests" },
1323:                        { "receivedReplies", "jbi.statistics.receivedReplies" },
1324:                        { "receivedErrors", "jbi.statistics.receivedErrors" },
1325:                        { "receivedDones", "jbi.statistics.receivedDones" },
1326:                        { "sentRequests", "jbi.statistics.sentRequests" },
1327:                        { "sentReplies", "jbi.statistics.sentReplies" },
1328:                        { "sentErrors", "jbi.statistics.sentErrors" },
1329:                        { "sentDones", "jbi.statistics.sentDones" }, };
1330:                TableRowGroup result = new TableRowGroup();
1331:                List children = result.getChildren();
1332:
1333:                for (int i = 0; i < IDS_HEADINGS.length; ++i) {
1334:
1335:                    children
1336:                            .add(addTableColumnHeader(
1337:                                    IDS_HEADINGS[i][INDEX_ID],
1338:                                    I18nUtilities
1339:                                            .getResourceString(IDS_HEADINGS[i][INDEX_HEADING])));
1340:                }
1341:
1342:                result.setCollapsed(true);
1343:                return result;
1344:            }
1345:
1346:            /**
1347:             * @param aListOfEndpointsStatsCDs  The feature to be added to the
1348:             *      ProvidingEndpointsGroup attribute
1349:             * @return                          Description of the Returned Value
1350:             */
1351:            private static TableRowGroup addProvidingEndpointsGroup(
1352:                    List aListOfEndpointsStatsCDs) {
1353:                TableRowGroup result = new TableRowGroup();
1354:
1355:                result
1356:                        .setHeaderText(I18nUtilities
1357:                                .getResourceString("jbi.statistics.provisioningEndpoint"));
1358:                result.setGroupToggleButton(true);
1359:
1360:                for (int i = 0; i < aListOfEndpointsStatsCDs.size(); ++i) {
1361:                    sLog
1362:                            .fine("JSFUtils.addProvidingEndpointsGroup aListOfEndpointsStatsCDs.get("
1363:                                    + i + "):");
1364:                    CompositeData nextEndpointCD = (CompositeData) aListOfEndpointsStatsCDs
1365:                            .get(i);
1366:                    CompositeDataUtils.dump(nextEndpointCD);
1367:                }
1368:
1369:                setColumnData(SELECT_PROVIDING, result,
1370:                        aListOfEndpointsStatsCDs);
1371:
1372:                return result;
1373:            }
1374:
1375:            /**
1376:             * @param aListOfEndpointsStatsCDs  The feature to be added to the
1377:             *      ConsumingEndpointsGroup attribute
1378:             * @return                          Description of the Returned Value
1379:             */
1380:            private static TableRowGroup addConsumingEndpointsGroup(
1381:                    List aListOfEndpointsStatsCDs) {
1382:                TableRowGroup result = new TableRowGroup();
1383:
1384:                result.setHeaderText(I18nUtilities
1385:                        .getResourceString("jbi.statistics.consumingEndpoint"));
1386:                result.setGroupToggleButton(true);
1387:
1388:                for (int i = 0; i < aListOfEndpointsStatsCDs.size(); ++i) {
1389:                    sLog
1390:                            .fine("JSFUtils.addConsumingEndpointsGroup aListOfEndpointsStatsCDs.get("
1391:                                    + i + "):");
1392:                    CompositeData nextEndpointCD = (CompositeData) aListOfEndpointsStatsCDs
1393:                            .get(i);
1394:                    CompositeDataUtils.dump(nextEndpointCD);
1395:                }
1396:
1397:                setColumnData(SELECT_CONSUMING, result,
1398:                        aListOfEndpointsStatsCDs);
1399:
1400:                return result;
1401:            }
1402:
1403:            /**
1404:             * @param aListOfEndpointsStatsCDs  The feature to be added to the
1405:             *      TotalsGroup attribute
1406:             * @return                          Description of the Returned Value
1407:             */
1408:            private static TableRowGroup addTotalsGroup(
1409:                    List aListOfEndpointsStatsCDs) {
1410:                TableRowGroup result = new TableRowGroup();
1411:
1412:                result.setHeaderText(I18nUtilities
1413:                        .getResourceString("jbi.statistics.totals"));
1414:                result.setGroupToggleButton(true);
1415:
1416:                for (int i = 0; i < aListOfEndpointsStatsCDs.size(); ++i) {
1417:                    sLog
1418:                            .fine("JSFUtils.addTotalsGroup aListOfEndpointsStatsCDs.get("
1419:                                    + i + "):");
1420:                    CompositeData nextEndpointCD = (CompositeData) aListOfEndpointsStatsCDs
1421:                            .get(i);
1422:                    CompositeDataUtils.dump(nextEndpointCD);
1423:                }
1424:
1425:                setColumnData(SELECT_TOTALS, result, aListOfEndpointsStatsCDs);
1426:
1427:                return result;
1428:            }
1429:
1430:            /**
1431:             * @param anId         The feature to be added to the TableColumnHeader
1432:             *      attribute
1433:             * @param aHeaderText  The feature to be added to the TableColumnHeader
1434:             *      attribute
1435:             * @return             Description of the Returned Value
1436:             */
1437:            private static TableColumn addTableColumnHeader(String anId,
1438:                    String aHeaderText) {
1439:                TableColumn result = new TableColumn();
1440:                result.setId(anId + "TCHeader");
1441:                result.setHeaderText(aHeaderText);
1442:                result.setRowHeader(true);
1443:                return result;
1444:            }
1445:
1446:            /**
1447:             * initializes a table column to obtain data from a provider
1448:             *
1449:             * @param anId          The feature to be added to the TableColumnData
1450:             *      attribute
1451:             * @param anExpression  used to fetch data
1452:             * @return              Description of the Returned Value
1453:             */
1454:            private static TableColumn addTableColumnData(String anId,
1455:                    String anExpression) {
1456:                TableColumn result = new TableColumn();
1457:                result.setId(anId + "TCData");
1458:
1459:                StaticText data = new StaticText();
1460:                data.setId(anId + "StaticText");
1461:
1462:                setValueExpression(anExpression, data);
1463:
1464:                result.getChildren().add(data);
1465:                return result;
1466:            }
1467:
1468:            /**
1469:             * Description of the Method
1470:             *
1471:             * @param anId  Description of Parameter
1472:             * @return      Description of the Returned Value
1473:             */
1474:            private static PropertySheet createPS(String anId) {
1475:                final String PS = "Ps";
1476:                PropertySheet result = new PropertySheet();
1477:                result.setId(anId + PS);
1478:                return result;
1479:            }
1480:
1481:            /**
1482:             * Description of the Method
1483:             *
1484:             * @param anId         Description of Parameter
1485:             * @param aHeadingKey  Description of Parameter
1486:             * @param aParent      Description of Parameter
1487:             * @return             Description of the Returned Value
1488:             */
1489:            private static PropertySheetSection createPSS(String anId,
1490:                    String aHeadingKey, PropertySheet aParent) {
1491:                final String PSS = "Pss";
1492:                PropertySheetSection result = new PropertySheetSection();
1493:                result.setId(anId + PSS);
1494:                String pssHeading = I18nUtilities
1495:                        .getResourceString(aHeadingKey);
1496:                result.setLabel(pssHeading);
1497:                aParent.getChildren().add(result);
1498:                return result;
1499:            }
1500:
1501:            /**
1502:             * Description of the Method
1503:             *
1504:             * @param anIdPrefix  Description of Parameter
1505:             * @param aName       Description of Parameter
1506:             * @param aLabelKey   Description of Parameter
1507:             * @param isRequired  Description of Parameter
1508:             * @param aParent     Description of Parameter
1509:             * @return            Description of the Returned Value
1510:             */
1511:            private static Property createProperty(String anIdPrefix,
1512:                    String aName, String aLabelKey, boolean isRequired,
1513:                    PropertySheetSection aParent) {
1514:                final String PROP = "Prop";
1515:                Property result = new Property();
1516:                result.setId(anIdPrefix + PROP);
1517:                HiddenField propNameForDecode = createHiddenField(anIdPrefix,
1518:                        aName, result);
1519:                String displayLabel = I18nUtilities
1520:                        .getResourceString(aLabelKey);
1521:                Label label = createLabel(anIdPrefix, isRequired, displayLabel,
1522:                        result);
1523:                aParent.getChildren().add(result);
1524:                return result;
1525:            }
1526:
1527:            /**
1528:             * Description of the Method
1529:             *
1530:             * @param anIdPrefix      Description of Parameter
1531:             * @param aNameForDecode  Description of Parameter
1532:             * @param aParent         Description of Parameter
1533:             * @return                Description of the Returned Value
1534:             */
1535:            private static HiddenField createHiddenField(String anIdPrefix,
1536:                    String aNameForDecode, Property aParent) {
1537:                HiddenField result = new HiddenField();
1538:                result.setId(anIdPrefix + "hdnFld");
1539:                result.setText(aNameForDecode);
1540:                aParent.getChildren().add(result);
1541:                return result;
1542:            }
1543:
1544:            /**
1545:             * @param anIdPrefix      Description of Parameter
1546:             * @param aNameForDecode  Description of Parameter
1547:             * @param aLabelKey       Description of Parameter
1548:             * @param aValue          Description of Parameter
1549:             * @param aParent         Description of Parameter
1550:             * @return                Description of the Returned Value
1551:             */
1552:            private static Property createBooleanInputProperty(
1553:                    String anIdPrefix, String aNameForDecode, String aLabelKey,
1554:                    String aValue, PropertySheetSection aParent) {
1555:                Property result;
1556:                ArrayList trueFalse = new ArrayList();
1557:                trueFalse.add(Boolean.toString(true));
1558:                trueFalse.add(Boolean.toString(false));
1559:
1560:                result = createDropDownProperty(anIdPrefix, aNameForDecode,
1561:                        aLabelKey, trueFalse, aValue, IS_NOT_SUBMIT_FORM,
1562:                        aParent);
1563:                return result;
1564:            }
1565:
1566:            /**
1567:             * @param anIdPrefix         Description of Parameter
1568:             * @param aNameForDecode     Description of Parameter
1569:             * @param aLabelKey          Description of Parameter
1570:             * @param aSelectionList     Description of Parameter
1571:             * @param aCurrentSelection  Description of Parameter
1572:             * @param isSubmitForm       Description of Parameter
1573:             * @param aParent            Description of Parameter
1574:             * @return                   Description of the Returned Value
1575:             */
1576:            private static Property createDropDownProperty(String anIdPrefix,
1577:                    String aNameForDecode, String aLabelKey,
1578:                    List<String> aSelectionList, String aCurrentSelection,
1579:                    boolean isSubmitForm, PropertySheetSection aParent) {
1580:                Property result;
1581:
1582:                result = createProperty(anIdPrefix, aNameForDecode, aLabelKey,
1583:                        false, aParent);
1584:
1585:                ArrayList<Option> optionsList = new ArrayList<Option>();
1586:                for (int i = 0; i < aSelectionList.size(); ++i) {
1587:                    String selection = aSelectionList.get(i);
1588:                    String label = selection;
1589:                    Option option = new Option(selection, label);
1590:                    optionsList.add(option);
1591:                }
1592:
1593:                Option[] optionsArray = new Option[0];
1594:                optionsArray = optionsList.toArray(optionsArray);
1595:
1596:                DropDown dropDown = new DropDown();
1597:                dropDown.setId(anIdPrefix + "dropDown");
1598:
1599:                dropDown.setItems(optionsArray);
1600:
1601:                dropDown.setSelected(aCurrentSelection);
1602:                dropDown.setSubmitForm(isSubmitForm);
1603:
1604:                result.getChildren().add(dropDown);
1605:
1606:                return result;
1607:            }
1608:
1609:            /**
1610:             * @param anIdPrefix      Description of Parameter
1611:             * @param aNameForDecode  Description of Parameter
1612:             * @param aLabelKey       Description of Parameter
1613:             * @param isRequired      Description of Parameter
1614:             * @param aValue          Description of Parameter
1615:             * @param aParent         Description of Parameter
1616:             * @return                Description of the Returned Value
1617:             */
1618:            private static Property createNumericInputProperty(
1619:                    String anIdPrefix, String aNameForDecode, String aLabelKey,
1620:                    boolean isRequired, String aValue,
1621:                    PropertySheetSection aParent) {
1622:                Property result = createTextInputProperty(anIdPrefix,
1623:                        aNameForDecode, aLabelKey, isRequired, aValue, aParent);
1624:                // TBD tag numeric
1625:                return result;
1626:            }
1627:
1628:            /**
1629:             * @param anIdPrefix      Description of Parameter
1630:             * @param aNameForDecode  Description of Parameter
1631:             * @param aLabelKey       Description of Parameter
1632:             * @param isRequired      Description of Parameter
1633:             * @param aValue          Description of Parameter
1634:             * @param aParent         Description of Parameter
1635:             * @return                Description of the Returned Value
1636:             */
1637:            private static Property createPasswordInputProperty(
1638:                    String anIdPrefix, String aNameForDecode, String aLabelKey,
1639:                    boolean isRequired, String aValue,
1640:                    PropertySheetSection aParent) {
1641:                final String PASSWORD_FIELD = "PwFld";
1642:                Property result = createProperty(anIdPrefix, aNameForDecode,
1643:                        aLabelKey, isRequired, aParent);
1644:                PasswordField passwordField = new PasswordField();
1645:                passwordField.setId(anIdPrefix + PASSWORD_FIELD);
1646:                if (isRequired) {
1647:                    passwordField.setStyleClass(FIELD_REQUIRED);
1648:                }
1649:                passwordField.setPassword(aValue);
1650:                result.getChildren().add(passwordField);
1651:                return result;
1652:            }
1653:
1654:            /**
1655:             * @param anIdPrefix  Description of Parameter
1656:             * @param aLabelKey   Description of Parameter
1657:             * @param aValue      Description of Parameter
1658:             * @param aParent     Description of Parameter
1659:             * @return            Description of the Returned Value
1660:             */
1661:            private static Property createStaticTextProperty(String anIdPrefix,
1662:                    String aLabelKey, String aValue,
1663:                    PropertySheetSection aParent) {
1664:                final String NO_DECODE = "no decode; not an input";
1665:                // Not I18n
1666:                final String STATIC_TEXT = "StTxt";
1667:                Property result = createProperty(anIdPrefix, NO_DECODE,
1668:                        aLabelKey, false, aParent);
1669:                StaticText text = new StaticText();
1670:                text.setId(anIdPrefix + STATIC_TEXT);
1671:                text.setText(aValue);
1672:                result.getChildren().add(text);
1673:                return result;
1674:            }
1675:
1676:            /**
1677:             * @param anIdPrefix      Description of Parameter
1678:             * @param aNameForDecode  Description of Parameter
1679:             * @param aLabelKey       Description of Parameter
1680:             * @param isRequired      Description of Parameter
1681:             * @param aValue          Description of Parameter
1682:             * @param aParent         Description of Parameter
1683:             * @return                Description of the Returned Value
1684:             */
1685:            private static Property createTextInputProperty(String anIdPrefix,
1686:                    String aNameForDecode, String aLabelKey,
1687:                    boolean isRequired, String aValue,
1688:                    PropertySheetSection aParent) {
1689:                final String TEXT_FIELD = "TxtFld";
1690:                Property result = createProperty(anIdPrefix, aNameForDecode,
1691:                        aLabelKey, isRequired, aParent);
1692:                TextField textField = new TextField();
1693:                textField.setId(anIdPrefix + TEXT_FIELD);
1694:                if (isRequired) {
1695:                    textField.setStyleClass(FIELD_REQUIRED);
1696:                }
1697:                textField.setText(aValue);
1698:                result.getChildren().add(textField);
1699:                return result;
1700:            }
1701:
1702:            /**
1703:             * @param aCompositeData  Description of Parameter
1704:             * @param aKey            Description of Parameter
1705:             * @param aDefaultValue   Description of Parameter
1706:             * @return                Description of the Returned Value
1707:             */
1708:            private static String formatDate(CompositeData aCompositeData,
1709:                    String aKey, String aDefaultValue) {
1710:                String result = aDefaultValue;
1711:
1712:                Date date = CompositeDataUtils.findCompositeDate(
1713:                        aCompositeData, aKey);
1714:
1715:                if (null != date) {
1716:                    DateFormat localizedDateFormat = DateFormat
1717:                            .getDateInstance(DateFormat.LONG);
1718:
1719:                    DateFormat localizedTimeFormat = DateFormat
1720:                            .getTimeInstance(DateFormat.LONG);
1721:                    result = localizedDateFormat.format(date) + " "
1722:                            + localizedTimeFormat.format(date);
1723:                }
1724:                return result;
1725:            }
1726:
1727:            /**
1728:             * @param aCompositeData  Description of Parameter
1729:             * @param aKey            Description of Parameter
1730:             * @param aDefaultValue   Description of Parameter
1731:             * @return                Description of the Returned Value
1732:             */
1733:            private static String formatTime(CompositeData aCompositeData,
1734:                    String aKey, String aDefaultValue) {
1735:
1736:                Object[] timeArray = CompositeDataUtils
1737:                        .findCompositeResponseTime(aCompositeData, aKey);
1738:                String result = aDefaultValue;
1739:
1740:                if ((null != timeArray) && (0 < timeArray.length)
1741:                        && (!((Double) timeArray[0]).isNaN())) {
1742:                    result = GuiUtil
1743:                            .getMessage(
1744:                                    I18nUtilities
1745:                                            .getResourceString("jbi.stats.response.time.format.nanoseconds"),
1746:                                    timeArray);
1747:                }
1748:                return result;
1749:            }
1750:
1751:            /**
1752:             * @param aList  The feature to be added to the TestData attribute
1753:             */
1754:            private static void addTestData(List aList) {
1755:                int testCount = 0;
1756:                for (int i = 0; i < 3; ++i) {
1757:                    EndpointStatsBean row1 = new EndpointStatsBean();
1758:                    row1.setEndpointName("purchaseOrderService" + i
1759:                            + ",purchaseOrderPort" + i);
1760:                    row1.setReceivedDones("" + (++testCount));
1761:                    row1.setReceivedErrors("" + (++testCount));
1762:                    row1.setReceivedReplies("" + (++testCount));
1763:                    row1.setReceivedRequests("" + (++testCount));
1764:                    row1.setSentDones("" + (++testCount));
1765:                    row1.setSentErrors("" + (++testCount));
1766:                    row1.setSentReplies("" + (++testCount));
1767:                    row1.setSentRequests("" + (++testCount));
1768:
1769:                    aList.add(row1);
1770:                }
1771:            }
1772:
1773:            /**
1774:             * Default table width
1775:             */
1776:            private static final String DEFAULT_TABLE_WIDTH = "55";
1777:
1778:            /**
1779:             * Default text columns
1780:             */
1781:            private static final int DEFAULT_TEXT_COLUMNS = 55;
1782:
1783:            /**
1784:             * Set up a flag for cluster profile support.
1785:             */
1786:            private static final boolean IS_CLUSTER_PROFILE = ClusterUtilities
1787:                    .isClusterProfile();
1788:
1789:            /**
1790:             * Set up the <code>com.sun.jbi.jsf</code> subcomponent logger.
1791:             */
1792:            private static Logger sLog = JBILogger.getInstance();
1793:
1794:            /*
1795:             *  used to filter data for table groups
1796:             */
1797:            private static final String SELECT_CONSUMING = "CONSUMING";
1798:            private static final String SELECT_PROVIDING = "PROVIDING";
1799:            private static final String SELECT_TOTALS = "TOTALS";
1800:
1801:            private static final String PROP_PREFIX = "prop";
1802:
1803:            private static final String FIELD_REQUIRED = "required";
1804:            private static final String HELP_INLINE_TYPE_FIELD = "field";
1805:            private static final int INDEX_EXPR = 1;
1806:            private static final int INDEX_HEADING = 1;
1807:            private static final int INDEX_ID = 0;
1808:            private static final boolean IS_NOT_SUBMIT_FORM = false;
1809:
1810:            /**
1811:             * prevents instantiation
1812:             */
1813:            private JSFUtils() {
1814:            }
1815:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.