Source Code Cross Referenced for OperationHandlers.java in  » ESB » open-esb » com » sun » jbi » jsf » handlers » 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.handlers 
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-2007 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:        package com.sun.jbi.jsf.handlers;
0038:
0039:        import com.sun.data.provider.impl.ObjectListDataProvider;
0040:        import com.sun.data.provider.FieldKey;
0041:        import com.sun.data.provider.RowKey;
0042:        import com.sun.enterprise.tools.admingui.util.GuiUtil;
0043:        import com.sun.jbi.jsf.bean.ListBean;
0044:        import com.sun.jbi.jsf.bean.ShowBean;
0045:        import com.sun.jbi.jsf.bean.OperationBean;
0046:        import com.sun.jbi.jsf.bean.AlertBean; //import com.sun.jbi.jsf.configuration.beans.ConfigurationBean;
0047:        import com.sun.jbi.jsf.util.AlertUtilities;
0048:        import com.sun.jbi.jsf.util.BeanUtilities;
0049:        import com.sun.jbi.jsf.util.ClusterUtilities;
0050:        import com.sun.jbi.jsf.util.I18nUtilities;
0051:        import com.sun.jbi.jsf.util.JBIConstants;
0052:        import com.sun.jbi.jsf.util.JBILogger;
0053:        import com.sun.jbi.jsf.util.SharedConstants;
0054:        import com.sun.jbi.jsf.util.SystemLoggerUtilities;
0055:        import com.sun.jbi.jsf.util.TableUtilities;
0056:        import com.sun.jbi.ui.common.JBIAdminCommands;
0057:        import com.sun.jbi.ui.common.JBIComponentInfo;
0058:        import com.sun.jbi.ui.common.ServiceAssemblyInfo;
0059:        import com.sun.jbi.ui.common.JBIManagementMessage;
0060:        import com.sun.jsftemplating.annotation.Handler;
0061:        import com.sun.jsftemplating.annotation.HandlerInput;
0062:        import com.sun.jsftemplating.annotation.HandlerOutput;
0063:        import com.sun.jsftemplating.layout.descriptors.handler.HandlerContext;
0064:        import com.sun.webui.jsf.component.TableRowGroup;
0065:        import com.sun.webui.jsf.component.TextField;
0066:        import com.sun.webui.jsf.component.Checkbox;
0067:
0068:        import java.util.ArrayList;
0069:        import java.util.Iterator;
0070:        import java.util.List;
0071:        import java.util.Map;
0072:        import java.util.Properties;
0073:        import java.util.logging.Logger;
0074:        import java.util.logging.Level;
0075:
0076:        import javax.el.ELContext;
0077:        import javax.el.MethodExpression;
0078:        import javax.faces.application.FacesMessage;
0079:        import javax.faces.component.UIComponent;
0080:        import javax.faces.context.FacesContext;
0081:
0082:        /**
0083:         * Provides jsftemplating handlers for table actions on selected rows,
0084:         * such as JBI LifeCycle operations (start, stop, shut down), undeployment, or uninstallation.
0085:         */
0086:        public class OperationHandlers {
0087:            private static Logger sLog = JBILogger.getInstance();
0088:            private static String BREAK = "<br />";
0089:            private static String NEWLINE = "\r";
0090:
0091:            /**
0092:             * <p> Enables (starts) or Disables (stops, then shuts down) each selected Component or Deployment row.
0093:             * <p> Input  value: "tableRowGroup" -- Type: <code> com.sun.webui.jsf.component.TableRowGroup</code></p>
0094:             * <p> Input  value: "tableType" -- Type: <code> java.lang.String</code>
0095:             * Valid types: 'deployments' or 'bindingsEngines' (Note: 'libraries' do not have LifeCycles)
0096:             * <p> Input  value: "isEnabled" -- Type: <code> java.lang.Boolean</code>
0097:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
0098:             */
0099:            @Handler(id="jbiSetEnablementForSelectedRows",input={@HandlerInput(name="tableRowGroup",type=TableRowGroup.class,required=true),@HandlerInput(name="tableType",type=String.class,required=true),@HandlerInput(name="isEnabled",type=Boolean.class,required=true)},output={@HandlerOutput(name="isAlertNeeded",type=Boolean.class),@HandlerOutput(name="alertSummary",type=String.class),@HandlerOutput(name="alertDetails",type=String.class)})
0100:            public static void jbiSetEnablementForSelectectedRows(
0101:                    HandlerContext handlerCtx) {
0102:                String alertType = "";
0103:                String alertDetails = "";
0104:                String alertSummary = "";
0105:                String internalError = "";
0106:                String successResult = "";
0107:                String failureResult = "";
0108:                String warningResult = "";
0109:
0110:                int countSuccessfulOperations = 0;
0111:                int countFailedOperations = 0;
0112:                int countWarningOperations = 0;
0113:
0114:                boolean warningFlag = false;
0115:                boolean failureFlag = false;
0116:                boolean internalErrorFlag = false;
0117:                boolean isAlertNeeded = false;
0118:
0119:                Properties rowProperties = new Properties();
0120:
0121:                TableRowGroup trg = (TableRowGroup) handlerCtx
0122:                        .getInputValue("tableRowGroup");
0123:                String tableType = (String) handlerCtx
0124:                        .getInputValue("tableType");
0125:                Boolean isEnabled = (Boolean) handlerCtx
0126:                        .getInputValue("isEnabled");
0127:
0128:                sLog
0129:                        .fine("OperationHandlers.jbiSetEnablementForSelectedRows(...)"
0130:                                + ", tableType="
0131:                                + tableType
0132:                                + ", isEnabled="
0133:                                + isEnabled);
0134:
0135:                List componentOrDeploymentRows = getSelectedComponentOrDeploymentRowProperties(trg);
0136:                Iterator rowIt = componentOrDeploymentRows.iterator();
0137:                while (rowIt.hasNext()) {
0138:                    rowProperties = (Properties) rowIt.next();
0139:                    sLog
0140:                            .fine("OperationHandlers.jbiSetEnablementForSelectedRows(...), rowProperties="
0141:                                    + rowProperties);
0142:                    String rowName = rowProperties
0143:                            .getProperty(SharedConstants.KEY_NAME);
0144:                    String rowType = rowProperties
0145:                            .getProperty(SharedConstants.KEY_TYPE);
0146:
0147:                    List targets = ClusterUtilities.findTargetsForNameByType(
0148:                            rowName, rowType);
0149:
0150:                    sLog
0151:                            .fine("OperationHandlers.jbiSetEnablementForSelectedRows(...)"
0152:                                    + ", rowName="
0153:                                    + rowName
0154:                                    + ", targets="
0155:                                    + targets);
0156:
0157:                    // If a target is not associated with this component or service assembly
0158:                    // then we need to add an error message to the alerts.
0159:                    if (targets.size() == 0) {
0160:                        String typeText = "";
0161:                        if (SharedConstants.COMPONENT_TABLE_TYPE
0162:                                .equals(tableType)) {
0163:                            typeText = I18nUtilities
0164:                                    .getResourceString("jbi.failed.no.target.component");
0165:                        } else {
0166:                            typeText = I18nUtilities
0167:                                    .getResourceString("jbi.failed.no.target.deployment");
0168:                        }
0169:                        failureFlag = true;
0170:                        ++countFailedOperations;
0171:
0172:                        Object[] args = { typeText, rowName };
0173:                        failureResult = GuiUtil.getMessage(I18nUtilities
0174:                                .getResourceString("jbi.failed.no.target"),
0175:                                args);
0176:                        alertDetails += failureResult + BREAK;
0177:                    }
0178:
0179:                    else {
0180:                        // If Enabling the component/deployment in the row
0181:                        if (isEnabled) {
0182:                            rowProperties = start(rowProperties, targets);
0183:                        }
0184:
0185:                        // If Disabling the component/deployment in the row
0186:                        else {
0187:                            rowProperties = shutDown(rowProperties, targets);
0188:                        }
0189:
0190:                        successResult = rowProperties
0191:                                .getProperty(SharedConstants.SUCCESS_RESULT);
0192:                        internalError = rowProperties
0193:                                .getProperty(SharedConstants.INTERNAL_ERROR);
0194:                        warningResult = rowProperties
0195:                                .getProperty(SharedConstants.WARNING_RESULT);
0196:
0197:                        if (null != internalError) {
0198:                            internalErrorFlag = true;
0199:                            break;
0200:                        }
0201:
0202:                        if (null != successResult) {
0203:                            ++countSuccessfulOperations;
0204:                        } else {
0205:                            failureFlag = true;
0206:                            ++countFailedOperations;
0207:                            failureResult = rowProperties
0208:                                    .getProperty(SharedConstants.FAILURE_RESULT);
0209:                            alertDetails += failureResult + BREAK;
0210:                        }
0211:
0212:                        if (null != warningResult) {
0213:                            warningFlag = true;
0214:                            ++countWarningOperations;
0215:                            warningResult = rowProperties
0216:                                    .getProperty(SharedConstants.WARNING_RESULT);
0217:                            alertDetails += warningResult + BREAK;
0218:                        }
0219:                    }
0220:                }
0221:
0222:                // Display the alert message if a failure was encountered
0223:                if (failureFlag || internalErrorFlag) {
0224:                    isAlertNeeded = true;
0225:                    if (isEnabled) {
0226:                        if (SharedConstants.COMPONENT_TABLE_TYPE
0227:                                .equalsIgnoreCase(tableType)) {
0228:                            alertSummary = I18nUtilities
0229:                                    .getResourceString("jbi.enable.component.error.summary");
0230:                        } else {
0231:                            alertSummary = I18nUtilities
0232:                                    .getResourceString("jbi.enable.deployment.error.summary");
0233:                        }
0234:                    }
0235:
0236:                    else {
0237:                        if (SharedConstants.COMPONENT_TABLE_TYPE
0238:                                .equalsIgnoreCase(tableType)) {
0239:                            alertSummary = I18nUtilities
0240:                                    .getResourceString("jbi.disable.component.error.summary");
0241:                        } else {
0242:                            alertSummary = I18nUtilities
0243:                                    .getResourceString("jbi.disable.deployment.error.summary");
0244:                        }
0245:                    }
0246:                    alertType = "error";
0247:                    alertDetails = BeanUtilities
0248:                            .addAlertFooterMessage(alertDetails);
0249:                }
0250:
0251:                else if (warningFlag) {
0252:                    isAlertNeeded = true;
0253:                    alertType = "warning";
0254:                    alertSummary = rowProperties
0255:                            .getProperty(SharedConstants.WARNING_SUMMARY);
0256:                    alertDetails = BeanUtilities
0257:                            .addAlertFooterMessage(alertDetails);
0258:                }
0259:
0260:                // Set the alert type
0261:                AlertBean alertBean = BeanUtilities.getAlertBean();
0262:                alertBean.setAlertType(alertType);
0263:
0264:                sLog
0265:                        .fine("OperationHandlers.jbiSetEnablementForSelectedRows(...), "
0266:                                + " isAlertNeeded="
0267:                                + isAlertNeeded
0268:                                + ", alertSummary="
0269:                                + alertSummary
0270:                                + ", alertDetails=" + alertDetails);
0271:
0272:                handlerCtx.setOutputValue("isAlertNeeded", Boolean
0273:                        .toString(isAlertNeeded));
0274:                handlerCtx.setOutputValue("alertSummary", alertSummary);
0275:                handlerCtx.setOutputValue("alertDetails", alertDetails);
0276:            }
0277:
0278:            /**
0279:             * <p> Delegates JBI LifeCycle operation requests (start, stop, or shut down) for each selected
0280:             * Component or Deployment row.
0281:             * <p> Input  value: "tableRowGroup" -- Type: <code> com.sun.webui.jsf.component.TableRowGroup</code></p>
0282:             * <p> Input  value: "tableType" -- Type: <code> java.lang.String</code>
0283:             * Valid types: 'deployments' or 'bindingsEngines' (Note: 'libraries' do not have LifeCycles)
0284:             * <p> Input  value: "operation" -- Type: <code> java.lang.String</code>
0285:             * Valid operations: 'start,' 'stop,' or 'shutDown.'
0286:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
0287:             */
0288:            @Handler(id="jbiOperateSelectedComponentOrDeploymentRows",input={@HandlerInput(name="tableRowGroup",type=TableRowGroup.class,required=true),@HandlerInput(name="tableType",type=String.class,required=true),@HandlerInput(name="operation",type=String.class,required=true)},output={@HandlerOutput(name="isAlertNeeded",type=Boolean.class),@HandlerOutput(name="alertSummary",type=String.class),@HandlerOutput(name="alertDetails",type=String.class)})
0289:            public static void jbiOperateSelectedComponentOrDeploymentRows(
0290:                    HandlerContext handlerCtx) {
0291:                TableRowGroup trg = (TableRowGroup) handlerCtx
0292:                        .getInputValue("tableRowGroup");
0293:                String tableType = (String) handlerCtx
0294:                        .getInputValue("tableType");
0295:                String operation = (String) handlerCtx
0296:                        .getInputValue("operation");
0297:
0298:                sLog.fine("OperationHandlers.jbiOperateSelectedRows(...) trg="
0299:                        + trg + ", tableType=" + tableType + ", operation="
0300:                        + operation);
0301:
0302:                List targets = new ArrayList();
0303:                Properties targetProperties = new Properties();
0304:                targetProperties.setProperty(SharedConstants.KEY_NAME,
0305:                        JBIAdminCommands.SERVER_TARGET_KEY);
0306:                targets.add(targetProperties);
0307:
0308:                List componentOrDeploymentRows = getSelectedComponentOrDeploymentRowProperties(trg);
0309:                Iterator rowIt = componentOrDeploymentRows.iterator();
0310:
0311:                int countFailedOperations = 0;
0312:                int countSuccessfulOperations = 0;
0313:
0314:                String alertDetails = "";
0315:
0316:                while (rowIt.hasNext()) {
0317:                    Properties rowProperties = (Properties) rowIt.next();
0318:
0319:                    if (OperationBean.OPERATION_START.equals(operation)) {
0320:                        rowProperties = start(rowProperties, targets);
0321:                    } else if (OperationBean.OPERATION_STOP.equals(operation)) {
0322:                        rowProperties = stop(rowProperties, targets);
0323:                    } else if (OperationBean.OPERATION_SHUT_DOWN
0324:                            .equals(operation)) {
0325:                        rowProperties = shutDown(rowProperties, targets);
0326:                    } else {
0327:                        String error = "internal error detected in OperationHandlers.jbiOperateSelectedRows, invalud operation="
0328:                                + operation;
0329:                        sLog
0330:                                .fine("OperationHandlers.jbiOperateSelectedRows(...) error="
0331:                                        + error);
0332:                        rowProperties.setProperty("failure-result", error);
0333:                    }
0334:
0335:                    String failureResult = rowProperties
0336:                            .getProperty(SharedConstants.FAILURE_RESULT);
0337:                    String successResult = rowProperties
0338:                            .getProperty(SharedConstants.SUCCESS_RESULT);
0339:
0340:                    if ((null == failureResult) && (null != successResult)) {
0341:                        ++countSuccessfulOperations; // full or "partial" success 
0342:                        sLog
0343:                                .fine("OperationHandlers.jbiOperateSelectedRows(...), "
0344:                                        + " success for rowProperties="
0345:                                        + rowProperties
0346:                                        + ", countFailedOperations="
0347:                                        + countFailedOperations
0348:                                        + ", countSuccessfulOperations="
0349:                                        + countSuccessfulOperations);
0350:
0351:                        // since a partial success appears as a success, but with one or more task-result=FAILED, 
0352:                        // need to handle those as warnings below
0353:                        String exceptionMessage = AlertUtilities
0354:                                .getMessage(successResult);
0355:                        if (!"".equals(exceptionMessage)) {
0356:                            failureResult = successResult; // "partial" success, handle failures below
0357:                        }
0358:
0359:                    }
0360:
0361:                    if (null != failureResult) {
0362:                        ++countFailedOperations;
0363:                        sLog
0364:                                .fine("OperationHandlers.jbiOperateSelectedRows(...), "
0365:                                        + " failure for rowProperties="
0366:                                        + rowProperties
0367:                                        + ", countFailedOperations="
0368:                                        + countFailedOperations
0369:                                        + ", countSuccessfulOperations="
0370:                                        + countSuccessfulOperations);
0371:
0372:                        String name = (String) rowProperties
0373:                                .getProperty("name");
0374:
0375:                        String details = "";
0376:                        String exceptionMessage = AlertUtilities
0377:                                .getMessage(failureResult);
0378:                        if ("".equals(exceptionMessage)) {
0379:                            details = failureResult;
0380:                        } else {
0381:                            details = exceptionMessage;
0382:                        }
0383:                        Object[] args = { name, operation, details };
0384:                        String alertDet = GuiUtil.getMessage(I18nUtilities
0385:                                .getResourceString("jbi.operation.failed"),
0386:                                args);
0387:                        alertDetails += alertDet + BREAK;
0388:                    }
0389:                }
0390:
0391:                String alertSummary = "";
0392:                if (0 < countFailedOperations) {
0393:                    if (0 < countSuccessfulOperations) {
0394:                        if (1 == countFailedOperations) {
0395:                            alertSummary = I18nUtilities
0396:                                    .getResourceString("jbi.operations.one.failed.alert.summary.text");
0397:                        } else {
0398:                            alertSummary = I18nUtilities
0399:                                    .getResourceString("jbi.operations.some.failed.alert.summary.text");
0400:                        }
0401:                    } else {
0402:                        alertSummary = I18nUtilities
0403:                                .getResourceString("jbi.operations.all.failed.alert.summary.text");
0404:                    }
0405:                    alertDetails = BeanUtilities
0406:                            .addAlertFooterMessage(alertDetails);
0407:                }
0408:
0409:                boolean isAlertNeeded = (0 < countFailedOperations);
0410:                handlerCtx.setOutputValue("isAlertNeeded", Boolean
0411:                        .toString(isAlertNeeded));
0412:                handlerCtx.setOutputValue("alertSummary", alertSummary);
0413:                handlerCtx.setOutputValue("alertDetails", alertDetails);
0414:
0415:                sLog
0416:                        .fine("OperationHandlers.jbiOperateSelectedComponentOrDeploymentRows(...), "
0417:                                + " isAlertNeeded="
0418:                                + isAlertNeeded
0419:                                + ", alertSummary="
0420:                                + alertSummary
0421:                                + ", alertDetails=" + alertDetails);
0422:            }
0423:
0424:            /**
0425:             * <p> Delegates JBI LifeCycle operation requests (start, stop, or shut down) for each selected Target row.
0426:             * <p> Input  value: "tableRowGroup" -- Type: <code> com.sun.webui.jsf.component.TableRowGroup</code></p>
0427:             * <p> Input  value: "targetName" -- Type: <code> java.lang.String</code>
0428:             * <p> Input  value: "operation" -- Type: <code> java.lang.String</code>
0429:             * Valid operations: 'start,' 'stop,' or 'shutDown.'
0430:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
0431:             */
0432:            @Handler(id="jbiOperateSelectedSingleTargetRows",input={@HandlerInput(name="tableRowGroup",type=TableRowGroup.class,required=true),@HandlerInput(name="targetName",type=String.class,required=true),@HandlerInput(name="operation",type=String.class,required=true),@HandlerInput(name="componentOrDeploymentType",type=String.class,required=true)},output={@HandlerOutput(name="isAlertNeeded",type=Boolean.class),@HandlerOutput(name="alertSummary",type=String.class),@HandlerOutput(name="alertDetails",type=String.class)})
0433:            public static void jbiOperateSelectedSingleTargetRows(
0434:                    HandlerContext handlerCtx) {
0435:                TableRowGroup trg = (TableRowGroup) handlerCtx
0436:                        .getInputValue("tableRowGroup");
0437:                String targetName = (String) handlerCtx
0438:                        .getInputValue("targetName");
0439:                String operation = (String) handlerCtx
0440:                        .getInputValue("operation");
0441:                String componentOrDeploymentType = (String) handlerCtx
0442:                        .getInputValue("componentOrDeploymentType");
0443:
0444:                sLog
0445:                        .fine("OperationHandlers.jbiOperateSelectedSingleTargetRows(...), trg="
0446:                                + trg
0447:                                + ", targetName="
0448:                                + targetName
0449:                                + ", operation="
0450:                                + operation
0451:                                + ", componentOrDeploymentType="
0452:                                + componentOrDeploymentType);
0453:
0454:                List targetRows = TableUtilities.getSelectedRowProperties(trg);
0455:
0456:                boolean failureFlag = false;
0457:                boolean isAlertNeeded = false;
0458:                String alertSummary = "";
0459:                String alertDetails = "";
0460:                String successResult = "";
0461:                String failureResult = "";
0462:
0463:                int countSuccessfulOperations = 0;
0464:                int countFailedOperations = 0;
0465:
0466:                if (0 < targetRows.size()) {
0467:                    Properties singleTargetProperties = new Properties();
0468:                    singleTargetProperties.setProperty(
0469:                            SharedConstants.KEY_NAME, targetName);
0470:
0471:                    List singleTargetList = new ArrayList();
0472:                    singleTargetList.add(singleTargetProperties);
0473:
0474:                    Iterator rows = targetRows.iterator();
0475:                    while (rows.hasNext()) {
0476:                        Properties compOrSaRow = (Properties) rows.next();
0477:
0478:                        if (OperationBean.OPERATION_START.equals(operation)) {
0479:                            compOrSaRow = start(compOrSaRow, singleTargetList);
0480:                        } else if (OperationBean.OPERATION_SHUT_DOWN
0481:                                .equals(operation)) {
0482:                            //compOrSaRow = stop(compOrSaRow, singleTargetList); -- done by framework
0483:                            compOrSaRow = shutDown(compOrSaRow,
0484:                                    singleTargetList);
0485:                        } else {
0486:                            sLog
0487:                                    .fine("OperationHandlers.jbiOperateSelectedRows invalid operation="
0488:                                            + operation + " ignored");
0489:                        }
0490:
0491:                        successResult = compOrSaRow
0492:                                .getProperty(SharedConstants.SUCCESS_RESULT);
0493:                        if (null != successResult) {
0494:                            ++countSuccessfulOperations;
0495:                        } else {
0496:                            failureFlag = true;
0497:                            ++countFailedOperations;
0498:                            failureResult = compOrSaRow
0499:                                    .getProperty(SharedConstants.FAILURE_RESULT);
0500:                            alertDetails += failureResult + BREAK;
0501:                        }
0502:
0503:                        if (failureFlag) {
0504:                            isAlertNeeded = true;
0505:                            if (SharedConstants.COMPONENT_TABLE_TYPE
0506:                                    .equalsIgnoreCase(componentOrDeploymentType)) {
0507:                                alertSummary = I18nUtilities
0508:                                        .getResourceString("jbi.operation.component.error.summary");
0509:                            } else {
0510:                                alertSummary = I18nUtilities
0511:                                        .getResourceString("jbi.operation.deployment.error.summary");
0512:                            }
0513:                            alertDetails = BeanUtilities
0514:                                    .addAlertFooterMessage(alertDetails);
0515:                        }
0516:
0517:                        // TBD determine warning or failure setAlertType
0518:                        String alertType = "warning";
0519:                        AlertBean alertBean = BeanUtilities.getAlertBean();
0520:                        alertBean.setAlertType(alertType);
0521:                    }
0522:                } else {
0523:                    sLog
0524:                            .fine("OperationHandlers.jbiOperateSelectedRows nothing selected");
0525:                }
0526:
0527:                handlerCtx.setOutputValue("isAlertNeeded", Boolean
0528:                        .toString(isAlertNeeded));
0529:                handlerCtx.setOutputValue("alertSummary", alertSummary);
0530:                handlerCtx.setOutputValue("alertDetails", alertDetails);
0531:
0532:                sLog
0533:                        .fine("OperationHandlers.jbiOperateSelectedSingleTargetRows(...), "
0534:                                + " isAlertNeeded="
0535:                                + isAlertNeeded
0536:                                + ", alertSummary="
0537:                                + alertSummary
0538:                                + ", alertDetails=" + alertDetails);
0539:            }
0540:
0541:            /**
0542:             * <p> Delegates JBI LifeCycle operation requests (start, stop, or shut down) for each selected Target row.
0543:             * <p> Input  value: "tableRowGroup" -- Type: <code> com.sun.webui.jsf.component.TableRowGroup</code></p>
0544:             * <p> Input  value: "componentOrDeploymentType" -- Type: <code> java.lang.String</code>
0545:             * Valid types: 'deployments' or 'bindingsEngines' (Note: 'libraries' do not have LifeCycles)
0546:             * <p> Input  value: "componentOrDeploymentName" -- Type: <code> java.lang.String</code>
0547:             * <p> Input  value: "operation" -- Type: <code> java.lang.String</code>
0548:             * Valid operations: 'start,' 'stop,' or 'shutDown.'
0549:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
0550:             */
0551:            @Handler(id="jbiOperateSelectedTargetRows",input={@HandlerInput(name="tableRowGroup",type=TableRowGroup.class,required=true),@HandlerInput(name="componentOrDeploymentType",type=String.class,required=true),@HandlerInput(name="componentOrDeploymentName",type=String.class,required=true),@HandlerInput(name="operation",type=String.class,required=true)},output={@HandlerOutput(name="isAlertNeeded",type=Boolean.class),@HandlerOutput(name="alertSummary",type=String.class),@HandlerOutput(name="alertDetails",type=String.class)})
0552:            public static void jbiOperateSelectedTargetRows(
0553:                    HandlerContext handlerCtx) {
0554:                String alertType = "";
0555:                String alertDetails = "";
0556:                String alertSummary = "";
0557:                String successResult = "";
0558:                String failureResult = "";
0559:                String warningResult = "";
0560:
0561:                int countSuccessfulOperations = 0;
0562:                int countFailedOperations = 0;
0563:                int countWarningOperations = 0;
0564:
0565:                boolean warningFlag = false;
0566:                boolean failureFlag = false;
0567:                boolean isAlertNeeded = false;
0568:
0569:                Properties rowProperties = new Properties();
0570:
0571:                TableRowGroup trg = (TableRowGroup) handlerCtx
0572:                        .getInputValue("tableRowGroup");
0573:                String componentOrDeploymentType = (String) handlerCtx
0574:                        .getInputValue("componentOrDeploymentType");
0575:                String componentOrDeploymentName = (String) handlerCtx
0576:                        .getInputValue("componentOrDeploymentName");
0577:                String operation = (String) handlerCtx
0578:                        .getInputValue("operation");
0579:
0580:                sLog
0581:                        .fine("OperationHandlers.jbiOperateSelectedTargetRows(...), trg="
0582:                                + trg
0583:                                + ", componentOrDeploymentType="
0584:                                + componentOrDeploymentType
0585:                                + ", componentOrDeploymentName="
0586:                                + componentOrDeploymentName
0587:                                + ", operation="
0588:                                + operation);
0589:
0590:                List targetRows = getSelectedTargetRowProperties(trg);
0591:
0592:                if (0 < targetRows.size()) {
0593:                    rowProperties.setProperty(SharedConstants.KEY_TYPE,
0594:                            componentOrDeploymentType);
0595:                    rowProperties.setProperty(SharedConstants.KEY_NAME,
0596:                            componentOrDeploymentName);
0597:
0598:                    if (OperationBean.OPERATION_START.equals(operation)) {
0599:                        rowProperties = start(rowProperties, targetRows);
0600:                    } else if (OperationBean.OPERATION_STOP.equals(operation)) {
0601:                        rowProperties = stop(rowProperties, targetRows);
0602:                    } else if (OperationBean.OPERATION_SHUT_DOWN
0603:                            .equals(operation)) {
0604:                        rowProperties = shutDown(rowProperties, targetRows);
0605:                    } else {
0606:                        sLog
0607:                                .fine("OperationHandlers.jbiOperateSelectedRows invalid operation="
0608:                                        + operation + " ignored");
0609:                    }
0610:
0611:                    successResult = rowProperties
0612:                            .getProperty(SharedConstants.SUCCESS_RESULT);
0613:                    warningResult = rowProperties
0614:                            .getProperty(SharedConstants.WARNING_RESULT);
0615:
0616:                    if (null != successResult) {
0617:                        ++countSuccessfulOperations;
0618:                    } else {
0619:                        failureFlag = true;
0620:                        ++countFailedOperations;
0621:                        failureResult = rowProperties
0622:                                .getProperty(SharedConstants.FAILURE_RESULT);
0623:                        alertDetails += failureResult + BREAK;
0624:                    }
0625:
0626:                    if (null != warningResult) {
0627:                        warningFlag = true;
0628:                        ++countWarningOperations;
0629:                        warningResult = rowProperties
0630:                                .getProperty(SharedConstants.WARNING_RESULT);
0631:                        alertDetails += warningResult + BREAK;
0632:                    }
0633:                } else {
0634:                    sLog
0635:                            .fine("OperationHandlers.jbiOperateSelectedRows nothing selected");
0636:                }
0637:
0638:                if (failureFlag) {
0639:                    isAlertNeeded = true;
0640:                    if (SharedConstants.COMPONENT_TABLE_TYPE
0641:                            .equalsIgnoreCase(componentOrDeploymentType)) {
0642:                        alertSummary = I18nUtilities
0643:                                .getResourceString("jbi.operation.component.error.summary");
0644:                    } else {
0645:                        alertSummary = I18nUtilities
0646:                                .getResourceString("jbi.operation.deployment.error.summary");
0647:                    }
0648:                    alertDetails = BeanUtilities
0649:                            .addAlertFooterMessage(alertDetails);
0650:                }
0651:
0652:                else if (warningFlag) {
0653:                    isAlertNeeded = true;
0654:                    alertType = "warning";
0655:                    alertSummary = rowProperties
0656:                            .getProperty(SharedConstants.WARNING_SUMMARY);
0657:                    alertDetails = BeanUtilities
0658:                            .addAlertFooterMessage(alertDetails);
0659:                }
0660:
0661:                // Set the alert type
0662:                AlertBean alertBean = BeanUtilities.getAlertBean();
0663:                alertBean.setAlertType(alertType);
0664:
0665:                sLog
0666:                        .fine("OperationHandlers.jbiOperateSelectedTargetRows(...), "
0667:                                + " isAlertNeeded="
0668:                                + isAlertNeeded
0669:                                + ", alertSummary="
0670:                                + alertSummary
0671:                                + ", alertDetails=" + alertDetails);
0672:
0673:                handlerCtx.setOutputValue("isAlertNeeded", Boolean
0674:                        .toString(isAlertNeeded));
0675:                handlerCtx.setOutputValue("alertSummary", alertSummary);
0676:                handlerCtx.setOutputValue("alertDetails", alertDetails);
0677:            }
0678:
0679:            /**
0680:             * Returns a list of component or deployment names and types for the selected rows.
0681:             * <p> Will set the filter type in the ListBean.
0682:             * <p> Input  value: "operation" -- Type: <code> java.lang.String</code>
0683:             * Valid operations: The filter type
0684:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
0685:             */
0686:            @Handler(id="filterTableType",input={@HandlerInput(name="operation",type=String.class,required=true)})
0687:            public static void filterTableType(HandlerContext handlerCtx) {
0688:                String operation = (String) handlerCtx
0689:                        .getInputValue("operation");
0690:                ListBean listBean = BeanUtilities.getListBean();
0691:                listBean.setFilterType(operation);
0692:            }
0693:
0694:            /**
0695:             * <p> Will set the filter type in the ListBean.
0696:             * <p> Input  value: "operation" -- Type: <code> java.lang.String</code>
0697:             * Valid operations: The filter type
0698:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
0699:             */
0700:            @Handler(id="jbiFilterTableComponentState",input={@HandlerInput(name="value",type=String.class,required=true),@HandlerInput(name="values",type=String.class,required=true)})
0701:            public static void jbiFilterTableComponentState(
0702:                    HandlerContext handlerCtx) {
0703:                String value = (String) handlerCtx.getInputValue("value");
0704:                String values = (String) handlerCtx.getInputValue("values");
0705:                ListBean listBean = BeanUtilities.getListBean();
0706:                listBean.setFilterComponentState(value, values);
0707:            }
0708:
0709:            /**
0710:             * <p> Will set the filter type in the ListBean.
0711:             * <p> Input  value: "operation" -- Type: <code> java.lang.String</code>
0712:             * Valid operations: The filter type
0713:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
0714:             */
0715:            @Handler(id="jbiFilterTableAssemblyState",input={@HandlerInput(name="value",type=String.class,required=true),@HandlerInput(name="values",type=String.class,required=true)})
0716:            public static void jbiFilterTableAssemblyState(
0717:                    HandlerContext handlerCtx) {
0718:                String value = (String) handlerCtx.getInputValue("value");
0719:                String values = (String) handlerCtx.getInputValue("values");
0720:                ListBean listBean = BeanUtilities.getListBean();
0721:                listBean.setFilterAssemblyState(value, values);
0722:            }
0723:
0724:            /**
0725:             * <p> Will set the filter type in the ListBean.
0726:             * <p> Input  value: "operation" -- Type: <code> java.lang.String</code>
0727:             * Valid operations: The filter type
0728:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
0729:             */
0730:            @Handler(id="jbiFilterTargetTableComponentState",input={@HandlerInput(name="value",type=String.class,required=true),@HandlerInput(name="values",type=String.class,required=true)})
0731:            public static void jbiFilterTargetTableComponentState(
0732:                    HandlerContext handlerCtx) {
0733:                String value = (String) handlerCtx.getInputValue("value");
0734:                String values = (String) handlerCtx.getInputValue("values");
0735:                ShowBean showBean = BeanUtilities.getShowBean();
0736:                showBean.setFilterTargetComponentState(value, values);
0737:            }
0738:
0739:            /**
0740:             * <p> Will set the filter type in the ListBean.
0741:             * <p> Input  value: "operation" -- Type: <code> java.lang.String</code>
0742:             * Valid operations: The filter type
0743:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
0744:             */
0745:            @Handler(id="jbiFilterTargetTableAssemblyState",input={@HandlerInput(name="value",type=String.class,required=true),@HandlerInput(name="values",type=String.class,required=true)})
0746:            public static void jbiFilterTargetTableAssemblyState(
0747:                    HandlerContext handlerCtx) {
0748:                String value = (String) handlerCtx.getInputValue("value");
0749:                String values = (String) handlerCtx.getInputValue("values");
0750:                ShowBean showBean = BeanUtilities.getShowBean();
0751:                showBean.setFilterTargetAssemblyState(value, values);
0752:            }
0753:
0754:            /**
0755:             *  <p> This handler saves the values for all the attributes in the
0756:             *      Server Logging Levels Page.</p>
0757:             *  <p> Input value: "propertySheetParentId" -- Type: <code>java.lang.String</code></p>
0758:             *  <p> Input value: "propertySheetId" -- Type: <code>java.lang.String</code></p>
0759:             *  <p> Input value: "propertySheetSectionIdTag" -- Type: <code>java.lang.String</code></p>
0760:             *  <p> Input value: "propertySheetIdTag" -- Type: <code>java.lang.String</code></p>
0761:             *  <p> Input value: "propertyIdTag" -- Type: <code>java.lang.String</code></p>
0762:             *  <p> Input value: "hiddenFieldIdTag" -- Type: <code>java.lang.String</code></p>
0763:             *  <p> Input value: "componentName" -- Type: <code>java.lang.String</code></p>
0764:             *  <p> Input value: "targetName" -- Type: <code>java.lang.String</code></p>
0765:             *  <p> Input value: "instanceName" -- Type: <code>java.lang.String</code></p>
0766:             *  @param  context The HandlerContext.
0767:             */
0768:            @Handler(id="jbiSaveComponentLogLevels",input={@HandlerInput(name="propertySheetParentId",type=String.class,required=true),@HandlerInput(name="propertySheetId",type=String.class,required=true),@HandlerInput(name="propertySheetSectionIdTag",type=String.class,required=true),@HandlerInput(name="propertySheetIdTag",type=String.class,required=true),@HandlerInput(name="propertyIdTag",type=String.class,required=true),@HandlerInput(name="dropDownIdTag",type=String.class,required=true),@HandlerInput(name="hiddenFieldIdTag",type=String.class,required=true),@HandlerInput(name="componentName",type=String.class,required=true),@HandlerInput(name="targetName",type=String.class,required=true),@HandlerInput(name="instanceName",type=String.class,required=true)},output={@HandlerOutput(name="isAlertNeeded",type=Boolean.class),@HandlerOutput(name="alertSummary",type=String.class),@HandlerOutput(name="alertDetails",type=String.class)})
0769:            public static void jbiSaveComponentLogLevels(
0770:                    HandlerContext handlerCtx) {
0771:
0772:                String propertySheetParentId = (String) handlerCtx
0773:                        .getInputValue("propertySheetParentId");
0774:                String propertySheetId = (String) handlerCtx
0775:                        .getInputValue("propertySheetId");
0776:                String propertySheetSectionIdTag = (String) handlerCtx
0777:                        .getInputValue("propertySheetSectionIdTag");
0778:                String propertyIdTag = (String) handlerCtx
0779:                        .getInputValue("propertyIdTag");
0780:                String dropDownIdTag = (String) handlerCtx
0781:                        .getInputValue("dropDownIdTag");
0782:                String hiddenFieldIdTag = (String) handlerCtx
0783:                        .getInputValue("hiddenFieldIdTag");
0784:                String componentName = (String) handlerCtx
0785:                        .getInputValue("componentName");
0786:                String targetName = (String) handlerCtx
0787:                        .getInputValue("targetName");
0788:                String instanceName = (String) handlerCtx
0789:                        .getInputValue("instanceName");
0790:
0791:                String alertType = "";
0792:                String alertDetails = "";
0793:                String alertSummary = "";
0794:                boolean isAlertNeeded = true;
0795:
0796:                Properties result = jbiSetComponentLogLevels(
0797:                        propertySheetParentId, propertySheetId,
0798:                        propertySheetSectionIdTag, propertyIdTag,
0799:                        dropDownIdTag, hiddenFieldIdTag, componentName,
0800:                        targetName, instanceName, handlerCtx);
0801:
0802:                String failureResult = result
0803:                        .getProperty(SharedConstants.FAILURE_RESULT);
0804:                if ((null != failureResult) && (failureResult.length() > 0)) {
0805:                    alertType = "error";
0806:                    alertSummary = I18nUtilities
0807:                            .getResourceString("jbi.configure.loggers.failure.summary.message");
0808:                    alertDetails = failureResult;
0809:                } else {
0810:                    alertType = "success";
0811:                    alertSummary = I18nUtilities
0812:                            .getResourceString("jbi.configure.loggers.success.summary.message");
0813:                    alertDetails = "";
0814:                }
0815:
0816:                // Set the alert type
0817:                AlertBean alertBean = BeanUtilities.getAlertBean();
0818:                alertBean.setAlertType(alertType);
0819:
0820:                handlerCtx.setOutputValue("isAlertNeeded", isAlertNeeded);
0821:                handlerCtx.setOutputValue("alertSummary", alertSummary);
0822:                handlerCtx.setOutputValue("alertDetails", alertDetails);
0823:            }
0824:
0825:            /**
0826:             * Saves the log levels for the specified instance.  Called from cluster profile.
0827:             * <p> Will set the filter type in the ListBean.
0828:             * <p> Input  value: "operation" -- Type: <code> java.lang.String</code>
0829:             * Valid operations: The filter type
0830:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
0831:             */
0832:            @Handler(id="jbiSaveInstancesLogLevels",input={@HandlerInput(name="propertySheetParentId",type=String.class,required=true),@HandlerInput(name="propertySheetId",type=String.class,required=true),@HandlerInput(name="propertySheetSectionIdTag",type=String.class,required=true),@HandlerInput(name="propertyIdTag",type=String.class,required=true),@HandlerInput(name="dropDownIdTag",type=String.class,required=true),@HandlerInput(name="hiddenFieldIdTag",type=String.class,required=true),@HandlerInput(name="componentName",type=String.class,required=true),@HandlerInput(name="targetNames",type=String[].class,required=true),@HandlerInput(name="instanceNames",type=String[].class,required=true)},output={@HandlerOutput(name="isAlertNeeded",type=Boolean.class),@HandlerOutput(name="alertSummary",type=String.class),@HandlerOutput(name="alertDetails",type=String.class)})
0833:            public static void jbiSaveInstancesLogLevels(
0834:                    HandlerContext handlerCtx) {
0835:                String propertySheetParentId = (String) handlerCtx
0836:                        .getInputValue("propertySheetParentId");
0837:                String propertySheetId = (String) handlerCtx
0838:                        .getInputValue("propertySheetId");
0839:                String propertySheetSectionIdTag = (String) handlerCtx
0840:                        .getInputValue("propertySheetSectionIdTag");
0841:                String propertyIdTag = (String) handlerCtx
0842:                        .getInputValue("propertyIdTag");
0843:                String dropDownIdTag = (String) handlerCtx
0844:                        .getInputValue("dropDownIdTag");
0845:                String hiddenFieldIdTag = (String) handlerCtx
0846:                        .getInputValue("hiddenFieldIdTag");
0847:                String componentName = (String) handlerCtx
0848:                        .getInputValue("componentName");
0849:                String[] instanceNames = (String[]) handlerCtx
0850:                        .getInputValue("instanceNames");
0851:                String[] targetNames = (String[]) handlerCtx
0852:                        .getInputValue("targetNames");
0853:
0854:                String alertType = "";
0855:                String alertSummary = "";
0856:                String alertDetails = "";
0857:                String failureResult = "";
0858:                String failureResultDetails = "";
0859:
0860:                int countSuccessfulOperations = 0;
0861:                int countFailedOperations = 0;
0862:
0863:                boolean failureFlag = false;
0864:                boolean isAlertNeeded = true;
0865:
0866:                for (int i = 0; i < instanceNames.length; i++) {
0867:                    Properties result = jbiSetComponentLogLevels(
0868:                            propertySheetParentId, propertySheetId,
0869:                            propertySheetSectionIdTag, propertyIdTag,
0870:                            dropDownIdTag, hiddenFieldIdTag, componentName,
0871:                            targetNames[i], instanceNames[i], handlerCtx);
0872:
0873:                    failureResult = result
0874:                            .getProperty(SharedConstants.FAILURE_RESULT);
0875:                    if ((null != failureResult) && (failureResult.length() > 0)) {
0876:                        failureFlag = true;
0877:                        ++countFailedOperations;
0878:                        failureResultDetails += failureResult + BREAK;
0879:                    }
0880:                }
0881:
0882:                // Set the result type based on the failure and success flags.
0883:                if (failureFlag) {
0884:                    alertType = "error";
0885:                    alertSummary = I18nUtilities
0886:                            .getResourceString("jbi.configure.loggers.failure.summary.message");
0887:                    alertDetails = failureResultDetails;
0888:                } else {
0889:                    alertType = "success";
0890:                    alertSummary = I18nUtilities
0891:                            .getResourceString("jbi.configure.loggers.success.summary.message");
0892:                    alertDetails = "";
0893:                }
0894:
0895:                // Set the alert type
0896:                AlertBean alertBean = BeanUtilities.getAlertBean();
0897:                alertBean.setAlertType(alertType);
0898:
0899:                handlerCtx.setOutputValue("isAlertNeeded", isAlertNeeded);
0900:                handlerCtx.setOutputValue("alertSummary", alertSummary);
0901:                handlerCtx.setOutputValue("alertDetails", alertDetails);
0902:
0903:                // Update the Instances Update List so the selected values will still be selected.
0904:                ListBean listBean = BeanUtilities.getListBean();
0905:                listBean.setUpdateInstancesList(instanceNames);
0906:            }
0907:
0908:            /**
0909:             * Saves the log levels for the specified instance.  Called from cluster profile.
0910:             * <p> Will set the filter type in the ListBean.
0911:             * <p> Input  value: "operation" -- Type: <code> java.lang.String</code>
0912:             * Valid operations: The filter type
0913:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
0914:             */
0915:            @Handler(id="jbiSaveJBIRuntimeLogLevels",input={@HandlerInput(name="propertySheetParentId",type=String.class,required=true),@HandlerInput(name="propertySheetId",type=String.class,required=true),@HandlerInput(name="propertySheetSectionIdTag",type=String.class,required=true),@HandlerInput(name="propertyIdTag",type=String.class,required=true),@HandlerInput(name="dropDownIdTag",type=String.class,required=true),@HandlerInput(name="hiddenFieldIdTag",type=String.class,required=true),@HandlerInput(name="targetName",type=String.class,required=true),@HandlerInput(name="instanceName",type=String.class,required=true)},output={@HandlerOutput(name="isAlertNeeded",type=Boolean.class),@HandlerOutput(name="alertSummary",type=String.class),@HandlerOutput(name="alertDetails",type=String.class)})
0916:            public static void jbiSaveJBIRuntimeLogLevels(
0917:                    HandlerContext handlerCtx) {
0918:                String propertySheetParentId = (String) handlerCtx
0919:                        .getInputValue("propertySheetParentId");
0920:                String propertySheetId = (String) handlerCtx
0921:                        .getInputValue("propertySheetId");
0922:                String propertySheetSectionIdTag = (String) handlerCtx
0923:                        .getInputValue("propertySheetSectionIdTag");
0924:                String propertyIdTag = (String) handlerCtx
0925:                        .getInputValue("propertyIdTag");
0926:                String dropDownIdTag = (String) handlerCtx
0927:                        .getInputValue("dropDownIdTag");
0928:                String hiddenFieldIdTag = (String) handlerCtx
0929:                        .getInputValue("hiddenFieldIdTag");
0930:                String instanceName = (String) handlerCtx
0931:                        .getInputValue("instanceName");
0932:                String targetName = (String) handlerCtx
0933:                        .getInputValue("targetName");
0934:
0935:                String alertType = "";
0936:                String alertSummary = "";
0937:                String alertDetails = "";
0938:                String failureResult = "";
0939:                String failureResultDetails = "";
0940:
0941:                int countSuccessfulOperations = 0;
0942:                int countFailedOperations = 0;
0943:
0944:                boolean failureFlag = false;
0945:                boolean isAlertNeeded = true;
0946:
0947:                Properties result = jbiSetJBIRuntimeLogLevels(
0948:                        propertySheetParentId, propertySheetId,
0949:                        propertySheetSectionIdTag, propertyIdTag,
0950:                        dropDownIdTag, hiddenFieldIdTag, targetName,
0951:                        instanceName, handlerCtx);
0952:
0953:                failureResult = result
0954:                        .getProperty(SharedConstants.FAILURE_RESULT);
0955:                if ((null != failureResult) && (failureResult.length() > 0)) {
0956:                    failureFlag = true;
0957:                    ++countFailedOperations;
0958:                    failureResultDetails += failureResult + BREAK;
0959:                }
0960:
0961:                // Set the result type based on the failure and success flags.
0962:                if (failureFlag) {
0963:                    alertType = "error";
0964:                    alertSummary = I18nUtilities
0965:                            .getResourceString("jbi.runtime.loggers.failure.summary.message");
0966:                    alertDetails = failureResultDetails;
0967:                } else {
0968:                    alertType = "success";
0969:                    alertSummary = I18nUtilities
0970:                            .getResourceString("jbi.runtime.loggers.success.summary.message");
0971:                    alertDetails = "";
0972:                }
0973:
0974:                // Set the alert type
0975:                AlertBean alertBean = BeanUtilities.getAlertBean();
0976:                alertBean.setAlertType(alertType);
0977:
0978:                handlerCtx.setOutputValue("isAlertNeeded", isAlertNeeded);
0979:                handlerCtx.setOutputValue("alertSummary", alertSummary);
0980:                handlerCtx.setOutputValue("alertDetails", alertDetails);
0981:            }
0982:
0983:            /**
0984:             * Returns a list of component or deployment names and types for the selected rows.
0985:             * <p> Will set the filter type in the ListBean.
0986:             * <p> Input  instanceName:  -- Type: <code> java.lang.String</code>
0987:             * Valid operations: The filter type
0988:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
0989:             */
0990:            @Handler(id="jbiInitUpdateList",input={@HandlerInput(name="instanceName",type=String.class,required=true)})
0991:            public static void jbiInitUpdateList(HandlerContext handlerCtx) {
0992:
0993:                String value = (String) handlerCtx
0994:                        .getInputValue("instanceName");
0995:                String[] values = { value };
0996:                ListBean listBean = BeanUtilities.getListBean();
0997:                listBean.setUpdateInstancesList(values);
0998:            }
0999:
1000:            /**
1001:             * Will set the runtime configuration values for the specified target.
1002:             * <p> Input   target:  -- Type: <code> java.lang.String</code>
1003:             * <p> Input   msgSvcTimingStatisticsEnabled:  -- Type: <code> java.lang.String</code>
1004:             * <p> Input   heartBeatInterval:  -- Type: <code> java.lang.String</code>
1005:             * <p> Input   autoInstallEnabled:  -- Type: <code> java.lang.String</code>
1006:             * <p> Input   autoInstallDir:  -- Type: <code> java.lang.String</code>
1007:             * <p> Input   startOnVerify:  -- Type: <code> java.lang.String</code>
1008:             * <p> Input   startOnDeploy:  -- Type: <code> java.lang.String</code>
1009:             * <p> Input   installationTimeout:  -- Type: <code> java.lang.String</code>
1010:             * <p> Input   componentTimeout:  -- Type: <code> java.lang.String</code>
1011:             * <p> Input   serviceUnitTimeout:  -- Type: <code> java.lang.String</code>
1012:             * Valid operations: The filter type
1013:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
1014:             */
1015:            @Handler(id="jbiSetRuntimeConfigurationParameters",input={@HandlerInput(name="target",type=String.class,required=true),@HandlerInput(name="msgSvcTimingStatisticsEnabled",type=String.class,required=true),@HandlerInput(name="heartBeatInterval",type=String.class,required=true),@HandlerInput(name="autoInstallEnabled",type=String.class,required=true),@HandlerInput(name="startOnVerify",type=String.class,required=true),@HandlerInput(name="startOnDeploy",type=String.class,required=true),@HandlerInput(name="installationTimeout",type=String.class,required=true),@HandlerInput(name="componentTimeout",type=String.class,required=true),@HandlerInput(name="serviceUnitTimeout",type=String.class,required=true)})
1016:            public static void jbiSetRuntimeConfigurationParameters(
1017:                    HandlerContext handlerCtx) {
1018:                String alertType = "";
1019:                String alertSummary = "";
1020:                String alertDetails = "";
1021:
1022:                String target = (String) handlerCtx.getInputValue("target");
1023:                String msgSvcTimingStatisticsEnabled = (String) handlerCtx
1024:                        .getInputValue("msgSvcTimingStatisticsEnabled");
1025:                String heartBeatInterval = (String) handlerCtx
1026:                        .getInputValue("heartBeatInterval");
1027:                String autoInstallEnabled = (String) handlerCtx
1028:                        .getInputValue("autoInstallEnabled");
1029:                String startOnVerify = (String) handlerCtx
1030:                        .getInputValue("startOnVerify");
1031:                String startOnDeploy = (String) handlerCtx
1032:                        .getInputValue("startOnDeploy");
1033:                String installationTimeout = (String) handlerCtx
1034:                        .getInputValue("installationTimeout");
1035:                String componentTimeout = (String) handlerCtx
1036:                        .getInputValue("componentTimeout");
1037:                String serviceUnitTimeout = (String) handlerCtx
1038:                        .getInputValue("serviceUnitTimeout");
1039:
1040:                Properties configurationProperties = new Properties();
1041:
1042:                // note: these values have already been validated by the OperationBean
1043:                configurationProperties = setPropertyIfNotNull(
1044:                        configurationProperties,
1045:                        "msgSvcTimingStatisticsEnabled",
1046:                        msgSvcTimingStatisticsEnabled);
1047:                configurationProperties = setPropertyIfNotNull(
1048:                        configurationProperties, "heartBeatInterval",
1049:                        heartBeatInterval);
1050:                configurationProperties = setPropertyIfNotNull(
1051:                        configurationProperties, "autoInstallEnabled",
1052:                        autoInstallEnabled.toString());
1053:                configurationProperties = setPropertyIfNotNull(
1054:                        configurationProperties, "startOnVerify", startOnVerify
1055:                                .toString());
1056:                configurationProperties = setPropertyIfNotNull(
1057:                        configurationProperties, "startOnDeploy", startOnDeploy
1058:                                .toString());
1059:                configurationProperties = setPropertyIfNotNull(
1060:                        configurationProperties, "installationTimeout",
1061:                        installationTimeout);
1062:                configurationProperties = setPropertyIfNotNull(
1063:                        configurationProperties, "componentTimeout",
1064:                        componentTimeout);
1065:                configurationProperties = setPropertyIfNotNull(
1066:                        configurationProperties, "serviceUnitTimeout",
1067:                        serviceUnitTimeout);
1068:
1069:                Properties changedConfigurationProperties = findChangedRuntimeConfigurationProperties(
1070:                        target, configurationProperties);
1071:
1072:                JBIAdminCommands mJac = BeanUtilities.getClient();
1073:                try {
1074:                    boolean restartRequired = mJac.setRuntimeConfiguration(
1075:                            changedConfigurationProperties, target);
1076:                    sLog
1077:                            .fine("OperationHandlers.jbiSetRuntimeConfigurationParameters changedConfigurationProperties="
1078:                                    + changedConfigurationProperties
1079:                                    + ", target="
1080:                                    + target
1081:                                    + ", restartRequired=" + restartRequired);
1082:                    if (null != configurationProperties) {
1083:                        for (Object object : configurationProperties.keySet()) {
1084:                            String k = (String) object;
1085:                            String v = (String) configurationProperties
1086:                                    .getProperty(k);
1087:                            sLog
1088:                                    .fine("OperationHandlers.jbiSetRuntimeConfigurationParameters k="
1089:                                            + k + ", v=" + v);
1090:                        }
1091:                    }
1092:
1093:                    if (restartRequired) {
1094:                        alertType = "info";
1095:                        alertSummary = I18nUtilities
1096:                                .getResourceString("jbi.root.configuration.restart.required.summary");
1097:                        if (target.equalsIgnoreCase("domain")) {
1098:                            alertDetails = I18nUtilities
1099:                                    .getResourceString("jbi.root.configuration.restart.required.all.targets.details");
1100:                        } else {
1101:                            Object[] args = { target };
1102:                            alertDetails = GuiUtil
1103:                                    .getMessage(
1104:                                            I18nUtilities
1105:                                                    .getResourceString("jbi.root.configuration.restart.required.a.target.details"),
1106:                                            args);
1107:                        }
1108:                    } else {
1109:                        alertType = "success";
1110:                        alertSummary = I18nUtilities
1111:                                .getResourceString("jbi.configure.loggers.success.summary.message");
1112:                    }
1113:                } catch (com.sun.jbi.ui.common.JBIRemoteException jbiRemoteEx) {
1114:                    JBIManagementMessage mgmtMsg = null;
1115:                    mgmtMsg = BeanUtilities
1116:                            .extractJBIManagementMessage(jbiRemoteEx);
1117:                    alertType = "error";
1118:                    alertSummary = I18nUtilities
1119:                            .getResourceString("jbi.configure.runtime.alert.summary ");
1120:                    alertDetails = mgmtMsg.getMessage();
1121:                    alertDetails = BeanUtilities
1122:                            .addAlertFooterMessage(alertDetails);
1123:                }
1124:
1125:                AlertBean alertBean = BeanUtilities.getAlertBean();
1126:                alertBean.setAlertType(alertType);
1127:                alertBean.setAlertSummary(alertSummary);
1128:                alertBean.setAlertDetail(alertDetails);
1129:
1130:                sLog
1131:                        .fine("OperationHandler.jbiSetRuntimeConfigurationParameters, alertSummary="
1132:                                + alertSummary
1133:                                + ", alertDetails="
1134:                                + alertDetails);
1135:            }
1136:
1137:            /**
1138:             * Will retrieve the runtime configuration values for a given target.
1139:             * <p> Input  target:  -- Type: <code> java.lang.String</code>
1140:             * <p> Output  msgSvcTimingStatisticsEnabled:  -- Type: <code> java.lang.Boolean</code>
1141:             * <p> Output  heartBeatInterval:  -- Type: <code> java.lang.String</code>
1142:             * <p> Output  jbiHome:  -- Type: <code> java.lang.String</code>
1143:             * <p> Output  autoInstallEnabled:  -- Type: <code> java.lang.Boolean</code>
1144:             * <p> Output  autoInstallDir:  -- Type: <code> java.lang.String</code>
1145:             * <p> Output  startOnVerify:  -- Type: <code> java.lang.String</code>
1146:             * <p> Output  startOnDeploy:  -- Type: <code> java.lang.String</code>
1147:             * <p> Output  installationTimeout:  -- Type: <code> java.lang.String</code>
1148:             * <p> Output  componentTimeout:  -- Type: <code> java.lang.String</code>
1149:             * <p> Output  serviceUnitTimeout:  -- Type: <code> java.lang.String</code>
1150:             * Valid operations: The filter type
1151:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
1152:             */
1153:            @Handler(id="jbiGetRuntimeConfigurationParameters",input={@HandlerInput(name="target",type=String.class,required=true)},output={@HandlerOutput(name="msgSvcTimingStatisticsEnabled",type=Boolean.class),@HandlerOutput(name="heartBeatInterval",type=String.class),@HandlerOutput(name="jbiHome",type=String.class),@HandlerOutput(name="autoInstallEnabled",type=Boolean.class),@HandlerOutput(name="autoInstallDir",type=String.class),@HandlerOutput(name="startOnVerify",type=Boolean.class),@HandlerOutput(name="startOnDeploy",type=Boolean.class),@HandlerOutput(name="installationTimeout",type=String.class),@HandlerOutput(name="componentTimeout",type=String.class),@HandlerOutput(name="serviceUnitTimeout",type=String.class)})
1154:            public static void jbiGetRuntimeConfigurationParameters(
1155:                    HandlerContext handlerCtx) {
1156:                // Get all properties for the specified target
1157:                String target = (String) handlerCtx.getInputValue("target");
1158:
1159:                Properties properties = getCurrentRuntimeConfigurationProperties(target);
1160:                String jbiHome = properties.getProperty("jbiHome");
1161:                sLog
1162:                        .fine("OperationHandlers.jbiGetRuntimeConfigurationParameters("
1163:                                + target + ") target jbiHome=" + jbiHome);
1164:
1165:                // if jbiHome is not set, handle as a special case:
1166:                if ((null == jbiHome) || ("".equals(jbiHome))) {
1167:                    JBIAdminCommands mJac = BeanUtilities.getClient();
1168:
1169:                    try {
1170:                        Properties defaultProperties = null;
1171:                        // domain target does not provide a jbiHome, use the factory-default instead
1172:                        if (target.equalsIgnoreCase("domain")) {
1173:                            defaultProperties = mJac
1174:                                    .getDefaultRuntimeConfiguration();
1175:                            jbiHome = defaultProperties.getProperty("jbiHome");
1176:                            sLog
1177:                                    .fine("OperationHandlers.jbiGetRuntimeConfigurationParameters("
1178:                                            + target
1179:                                            + ") factory-default jbiHome="
1180:                                            + jbiHome);
1181:                        }
1182:                        // non-domain targets may not provide a jbiHome, use the domain-default instead
1183:                        else {
1184:                            defaultProperties = mJac
1185:                                    .getRuntimeConfiguration("domain");
1186:                            jbiHome = defaultProperties.getProperty("jbiHome");
1187:                            sLog
1188:                                    .fine("OperationHandlers.jbiGetRuntimeConfigurationParameters("
1189:                                            + target
1190:                                            + ") domain-default jbiHome="
1191:                                            + jbiHome);
1192:                        }
1193:                    } catch (com.sun.jbi.ui.common.JBIRemoteException jbiRemoteEx) {
1194:                        jbiRemoteEx.printStackTrace();
1195:                    }
1196:                }
1197:
1198:                handlerCtx.setOutputValue("heartBeatInterval", properties
1199:                        .getProperty("heartBeatInterval"));
1200:                handlerCtx
1201:                        .setOutputValue(
1202:                                "msgSvcTimingStatisticsEnabled",
1203:                                properties
1204:                                        .getProperty("msgSvcTimingStatisticsEnabled"));
1205:                handlerCtx.setOutputValue("jbiHome", properties
1206:                        .getProperty("jbiHome"));
1207:                handlerCtx.setOutputValue("autoInstallEnabled", properties
1208:                        .getProperty("autoInstallEnabled"));
1209:                handlerCtx.setOutputValue("autoInstallDir", properties
1210:                        .getProperty("autoInstallDir"));
1211:                handlerCtx.setOutputValue("startOnVerify", properties
1212:                        .getProperty("startOnVerify"));
1213:                handlerCtx.setOutputValue("startOnDeploy", properties
1214:                        .getProperty("startOnDeploy"));
1215:                handlerCtx.setOutputValue("installationTimeout", properties
1216:                        .getProperty("installationTimeout"));
1217:                handlerCtx.setOutputValue("componentTimeout", properties
1218:                        .getProperty("componentTimeout"));
1219:                handlerCtx.setOutputValue("serviceUnitTimeout", properties
1220:                        .getProperty("serviceUnitTimeout"));
1221:            }
1222:
1223:            /**
1224:             * Will retrieve the runtime configuration values for a given target.
1225:             * <p> Input  target:  -- Type: <code> java.lang.String</code>
1226:             * <p> Output  msgSvcTimingStatisticsEnabled:  -- Type: <code> java.lang.Boolean</code>
1227:             * <p> Output  heartBeatInterval:  -- Type: <code> java.lang.String</code>
1228:             * <p> Output  jbiHome:  -- Type: <code> java.lang.String</code>
1229:             * <p> Output  autoInstallEnabled:  -- Type: <code> java.lang.Boolean</code>
1230:             * <p> Output  autoInstallDir:  -- Type: <code> java.lang.String</code>
1231:             * <p> Output  startOnVerify:  -- Type: <code> java.lang.String</code>
1232:             * <p> Output  startOnDeploy:  -- Type: <code> java.lang.String</code>
1233:             * <p> Output  installationTimeout:  -- Type: <code> java.lang.String</code>
1234:             * <p> Output  componentTimeout:  -- Type: <code> java.lang.String</code>
1235:             * <p> Output  serviceUnitTimeout:  -- Type: <code> java.lang.String</code>
1236:             * Valid operations: The filter type
1237:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
1238:             */
1239:            @Handler(id="jbiGetRuntimeConfigurationDefaultParameters",input={@HandlerInput(name="target",type=String.class,required=true)},output={@HandlerOutput(name="msgSvcTimingStatisticsEnabled",type=Boolean.class),@HandlerOutput(name="heartBeatInterval",type=String.class),@HandlerOutput(name="jbiHome",type=String.class),@HandlerOutput(name="autoInstallEnabled",type=Boolean.class),@HandlerOutput(name="autoInstallDir",type=String.class),@HandlerOutput(name="startOnVerify",type=Boolean.class),@HandlerOutput(name="startOnDeploy",type=Boolean.class),@HandlerOutput(name="installationTimeout",type=String.class),@HandlerOutput(name="componentTimeout",type=String.class),@HandlerOutput(name="serviceUnitTimeout",type=String.class)})
1240:            public static void jbiGetRuntimeConfigurationDefaultParameters(
1241:                    HandlerContext handlerCtx) {
1242:                String target = (String) handlerCtx.getInputValue("target");
1243:
1244:                JBIAdminCommands mJac = BeanUtilities.getClient();
1245:                try {
1246:
1247:                    // A target of domain says we should retrieve the Factory Default values. This
1248:                    // is done by calling getDefaultRuntimeConfiguration.
1249:                    Properties properties = null;
1250:                    if (target.equalsIgnoreCase("domain")) {
1251:                        properties = mJac.getDefaultRuntimeConfiguration();
1252:                    }
1253:
1254:                    // If the target value is NOT domain, then we should retrieve the default
1255:                    // values that are set for the domain.  This is done by retrieving the
1256:                    // runtime configuration values using the domain as the target.
1257:                    else {
1258:                        properties = mJac.getRuntimeConfiguration("domain");
1259:                    }
1260:                    handlerCtx
1261:                            .setOutputValue(
1262:                                    "msgSvcTimingStatisticsEnabled",
1263:                                    properties
1264:                                            .getProperty("msgSvcTimingStatisticsEnabled"));
1265:                    handlerCtx.setOutputValue("heartBeatInterval", properties
1266:                            .getProperty("heartBeatInterval"));
1267:                    handlerCtx.setOutputValue("jbiHome", properties
1268:                            .getProperty("jbiHome"));
1269:                    handlerCtx.setOutputValue("autoInstallEnabled", properties
1270:                            .getProperty("autoInstallEnabled"));
1271:                    handlerCtx.setOutputValue("autoInstallDir", properties
1272:                            .getProperty("autoInstallDir"));
1273:                    handlerCtx.setOutputValue("startOnVerify", properties
1274:                            .getProperty("startOnVerify"));
1275:                    handlerCtx.setOutputValue("startOnDeploy", properties
1276:                            .getProperty("startOnDeploy"));
1277:                    handlerCtx.setOutputValue("installationTimeout", properties
1278:                            .getProperty("installationTimeout"));
1279:                    handlerCtx.setOutputValue("componentTimeout", properties
1280:                            .getProperty("componentTimeout"));
1281:                    handlerCtx.setOutputValue("serviceUnitTimeout", properties
1282:                            .getProperty("serviceUnitTimeout"));
1283:                } catch (com.sun.jbi.ui.common.JBIRemoteException jbiRemoteEx) {
1284:                    jbiRemoteEx.printStackTrace();
1285:                }
1286:            }
1287:
1288:            /**
1289:             * Returns a list of component or deployment names and types for the selected rows.
1290:             * <p> Will set the filter type in the ListBean.
1291:             * <p> Input  key:  -- Type: <code> java.lang.String</code>
1292:             * <p> Input  value:  -- Type: <code> java.lang.String</code>
1293:             * Valid operations: The filter type
1294:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
1295:             */
1296:            @Handler(id="jbiSetComponentConfigurationParameter",input={@HandlerInput(name="key",type=String.class,required=true),@HandlerInput(name="value",type=String.class,required=true)})
1297:            public static void jbiSetComponentConfigurationParameter(
1298:                    HandlerContext handlerCtx) {
1299:                String key = (String) handlerCtx.getInputValue("key");
1300:                String value = (String) handlerCtx.getInputValue("value");
1301:                //        ConfigurationBean configurationBean = BeanUtilities.getConfigurationBean();
1302:                //configurationBean.setParameterValue(key,value);
1303:            }
1304:
1305:            /**
1306:             * Returns a the total count of installed binding components.
1307:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
1308:             */
1309:            @Handler(id="jbiGetInstalledComponentCount",input={@HandlerInput(name="target",type=String.class,required=true)},output={@HandlerOutput(name="totalCount",type=String.class)})
1310:            public static void jbiGetInstalledComponentCount(
1311:                    HandlerContext handlerCtx) {
1312:                String target = (String) handlerCtx.getInputValue("target");
1313:                int totalCount = 0;
1314:                JBIAdminCommands mJac = BeanUtilities.getClient();
1315:
1316:                String result = "";
1317:                try {
1318:                    result = mJac.listBindingComponents(null, null, null,
1319:                            target);
1320:                    List list = JBIComponentInfo.readFromXmlText(result);
1321:                    totalCount = list.size();
1322:                    result = mJac.listServiceEngines(null, null, null, target);
1323:                    list = JBIComponentInfo.readFromXmlText(result);
1324:                    totalCount += list.size();
1325:                } catch (com.sun.jbi.ui.common.JBIRemoteException jbiRemoteEx) {
1326:                }
1327:                handlerCtx.setOutputValue("totalCount", totalCount);
1328:            }
1329:
1330:            /**
1331:             * Returns a the total count of installed binding components.
1332:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
1333:             */
1334:            @Handler(id="jbiGetInstalledBindingCount",input={@HandlerInput(name="target",type=String.class,required=true)},output={@HandlerOutput(name="totalCount",type=String.class)})
1335:            public static void jbiGetInstalledBindingCount(
1336:                    HandlerContext handlerCtx) {
1337:                String target = (String) handlerCtx.getInputValue("target");
1338:                int totalCount = 0;
1339:                JBIAdminCommands mJac = BeanUtilities.getClient();
1340:
1341:                String result = "";
1342:                try {
1343:                    result = mJac.listBindingComponents(null, null, null,
1344:                            target);
1345:                    List list = JBIComponentInfo.readFromXmlText(result);
1346:                    totalCount = list.size();
1347:                } catch (com.sun.jbi.ui.common.JBIRemoteException jbiRemoteEx) {
1348:                }
1349:                handlerCtx.setOutputValue("totalCount", totalCount);
1350:            }
1351:
1352:            /**
1353:             * Returns a the total count of installed binding components.
1354:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
1355:             */
1356:            @Handler(id="jbiGetInstalledEngineCount",input={@HandlerInput(name="target",type=String.class,required=true)},output={@HandlerOutput(name="totalCount",type=String.class)})
1357:            public static void jbiGetInstalledEngineCount(
1358:                    HandlerContext handlerCtx) {
1359:                String target = (String) handlerCtx.getInputValue("target");
1360:                int totalCount = 0;
1361:                JBIAdminCommands mJac = BeanUtilities.getClient();
1362:
1363:                String result = "";
1364:                try {
1365:                    result = mJac.listServiceEngines(null, null, null, target);
1366:                    List list = JBIComponentInfo.readFromXmlText(result);
1367:                    totalCount = list.size();
1368:                } catch (com.sun.jbi.ui.common.JBIRemoteException jbiRemoteEx) {
1369:                }
1370:                handlerCtx.setOutputValue("totalCount", totalCount);
1371:            }
1372:
1373:            /**
1374:             * Returns a the total count of installed binding components.
1375:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
1376:             */
1377:            @Handler(id="jbiGetInstalledSharedLibraryCount",input={@HandlerInput(name="target",type=String.class,required=true)},output={@HandlerOutput(name="totalCount",type=String.class)})
1378:            public static void jbiGetInstalledSharedLibraryCount(
1379:                    HandlerContext handlerCtx) {
1380:                String target = (String) handlerCtx.getInputValue("target");
1381:                int totalCount = 0;
1382:                JBIAdminCommands mJac = BeanUtilities.getClient();
1383:
1384:                String result = "";
1385:                try {
1386:                    result = mJac.listSharedLibraries(null, target);
1387:                    List list = JBIComponentInfo.readFromXmlText(result);
1388:                    totalCount = list.size();
1389:                } catch (com.sun.jbi.ui.common.JBIRemoteException jbiRemoteEx) {
1390:                }
1391:                handlerCtx.setOutputValue("totalCount", totalCount);
1392:            }
1393:
1394:            /**
1395:             * Returns a the total count of installed binding components.
1396:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
1397:             */
1398:            @Handler(id="jbiGetDeployedServiceAssemblyCount",input={@HandlerInput(name="target",type=String.class,required=true)},output={@HandlerOutput(name="totalCount",type=String.class)})
1399:            public static void jbiGetDeployedServiceAssemblyCount(
1400:                    HandlerContext handlerCtx) {
1401:                String target = (String) handlerCtx.getInputValue("target");
1402:                int totalCount = 0;
1403:                JBIAdminCommands mJac = BeanUtilities.getClient();
1404:
1405:                String result = "";
1406:                try {
1407:                    result = mJac.listServiceAssemblies(null, null, target);
1408:                    List list = ServiceAssemblyInfo
1409:                            .readFromXmlTextWithProlog(result);
1410:                    totalCount = list.size();
1411:                } catch (com.sun.jbi.ui.common.JBIRemoteException jbiRemoteEx) {
1412:                }
1413:                handlerCtx.setOutputValue("totalCount", totalCount);
1414:            }
1415:
1416:            /**
1417:             * Returns a the total count of installed binding components.
1418:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
1419:             */
1420:            @Handler(id="jbiGetSystemProperty",input={@HandlerInput(name="key",type=String.class,required=true)},output={@HandlerOutput(name="value",type=String.class)})
1421:            public static void jbiGetSystemProperty(HandlerContext handlerCtx) {
1422:                String key = (String) handlerCtx.getInputValue("key");
1423:                Properties pr = System.getProperties();
1424:                String value = pr.getProperty(key);
1425:                String newValue = "";
1426:                for (int i = 0; i < value.length(); i++) {
1427:                    if (value.charAt(i) == '\\') {
1428:                        newValue += "/";
1429:                    } else {
1430:                        newValue += value.charAt(i);
1431:                    }
1432:                }
1433:                handlerCtx.setOutputValue("value", newValue);
1434:            }
1435:
1436:            /**
1437:             * Presets a validation alert summary and clears details before a save.
1438:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
1439:             */
1440:            @Handler(id="jbiPresetValidationAlert")
1441:            public static void jbiPresetValidationAlert(
1442:                    HandlerContext handlerCtx) {
1443:                AlertBean alertBean = BeanUtilities.getAlertBean();
1444:                alertBean.setAlertType("error");
1445:                alertBean
1446:                        .setAlertSummary("Validation of required fields failed.");
1447:                alertBean.setAlertDetail(""); // must be empty, for revalidation to add only latest errors
1448:                sLog
1449:                        .fine("OperationHandlers.jbiPresetValidationAlert(), alert type="
1450:                                + alertBean.getAlertType()
1451:                                + ", alertSummary="
1452:                                + alertBean.getAlertSummary()
1453:                                + ", alertDetail=" + alertBean.getAlertDetail());
1454:            }
1455:
1456:            /**
1457:             * Sets a field validator for a textField and its JBI RT configuration property
1458:             * <p> Input  textField:  -- Type: <code>com.sun.webui.jsf.component.TextField</code>
1459:             * <p> Input  propertyName:  -- Type: <code>String</code>
1460:             * <p> Input  label:  -- Type: <code>String</code>
1461:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
1462:             */
1463:            @Handler(id="jbiSetFieldValidator",input={@HandlerInput(name="textField",type=com.sun.webui.jsf.component.TextField.class,required=true),@HandlerInput(name="propertyName",type=String.class,required=true),@HandlerInput(name="label",type=String.class,required=true)})
1464:            public static void jbiSetFieldValidator(HandlerContext handlerCtx) {
1465:                TextField textField = (TextField) handlerCtx
1466:                        .getInputValue("textField");
1467:                String propertyName = (String) handlerCtx
1468:                        .getInputValue("propertyName");
1469:                String label = (String) handlerCtx.getInputValue("label");
1470:                sLog.fine("OperationHandlers.jbiSetFieldValidator textField="
1471:                        + textField + ", propertyName=" + propertyName
1472:                        + ", label=" + label);
1473:
1474:                FacesContext facesContext = FacesContext.getCurrentInstance();
1475:                String textFieldId = textField.getClientId(facesContext);
1476:
1477:                // add UIComponent to propertyName mapping
1478:
1479:                // get map from session 
1480:                Map sessionMap = (Map) facesContext.getApplication()
1481:                        .createValueBinding("#{sessionScope}").getValue(
1482:                                facesContext);
1483:                sLog
1484:                        .finer("OperationHandlers.jbiSetFieldValidator before sessionMap="
1485:                                + sessionMap);
1486:
1487:                // add/replace map entry
1488:                sessionMap.put(textFieldId, propertyName);
1489:                sLog
1490:                        .fine("OperationHandlers.jbiSetFieldValidator updated mapping of textFieldId="
1491:                                + textFieldId
1492:                                + " to propertyName="
1493:                                + propertyName);
1494:
1495:                Properties alertPropertyLabels = (Properties) sessionMap
1496:                        .get("jbiAlertPropertyLabels");
1497:                if (null == alertPropertyLabels) {
1498:                    alertPropertyLabels = new Properties();
1499:                }
1500:                alertPropertyLabels.put(propertyName, label);
1501:                sessionMap.put("jbiAlertPropertyLabels", alertPropertyLabels);
1502:
1503:                // add validator to field
1504:                ELContext elcontext = facesContext.getELContext();
1505:                MethodExpression methodExpression = facesContext
1506:                        .getApplication().getExpressionFactory()
1507:                        .createMethodExpression(
1508:                                elcontext,
1509:                                "#{OperationBean.validateField}",
1510:                                null,
1511:                                new Class[] { FacesContext.class,
1512:                                        UIComponent.class, Object.class });
1513:                textField.setValidatorExpression(methodExpression);
1514:                sLog
1515:                        .fine("OperationHandlers.jbiSetFieldValidator validatorExpression="
1516:                                + methodExpression);
1517:
1518:                // Preset alert details for this property to assume validation failure 
1519:                // (this handles the case for a blank input field where the validator is not called)
1520:                // Each validator will remove its corresponding alert detail after validation passes
1521:                // or replace the detail if validation fails.
1522:                // 1. get session map
1523:                // 2. get alertDetail properties from sessionMap (create if missing)
1524:                // 3. add proptertyName to alertDetail mapping to alertDetail properties
1525:                // 4. put alertDetail properties back into sessionMap
1526:                // If all validation passes, this map becomes empty, and no validation alert is needed.
1527:                Properties alertDetailProperties = (Properties) sessionMap
1528:                        .get("jbiAlertDetailProperties");
1529:                if (null == alertDetailProperties) {
1530:                    alertDetailProperties = new Properties();
1531:                }
1532:
1533:                alertDetailProperties.put(propertyName, ""); // clear out prior validation errors
1534:                sessionMap.put("jbiAlertDetailProperties",
1535:                        alertDetailProperties);
1536:
1537:                sLog
1538:                        .finer("OperationHandlers.jbiSetFieldValidator after sessionMap="
1539:                                + sessionMap);
1540:            }
1541:
1542:            /**
1543:             * Sets a validaiton alert type and summary.
1544:             * <p> Input  alertType:  -- Type: <code>String</code>
1545:             * <p> Input  alertSummary:  -- Type: <code>String</code>
1546:             * @param  handlerCtx <code>HandlerContext</code> provides inputs and outputs.
1547:             */
1548:            @Handler(id="jbiSetValidationAlert",input={@HandlerInput(name="alertType",type=String.class,required=true),@HandlerInput(name="alertSummary",type=String.class,required=true)})
1549:            public static void jbiSetValidationAlert(HandlerContext handlerCtx) {
1550:                String alertType = (String) handlerCtx
1551:                        .getInputValue("alertType");
1552:                String alertSummary = (String) handlerCtx
1553:                        .getInputValue("alertSummary");
1554:                sLog
1555:                        .fine("OperationHandlers.jbiSetValidationAlert(), alertType="
1556:                                + alertType + ", alertSummary=" + alertSummary);
1557:                AlertBean alertBean = BeanUtilities.getAlertBean();
1558:                alertBean.setAlertType(alertType);
1559:                alertBean.setAlertSummary(alertSummary);
1560:            }
1561:
1562:            /**
1563:             *  <p> This method saves the values for all the attributes in the
1564:             *      Server Logging Levels Page.</p>
1565:             *  @param "propertySheetParentId" -- Type: <code>java.lang.String</code></p>
1566:             *  @param "propertySheetId" -- Type: <code>java.lang.String</code></p>
1567:             *  @param "propertySheetSectionIdTag" -- Type: <code>java.lang.String</code></p>
1568:             *  @param "propertySheetIdTag" -- Type: <code>java.lang.String</code></p>
1569:             *  @param "propertyIdTag" -- Type: <code>java.lang.String</code></p>
1570:             *  @param "hiddenFieldIdTag" -- Type: <code>java.lang.String</code></p>
1571:             *  @param "targetName" -- Type: <code>java.lang.String</code></p>
1572:             *  @param "instanceName" -- Type: <code>java.lang.String</code></p>
1573:             *  @return <code>Properties</code>
1574:             */
1575:            private static Properties jbiSetJBIRuntimeLogLevels(
1576:                    String propertySheetParentId, String propertySheetId,
1577:                    String propertySheetSectionIdTag, String propertyIdTag,
1578:                    String dropDownIdTag, String hiddenFieldIdTag,
1579:                    String targetName, String instanceName,
1580:                    HandlerContext handlerCtx) {
1581:
1582:                int loggerFailureCount = 0;
1583:
1584:                String propertySheetSectionId = "";
1585:                String propertyId = "";
1586:                String dropDownId = "";
1587:                String hiddenFieldId = "";
1588:
1589:                int propertySheetSectionCount = 1;
1590:                int propertyCount = 1;
1591:                int dropDownCount = 1;
1592:                int hiddenFieldCount = 1;
1593:
1594:                int loopLevel = 1;
1595:
1596:                int testCounter = 0;
1597:
1598:                JBIAdminCommands mJac = BeanUtilities.getClient();
1599:
1600:                // Retrieve the original logger levels so we can only save the log 
1601:                // level values for the loggers that have changed.
1602:                Map originalLoggerLevels = SystemLoggerUtilities
1603:                        .getJBIRuntimeLoggerLevels(targetName, instanceName);
1604:                if (loggerFailureCount == 0) {
1605:                    boolean propertySheetSectionLoop = true;
1606:                    while (propertySheetSectionLoop) {
1607:                        propertySheetSectionId = propertySheetSectionIdTag
1608:                                + Integer.toString(propertySheetSectionCount);
1609:                        boolean propertyLoop = true;
1610:                        while (propertyLoop) {
1611:                            propertyId = propertyIdTag
1612:                                    + Integer.toString(propertyCount);
1613:                            boolean dropDownLoop = true;
1614:                            while (dropDownLoop) {
1615:                                String key = propertySheetParentId + ":"
1616:                                        + propertySheetId + ":"
1617:                                        + propertySheetSectionId + ":"
1618:                                        + propertyId;
1619:
1620:                                // First try to find the dropdown component using the new woodstock naming
1621:                                // convention (no "_list" appended to the end of the id).  If the component
1622:                                // was not found, then try to find it using the old naming convention
1623:                                // ("_list" appended to the end of the id)
1624:                                dropDownId = dropDownIdTag
1625:                                        + Integer.toString(dropDownCount);
1626:                                String dropDownKey = key + ":" + dropDownId;
1627:                                String dropDownValue = (String) handlerCtx
1628:                                        .getFacesContext().getExternalContext()
1629:                                        .getRequestParameterMap().get(
1630:                                                dropDownKey);
1631:
1632:                                if (dropDownValue == null) {
1633:                                    dropDownKey += "_list";
1634:                                    dropDownValue = (String) handlerCtx
1635:                                            .getFacesContext()
1636:                                            .getExternalContext()
1637:                                            .getRequestParameterMap().get(
1638:                                                    dropDownKey);
1639:                                }
1640:
1641:                                if (dropDownValue == null) {
1642:                                    loopLevel++;
1643:                                    if (loopLevel == 2) {
1644:                                        dropDownLoop = false;
1645:                                        propertyCount++;
1646:                                    } else {
1647:                                        if (loopLevel == 3) {
1648:                                            propertyLoop = false;
1649:                                            dropDownLoop = false;
1650:                                            propertySheetSectionCount++;
1651:                                        } else {
1652:                                            propertySheetSectionLoop = false;
1653:                                            propertyLoop = false;
1654:                                            dropDownLoop = false;
1655:                                        }
1656:                                    }
1657:                                } else {
1658:                                    hiddenFieldId = hiddenFieldIdTag
1659:                                            + Integer
1660:                                                    .toString(hiddenFieldCount);
1661:                                    String hiddenFieldKey = key + ":"
1662:                                            + hiddenFieldId;
1663:                                    Object hiddenFieldValue = handlerCtx
1664:                                            .getFacesContext()
1665:                                            .getExternalContext()
1666:                                            .getRequestParameterMap().get(
1667:                                                    hiddenFieldKey);
1668:
1669:                                    if (hiddenFieldValue != null) {
1670:                                        String loggerCustomName = hiddenFieldValue
1671:                                                .toString();
1672:                                        if (null != mJac) {
1673:                                            Level originalLevel = (Level) originalLoggerLevels
1674:                                                    .get(loggerCustomName);
1675:                                            String originalLevelName = originalLevel
1676:                                                    .getName();
1677:
1678:                                            // Only change the logger level if the new value is different then the original
1679:                                            if (!(dropDownValue
1680:                                                    .equalsIgnoreCase(originalLevelName))) {
1681:                                                SystemLoggerUtilities
1682:                                                        .setJBIRuntimeLoggerLevel(
1683:                                                                loggerCustomName,
1684:                                                                dropDownValue,
1685:                                                                targetName,
1686:                                                                instanceName);
1687:                                            }
1688:                                        }
1689:                                    }
1690:                                    loopLevel = 1;
1691:                                    dropDownCount++;
1692:                                    hiddenFieldCount++;
1693:                                }
1694:                            }
1695:                        }
1696:                    }
1697:                }
1698:
1699:                // Place the messages in the properties result.  Note, only an error
1700:                // message will be returned.
1701:                Properties result = new Properties();
1702:                result.setProperty(SharedConstants.KEY_NAME, instanceName);
1703:                result.setProperty(SharedConstants.FAILURE_RESULT, "");
1704:                if (loggerFailureCount > 0) {
1705:                    String strCount = loggerFailureCount + "";
1706:                    Object[] args = { strCount, instanceName };
1707:                    String msg = GuiUtil
1708:                            .getMessage(
1709:                                    I18nUtilities
1710:                                            .getResourceString("jbi.configure.loggers.failure.message"),
1711:                                    args);
1712:                    result.setProperty(SharedConstants.FAILURE_RESULT, msg);
1713:                }
1714:
1715:                return result;
1716:
1717:            }
1718:
1719:            /**
1720:             *  <p> This method saves the values for all the attributes in the
1721:             *      Server Logging Levels Page.</p>
1722:             *  @param "propertySheetParentId" -- Type: <code>java.lang.String</code></p>
1723:             *  @param "propertySheetId" -- Type: <code>java.lang.String</code></p>
1724:             *  @param "propertySheetSectionIdTag" -- Type: <code>java.lang.String</code></p>
1725:             *  @param "propertySheetIdTag" -- Type: <code>java.lang.String</code></p>
1726:             *  @param "propertyIdTag" -- Type: <code>java.lang.String</code></p>
1727:             *  @param "hiddenFieldIdTag" -- Type: <code>java.lang.String</code></p>
1728:             *  @param "componentName" -- Type: <code>java.lang.String</code></p>
1729:             *  @param "targetName" -- Type: <code>java.lang.String</code></p>
1730:             *  @param "instanceName" -- Type: <code>java.lang.String</code></p>
1731:             *  @return <code>Properties</code>
1732:             */
1733:            private static Properties jbiSetComponentLogLevels(
1734:                    String propertySheetParentId, String propertySheetId,
1735:                    String propertySheetSectionIdTag, String propertyIdTag,
1736:                    String dropDownIdTag, String hiddenFieldIdTag,
1737:                    String componentName, String targetName,
1738:                    String instanceName, HandlerContext handlerCtx) {
1739:
1740:                int loggerFailureCount = 0;
1741:
1742:                String propertySheetSectionId = "";
1743:                String propertyId = "";
1744:                String dropDownId = "";
1745:                String hiddenFieldId = "";
1746:
1747:                int propertySheetSectionCount = 1;
1748:                int propertyCount = 1;
1749:                int dropDownCount = 1;
1750:                int hiddenFieldCount = 1;
1751:
1752:                int loopLevel = 1;
1753:
1754:                int testCounter = 0;
1755:
1756:                JBIAdminCommands mJac = BeanUtilities.getClient();
1757:
1758:                // Retrieve the original logger levels so we can only save the log 
1759:                // level values for the loggers that have changed.
1760:                Map originalLoggerLevels = null;
1761:                try {
1762:                    originalLoggerLevels = mJac.getComponentLoggerLevels(
1763:                            componentName, targetName, instanceName);
1764:                } catch (com.sun.jbi.ui.common.JBIRemoteException jbiRemoteEx) {
1765:                    sLog.fine("jbiSetComponentLogLevels(): caught jbiRemoteEx="
1766:                            + jbiRemoteEx);
1767:                    sLog
1768:                            .fine("jbiSetComponentLogLevels(): unable to retrieve the original log level values");
1769:                    loggerFailureCount++;
1770:                }
1771:
1772:                if (loggerFailureCount == 0) {
1773:                    boolean propertySheetSectionLoop = true;
1774:                    while (propertySheetSectionLoop) {
1775:                        propertySheetSectionId = propertySheetSectionIdTag
1776:                                + Integer.toString(propertySheetSectionCount);
1777:                        boolean propertyLoop = true;
1778:                        while (propertyLoop) {
1779:                            propertyId = propertyIdTag
1780:                                    + Integer.toString(propertyCount);
1781:                            boolean dropDownLoop = true;
1782:                            while (dropDownLoop) {
1783:                                String key = propertySheetParentId + ":"
1784:                                        + propertySheetId + ":"
1785:                                        + propertySheetSectionId + ":"
1786:                                        + propertyId;
1787:
1788:                                // First try to find the dropdown component using the new woodstock naming
1789:                                // convention (no "_list" appended to the end of the id).  If the component
1790:                                // was not found, then try to find it using the old naming convention
1791:                                // ("_list" appended to the end of the id)
1792:                                dropDownId = dropDownIdTag
1793:                                        + Integer.toString(dropDownCount);
1794:                                String dropDownKey = key + ":" + dropDownId;
1795:                                String dropDownValue = (String) handlerCtx
1796:                                        .getFacesContext().getExternalContext()
1797:                                        .getRequestParameterMap().get(
1798:                                                dropDownKey);
1799:
1800:                                if (dropDownValue == null) {
1801:                                    dropDownKey += "_list";
1802:                                    dropDownValue = (String) handlerCtx
1803:                                            .getFacesContext()
1804:                                            .getExternalContext()
1805:                                            .getRequestParameterMap().get(
1806:                                                    dropDownKey);
1807:                                }
1808:
1809:                                if (dropDownValue == null) {
1810:                                    loopLevel++;
1811:                                    if (loopLevel == 2) {
1812:                                        dropDownLoop = false;
1813:                                        propertyCount++;
1814:                                    } else {
1815:                                        if (loopLevel == 3) {
1816:                                            propertyLoop = false;
1817:                                            dropDownLoop = false;
1818:                                            propertySheetSectionCount++;
1819:                                        } else {
1820:                                            propertySheetSectionLoop = false;
1821:                                            propertyLoop = false;
1822:                                            dropDownLoop = false;
1823:                                        }
1824:                                    }
1825:                                } else {
1826:                                    hiddenFieldId = hiddenFieldIdTag
1827:                                            + Integer
1828:                                                    .toString(hiddenFieldCount);
1829:                                    String hiddenFieldKey = key + ":"
1830:                                            + hiddenFieldId;
1831:                                    Object hiddenFieldValue = handlerCtx
1832:                                            .getFacesContext()
1833:                                            .getExternalContext()
1834:                                            .getRequestParameterMap().get(
1835:                                                    hiddenFieldKey);
1836:
1837:                                    if (hiddenFieldValue != null) {
1838:                                        String loggerCustomName = hiddenFieldValue
1839:                                                .toString();
1840:                                        try {
1841:                                            String loggerTagName = (String) SystemLoggerUtilities.loggerNames
1842:                                                    .get(loggerCustomName);
1843:                                            if (loggerTagName != null) {
1844:                                                String logLevelStr = dropDownValue;
1845:                                                String targetConfig = targetName
1846:                                                        + "-config";
1847:                                                String originalLogLevelStr = SystemLoggerUtilities
1848:                                                        .getLogLevelValue(
1849:                                                                loggerTagName,
1850:                                                                targetConfig);
1851:                                                if (!(dropDownValue
1852:                                                        .equalsIgnoreCase(originalLogLevelStr))) {
1853:                                                    if (dropDownValue
1854:                                                            .equalsIgnoreCase(GuiUtil
1855:                                                                    .getMessage(I18nUtilities
1856:                                                                            .getResourceString("loglevel.DEFAULT")))) {
1857:                                                        dropDownValue = (Level
1858:                                                                .parse("INFO"))
1859:                                                                .getName();
1860:                                                    }
1861:                                                    SystemLoggerUtilities
1862:                                                            .setLogLevelValue(
1863:                                                                    loggerCustomName,
1864:                                                                    targetName,
1865:                                                                    dropDownValue);
1866:                                                    sLog
1867:                                                            .fine("OperationHandlers - jbiSaveComponentLogLevels() "
1868:                                                                    + "Updated System Logger: "
1869:                                                                    + ", loggerCustomName="
1870:                                                                    + loggerCustomName
1871:                                                                    + ", dropDownValue="
1872:                                                                    + dropDownValue
1873:                                                                    + ", targetName="
1874:                                                                    + targetName);
1875:                                                }
1876:                                            } else {
1877:                                                if (null != mJac) {
1878:                                                    Level logLevel = null;
1879:
1880:                                                    if (!(dropDownValue
1881:                                                            .equalsIgnoreCase(GuiUtil
1882:                                                                    .getMessage(I18nUtilities
1883:                                                                            .getResourceString("loglevel.DEFAULT"))))) {
1884:                                                        logLevel = Level
1885:                                                                .parse(dropDownValue);
1886:                                                    }
1887:                                                    Level originalLevel = (Level) originalLoggerLevels
1888:                                                            .get(loggerCustomName);
1889:
1890:                                                    if ((logLevel == null)
1891:                                                            || ((originalLevel != null) && (!(logLevel
1892:                                                                    .getName()
1893:                                                                    .equalsIgnoreCase(originalLevel
1894:                                                                            .getName()))))) {
1895:                                                        mJac
1896:                                                                .setComponentLoggerLevel(
1897:                                                                        componentName,
1898:                                                                        loggerCustomName,
1899:                                                                        logLevel,
1900:                                                                        targetName,
1901:                                                                        instanceName);
1902:                                                        sLog
1903:                                                                .fine("OperationHandlers - jbiSaveComponentLogLevels() "
1904:                                                                        + "Updated JBI Logger: "
1905:                                                                        + "componentName="
1906:                                                                        + componentName
1907:                                                                        + ", loggerCustomName="
1908:                                                                        + loggerCustomName
1909:                                                                        + ", logLevel="
1910:                                                                        + logLevel
1911:                                                                        + ", originalLevel="
1912:                                                                        + originalLevel
1913:                                                                        + ", targetName="
1914:                                                                        + targetName
1915:                                                                        + ", instanceName="
1916:                                                                        + instanceName);
1917:                                                    }
1918:                                                }
1919:                                            }
1920:                                        } catch (com.sun.jbi.ui.common.JBIRemoteException jbiRemoteEx) {
1921:                                            sLog
1922:                                                    .fine("jbiSetComponentLogLevels(): caught jbiRemoteEx="
1923:                                                            + jbiRemoteEx);
1924:                                            loggerFailureCount++;
1925:                                        }
1926:                                    }
1927:
1928:                                    loopLevel = 1;
1929:                                    dropDownCount++;
1930:                                    hiddenFieldCount++;
1931:                                }
1932:                            }
1933:                        }
1934:                    }
1935:                }
1936:
1937:                // Place the messages in the properties result.  Note, only an error
1938:                // message will be returned.
1939:                Properties result = new Properties();
1940:                result.setProperty(SharedConstants.KEY_NAME, instanceName);
1941:                result.setProperty(SharedConstants.FAILURE_RESULT, "");
1942:                if (loggerFailureCount > 0) {
1943:                    String strCount = loggerFailureCount + "";
1944:                    Object[] args = { strCount, instanceName };
1945:                    String msg = GuiUtil
1946:                            .getMessage(
1947:                                    I18nUtilities
1948:                                            .getResourceString("jbi.configure.loggers.failure.message"),
1949:                                    args);
1950:                    result.setProperty(SharedConstants.FAILURE_RESULT, msg);
1951:                }
1952:
1953:                return result;
1954:
1955:            }
1956:
1957:            /**
1958:             * Returns a list of names and types for the selected rows.
1959:             * @param aGroup <code>TableRowGroup</code> the table data with some rows selected.
1960:             * @return <code>List</code> of <code>Properties</code> objects
1961:             * <p> Each properties object has 'name' and 'type' keys and values.
1962:             */
1963:            private static List getSelectedComponentOrDeploymentRowProperties(
1964:                    TableRowGroup aGroup) {
1965:                ArrayList result = new ArrayList();
1966:
1967:                ObjectListDataProvider dp = (ObjectListDataProvider) aGroup
1968:                        .getSourceData();
1969:
1970:                if (null != dp) {
1971:                    try {
1972:                        FieldKey fkName = dp
1973:                                .getFieldKey(SharedConstants.KEY_NAME);
1974:                        FieldKey fkType = dp
1975:                                .getFieldKey(SharedConstants.KEY_TYPE);
1976:
1977:                        RowKey[] rowKeys = aGroup.getSelectedRowKeys();
1978:
1979:                        for (int cnt = 0; cnt < rowKeys.length; cnt++) {
1980:                            Properties selectedRowProperties = new Properties();
1981:
1982:                            String compName = (String) dp.getValue(fkName,
1983:                                    rowKeys[cnt]);
1984:
1985:                            selectedRowProperties.setProperty(
1986:                                    SharedConstants.KEY_NAME, compName);
1987:
1988:                            String compType = (String) dp.getValue(fkType,
1989:                                    rowKeys[cnt]);
1990:
1991:                            sLog
1992:                                    .fine("OperationHandlers.getSelectedComponentOrDeploymentRowProperties(...), compType="
1993:                                            + compType);
1994:
1995:                            if ((JBIConstants.JBI_BINDING_COMPONENT_TYPE
1996:                                    .equals(compType))
1997:                                    || (JBIConstants.JBI_SERVICE_ENGINE_TYPE
1998:                                            .equals(compType))) {
1999:                                selectedRowProperties.setProperty(
2000:                                        SharedConstants.KEY_TYPE, compType);
2001:                            } else {
2002:                                selectedRowProperties.setProperty(
2003:                                        SharedConstants.KEY_TYPE,
2004:                                        JBIConstants.JBI_SERVICE_ASSEMBLY_TYPE);
2005:                            }
2006:
2007:                            result.add(selectedRowProperties);
2008:                        }
2009:                    } catch (Exception ex) {
2010:                        sLog
2011:                                .fine("OperationHandlers.getSelectedComponentOrDeploymentRowProperties(), caught ex="
2012:                                        + ex);
2013:                        ex.printStackTrace(System.err);
2014:                    }
2015:                } else {
2016:                    sLog
2017:                            .fine("OperationHandlers.getSelectedComponentOrDeploymentRowProperties(), cannot process dp="
2018:                                    + dp);
2019:                }
2020:
2021:                sLog
2022:                        .fine("OperationHandlers.getSelectedComponentOrDeploymentRowProperties(), result="
2023:                                + result);
2024:                return result;
2025:            }
2026:
2027:            /**
2028:             * Returns a list of target cluster or stand-alone instances for the selected rows.
2029:             * @param aGroup <code>TableRowGroup</code> the table data with some rows selected.
2030:             * @return <code>List</code> of <code>Properties</code> objects
2031:             * <p> Each properties object has 'target' key and value.
2032:             */
2033:            private static List getSelectedTargetRowProperties(
2034:                    TableRowGroup aGroup) {
2035:                if (true) {
2036:                    return TableUtilities.getSelectedRowProperties(aGroup);
2037:                } else {
2038:                    ArrayList result = new ArrayList();
2039:
2040:                    sLog
2041:                            .fine("OperationHandlers.getSelectedTargetRowProperties("
2042:                                    + aGroup + ")");
2043:
2044:                    ObjectListDataProvider dp = (ObjectListDataProvider) aGroup
2045:                            .getSourceData();
2046:
2047:                    if (null != dp) {
2048:                        try {
2049:                            FieldKey fkName = dp
2050:                                    .getFieldKey(SharedConstants.KEY_NAME);
2051:                            FieldKey fkType = dp
2052:                                    .getFieldKey(SharedConstants.KEY_TYPE);
2053:
2054:                            RowKey[] rowKeys = aGroup.getSelectedRowKeys();
2055:
2056:                            for (int cnt = 0; cnt < rowKeys.length; cnt++) {
2057:                                Properties selectedRowProperties = new Properties();
2058:
2059:                                String targetName = (String) dp.getValue(
2060:                                        fkName, rowKeys[cnt]);
2061:
2062:                                selectedRowProperties.setProperty(
2063:                                        SharedConstants.KEY_NAME, targetName);
2064:
2065:                                String targetType = (String) dp.getValue(
2066:                                        fkType, rowKeys[cnt]);
2067:
2068:                                selectedRowProperties.setProperty(
2069:                                        SharedConstants.KEY_TYPE, targetType);
2070:
2071:                                result.add(selectedRowProperties);
2072:                            }
2073:                        } catch (Exception ex) {
2074:                            sLog
2075:                                    .fine("OperationHandlers.getSelectedTargetRowProperties(), caught ex="
2076:                                            + ex);
2077:                            ex.printStackTrace(System.err);
2078:                        }
2079:                    } else {
2080:                        sLog
2081:                                .fine("OperationHandlers.getSelectedTargetRowProperties(), cannot process dp="
2082:                                        + dp);
2083:                    }
2084:
2085:                    sLog
2086:                            .fine("OperationHandlers.getSelectedTargetRowProperties(), result="
2087:                                    + result);
2088:                    return result;
2089:                }
2090:            }
2091:
2092:            private static Properties shutDown(Properties aRowProperties,
2093:                    List aTargetsList) {
2094:                sLog.fine("OperationHandlers.shutDown(" + aRowProperties + ", "
2095:                        + aTargetsList + ")");
2096:                OperationBean operationBean = BeanUtilities.getOperationBean();
2097:                aRowProperties = operationBean.shutDown(aRowProperties,
2098:                        aTargetsList);
2099:                aRowProperties = adjustResults(aRowProperties);
2100:                return aRowProperties;
2101:            }
2102:
2103:            private static Properties start(Properties aRowProperties,
2104:                    List aTargetsList) {
2105:                sLog.fine("OperationHandlers.start(" + aRowProperties + ", "
2106:                        + aTargetsList + ")");
2107:                OperationBean operationBean = BeanUtilities.getOperationBean();
2108:                aRowProperties = operationBean.start(aRowProperties,
2109:                        aTargetsList);
2110:                aRowProperties = adjustResults(aRowProperties);
2111:                return aRowProperties;
2112:            }
2113:
2114:            private static Properties stop(Properties aRowProperties,
2115:                    List aTargetsList) {
2116:                sLog.fine("OperationHandlers.stop(" + aRowProperties + ", "
2117:                        + aTargetsList + ")");
2118:                OperationBean operationBean = BeanUtilities.getOperationBean();
2119:                aRowProperties = operationBean.stop(aRowProperties,
2120:                        aTargetsList);
2121:                aRowProperties = adjustResults(aRowProperties);
2122:                return aRowProperties;
2123:
2124:                // TBD accumulate results
2125:            }
2126:
2127:            /**
2128:             * ensures that there is only one success or failure
2129:             * i.e. takes warnings from success results and turns
2130:             * them into failure results, to force alert details to be
2131:             * displayed
2132:             * @param aRowProperties containing zero or more success and
2133:             * zero or more failure results
2134:             * @returns Propeties with failure results if any, otherwise
2135:             * success results, if any
2136:             */
2137:            private static Properties adjustResults(Properties aRowProperties) {
2138:                sLog.fine("OperationHandlers.adjustResults(" + aRowProperties
2139:                        + ")");
2140:                JBIManagementMessage mgmtMsg = null;
2141:                String failureResult = aRowProperties
2142:                        .getProperty(SharedConstants.FAILURE_RESULT);
2143:                if (null == failureResult) {
2144:                    String failureResult2 = aRowProperties
2145:                            .getProperty(SharedConstants.SUCCESS_RESULT);
2146:                    if (null == failureResult2) {
2147:                        sLog
2148:                                .fine("OperationHandlers.adjustResults(...) no failure or success (?!) --nothing to adjust");
2149:                    } else {
2150:                        mgmtMsg = BeanUtilities
2151:                                .extractJBIManagementMessage(failureResult2);
2152:                        sLog
2153:                                .fine("OperationHandlers.adjustResults(...) mgmtMsg="
2154:                                        + mgmtMsg);
2155:                        if ((null != mgmtMsg)
2156:                                && ((mgmtMsg.isFailedMsg() || mgmtMsg
2157:                                        .isWarningMsg()))) {
2158:                            sLog
2159:                                    .fine("OperationHandlers.adjustResults(...) jbiXmlResults has failure(s) -- adjust failureResult2="
2160:                                            + failureResult2);
2161:                            aRowProperties
2162:                                    .remove(SharedConstants.SUCCESS_RESULT);
2163:                            String msg = mgmtMsg.getMessage();
2164:                            msg = msg.replaceAll(NEWLINE, BREAK);
2165:                            sLog
2166:                                    .fine("OperationHandlers.adjustResults(...) msg="
2167:                                            + msg);
2168:                            aRowProperties.setProperty(
2169:                                    SharedConstants.FAILURE_RESULT, msg);
2170:                        } else {
2171:                            sLog
2172:                                    .fine("OperationHandlers.adjustResults(...) jbiXmlResult success --nothing to adjust");
2173:                        }
2174:                    }
2175:                } else {
2176:                    sLog
2177:                            .fine("OperationHandlers.accumulateResults(...) found failure--accumulate failureResult="
2178:                                    + failureResult);
2179:                    mgmtMsg = BeanUtilities
2180:                            .extractJBIManagementMessage(failureResult);
2181:                    if (null != mgmtMsg) {
2182:                        aRowProperties.remove(SharedConstants.SUCCESS_RESULT);
2183:                        String msg = mgmtMsg.getMessage();
2184:                        msg = msg.replaceAll(NEWLINE, BREAK);
2185:                        aRowProperties.setProperty(
2186:                                SharedConstants.FAILURE_RESULT, msg);
2187:                    } else {
2188:                        sLog
2189:                                .fine("OperationHandlers.accumulateResults(...) no management message");
2190:                    }
2191:                }
2192:                return aRowProperties;
2193:            }
2194:
2195:            /**
2196:             * gets the current properties for a target
2197:             * @param aTarget String  (domain, server, cluster1, server2, etc.)
2198:             * @returns Properties
2199:             */
2200:            private static Properties getCurrentRuntimeConfigurationProperties(
2201:                    String aTarget) {
2202:                Properties result = new Properties();
2203:                JBIAdminCommands mJac = BeanUtilities.getClient();
2204:
2205:                try {
2206:                    result = mJac.getRuntimeConfiguration(aTarget);
2207:                    sLog
2208:                            .fine("OperationHandlers.jbiGetRuntimeConfigurationParameters msgSvcTimingStatisticsEnabled metaData = "
2209:                                    + mJac
2210:                                            .getRuntimeConfigurationMetaData("msgSvcTimingStatisticsEnabled"));
2211:                    sLog
2212:                            .fine("OperationHandlers.jbiGetRuntimeConfigurationParameters heartBeatInterval metaData = "
2213:                                    + mJac
2214:                                            .getRuntimeConfigurationMetaData("heartBeatInterval"));
2215:                    sLog
2216:                            .fine("OperationHandlers.jbiGetRuntimeConfigurationParameters jbiHome metaData = "
2217:                                    + mJac
2218:                                            .getRuntimeConfigurationMetaData("jbiHome"));
2219:                    sLog
2220:                            .fine("OperationHandlers.jbiGetRuntimeConfigurationParameters autoInstallEnabled metaData = "
2221:                                    + mJac
2222:                                            .getRuntimeConfigurationMetaData("autoInstallEnabled"));
2223:                    sLog
2224:                            .fine("OperationHandlers.jbiGetRuntimeConfigurationParameters autoInstallDir metaData = "
2225:                                    + mJac
2226:                                            .getRuntimeConfigurationMetaData("autoInstallDir"));
2227:                    sLog
2228:                            .fine("OperationHandlers.jbiGetRuntimeConfigurationParameters startOnDeploy metaData = "
2229:                                    + mJac
2230:                                            .getRuntimeConfigurationMetaData("startOnDeploy"));
2231:                    sLog
2232:                            .fine("OperationHandlers.jbiGetRuntimeConfigurationParameters installationTimeout metaData = "
2233:                                    + mJac
2234:                                            .getRuntimeConfigurationMetaData("installationTimeout"));
2235:                    sLog
2236:                            .fine("OperationHandlers.jbiGetRuntimeConfigurationParameters componentTimeout metaData = "
2237:                                    + mJac
2238:                                            .getRuntimeConfigurationMetaData("componentTimeout"));
2239:                    sLog
2240:                            .fine("OperationHandlers.jbiGetRuntimeConfigurationParameters serviceUnitTimeout metaData = "
2241:                                    + mJac
2242:                                            .getRuntimeConfigurationMetaData("serviceUnitTimeout"));
2243:
2244:                    if (null != result) {
2245:                        for (Object object : result.keySet()) {
2246:                            String k = (String) object;
2247:                            String v = (String) result.getProperty(k);
2248:                            sLog
2249:                                    .finer("OperationHandlers.getCurrentRuntimeConfigurationProperties "
2250:                                            + k
2251:                                            + " metaData = "
2252:                                            + mJac
2253:                                                    .getRuntimeConfigurationMetaData(k));
2254:                            sLog
2255:                                    .finer("OperationHandlers.getCurrentRuntimeConfigurationProperties("
2256:                                            + aTarget
2257:                                            + "), key="
2258:                                            + k
2259:                                            + ", value=" + v);
2260:                        }
2261:                    }
2262:                } catch (com.sun.jbi.ui.common.JBIRemoteException jbiRemoteEx) {
2263:                    jbiRemoteEx.printStackTrace();
2264:                }
2265:                sLog
2266:                        .fine("OperationHandlers.getCurrentRuntimeConfigurationProperties("
2267:                                + aTarget + ")=" + result);
2268:                return result;
2269:            }
2270:
2271:            /**
2272:             * finds the changed properties for a target
2273:             * @param aTarget String  (domain, server, cluster1, server2, etc.)
2274:             * @param aTarget String  (domain, server, cluster1, server2, etc.)
2275:             * @returns Properties
2276:             */
2277:            private static Properties findChangedRuntimeConfigurationProperties(
2278:                    String aTarget, Properties aListOfAllProperties) {
2279:                Properties result = new Properties();
2280:                sLog
2281:                        .fine("OperationHandlers.findCurrentRuntimeConfigurationProperties("
2282:                                + aTarget + ")");
2283:                Properties currentProperties = getCurrentRuntimeConfigurationProperties(aTarget);
2284:                // for each property, omit those unchanged from the current configuration
2285:                if (null != aListOfAllProperties) {
2286:                    for (Object object : aListOfAllProperties.keySet()) {
2287:                        String k = (String) object;
2288:                        String newValue = (String) aListOfAllProperties
2289:                                .getProperty(k);
2290:                        String currentValue = currentProperties.getProperty(k);
2291:                        sLog
2292:                                .finer("OperationHandlers.findCurrentRuntimeConfigurationProperties("
2293:                                        + aTarget
2294:                                        + "), k="
2295:                                        + k
2296:                                        + ", newValue="
2297:                                        + newValue
2298:                                        + ", currentValue="
2299:                                        + currentValue);
2300:                        if ((null != newValue)
2301:                                && (!newValue.equals(currentValue))) {
2302:                            result.setProperty(k, newValue);
2303:                            sLog
2304:                                    .finer("OperationHandlers.findCurrentRuntimeConfigurationProperties("
2305:                                            + aTarget
2306:                                            + "), k="
2307:                                            + k
2308:                                            + ", newValue="
2309:                                            + newValue
2310:                                            + " added to result");
2311:                        }
2312:
2313:                    }
2314:                }
2315:
2316:                sLog
2317:                        .fine("OperationHandlers.findCurrentRuntimeConfigurationProperties("
2318:                                + aTarget + "), result=" + result);
2319:                return result;
2320:            }
2321:
2322:            private static Properties setPropertyIfNotNull(
2323:                    Properties aProperties, String aKey, String aValue) {
2324:                Properties result = aProperties;
2325:                sLog.fine("OperationalHandlers.setPropertyIfNotNull(...), key="
2326:                        + aKey + ", value=" + aValue);
2327:                if (null != aValue) {
2328:                    result.setProperty(aKey, aValue);
2329:                }
2330:                return result;
2331:            }
2332:
2333:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.