Source Code Cross Referenced for ComponentConfigurationHandlers.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-2008 Sun Microsystems, Inc. All rights reserved.
0005:         *
0006:         *  The contents of this file are subject to the terms of either the GNU
0007:         *  General Public License Version 2 only ("GPL") or the Common Development
0008:         *  and Distribution License("CDDL") (collectively, the "License").  You
0009:         *  may not use this file except in compliance with the License. You can obtain
0010:         *  a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
0011:         *  or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
0012:         *  language governing permissions and limitations under the License.
0013:         *
0014:         *  When distributing the software, include this License Header Notice in each
0015:         *  file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
0016:         *  Sun designates this particular file as subject to the "Classpath" exception
0017:         *  as provided by Sun in the GPL Version 2 section of the License file that
0018:         *  accompanied this code.  If applicable, add the following below the License
0019:         *  Header, with the fields enclosed by brackets [] replaced by your own
0020:         *  identifying information: "Portions Copyrighted [year]
0021:         *  [name of copyright owner]"
0022:         *
0023:         *  Contributor(s):
0024:         *
0025:         *  If you wish your version of this file to be governed by only the CDDL or
0026:         *  only the GPL Version 2, indicate your decision by adding "[Contributor]
0027:         *  elects to include this software in this distribution under the [CDDL or GPL
0028:         *  Version 2] license."  If you don't indicate a single choice of license, a
0029:         *  recipient has the option to distribute your version of this file under
0030:         *  either the CDDL, the GPL Version 2 or to extend the choice of license to
0031:         *  its licensees as provided above.  However, if you add GPL Version 2 code
0032:         *  and therefore, elected the GPL Version 2 license, then the option applies
0033:         *  only if the new code is made subject to such option by the copyright
0034:         *  holder.
0035:         */
0036:        package com.sun.jbi.jsf.handlers;
0037:
0038:        import java.util.ArrayList;
0039:        import java.util.HashMap;
0040:        import java.util.Iterator;
0041:        import java.util.List;
0042:        import java.util.Properties;
0043:        import java.util.logging.Level;
0044:        import java.util.logging.Logger;
0045:        import javax.faces.component.UIComponent;
0046:        import javax.faces.model.SelectItem;
0047:        import com.sun.data.provider.FieldKey;
0048:        import com.sun.data.provider.RowKey;
0049:        import com.sun.data.provider.impl.ObjectListDataProvider;
0050:        import com.sun.enterprise.tools.admingui.handlers.ConfigurationHandlers;
0051:        import com.sun.enterprise.tools.admingui.util.GuiUtil;
0052:        import com.sun.jbi.jsf.bean.AlertBean;
0053:        import com.sun.jbi.jsf.bean.CompAppConfig;
0054:        import com.sun.jbi.jsf.bean.ShowBean;
0055:        import com.sun.jbi.jsf.util.AlertUtilities;
0056:        import com.sun.jbi.jsf.util.AppConfigUtils;
0057:        import com.sun.jbi.jsf.util.AppVarUtils;
0058:        import com.sun.jbi.jsf.util.BeanUtilities;
0059:        import com.sun.jbi.jsf.util.ClusterUtilities;
0060:        import com.sun.jbi.jsf.util.CompConfigUtils;
0061:        import com.sun.jbi.jsf.util.I18nUtilities;
0062:        import com.sun.jbi.jsf.util.JBILogger;
0063:        import com.sun.jbi.jsf.util.SharedConstants;
0064:        import com.sun.jbi.ui.common.JBIAdminCommands;
0065:        import com.sun.jsftemplating.annotation.Handler;
0066:        import com.sun.jsftemplating.annotation.HandlerInput;
0067:        import com.sun.jsftemplating.annotation.HandlerOutput;
0068:        import com.sun.jsftemplating.layout.descriptors.handler.HandlerContext;
0069:        import com.sun.webui.jsf.component.HiddenField;
0070:        import com.sun.webui.jsf.component.PasswordField;
0071:        import com.sun.webui.jsf.component.Property;
0072:        import com.sun.webui.jsf.component.PropertySheet;
0073:        import com.sun.webui.jsf.component.PropertySheetSection;
0074:        import com.sun.webui.jsf.component.Table;
0075:        import com.sun.webui.jsf.component.TableRowGroup;
0076:        import com.sun.webui.jsf.component.TextField;
0077:
0078:        /**
0079:         * Provides jsftemplating handlers for Component Configuration setting
0080:         *
0081:         * @author   Sun Microsystems Inc.
0082:         */
0083:        public final class ComponentConfigurationHandlers {
0084:
0085:            /**
0086:             * private CTOR to preven instantiation or subclassing
0087:             */
0088:            private ComponentConfigurationHandlers() {
0089:            }
0090:
0091:            /**
0092:             * <p>
0093:             *
0094:             * This handler saves the values for all the attributes in the Server
0095:             * Logging Levels Page.</p>
0096:             *
0097:             * @param handlerCtx  Description of Parameter
0098:             */
0099:            @Handler(id="jbiSaveComponentConfiguration")
0100:            public static void jbiSaveComponentConfiguration(
0101:                    HandlerContext handlerCtx) {
0102:                //        ConfigurationBean configurationBean = BeanUtilities.getConfigurationBean();
0103:                //        AlertBean alertBean = BeanUtilities.getAlertBean();
0104:                //        configurationBean.save();
0105:            }
0106:
0107:            /**
0108:             * <p>
0109:             *
0110:             * This handler saves the updated component runtime configuration </p>
0111:             *
0112:             * @param handlerCtx  Description of Parameter
0113:             */
0114:            @Handler(id="jbiSaveCompRuntimeConfig")
0115:            public static void jbiSaveCompRuntimeConfig(
0116:                    HandlerContext handlerCtx) {
0117:                // TBD
0118:            }
0119:
0120:            /**
0121:             * <p>
0122:             *
0123:             * This handler saves the values for all the attributes in the Server
0124:             * Logging Levels Page.</p>
0125:             *
0126:             * @param handlerCtx  Description of Parameter
0127:             */
0128:            @Handler(id="jbiSaveInstancesComponentConfiguration",input={@HandlerInput(name="targets",type=String.class,required=true)})
0129:            public static void jbiSaveInstancesComponentConfiguration(
0130:                    HandlerContext handlerCtx) {
0131:                String[] targets = (String[]) handlerCtx
0132:                        .getInputValue("targets");
0133:                //        ConfigurationBean configurationBean = BeanUtilities.getConfigurationBean();
0134:                //        AlertBean alertBean = BeanUtilities.getAlertBean();
0135:                //        configurationBean.save(targets);
0136:            }
0137:
0138:            /**
0139:             * <p>
0140:             *
0141:             * For a given (started) component type and name and a given instance,
0142:             * updates the ShowBean with the list of application configuration names.
0143:             * </p> <p>
0144:             *
0145:             * If the component has not targets, or the selected instance is not
0146:             * started, or the component is not started, or the component has not
0147:             * provided an application configuration MBean, returns an alert summary
0148:             * and details. </p> <p>
0149:             *
0150:             * Input value: "requestedCompName" -- Type: <code> java.lang.String</code>
0151:             * the requested component name</p> <p>
0152:             *
0153:             * Input value: "compType" -- Type: <code> java.lang.String</code> the
0154:             * requested component type</p> <p>
0155:             *
0156:             * Input value: "requestedInstanceName" -- Type: <code> java.lang.String</code>
0157:             * the requested instance name, or null</p> <p>
0158:             *
0159:             * Output value: "alertDetails" -- Type: <code>String</code> alert
0160:             * details, if needed</p> <p>
0161:             *
0162:             * Output value: "alertSummary" -- Type: <code>String</code> alert
0163:             * summary, if neeed</p> <p>
0164:             *
0165:             * Output value: "instanceList" -- Type: <code>SelectItem[]</code>list of
0166:             * instances to populate dropDown, if any</p> <p>
0167:             *
0168:             * Output value: "isAlertNeeded" -- Type: <code>java.lang.Boolean</code>
0169:             * true if alert should be displayed</p> <p>
0170:             *
0171:             * Output value: "isInstanceDropDownEnabled" -- Type: <code>java.lang.Boolean</code>
0172:             * true if the dropDown selection may be changed</p> <p>
0173:             *
0174:             * Output value: "selectedInstance" -- Type: <code>String</code>the
0175:             * currently selected instance, or a default</p>
0176:             *
0177:             * @param handlerCtx  Description of Parameter
0178:             */
0179:            @Handler(id="jbiSetCompAppConfigNamesData",input={@HandlerInput(name="compName",type=String.class,required=true),@HandlerInput(name="compType",type=String.class,required=true),@HandlerInput(name="instance",type=String.class,required=true)},output={@HandlerOutput(name="alertDetails",type=String.class),@HandlerOutput(name="alertSummary",type=String.class),@HandlerOutput(name="instanceList",type=SelectItem[].class),@HandlerOutput(name="isAlertNeeded",type=Boolean.class),@HandlerOutput(name="isInstanceDropDownEnabled",type=Boolean.class),@HandlerOutput(name="selectedInstance",type=String.class)})
0180:            public static void jbiSetCompAppConfigNamesData(
0181:                    HandlerContext handlerCtx) {
0182:                String compName = (String) handlerCtx.getInputValue("compName");
0183:                String compType = (String) handlerCtx.getInputValue("compType");
0184:                String instance = (String) handlerCtx.getInputValue("instance");
0185:
0186:                sLog
0187:                        .fine("ComponentConfigurationHandlers.jbiSetCompAppConfigNamesData("
0188:                                + handlerCtx
0189:                                + "), compName="
0190:                                + compName
0191:                                + ", compType="
0192:                                + compType
0193:                                + ", instance="
0194:                                + instance);
0195:
0196:                String alertDetails = "";
0197:                String alertSummary = "";
0198:
0199:                List allInstances = ClusterUtilities.findAllNonDomainTargets();
0200:                String[] instances = new String[0];
0201:                instances = (String[]) allInstances.toArray(instances);
0202:                SelectItem[] instanceList = ConfigurationHandlers
0203:                        .getOptions(instances);
0204:
0205:                boolean isAlertNeeded = false;
0206:                boolean isInstanceDropDownEnabled = true;
0207:                String selectedInstance = instance;
0208:
0209:                ShowBean showBean = BeanUtilities.getShowBean();
0210:                Properties statusProps = new Properties();
0211:
0212:                boolean isCompStartedOnInstance = showBean
0213:                        .isCompStartedOnInstance(compName, compType, instance,
0214:                                statusProps);
0215:                if (isCompStartedOnInstance) {
0216:                    // sets (or clears) table
0217:                    showBean.setCompAppConfigNamesTableData(compName, compType,
0218:                            instance);
0219:                } else {
0220:                    isAlertNeeded = true;
0221:                    alertSummary = (String) statusProps.get("alert-summary");
0222:                    if (null == alertSummary) {
0223:                        alertSummary = I18nUtilities
0224:                                .getResourceString("jbi.configuration.alert");
0225:                    }
0226:                    alertDetails = (String) statusProps.get("alert-details");
0227:                    if (null == alertDetails) {
0228:                        alertDetails = I18nUtilities
0229:                                .getResourceString("jbi.configuration.msgComponentDown");
0230:                    }
0231:                }
0232:
0233:                handlerCtx.setOutputValue("alertDetails", alertDetails);
0234:                handlerCtx.setOutputValue("alertSummary", alertSummary);
0235:                handlerCtx.setOutputValue("instanceList", instanceList);
0236:                handlerCtx.setOutputValue("isAlertNeeded", Boolean
0237:                        .toString(isAlertNeeded));
0238:                handlerCtx.setOutputValue("isInstanceDropDownEnabled", Boolean
0239:                        .toString(isInstanceDropDownEnabled));
0240:                handlerCtx.setOutputValue("selectedInstance", selectedInstance);
0241:
0242:                sLog
0243:                        .fine("ComponentConfigurationHandlers.jbiSetCompInstanceAppConfigNames(...)"
0244:                                + ", alertDetails="
0245:                                + alertDetails
0246:                                + ", alertSummary="
0247:                                + alertSummary
0248:                                + ", instanceList="
0249:                                + instanceList
0250:                                + ", isAlertNeeded="
0251:                                + isAlertNeeded
0252:                                + ", isInstanceDropDownEnabled="
0253:                                + isInstanceDropDownEnabled
0254:                                + ", selectedInstance=" + selectedInstance + "");
0255:            }
0256:
0257:            /**
0258:             * <p>
0259:             *
0260:             * For a given component and instance updates the <code>CompConfigBean</code>
0261:             * with a configuration property sheet of the requested configuration type
0262:             * (if any) <p>
0263:             *
0264:             * If the component has no targets, or the (possibly default) selected
0265:             * instance is not running, or the component is not started, or the
0266:             * component does not support the requested type of configuration, returns
0267:             * an alert summary and details. </p> <p  />
0268:             *
0269:             * <p>
0270:             *
0271:             * Input value: "compName" -- Type: <code> java.lang.String</code> the
0272:             * requested component name</p> <p>
0273:             *
0274:             * Input value: "compType" -- Type: <code> java.lang.String</code> the
0275:             * requested component type</p> <p>
0276:             *
0277:             * Input value: "configType" -- Type: <code> java.lang.String</code> the
0278:             * requested configuration data type, one of: <code>application</code>,
0279:             * <code>installation</code>, or <code>runtime</code></p> <p>
0280:             *
0281:             * Input value: "prevSelectedInstance" -- Type: <code> java.lang.String</code>
0282:             * the previous selected instance name, or <code>null</code> if this page
0283:             * is being loaded for the first time.</p> <p  />
0284:             *
0285:             * <p>
0286:             *
0287:             * Output value: "instancesList" -- Type: <code>SelectItem[]</code>
0288:             * instances, if any, to populate dropDown</p> <p>
0289:             *
0290:             * Output value: "isInstanceDropDownEnabled" -- Type: <code>java.lang.Boolean</code>
0291:             * true if the dropDown selection may be changed, set to false if the list
0292:             * contains one or zero choices</p> <p>
0293:             *
0294:             * Output value: "currSelectedInstance" -- Type: <code>String</code>the
0295:             * currently selected instance, or a default initial selection, or null if
0296:             * there are no targets for this component</p> <p>
0297:             *
0298:             * Output value: "isAlertNeeded" -- Type: <code>java.lang.Boolean</code>
0299:             * true if alert should be displayed</p> <p>
0300:             *
0301:             * Output value: "alertSummary" -- Type: <code>String</code> alert
0302:             * summary, if neeed</p> <p>
0303:             *
0304:             * Output value: "alertDetails" -- Type: <code>String</code> alert
0305:             * details, if needed</p>
0306:             *
0307:             * @param handlerCtx  Description of Parameter
0308:             */
0309:            @Handler(id="jbiSetCompConfigData",input={@HandlerInput(name="compName",type=String.class,required=true),@HandlerInput(name="compType",type=String.class,required=true),@HandlerInput(name="configType",type=String.class,required=true),@HandlerInput(name="prevSelectedInstance",type=String.class,required=true)},output={@HandlerOutput(name="instancesList",type=SelectItem[].class),@HandlerOutput(name="isInstanceDropDownEnabled",type=Boolean.class),@HandlerOutput(name="currSelectedInstance",type=String.class),@HandlerOutput(name="isAlertNeeded",type=Boolean.class),@HandlerOutput(name="alertSummary",type=String.class),@HandlerOutput(name="alertDetails",type=String.class)})
0310:            public static void jbiSetCompConfigData(HandlerContext handlerCtx) {
0311:                String compName = (String) handlerCtx.getInputValue("compName");
0312:                String compType = (String) handlerCtx.getInputValue("compType");
0313:                String configType = (String) handlerCtx
0314:                        .getInputValue("configType");
0315:                String prevSelectedInstance = (String) handlerCtx
0316:                        .getInputValue("prevSelectedInstance");
0317:
0318:                sLog
0319:                        .fine("ComponentConfigurationHandlers.jbiSetCompConfigData("
0320:                                + handlerCtx
0321:                                + "), compName="
0322:                                + compName
0323:                                + ", compType="
0324:                                + compType
0325:                                + ", configType="
0326:                                + configType
0327:                                + ", prevSelectedInstance="
0328:                                + prevSelectedInstance);
0329:
0330:                String alertDetails = AlertBean.ALERT_DETAIL_NONE;
0331:                String alertSummary = AlertBean.ALERT_SUMMARY_NONE;
0332:
0333:                String compState = null;
0334:                String currSelectedInstance = null;
0335:                List instanceNamesList = null;
0336:                String instanceState = null;
0337:                SelectItem[] instancesList = new SelectItem[0];
0338:                boolean isAlertNeeded = false;
0339:                boolean isConfigDataAvailable = false;
0340:                boolean isConfigTypeSupported = false;
0341:                boolean isInstanceDropDownEnabled = false;
0342:                boolean isInternalError = false;
0343:
0344:                /*
0345:                 *  ************************* (begin) commented-out section *************************
0346:                 *  // try
0347:                 *  //  get instance list for comp name/type
0348:                 *  try
0349:                 *  {
0350:                 *  (end) commented-out section *************************
0351:                 */
0352:                instanceNamesList = CompConfigUtils.getInstances(compName,
0353:                        compType);
0354:
0355:                // if there is an instance list,
0356:                //    get currSel for instance list for comp name/type and prev selection
0357:                if ((null != instanceNamesList)
0358:                        && (0 < instanceNamesList.size())) {
0359:                    // (use the prevSelectedInstance if valid, regardless of instance
0360:                    // state or component state; if prevSelectedInstance is null or
0361:                    // invalid, select "server" (if valid) or the "first" started
0362:                    // instance or (if none started) just the "first" instance.
0363:                    currSelectedInstance = CompConfigUtils
0364:                            .selectCurrentInstance(compName, compType,
0365:                                    instanceNamesList, prevSelectedInstance);
0366:                }
0367:
0368:                // if there is a currently selected instance
0369:                //    get its running state
0370:                if (null != currSelectedInstance) {
0371:                    instanceState = CompConfigUtils
0372:                            .getInstanceState(currSelectedInstance);
0373:                }
0374:
0375:                // If the instance is running,
0376:                //    gets the state for comp name/type on instance (-> target)
0377:                if ("running".equals(instanceState)) {
0378:                    compState = CompConfigUtils.getCompState(compName,
0379:                            compType, currSelectedInstance);
0380:                }
0381:
0382:                // If the component is started on the instance,
0383:                //    determins if the configuration type is supported
0384:                if ("started".equals(compState)) {
0385:                    isConfigTypeSupported = CompConfigUtils
0386:                            .isConfigTypeSupported(configType, compName,
0387:                                    compType, currSelectedInstance);
0388:                }
0389:
0390:                //  if capable
0391:                //    set PS for comp name/type on instance for config type
0392:                if (isConfigTypeSupported) {
0393:                    isConfigDataAvailable = CompConfigUtils.setConfigPS(
0394:                            configType, compName, compType,
0395:                            currSelectedInstance);
0396:                }
0397:                /*
0398:                 *  ************************* (begin) commented-out section *************************
0399:                 *  }
0400:                 *  // catch exception
0401:                 *  //    set/log exception
0402:                 *  catch (Exception ex)
0403:                 *  {
0404:                 *  isInternalError = true;
0405:                 *  // TBD log exception
0406:                 *  }
0407:                 *  // check results
0408:                 *  //    if successful, set data PS
0409:                 *  //    else if unsuccessful, set alert and n/a PS
0410:                 *  //    else if not capable, set n/a PS
0411:                 *  //    else if not started, set alert and n/a PS
0412:                 *  //    else if no instance, set alert and n/a PS
0413:                 *  //    else if no targets, set alert and n/a PS
0414:                 *  //    else if exception, set alert and n/a PS
0415:                 *  //TBDsetResults(handlerCtx);
0416:                 *  // 1. prepare alert summary for requested config type
0417:                 *  // 2.
0418:                 *  // I. get all instances and selected instance for the specified component
0419:                 *  try
0420:                 *  {
0421:                 *  // IA. gets all instances
0422:                 *  List instanceNamesList =
0423:                 *  CompConfigUtils.getInstances(compName,
0424:                 *  compType);
0425:                 *  // IB. if there are instances, gets the current selected instance
0426:                 *  if ((null != instanceNamesList)
0427:                 *  &&(0 < instanceNamesList.size()))
0428:                 *  {
0429:                 *  // (use the prevSelectedInstance if valid, regardless of instance
0430:                 *  // state or component state; if prevSelectedInstance is null or
0431:                 *  // invalid, select "server" (if valid) or the "first" started
0432:                 *  // instance or (if none started) just the "first" instance.
0433:                 *  currSelectedInstance =
0434:                 *  CompConfigUtils.selectCurrentInstance(compName,
0435:                 *  compType,
0436:                 *  instanceNamesList,
0437:                 *  prevSelectedInstance);
0438:                 *  }
0439:                 *  else
0440:                 *  {
0441:                 *  isAlertNeeded =
0442:                 *  setAlertBean(alertSummary,
0443:                 *  "TBD no targets");
0444:                 *  }
0445:                 *  if (!isAlertNeeded)
0446:                 *  {
0447:                 *  // if there are targets, yet none could be selected,
0448:                 *  // consider this an internal error
0449:                 *  if (null == currSelectedInstance)
0450:                 *  {
0451:                 *  currSelectedInstance =
0452:                 *  prevSelectedInstance;
0453:                 *  // show alert "internal error"
0454:                 *  isAlertNeed =
0455:                 *  setAlertBean(alertSummary,
0456:                 *  "internal error");
0457:                 *  }
0458:                 *  }
0459:                 *  }
0460:                 *  catch (Exception ex)
0461:                 *  {
0462:                 *  // show alert "internal error"
0463:                 *  isAlertNeeded =
0464:                 *  setAlertBean(alertSummary,
0465:                 *  "TBD caught exception");
0466:                 *  // TBD log exception
0467:                 *  }
0468:                 *  // II. if no error, check component state and capabilities
0469:                 *  if (!isAlertNeeded)
0470:                 *  {
0471:                 *  boolean isConfigTypeSupported = false;
0472:                 *  boolean isCompStartedOnInstance =
0473:                 *  CompConfigUtils.isCompStartedOnInstance(compName,
0474:                 *  compType,
0475:                 *  currSelectedInstance);
0476:                 *  if (!isCompStartedOnInstance)
0477:                 *  {
0478:                 *  isAlertNeeded =
0479:                 *  setAlertBean(alertSummary,
0480:                 *  "TBD component not started"); // TBD inserts
0481:                 *  }
0482:                 *  else if ("application".equalsIgnoreCase(configType))
0483:                 *  {
0484:                 *  isConfigTypeSupported =
0485:                 *  CompConfuigUtils.isAppConfigSupported(compName,
0486:                 *  compType,
0487:                 *  currSelectedInstance);
0488:                 *  if (!isConfigTypeSupported)
0489:                 *  {
0490:                 *  isAlertNeeded = true;
0491:                 *  alertSummary = "TBD app config not available";
0492:                 *  alertDetails = "comp " + compName +
0493:                 *  " does not support application configuration";
0494:                 *  }
0495:                 *  }
0496:                 *  else if ("installation".equalsIgnoreCase(configType))
0497:                 *  {
0498:                 *  isConfigTypeSupported =
0499:                 *  CompConfuigUtils.isInstallConfigSupported(compName,
0500:                 *  compType,
0501:                 *  currSelectedInstance);
0502:                 *  if (!isConfigTypeSupported)
0503:                 *  {
0504:                 *  isAlertNeeded = true;
0505:                 *  alertSummary = "TBD component installation config not available";
0506:                 *  alertDetails = "TBD comp " + compName +
0507:                 *  " does not support installation configuration";
0508:                 *  }
0509:                 *  }
0510:                 *  else if ("runtime".equalsIgnoreCase(configType))
0511:                 *  {
0512:                 *  isConfigTypeSupported =
0513:                 *  CompConfuigUtils.isRuntimeConfigSupported(compName,
0514:                 *  compType,
0515:                 *  currSelectedInstance);
0516:                 *  if (!isConfigTypeSupported)
0517:                 *  {
0518:                 *  isAlertNeeded = true;
0519:                 *  alertSummary = "TBD component config not available";
0520:                 *  alertDetails = "TBD comp " + compName +
0521:                 *  " does not support component configuration";
0522:                 *  }
0523:                 *  }
0524:                 *  else
0525:                 *  {
0526:                 *  isAlertNeeded = true;
0527:                 *  alertSummary = "TBD internal error";
0528:                 *  alertDetails = "TBD unrecognized configType " + configType;
0529:                 *  }
0530:                 *  }
0531:                 *  // III. if no error, obtain requested configuration data
0532:                 *  // TBD
0533:                 *  // 1. if specified component has no targets (and therefore no instances), show alert
0534:                 *  if (true)
0535:                 *  {
0536:                 *  isAlertNeeded = true;
0537:                 *  alertSummary = "I18n TBD: component configuration not available";
0538:                 *  alertDetails = "I18n TBD: " + compName + " not installed to any targets";
0539:                 *  }
0540:                 *  else
0541:                 *  {
0542:                 *  // 2a. if no target selected so far,
0543:                 *  //     and server running and component installed on server, select server
0544:                 *  // 2b. if no target selected so far,
0545:                 *  //     and component installed on any targets, select "first" running instance
0546:                 *  // 2c. no target selected so far,
0547:                 *  //     and component installed on any targets, select "first" instance
0548:                 *  // 3a. if selected instance is not running, show alert
0549:                 *  // 3b. else if component is not started on selected instance, show alert
0550:                 *  // 3c. else if component does not support the requested config type, show alert
0551:                 *  // 4. else happy path: set requested config type PS on bean
0552:                 *  // 4a. if component application configuration requested, set that
0553:                 *  // 4b. else if component installation configuration requested, set that
0554:                 *  // 4c. else if component runtime configuration requested, set that
0555:                 *  // 4d. else internal error
0556:                 *  CompConfigBean compConfigBean =
0557:                 *  BeanUtilities.getCompConfigBean();
0558:                 *  if ("runtime".equalsIgnoreCase(configType))
0559:                 *  {
0560:                 *  compConfigBean
0561:                 *  .setCompRuntimeConfigPS(JSFUtils
0562:                 *  .getCompRuntimeConfigPS(compName,
0563:                 *  compType,
0564:                 *  currSelectedInstance));
0565:                 *  }
0566:                 *  }
0567:                 *  (end) commented-out section *************************
0568:                 */
0569:
0570:                handlerCtx.setOutputValue("instancesList", instancesList);
0571:                handlerCtx.setOutputValue("isInstanceDropDownEnabled",
0572:                        isInstanceDropDownEnabled);
0573:                handlerCtx.setOutputValue("currSelectedInstance",
0574:                        currSelectedInstance);
0575:                handlerCtx.setOutputValue("isAlertNeeded", Boolean
0576:                        .toString(isAlertNeeded));
0577:                handlerCtx.setOutputValue("alertSummary", alertSummary);
0578:                handlerCtx.setOutputValue("alertDetails", alertDetails);
0579:
0580:                sLog
0581:                        .fine("ComponentConfigurationHandlers.jbiSetCompConfigData(...)"
0582:                                + ", instancesList="
0583:                                + instancesList
0584:                                + ", isInstanceDropDownEnabled="
0585:                                + isInstanceDropDownEnabled
0586:                                + ", currSelectedInstance="
0587:                                + currSelectedInstance
0588:                                + ", isAlertNeeded="
0589:                                + isAlertNeeded
0590:                                + ", alertSummary="
0591:                                + alertSummary
0592:                                + ", alertDetails="
0593:                                + alertDetails + "");
0594:            }
0595:
0596:            /**
0597:             * <p>
0598:             *
0599:             * For a given component name and an application configuration name,
0600:             * returns the properties. <p>
0601:             *
0602:             * Input value: "action" -- Type: <code> java.lang.String</code> 'create'
0603:             * or 'edit' for new or exisitng app configs <p>
0604:             *
0605:             * Input value: "appConfigName" -- Type: <code> java.lang.String</code>
0606:             * the application configuration name</p> <p>
0607:             *
0608:             * Input value: "compName" -- Type: <code> java.lang.String</code> the
0609:             * component name</p> <p>
0610:             *
0611:             * Input value: "instanceName" -- Type: <code> java.lang.String</code> the
0612:             * instance name</p> <p>
0613:             *
0614:             * Input value: "propertySheet" -- Type: <code>com.sun.webui.jsf.component.PropertySheet</code>
0615:             * the edited property sheet</p> <p>
0616:             *
0617:             * Input value: "redirectOnFailure" -- Type: <code> java.lang.String</code>
0618:             * what to show if it fails <p>
0619:             *
0620:             * Input value: "redirectOnSuccess" -- Type: <code> java.lang.String</code>
0621:             * what to show if it works <p>
0622:             *
0623:             * Output value: "alertDetails" -- Type: <code>String</code>details, if
0624:             * failure</p> <p>
0625:             *
0626:             * Output value: "alertSummary" -- Type: <code>String</code>summary, if
0627:             * failure</p> <p>
0628:             *
0629:             * Output value: "isAlertNeeded" -- Type: <code>java.lang.Boolean</code>
0630:             * show alert or not</p> <p>
0631:             *
0632:             * Output value: "redirectTo" -- Type: <code>String</code> Where to go
0633:             * next, based on success/failure</p> Sets the application configuration
0634:             * properties into the ShowBean</p>
0635:             *
0636:             * @param handlerCtx  Description of Parameter
0637:             */
0638:            @Handler(id="jbiSaveCompAppConfigChanges",input={@HandlerInput(name="action",type=String.class,required=true),@HandlerInput(name="appConfigName",type=String.class,required=true),@HandlerInput(name="compName",type=String.class,required=true),@HandlerInput(name="instanceName",type=String.class,required=true),@HandlerInput(name="redirectOnFailure",type=String.class,required=true),@HandlerInput(name="redirectOnSuccess",type=String.class,required=true),@HandlerInput(name="propertySheet",type=PropertySheet.class,required=true)},output={@HandlerOutput(name="isAlertNeeded",type=Boolean.class),@HandlerOutput(name="alertDetails",type=String.class),@HandlerOutput(name="alertSummary",type=String.class),@HandlerOutput(name="redirectTo",type=String.class)})
0639:            public static void jbiSaveCompAppConfigChanges(
0640:                    HandlerContext handlerCtx) {
0641:                String action = (String) handlerCtx.getInputValue("action");
0642:                String appConfigName = (String) handlerCtx
0643:                        .getInputValue("appConfigName");
0644:                String compName = (String) handlerCtx.getInputValue("compName");
0645:                String instanceName = (String) handlerCtx
0646:                        .getInputValue("instanceName");
0647:                String redirectOnFailure = (String) handlerCtx
0648:                        .getInputValue("redirectOnFailure");
0649:                String redirectOnSuccess = (String) handlerCtx
0650:                        .getInputValue("redirectOnSuccess");
0651:                PropertySheet propertySheet = (PropertySheet) handlerCtx
0652:                        .getInputValue("propertySheet");
0653:
0654:                String alertDetails = "";
0655:                String alertSummary = "";
0656:                boolean isAlertNeeded = false;
0657:                String redirectTo = redirectOnSuccess;
0658:
0659:                sLog
0660:                        .fine("ComponentConfigurationHandlers.jbiSaveCompAppConfigChanges("
0661:                                + handlerCtx
0662:                                + ")"
0663:                                + ", action="
0664:                                + action
0665:                                + ", appConfigName="
0666:                                + appConfigName
0667:                                + ", compName="
0668:                                + compName
0669:                                + ", instanceName="
0670:                                + instanceName
0671:                                + ", redirectOnFailure="
0672:                                + redirectOnFailure
0673:                                + ", redirectOnSuccess="
0674:                                + redirectOnSuccess
0675:                                + ", propertySheet="
0676:                                + propertySheet);
0677:
0678:                Properties editedProps = new Properties();
0679:
0680:                Properties statusProps = new Properties();
0681:
0682:                if (null != propertySheet) {
0683:                    List pssList = propertySheet.getChildren();
0684:
0685:                    List selectionProperties = ((PropertySheetSection) pssList
0686:                            .get(0)).getChildren();
0687:
0688:                    // extract new configuration name
0689:                    if ("create".equals(action)) {
0690:                        for (int i = 0; i < selectionProperties.size(); ++i) {
0691:                            Property p = (Property) selectionProperties.get(i);
0692:                            List subElts = p.getChildren();
0693:                            for (int j = 0; j < subElts.size(); ++j) {
0694:                                UIComponent uiComp = (UIComponent) subElts
0695:                                        .get(j);
0696:                                if (uiComp instanceof  TextField) {
0697:                                    TextField textField = (TextField) uiComp;
0698:                                    if ("configNameTextField".equals(textField
0699:                                            .getId())) {
0700:                                        appConfigName = (String) textField
0701:                                                .getText();
0702:                                        sLog
0703:                                                .fine("ComponentConfigurationHandlers.jbiSaveCompAppConfigChanges("
0704:                                                        + "action=create, ...), appConfigName="
0705:                                                        + appConfigName);
0706:
0707:                                    }
0708:                                }
0709:                            }
0710:                        }
0711:                    }
0712:
0713:                    List propertiesList = ((PropertySheetSection) pssList
0714:                            .get(1)).getChildren();
0715:
0716:                    for (int i = 0; i < propertiesList.size(); ++i) {
0717:                        Property p = (Property) propertiesList.get(i);
0718:                        List subElts = p.getChildren();
0719:                        String fieldName = "";
0720:                        String fieldValue = "";
0721:                        for (int j = 0; j < subElts.size(); ++j) {
0722:                            UIComponent uiComp = (UIComponent) subElts.get(j);
0723:                            sLog
0724:                                    .fine("ComponentConfigurationHandlers.jbiSaveCompAppConfigChanges(...), subElt["
0725:                                            + j + "]=" + uiComp);
0726:                            if (uiComp instanceof  TextField) {
0727:                                TextField textField = (TextField) uiComp;
0728:                                fieldValue = (String) textField.getText();
0729:                            } else if (uiComp instanceof  PasswordField) {
0730:                                PasswordField passwordField = (PasswordField) uiComp;
0731:                                fieldValue = (String) passwordField.getText();
0732:                            } else if (uiComp instanceof  Table) {
0733:                                Table table = (Table) uiComp;
0734:                                TableRowGroup trg = (TableRowGroup) table
0735:                                        .getChildren().get(0);
0736:                                RowKey[] rows = trg.getRowKeys();
0737:                                for (int k = 0; k < rows.length; ++k) {
0738:                                    RowKey row = rows[k];
0739:                                    sLog
0740:                                            .fine("ComponentConfigurationHandlers.jbiSaveCompAppConfigChanges k="
0741:                                                    + k + ", row=" + row);
0742:                                }
0743:                            }
0744:                            // must check for this last since other types
0745:                            // subclass this type
0746:                            else if (uiComp instanceof  HiddenField) {
0747:                                HiddenField hiddenField = (HiddenField) uiComp;
0748:                                fieldName = (String) hiddenField.getText();
0749:
0750:                            }
0751:
0752:                            sLog
0753:                                    .fine("ComponentConfigurationHandlers.jbiSaveCompAppConfigChanges(...), fieldName="
0754:                                            + fieldName
0755:                                            + ", fieldValue="
0756:                                            + fieldValue);
0757:                            if ((null != fieldName) && !"".equals(fieldName)) {
0758:                                editedProps.setProperty(fieldName, fieldValue);
0759:                            }
0760:                        }
0761:                    }
0762:
0763:                    ShowBean showBean = BeanUtilities.getShowBean();
0764:
0765:                    showBean.saveCompAppConfigProps(action, compName,
0766:                            instanceName, appConfigName, editedProps,
0767:                            statusProps);
0768:                }
0769:
0770:                String failureResult = (String) statusProps
0771:                        .get("failure-result");
0772:                if (null != failureResult) {
0773:                    alertDetails = failureResult;
0774:                    alertSummary = "I18n TBD Save Failed";
0775:                    isAlertNeeded = true;
0776:                    redirectTo = redirectOnFailure;
0777:                }
0778:
0779:                handlerCtx.setOutputValue("alertDetails", alertDetails);
0780:                handlerCtx.setOutputValue("alertSummary", alertSummary);
0781:                handlerCtx.setOutputValue("isAlertNeeded", Boolean
0782:                        .toString(isAlertNeeded));
0783:                handlerCtx.setOutputValue("redirectTo", redirectTo);
0784:
0785:                sLog
0786:                        .fine("ComponentConfigPropsTableHandler.jbiSaveCompAppConfigChanges("
0787:                                + handlerCtx
0788:                                + ")"
0789:                                + ", alertDetails="
0790:                                + alertDetails
0791:                                + ", alertSummary="
0792:                                + alertSummary
0793:                                + ", isAlertNeeded="
0794:                                + isAlertNeeded + ", redirectTo=" + redirectTo);
0795:            }
0796:
0797:            /**
0798:             * <p>
0799:             *
0800:             * For a given component name saves the edited variables <p>
0801:             *
0802:             * Input value: "compName" -- Type: <code> java.lang.String</code> the
0803:             * component name</p> <p>
0804:             *
0805:             * Input value: "instanceName" -- Type: <code> java.lang.String</code> the
0806:             * instance name</p> <p>
0807:             *
0808:             * Output value: "alertDetails" -- Type: <code>String</code>details, if
0809:             * failure</p> <p>
0810:             *
0811:             * Output value: "alertSummary" -- Type: <code>String</code>summary, if
0812:             * failure</p> <p>
0813:             *
0814:             * Output value: "isAlertNeeded" -- Type: <code>java.lang.Boolean</code>
0815:             * show alert or not</p> Sets the component application variables
0816:             * properties into the ShowBean</p>
0817:             *
0818:             * @param handlerCtx  Description of Parameter
0819:             */
0820:            @Handler(id="jbiSaveCompAppVarsChanges",input={@HandlerInput(name="compName",type=String.class,required=true),@HandlerInput(name="instanceName",type=String.class,required=true),@HandlerInput(name="tableRowGroup",type=TableRowGroup.class,required=true)},output={@HandlerOutput(name="isAlertNeeded",type=Boolean.class),@HandlerOutput(name="alertDetails",type=String.class),@HandlerOutput(name="alertSummary",type=String.class)})
0821:            public static void jbiSaveCompAppVarsChanges(
0822:                    HandlerContext handlerCtx) {
0823:                String compName = (String) handlerCtx.getInputValue("compName");
0824:                String instanceName = (String) handlerCtx
0825:                        .getInputValue("instanceName");
0826:                TableRowGroup trg = (TableRowGroup) handlerCtx
0827:                        .getInputValue("tableRowGroup");
0828:
0829:                String alertDetails = "";
0830:                String alertSummary = "";
0831:                boolean isAlertNeeded = false;
0832:
0833:                sLog
0834:                        .fine("ComponentConfigurationHandlers.jbiSaveCompAppVarsChanges("
0835:                                + handlerCtx
0836:                                + ")"
0837:                                + ", compName="
0838:                                + compName
0839:                                + ", instanceName="
0840:                                + instanceName
0841:                                + ", trg="
0842:                                + trg);
0843:
0844:                Properties editedProps = new Properties();
0845:
0846:                ObjectListDataProvider dp = (ObjectListDataProvider) trg
0847:                        .getSourceData();
0848:
0849:                if (null != dp) {
0850:                    try {
0851:                        dp.commitChanges();
0852:
0853:                        List<CompAppConfig> origList = dp.getList();
0854:                        sLog
0855:                                .fine("ComponentConfigurationHandlers.jbiSaveCompAppVarsChanges(...)"
0856:                                        + ", origList=" + origList);
0857:
0858:                        FieldKey fkName = dp.getFieldKey("name");
0859:                        FieldKey fkType = dp.getFieldKey("type");
0860:                        FieldKey fkValue = dp.getFieldKey("value");
0861:
0862:                        RowKey[] rowKeys = trg.getRowKeys();
0863:
0864:                        sLog
0865:                                .fine("ComponentConfigurationHandlers.jbiSaveCompAppVarsChanges(...)"
0866:                                        + ", fkName="
0867:                                        + fkName
0868:                                        + ", fkValue="
0869:                                        + fkValue + ", rowKeys=" + rowKeys);
0870:
0871:                        for (int cnt = 0; cnt < rowKeys.length; cnt++) {
0872:                            String propName = (String) dp.getValue(fkName,
0873:                                    rowKeys[cnt]);
0874:
0875:                            String propType = (String) dp.getValue(fkType,
0876:                                    rowKeys[cnt]);
0877:
0878:                            String propValue = (String) dp.getValue(fkValue,
0879:                                    rowKeys[cnt]);
0880:
0881:                            sLog
0882:                                    .fine("ComponentConfigurationHandlers.jbiSaveCompAppVarsChanges(...)"
0883:                                            + ", propName="
0884:                                            + propName
0885:                                            + ", propType="
0886:                                            + propType
0887:                                            + ", propValue=" + propValue);
0888:
0889:                            editedProps.put(propName, (propType + propValue));
0890:                        }
0891:                    } catch (Exception ex) {
0892:                        sLog
0893:                                .log(
0894:                                        Level.FINE,
0895:                                        ("ComponentConfigurationHandlers.jbiSaveCompAppVarsChanges(), caught ex=" + ex),
0896:                                        ex);
0897:                    }
0898:                } else {
0899:                    // TBD
0900:                }
0901:                sLog
0902:                        .fine("ComponentConfigurationHandlers.jbiSaveCompAppVarsChanges(...)"
0903:                                + ", editedProps=" + editedProps);
0904:
0905:                Properties updateResult = AppVarUtils.update(compName,
0906:                        instanceName, editedProps);
0907:
0908:                // TBD error processing
0909:                alertDetails = "not implemented";
0910:                alertSummary = "Save failed";
0911:                isAlertNeeded = true;
0912:
0913:                handlerCtx.setOutputValue("alertDetails", alertDetails);
0914:                handlerCtx.setOutputValue("alertSummary", alertSummary);
0915:                handlerCtx.setOutputValue("isAlertNeeded", Boolean
0916:                        .toString(isAlertNeeded));
0917:
0918:                sLog
0919:                        .fine("ComponentConfigPropsTableHandler.jbiSaveCompAppVarsChanges("
0920:                                + handlerCtx
0921:                                + ")"
0922:                                + ", alertDetails="
0923:                                + alertDetails
0924:                                + ", alertSummary="
0925:                                + alertSummary
0926:                                + ", isAlertNeeded="
0927:                                + isAlertNeeded);
0928:            }
0929:
0930:            /**
0931:             * <p>
0932:             *
0933:             * For a given component name and an application configuration name,
0934:             * returns the properties. <p>
0935:             *
0936:             * Input value: "appConfigName" -- Type: <code> java.lang.String</code>
0937:             * the application configuration name</p> <p>
0938:             *
0939:             * Input value: "compName" -- Type: <code> java.lang.String</code> the
0940:             * component name</p> <p>
0941:             *
0942:             * Input value: "instanceName" -- Type: <code> java.lang.String</code> the
0943:             * instance name</p> Sets the application configuration properties into
0944:             * the ShowBean</p>
0945:             *
0946:             * @param handlerCtx  Description of Parameter
0947:             */
0948:            @Handler(id="jbiSetAppConfig",input={@HandlerInput(name="appConfigName",type=String.class,required=true),@HandlerInput(name="compName",type=String.class,required=true),@HandlerInput(name="instanceName",type=String.class,required=true)})
0949:            public static void jbiSetAppConfig(HandlerContext handlerCtx) {
0950:                String compName = (String) handlerCtx.getInputValue("compName");
0951:                String instanceName = (String) handlerCtx
0952:                        .getInputValue("instanceName");
0953:                String appConfigName = (String) handlerCtx
0954:                        .getInputValue("appConfigName");
0955:
0956:                sLog.fine("ComponentConfigPropsTableHandler.jbiGetAppConfig("
0957:                        + handlerCtx + "), compName=" + compName
0958:                        + ", instanceName=" + instanceName + ", appConfigName="
0959:                        + appConfigName);
0960:
0961:                Properties status = AppConfigUtils.checkAppConfig(instanceName,
0962:                        compName, appConfigName);
0963:                // TBD parse status for success-result or failure-result="alert details"
0964:
0965:                // if success
0966:
0967:                ShowBean showBean = BeanUtilities.getShowBean();
0968:                showBean.setCompAppConfigProps(compName, instanceName,
0969:                        appConfigName);
0970:                // if failure, set alert
0971:
0972:            }
0973:
0974:            /**
0975:             * <p>
0976:             *
0977:             * For a given component name creates an empty set of properties <p>
0978:             *
0979:             * Input value: "compName" -- Type: <code> java.lang.String</code> the
0980:             * component name</p> <p>
0981:             *
0982:             * Input value: "instanceName" -- Type: <code> java.lang.String</code> the
0983:             * instance name</p> Sets the new application configuration properties
0984:             * into the ShowBean</p>
0985:             *
0986:             * @param handlerCtx  Description of Parameter
0987:             */
0988:            @Handler(id="jbiSetNewAppConfig",input={@HandlerInput(name="compName",type=String.class,required=true),@HandlerInput(name="instanceName",type=String.class,required=true)})
0989:            public static void jbiSetNewAppConfig(HandlerContext handlerCtx) {
0990:                String compName = (String) handlerCtx.getInputValue("compName");
0991:                String instanceName = (String) handlerCtx
0992:                        .getInputValue("instanceName");
0993:
0994:                sLog
0995:                        .fine("ComponentConfigPropsTableHandler.jbiSetNewAppConfig("
0996:                                + handlerCtx
0997:                                + "), compName="
0998:                                + compName
0999:                                + ", instanceName=" + instanceName);
1000:
1001:                ShowBean showBean = BeanUtilities.getShowBean();
1002:                showBean.setNewCompAppConfigProps(compName, instanceName);
1003:            }
1004:
1005:            /**
1006:             * <p>
1007:             *
1008:             * Returns Component Variables data to populate table rows in a List of
1009:             * HashMaps, each HashMap containing the name, type, and value.</p> <p>
1010:             *
1011:             * Input value: "compName" -- Type: <code> java.lang.String</code> the
1012:             * component name</p> <p>
1013:             *
1014:             * Input value: "instanceName" -- Type: <code> java.lang.String</code> the
1015:             * instance name</p> <p>
1016:             *
1017:             * Output value: "TableList" -- Type: <code>java.util.List</code>/</p>
1018:             *
1019:             * @param handlerCtx  Description of Parameter
1020:             */
1021:            @Handler(id="jbiGetCompVarsTableList",input={@HandlerInput(name="compName",type=String.class,required=true),@HandlerInput(name="instanceName",type=String.class,required=true)},output={@HandlerOutput(name="TableList",type=List.class)})
1022:            public static void jbiGetCompVarsTableList(HandlerContext handlerCtx) {
1023:                List data = new ArrayList();
1024:
1025:                String compName = (String) handlerCtx.getInputValue("compName");
1026:                String instanceName = (String) handlerCtx
1027:                        .getInputValue("instanceName");
1028:
1029:                sLog
1030:                        .fine("ComponentConfigurationHandlers.jbiGetCompVarsTableList("
1031:                                + handlerCtx
1032:                                + "), compName="
1033:                                + compName
1034:                                + ", instanceName=" + instanceName);
1035:
1036:                // maps name to [type]value (or just to value)
1037:                Properties appVarsProps = AppVarUtils.getCompAppVars(compName,
1038:                        instanceName);
1039:
1040:                Iterator varsIt = appVarsProps.keySet().iterator();
1041:                while (varsIt.hasNext()) {
1042:                    String appVarName = (String) varsIt.next();
1043:                    String appVarOptTypeAndValue = (String) appVarsProps
1044:                            .get(appVarName);
1045:                    sLog
1046:                            .fine("ComponentConfigurationHandlers.jbiGetCompVarsTableList(), appVarName="
1047:                                    + appVarName
1048:                                    + ", appVarOptTypeAndValue="
1049:                                    + appVarOptTypeAndValue);
1050:
1051:                    String displayType = null;
1052:                    String appVarType = null;
1053:                    String appVarValue = null;
1054:
1055:                    if (0 == appVarOptTypeAndValue
1056:                            .indexOf(SharedConstants.APP_VAR_TYPE_BOOLEAN)) {
1057:                        displayType = I18nUtilities
1058:                                .getResourceString("jbi.show.comp.app.vars.typeIsBoolean");
1059:                        appVarType = SharedConstants.APP_VAR_TYPE_BOOLEAN;
1060:                        appVarValue = appVarOptTypeAndValue
1061:                                .substring(SharedConstants.APP_VAR_TYPE_BOOLEAN
1062:                                        .length());
1063:                        // ensure TRUE or FALSE when needed
1064:                        if (SharedConstants.APP_VAR_TYPE_BOOLEAN
1065:                                .equals(appVarType)) {
1066:                            if ("true".equalsIgnoreCase(appVarValue)) {
1067:                                appVarValue = "TRUE";
1068:                            } else {
1069:                                appVarValue = "FALSE";
1070:                            }
1071:                        }
1072:                    } else if (0 == appVarOptTypeAndValue
1073:                            .indexOf(SharedConstants.APP_VAR_TYPE_NUMBER)) {
1074:                        displayType = I18nUtilities
1075:                                .getResourceString("jbi.show.comp.app.vars.typeIsNumber");
1076:                        appVarType = SharedConstants.APP_VAR_TYPE_NUMBER;
1077:                        appVarValue = appVarOptTypeAndValue
1078:                                .substring(SharedConstants.APP_VAR_TYPE_NUMBER
1079:                                        .length());
1080:                    } else if (0 == appVarOptTypeAndValue
1081:                            .indexOf(SharedConstants.APP_VAR_TYPE_PASSWORD)) {
1082:                        displayType = I18nUtilities
1083:                                .getResourceString("jbi.show.comp.app.vars.typeIsPassword");
1084:                        appVarType = SharedConstants.APP_VAR_TYPE_PASSWORD;
1085:                        appVarValue = appVarOptTypeAndValue
1086:                                .substring(SharedConstants.APP_VAR_TYPE_PASSWORD
1087:                                        .length());
1088:                    } else {
1089:                        displayType = I18nUtilities
1090:                                .getResourceString("jbi.show.comp.app.vars.typeIsString");
1091:                        appVarType = SharedConstants.APP_VAR_TYPE_STRING;
1092:
1093:                        // if prefixed by [STRING] remove that
1094:                        if (0 == appVarOptTypeAndValue
1095:                                .indexOf(SharedConstants.APP_VAR_TYPE_STRING)) {
1096:                            appVarValue = appVarOptTypeAndValue
1097:                                    .substring(SharedConstants.APP_VAR_TYPE_STRING
1098:                                            .length());
1099:                        }
1100:                        // implicitly a String (not explicit type, or unrecognized type
1101:                        else {
1102:                            appVarValue = appVarOptTypeAndValue;
1103:                        }
1104:                    }
1105:
1106:                    sLog
1107:                            .fine("ComponentConfigurationHandlers.jbiGetCompVarsTableList()"
1108:                                    + ", displayType="
1109:                                    + displayType
1110:                                    + ", appVarValue=" + appVarValue);
1111:
1112:                    HashMap compVarsRow = new HashMap();
1113:                    compVarsRow.put("selected", false);
1114:                    compVarsRow.put("name", appVarName);
1115:                    compVarsRow.put("type", appVarType);
1116:                    compVarsRow.put("displayType", displayType);
1117:                    compVarsRow.put("value", appVarValue);
1118:                    compVarsRow.put("disabled", true);
1119:                    data.add(compVarsRow);
1120:                    sLog
1121:                            .finer("ComponentConfigurationHandlers.jbiGetCompVarsTableList()"
1122:                                    + ", selected="
1123:                                    + compVarsRow.get("selected")
1124:                                    + ", name="
1125:                                    + compVarsRow.get("name")
1126:                                    + ", type="
1127:                                    + compVarsRow.get("type")
1128:                                    + ", displayType="
1129:                                    + compVarsRow.get("displayType")
1130:                                    + ", value="
1131:                                    + compVarsRow.get("value")
1132:                                    + ", disabled="
1133:                                    + compVarsRow.get("disabled"));
1134:                }
1135:
1136:                sLog
1137:                        .fine("ComponentConfigurationHandlers.jbiGetCompVarsTableList(), data="
1138:                                + data);
1139:                handlerCtx.setOutputValue("TableList", data);
1140:            }
1141:
1142:            /**
1143:             * <p>
1144:             *
1145:             * Validates and adds a new component Application Variable name and type
1146:             * on the specified instance for the specified component. <p>
1147:             *
1148:             * Input value: "instance" -- Type: <code> java.lang.String</code> target
1149:             * instance <p>
1150:             *
1151:             * Input value: "component" -- Type: <code> java.lang.String</code> target
1152:             * component <p>
1153:             *
1154:             * Input value: "compAppVarName" -- Type: <code> java.lang.String</code>
1155:             * new app var name <p>
1156:             *
1157:             * Input value: "compAppVarType" -- Type: <code> java.lang.String</code>
1158:             * new app var type <p>
1159:             *
1160:             * Input value: "compAppVarValue" -- Type: <code> java.lang.String</code>
1161:             * new app var value <p>
1162:             *
1163:             * Input value: "redirectOnFailure" -- Type: <code> java.lang.String</code>
1164:             * what to show if it fails <p>
1165:             *
1166:             * Input value: "redirectOnSuccess" -- Type: <code> java.lang.String</code>
1167:             * what to show if it works <p>
1168:             *
1169:             * Output value: "isAlertNeeded" -- Type: <code>java.lang.Boolean</code>
1170:             * show alert or not</p> <p>
1171:             *
1172:             * Output value: "alertSummary" -- Type: <code>String</code>summary, if
1173:             * failure</p> <p>
1174:             *
1175:             * Output value: "alertDetails" -- Type: <code>String</code>details, if
1176:             * failure</p> <p>
1177:             *
1178:             * Output value: "redirectTo" -- Type: <code>String</code> Where to go
1179:             * next, based on success/failure</p>
1180:             *
1181:             * @param handlerCtx  <code>HandlerContext</code> provides inputs and
1182:             *      outputs.
1183:             */
1184:            @Handler(id="jbiAddCompAppVar",input={@HandlerInput(name="instanceName",type=String.class,required=true),@HandlerInput(name="componentName",type=String.class,required=true),@HandlerInput(name="compAppVarName",type=String.class,required=true),@HandlerInput(name="compAppVarType",type=String.class,required=true),@HandlerInput(name="compAppVarValue",type=String.class,required=true),@HandlerInput(name="redirectOnFailure",type=String.class,required=true),@HandlerInput(name="redirectOnSuccess",type=String.class,required=true)},output={@HandlerOutput(name="isAlertNeeded",type=Boolean.class),@HandlerOutput(name="alertSummary",type=String.class),@HandlerOutput(name="alertDetails",type=String.class),@HandlerOutput(name="redirectTo",type=String.class)})
1185:            public static void jbiAddCompAppVar(HandlerContext handlerCtx) {
1186:                String instanceName = (String) handlerCtx
1187:                        .getInputValue("instanceName");
1188:                String componentName = (String) handlerCtx
1189:                        .getInputValue("componentName");
1190:                String compAppVarName = (String) handlerCtx
1191:                        .getInputValue("compAppVarName");
1192:                String compAppVarType = (String) handlerCtx
1193:                        .getInputValue("compAppVarType");
1194:                String compAppVarValue = (String) handlerCtx
1195:                        .getInputValue("compAppVarValue");
1196:                String redirectOnFailure = (String) handlerCtx
1197:                        .getInputValue("redirectOnFailure");
1198:                String redirectOnSuccess = (String) handlerCtx
1199:                        .getInputValue("redirectOnSuccess");
1200:                String redirectTo = redirectOnSuccess;
1201:
1202:                String compAppVarValueMasked;
1203:                if (SharedConstants.APP_VAR_TYPE_PASSWORD
1204:                        .equals(compAppVarType)) {
1205:                    compAppVarValueMasked = "*masked*"; // not I18n
1206:                } else {
1207:                    compAppVarValueMasked = compAppVarValue;
1208:                }
1209:
1210:                sLog
1211:                        .fine("ComponentConfigurationHandlers.jbiAddCompAppVar(), instanceName="
1212:                                + instanceName
1213:                                + ", componentName="
1214:                                + componentName
1215:                                + ", compAppVarName="
1216:                                + compAppVarName
1217:                                + ", compAppVarType="
1218:                                + compAppVarType
1219:                                + ", compAppVarValue="
1220:                                + compAppVarValueMasked
1221:                                + ", redirectOnFailure="
1222:                                + redirectOnFailure
1223:                                + ", redirectOnSuccess=" + redirectOnSuccess);
1224:
1225:                String alertDetails = "";
1226:                String alertSummary = "";
1227:                boolean isAlertNeeded = false;
1228:
1229:                Properties saveResult = AppVarUtils.saveNewCompAppVar(
1230:                        componentName, instanceName, compAppVarName,
1231:                        compAppVarType, compAppVarValue);
1232:
1233:                sLog
1234:                        .fine("ComponentConfigurationHandlers.jbiAddCompAppVar(), saveResult="
1235:                                + saveResult);
1236:
1237:                String failureResult = (String) saveResult
1238:                        .get("failure-result");
1239:                if (null != failureResult) {
1240:                    isAlertNeeded = true;
1241:                    alertSummary = I18nUtilities
1242:                            .getResourceString("jbi.add.comp.app.var.failed.alert.summary.text");
1243:                    alertDetails = failureResult;
1244:                    redirectTo = redirectOnFailure;
1245:                }
1246:
1247:                handlerCtx.setOutputValue("isAlertNeeded", Boolean
1248:                        .toString(isAlertNeeded));
1249:                handlerCtx.setOutputValue("alertSummary", alertSummary);
1250:                handlerCtx.setOutputValue("alertDetails", alertDetails);
1251:                handlerCtx.setOutputValue("redirectTo", redirectTo);
1252:
1253:                sLog
1254:                        .fine("ComponentConfigurationHandlers.jbiAddCompAppVar(...), "
1255:                                + " isAlertNeeded="
1256:                                + isAlertNeeded
1257:                                + ", alertSummary="
1258:                                + alertSummary
1259:                                + ", alertDetails="
1260:                                + alertDetails
1261:                                + ", redirectTo=" + redirectTo);
1262:            }
1263:
1264:            /**
1265:             * <p>
1266:             *
1267:             * Delegates JBI deletion requests for each selected component Application
1268:             * Configuration row. <p>
1269:             *
1270:             * Input value: "tableRowGroup" -- Type: <code> com.sun.webui.jsf.component.TableRowGroup</code>
1271:             * </p> <p>
1272:             *
1273:             * Output value: "isAlertNeeded" -- Type: <code>java.lang.Boolean</code>
1274:             * </p> <p>
1275:             *
1276:             * Output value: "alertSummary" -- Type: <code>String</code>/</p> <p>
1277:             *
1278:             * Output value: "alertDetails" -- Type: <code>String</code>/</p>
1279:             *
1280:             * @param handlerCtx  <code>HandlerContext</code> provides inputs and
1281:             *      outputs.
1282:             */
1283:            @Handler(id="jbiDeleteSelectedCompAppConfigRows",input={@HandlerInput(name="compName",type=String.class,required=true),@HandlerInput(name="instanceName",type=String.class,required=true),@HandlerInput(name="tableRowGroup",type=TableRowGroup.class,required=true)},output={@HandlerOutput(name="isAlertNeeded",type=Boolean.class),@HandlerOutput(name="alertSummary",type=String.class),@HandlerOutput(name="alertDetails",type=String.class)})
1284:            public static void jbiDeleteSelectedCompAppConfigRows(
1285:                    HandlerContext handlerCtx) {
1286:
1287:                String compName = (String) handlerCtx.getInputValue("compName");
1288:                String instanceName = (String) handlerCtx
1289:                        .getInputValue("instanceName");
1290:                TableRowGroup trg = (TableRowGroup) handlerCtx
1291:                        .getInputValue("tableRowGroup");
1292:
1293:                sLog
1294:                        .fine("ComponentConfigurationHandlers.jbiDeleteSelectedCompAppConfigRows("
1295:                                + compName
1296:                                + ", "
1297:                                + instanceName
1298:                                + ", "
1299:                                + trg
1300:                                + ")");
1301:
1302:                int countFailedDeletions = 0;
1303:                int countSuccessfulDeletions = 0;
1304:                int countWarningDeletions = 0;
1305:
1306:                boolean isAlertNeeded = false;
1307:
1308:                String alertDetails = "";
1309:                String alertType = "";
1310:
1311:                ObjectListDataProvider dp = (ObjectListDataProvider) trg
1312:                        .getSourceData();
1313:
1314:                sLog
1315:                        .fine("ComponentConfigurationHandlers.jbiDeleteSelectedCompAppConfigRows(...)"
1316:                                + ", dp=" + dp);
1317:
1318:                FieldKey fkName = dp.getFieldKey("name");
1319:                sLog
1320:                        .fine("ComponentConfigurationHandlers.jbiDeleteSelectedCompAppConfigRows(...)"
1321:                                + ", fkName=" + fkName);
1322:
1323:                RowKey[] rowKeys = trg.getSelectedRowKeys();
1324:                sLog
1325:                        .fine("ComponentConfigurationHandlers.jbiDeleteSelectedCompAppConfigRows(...)"
1326:                                + ", rowKeys=" + rowKeys);
1327:
1328:                for (int cnt = 0; cnt < rowKeys.length; cnt++) {
1329:                    String compAppConfigName = (String) dp.getValue(fkName,
1330:                            rowKeys[cnt]);
1331:                    sLog
1332:                            .fine("ComponentConfigurationHandlers.jbiDeleteSelectedCompAppConfigRows(...)"
1333:                                    + ", rowKeys["
1334:                                    + cnt
1335:                                    + " ].getValue("
1336:                                    + fkName
1337:                                    + ").getValue="
1338:                                    + compAppConfigName);
1339:
1340:                    sLog
1341:                            .fine("ComponentConfigurationHandlers.jbiDeleteSelectedCompAppConfigRows(...)"
1342:                                    + ", delete compName/instanceName/compAppConfigName="
1343:                                    + compAppConfigName);
1344:
1345:                    // TBD delete (compName, instanceName, compAppConfigName);
1346:                    String result = null;
1347:
1348:                    try {
1349:                        JBIAdminCommands jac = BeanUtilities.getClient();
1350:
1351:                        result = jac.deleteApplicationConfiguration(compName,
1352:                                instanceName, compAppConfigName);
1353:
1354:                    } catch (com.sun.jbi.ui.common.JBIRemoteException jrEx) {
1355:                        sLog
1356:                                .log(
1357:                                        Level.FINE,
1358:                                        ("ComponentConfigurationHandlers.jbiDelteSelectedCompAppConfigRows(...) caught jrEx=" + jrEx),
1359:                                        jrEx);
1360:                    }
1361:                    sLog
1362:                            .fine("ComponentConfigurationHandlers.jbiDeleteSelectedCompAppConfigRows(...), result="
1363:                                    + result);
1364:
1365:                    String successResult = result;
1366:                    // TBD
1367:
1368:                    // (String)rowProperties.getProperty(SharedConstants.SUCCESS_RESULT);
1369:
1370:                    if (null != successResult) {
1371:                        ++countSuccessfulDeletions;
1372:                        sLog
1373:                                .fine("ComponentConfigurationHandlers.jbiDeleteSelectedCompAppConfigRows(...), "
1374:                                        + " success for "
1375:                                        + compAppConfigName
1376:                                        + ", countFailedDeletions="
1377:                                        + countFailedDeletions
1378:                                        + ", countSuccessfulDeletions="
1379:                                        + countSuccessfulDeletions);
1380:                    } else {
1381:                        String failureResult = null;
1382:                        // TBD
1383:                        // (String) rowProperties.getProperty(SharedConstants.FAILURE_RESULT);
1384:
1385:                        if ((null != failureResult)
1386:                                && (failureResult.trim().startsWith("WARNING"))) {
1387:                            ++countWarningDeletions;
1388:                        } else {
1389:                            ++countFailedDeletions;
1390:                        }
1391:
1392:                        sLog
1393:                                .fine("ComponentConfigurationHandlers.jbiDeleteSelectedCompAppConfigRows(...), "
1394:                                        + " failure for "
1395:                                        + compAppConfigName
1396:                                        + ", countFailedDeletions="
1397:                                        + countFailedDeletions
1398:                                        + ", countSuccessfulDeletions="
1399:                                        + countSuccessfulDeletions);
1400:
1401:                        String details = "";
1402:                        String exceptionMessage = AlertUtilities
1403:                                .getMessage(failureResult);
1404:                        if ("".equals(exceptionMessage)) {
1405:                            details = "" + failureResult;
1406:                        } else {
1407:                            details = "" + exceptionMessage;
1408:                        }
1409:
1410:                        Object[] args = { compAppConfigName, details };
1411:                        String i18nMessage = I18nUtilities
1412:                                .getResourceString("jbi.show.comp.app.config.deletion.failed.for.row");
1413:                        sLog
1414:                                .fine("ComponentConfigurationHandlers.jbiDeleteSelectedCompAppConfigRows(...)"
1415:                                        + ", i18nMessage="
1416:                                        + i18nMessage
1417:                                        + ", compAppConfigName="
1418:                                        + compAppConfigName
1419:                                        + ", details="
1420:                                        + details);
1421:                        if (null != i18nMessage) {
1422:                            alertDetails += GuiUtil.getMessage(i18nMessage,
1423:                                    args)
1424:                                    + "<br />";
1425:                        }
1426:                    }
1427:                }
1428:
1429:                String alertSummary = "";
1430:                if (0 < countFailedDeletions) {
1431:                    if ((0 < countSuccessfulDeletions)
1432:                            || (0 < countWarningDeletions)) {
1433:                        if (1 == countFailedDeletions) {
1434:                            alertSummary = I18nUtilities
1435:                                    .getResourceString("jbi.show.comp.app.config.delete.one.failed.alert.summary.text");
1436:                        } else {
1437:                            alertSummary = I18nUtilities
1438:                                    .getResourceString("jbi.show.comp.app.config.delete.some.failed.alert.summary.text");
1439:                        }
1440:                    } else {
1441:                        alertSummary = I18nUtilities
1442:                                .getResourceString("jbi.show.comp.app.config.delete.all.failed.alert.summary.text");
1443:                    }
1444:                    alertDetails = BeanUtilities
1445:                            .addAlertFooterMessage(alertDetails);
1446:                } else if (0 < countWarningDeletions) {
1447:                    alertSummary = I18nUtilities
1448:                            .getResourceString("jbi.show.comp.app.config.deletion.warning.summary");
1449:                    alertType = "warning";
1450:                    AlertBean alertBean = BeanUtilities.getAlertBean();
1451:                    alertBean.setAlertType(alertType);
1452:                }
1453:
1454:                if ((countFailedDeletions > 0) || (countWarningDeletions > 0)) {
1455:                    isAlertNeeded = true;
1456:                }
1457:                handlerCtx.setOutputValue("isAlertNeeded", Boolean
1458:                        .toString(isAlertNeeded));
1459:                handlerCtx.setOutputValue("alertSummary", alertSummary);
1460:                handlerCtx.setOutputValue("alertDetails", alertDetails);
1461:
1462:                sLog
1463:                        .fine("ComponentConfigurationHandlers.jbiDeleteSelectedCompAppConfigRows(...), "
1464:                                + " isAlertNeeded="
1465:                                + isAlertNeeded
1466:                                + ", alertSummary="
1467:                                + alertSummary
1468:                                + ", alertDetails=" + alertDetails);
1469:            }
1470:
1471:            /**
1472:             * <p>
1473:             *
1474:             * extracts the value of an option to a returned string <p>
1475:             *
1476:             * Input value: "option" -- Type: <code> com.sun.webui.jsf.model.Option</code>
1477:             * </p> <p>
1478:             *
1479:             * Output value: "string" -- Type: <code>java.lang.String</code></p>
1480:             *
1481:             * @param handlerCtx  <code>HandlerContext</code> provides inputs and
1482:             *      outputs.
1483:             */
1484:            @Handler(id="jbiOptionToString",input={@HandlerInput(name="option",type=Object.class,required=true)},output={@HandlerOutput(name="string",type=String.class)})
1485:            public static void jbiOptionToString(HandlerContext handlerCtx) {
1486:                String result = "";
1487:
1488:                Object option = handlerCtx.getInputValue("option");
1489:                System.err
1490:                        .println("ComponentConfigurationHandlers.jbiOptionToString option.getClass="
1491:                                + option.getClass());
1492:
1493:                sLog.fine("ComponentConfigurationHandlers.jbiOptionToString()");
1494:
1495:                Object value = null;
1496:                // option.getValue();
1497:
1498:                if (value instanceof  String) {
1499:                    result = (String) value;
1500:                }
1501:
1502:                handlerCtx.setOutputValue("string", result);
1503:
1504:                sLog
1505:                        .fine("ComponentConfigurationHandlers.jbiOptionToString(), result="
1506:                                + result);
1507:            }
1508:
1509:            /**
1510:             * <p>
1511:             *
1512:             * This handler deletes the given <code>RowKey</code>s and named
1513:             * Application Variables</p> <p>
1514:             *
1515:             * Input value: "instance" -- Type: <code> java.lang.String</code> target
1516:             * instance <p>
1517:             *
1518:             * Input value: "component" -- Type: <code> java.lang.String</code> target
1519:             * component <p>
1520:             *
1521:             * Input value: "tableRowGroup" -- Type: <code>com.sun.webui.jsf.component.TableRowGroup</code>
1522:             * table group to find rows <p>
1523:             *
1524:             * Input value: "rowKeys" -- Type: <code>com.sun.data.provider.RowKey[].class</code>
1525:             * selected row keys
1526:             *
1527:             * @param handlerCtx  Description of Parameter
1528:             */
1529:            @Handler(id="jbiDeleteCompAppVarsTableRows",input={@HandlerInput(name="compName",type=String.class,required=true),@HandlerInput(name="instanceName",type=String.class,required=true),@HandlerInput(name="tableRowGroup",type=TableRowGroup.class,required=true),@HandlerInput(name="rowKeys",type=RowKey[].class,required=true)})
1530:            public static void jbiDeleteCompAppVarsTableRows(
1531:                    HandlerContext handlerCtx) {
1532:                String compName = (String) handlerCtx.getInputValue("compName");
1533:                String instanceName = (String) handlerCtx
1534:                        .getInputValue("instanceName");
1535:                TableRowGroup trg = (TableRowGroup) handlerCtx
1536:                        .getInputValue("tableRowGroup");
1537:                RowKey[] keys = (RowKey[]) handlerCtx.getInputValue("rowKeys");
1538:                sLog
1539:                        .fine("ComponentConfigurationHandlers.jbiDeleteCompAppVarsTableRows()"
1540:                                + ", keys=" + keys);
1541:
1542:                ObjectListDataProvider dp = (ObjectListDataProvider) trg
1543:                        .getSourceData();
1544:                ArrayList toBeDeleted = new ArrayList();
1545:                for (RowKey key : keys) {
1546:                    FieldKey fkName = dp.getFieldKey("name");
1547:                    String compAppVarName = (String) dp.getValue(fkName, key);
1548:                    sLog
1549:                            .fine("ComponentConfigurationHandlers.jbiDeleteCompAppVarsTableRows()"
1550:                                    + ", delete Row with id = "
1551:                                    + key.getRowId()
1552:                                    + " and compAppVarName="
1553:                                    + compAppVarName);
1554:                    toBeDeleted.add(compAppVarName);
1555:                    dp.removeRow(key);
1556:                }
1557:
1558:                String[] appVarNamesArray = (String[]) toBeDeleted
1559:                        .toArray(new String[] {});
1560:
1561:                Properties result = AppVarUtils.deleteCompAppVars(compName,
1562:                        instanceName, appVarNamesArray);
1563:
1564:                // TBD error handling
1565:
1566:                sLog
1567:                        .fine("ComponentConfigurationHandlers.jbiDeleteCompAppVarsTableRows(), result="
1568:                                + result);
1569:            }
1570:
1571:            private static Logger sLog = JBILogger.getInstance();
1572:
1573:            //     /**
1574:            //      * Sets the AlertBean attribute of the ComponentConfigurationHandlers
1575:            //      * object
1576:            //      *
1577:            //      * @param aSummary  The new AlertBean value
1578:            //      * @param aDetails  The new AlertBean value
1579:            //      */
1580:            //     private void setAlertBean(String aSummary,
1581:            //                 String aDetails)
1582:            //     {
1583:            //         // TBD
1584:            //     }
1585:
1586:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.