Source Code Cross Referenced for ConfigurationServiceImpl.java in  » ESB » open-esb » com » sun » esb » management » impl » configuration » 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.esb.management.impl.configuration 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * BEGIN_HEADER - DO NOT EDIT
0003:         *
0004:         * The contents of this file are subject to the terms
0005:         * of the Common Development and Distribution License
0006:         * (the "License").  You may not use this file except
0007:         * in compliance with the License.
0008:         *
0009:         * You can obtain a copy of the license at
0010:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
0011:         * See the License for the specific language governing
0012:         * permissions and limitations under the License.
0013:         *
0014:         * When distributing Covered Code, include this CDDL
0015:         * HEADER in each file and include the License file at
0016:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
0017:         * If applicable add the following below this CDDL HEADER,
0018:         * with the fields enclosed by brackets "[]" replaced with
0019:         * your own identifying information: Portions Copyright
0020:         * [year] [name of copyright owner]
0021:         */
0022:
0023:        /*
0024:         * @(#)ConfigurationServiceImpl.java
0025:         * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
0026:         *
0027:         * END_HEADER - DO NOT EDIT
0028:         */
0029:        package com.sun.esb.management.impl.configuration;
0030:
0031:        import java.io.File;
0032:        import java.io.IOException;
0033:        import java.io.Serializable;
0034:        import java.net.MalformedURLException;
0035:        import java.net.URISyntaxException;
0036:        import java.util.HashMap;
0037:        import java.util.Map;
0038:        import java.util.Properties;
0039:        import java.util.logging.Level;
0040:        import java.util.zip.ZipFile;
0041:
0042:        import javax.management.MBeanServerConnection;
0043:        import javax.management.ObjectName;
0044:        import javax.management.openmbean.CompositeData;
0045:        import javax.management.openmbean.CompositeType;
0046:        import javax.management.openmbean.TabularData;
0047:        import javax.xml.parsers.ParserConfigurationException;
0048:
0049:        import org.xml.sax.SAXException;
0050:
0051:        import com.sun.esb.management.api.configuration.ConfigurationService;
0052:        import com.sun.esb.management.base.services.BaseServiceImpl;
0053:        import com.sun.esb.management.common.ManagementRemoteException;
0054:        import com.sun.esb.management.common.data.ApplicationVerificationReport;
0055:        import com.sun.esb.management.common.data.helper.ApplicationVerificationReportReader;
0056:        import com.sun.jbi.ui.common.JBIRemoteException;
0057:        import com.sun.jbi.ui.common.JarFactory;
0058:
0059:        /**
0060:         * Defines client operations for common configuration services across the JBI
0061:         * Runtime, component containers, configuring logger levels, etc. for clients.
0062:         *
0063:         * @author graj
0064:         */
0065:        public class ConfigurationServiceImpl extends BaseServiceImpl implements 
0066:                Serializable, ConfigurationService {
0067:
0068:            static final long serialVersionUID = -1L;
0069:
0070:            /** Constructor - Constructs a new instance of ConfigurationServiceImpl */
0071:            public ConfigurationServiceImpl() {
0072:                super (null, false);
0073:            }
0074:
0075:            /**
0076:             * Constructor - Constructs a new instance of ConfigurationServiceImpl
0077:             *
0078:             * @param serverConnection
0079:             */
0080:            public ConfigurationServiceImpl(
0081:                    MBeanServerConnection serverConnection) {
0082:                super (serverConnection, false);
0083:            }
0084:
0085:            /**
0086:             * Constructor - Constructs a new instance of ConfigurationServiceImpl
0087:             *
0088:             * @param serverConnection
0089:             * @param isRemoteConnection
0090:             */
0091:            public ConfigurationServiceImpl(
0092:                    MBeanServerConnection serverConnection,
0093:                    boolean isRemoteConnection) {
0094:                super (serverConnection, isRemoteConnection);
0095:            }
0096:
0097:            /**
0098:             * Detect the components support for component configuration. This method
0099:             * returns true if the component has a configuration MBean with configurable
0100:             * attributes
0101:             *
0102:             * @param componentName 
0103:             *            component identification
0104:             * @param targetName 
0105:             *              identification of the target. Can be a standalone server,
0106:             *              cluster or clustered instance.
0107:             * @return true if the components configuration MBean has configuration 
0108:             *              attributes
0109:             * @throws ManagementRemoteException if the component is not installed or is not 
0110:             *         in the Started state.
0111:             * 
0112:             */
0113:            public boolean isComponentConfigSupported(String componentName,
0114:                    String targetName) throws ManagementRemoteException {
0115:                ObjectName mbeanName = this 
0116:                        .getConfigurationServiceMBeanObjectName();
0117:                Boolean result = null;
0118:
0119:                Object[] params = new Object[2];
0120:                params[0] = componentName;
0121:                params[1] = targetName;
0122:
0123:                String[] signature = new String[2];
0124:                signature[0] = "java.lang.String";
0125:                signature[1] = "java.lang.String";
0126:
0127:                result = (Boolean) this .invokeMBeanOperation(mbeanName,
0128:                        "isComponentConfigSupported", params, signature);
0129:
0130:                return result;
0131:            }
0132:
0133:            /**
0134:             * Detect the components support for application configuration. This method
0135:             * returns true if the component has a configuration MBean and implements 
0136:             * all the operations for application configuration management.
0137:             *
0138:             * @param componentName 
0139:             *            component identification
0140:             * @param targetName 
0141:             *              identification of the target. Can be a standalone server,
0142:             *              cluster or clustered instance.
0143:             * @return true if the components configuration MBean implements all the
0144:             *         operations for application configuration.
0145:             * @throws ManagementRemoteException if the component is not installed or is not 
0146:             *         in the Started state.
0147:             * 
0148:             */
0149:            public boolean isAppConfigSupported(String componentName,
0150:                    String targetName) throws ManagementRemoteException {
0151:                ObjectName mbeanName = this 
0152:                        .getConfigurationServiceMBeanObjectName();
0153:                Boolean result = null;
0154:
0155:                Object[] params = new Object[2];
0156:                params[0] = componentName;
0157:                params[1] = targetName;
0158:
0159:                String[] signature = new String[2];
0160:                signature[0] = "java.lang.String";
0161:                signature[1] = "java.lang.String";
0162:
0163:                result = (Boolean) this .invokeMBeanOperation(mbeanName,
0164:                        "isAppConfigSupported", params, signature);
0165:
0166:                return result;
0167:            }
0168:
0169:            /**
0170:             * Detect the components support for application variables. This method
0171:             * returns true if the component has a configuration MBean and implements 
0172:             * all the operations for application variable management.
0173:             *
0174:             * @param componentName 
0175:             *            component identification
0176:             * @param targetName 
0177:             *              identification of the target. Can be a standalone server,
0178:             *              cluster or clustered instance.
0179:             * @return true if the components configuration MBean implements all the
0180:             *         operations for application variables.
0181:             * @throws ManagementRemoteException if the component is not installed or is not 
0182:             *         in the Started state.
0183:             * 
0184:             */
0185:            public boolean isAppVarsSupported(String componentName,
0186:                    String targetName) throws ManagementRemoteException {
0187:                ObjectName mbeanName = this 
0188:                        .getConfigurationServiceMBeanObjectName();
0189:                Boolean result = null;
0190:
0191:                Object[] params = new Object[2];
0192:                params[0] = componentName;
0193:                params[1] = targetName;
0194:
0195:                String[] signature = new String[2];
0196:                signature[0] = "java.lang.String";
0197:                signature[1] = "java.lang.String";
0198:
0199:                result = (Boolean) this .invokeMBeanOperation(mbeanName,
0200:                        "isAppVarsSupported", params, signature);
0201:
0202:                return result;
0203:            }
0204:
0205:            /**
0206:             * Add a named application configuration to a component installed on a given
0207:             * target.
0208:             *
0209:             * @param componentName
0210:             *            component identification
0211:             * @param targetName
0212:             *            identification of the target. Can be a standalone server,
0213:             *            cluster or clustered instance.
0214:             * @param name
0215:             *            application configuration name
0216:             * @param config
0217:             *            application configuration represented as a set of properties.
0218:             * @return a JBI Management message indicating the status of the operation.
0219:             * @throws ManagementRemoteException
0220:             *             if there is a jmx error accessing the instance
0221:             *
0222:             * @see com.sun.esb.management.api.configuration.ConfigurationService#addApplicationConfiguration(java.lang.String,
0223:             *      java.lang.String, java.lang.String, java.util.Properties)
0224:             */
0225:            public String addApplicationConfiguration(String componentName,
0226:                    String targetName, String name, Properties config)
0227:                    throws ManagementRemoteException {
0228:                ObjectName mbeanName = this 
0229:                        .getConfigurationServiceMBeanObjectName();
0230:                String jbiMgtMsgResponse = null;
0231:
0232:                Object[] params = new Object[4];
0233:                params[0] = componentName;
0234:                params[1] = targetName;
0235:                params[2] = name;
0236:                params[3] = config;
0237:
0238:                String[] signature = new String[4];
0239:                signature[0] = "java.lang.String";
0240:                signature[1] = "java.lang.String";
0241:                signature[2] = "java.lang.String";
0242:                signature[3] = "java.util.Properties";
0243:
0244:                jbiMgtMsgResponse = (String) this .invokeMBeanOperation(
0245:                        mbeanName, "addApplicationConfiguration", params,
0246:                        signature);
0247:
0248:                return jbiMgtMsgResponse;
0249:            }
0250:
0251:            /**
0252:             * Add application variables to a component installed on a given target. If
0253:             * even a variable from the set is already set on the component, this
0254:             * operation fails.
0255:             *
0256:             * @param componentName
0257:             *            component identification
0258:             * @param targetName
0259:             *            identification of the target. Can be a standalone server,
0260:             *            cluster or clustered instance.
0261:             * @param appVariables -
0262:             *            set of application variables to add. The values of the
0263:             *            application variables have the application variable type and
0264:             *            value and the format is "[type]value"
0265:             * @return a JBI Management message indicating the status of the operation.
0266:             *         In case a variable is not added the management message has a
0267:             *         ERROR task status message giving the details of the failure.
0268:             * @throws ManagementRemoteException
0269:             *
0270:             * @see com.sun.esb.management.api.configuration.ConfigurationService#addApplicationVariables(java.lang.String,
0271:             *      java.lang.String, java.util.Properties)
0272:             */
0273:            public String addApplicationVariables(String componentName,
0274:                    String targetName, Properties appVariables)
0275:                    throws ManagementRemoteException {
0276:                ObjectName mbeanName = this 
0277:                        .getConfigurationServiceMBeanObjectName();
0278:                String result = null;
0279:
0280:                Object[] params = new Object[3];
0281:                params[0] = componentName;
0282:                params[1] = targetName;
0283:                params[2] = appVariables;
0284:
0285:                String[] signature = new String[3];
0286:                signature[0] = "java.lang.String";
0287:                signature[1] = "java.lang.String";
0288:                signature[2] = "java.util.Properties";
0289:
0290:                result = (String) this .invokeMBeanOperation(mbeanName,
0291:                        "addApplicationVariables", params, signature);
0292:
0293:                return result;
0294:            }
0295:
0296:            /**
0297:             * Delete a named application configuration in a component installed on a
0298:             * given target.
0299:             *
0300:             * @param componentName
0301:             *            component identification
0302:             * @param targetName
0303:             *            identification of the target. Can be a standalone server,
0304:             *            cluster or clustered instance.
0305:             * @param name
0306:             *            name of application configuration to be deleted
0307:             * @return a JBI Management message indicating the status of the operation.
0308:             * @throws ManagementRemoteException
0309:             *             if there is a jmx error accessing the instance
0310:             *
0311:             * @see com.sun.esb.management.api.configuration.ConfigurationService#deleteApplicationConfiguration(java.lang.String,
0312:             *      java.lang.String, java.lang.String)
0313:             */
0314:            public String deleteApplicationConfiguration(String componentName,
0315:                    String targetName, String name)
0316:                    throws ManagementRemoteException {
0317:                ObjectName mbeanName = this 
0318:                        .getConfigurationServiceMBeanObjectName();
0319:                String jbiMgtMsgResponse = null;
0320:
0321:                Object[] params = new Object[3];
0322:                params[0] = componentName;
0323:                params[1] = targetName;
0324:                params[2] = name;
0325:
0326:                String[] signature = new String[3];
0327:                signature[0] = "java.lang.String";
0328:                signature[1] = "java.lang.String";
0329:                signature[2] = "java.lang.String";
0330:
0331:                jbiMgtMsgResponse = (String) this .invokeMBeanOperation(
0332:                        mbeanName, "deleteApplicationConfiguration", params,
0333:                        signature);
0334:
0335:                return jbiMgtMsgResponse;
0336:            }
0337:
0338:            /**
0339:             * Delete application variables from a component installed on a given
0340:             * target. If even a variable from the set has not been added to the
0341:             * component, this operation fails.
0342:             *
0343:             * @param componentName
0344:             *            component identification
0345:             * @param targetName
0346:             *            identification of the target. Can be a standalone server,
0347:             *            cluster or clustered instance.
0348:             * @param appVariableNames -
0349:             *            names of application variables to delete.
0350:             * @return a JBI Management message indicating the status of the operation.
0351:             *         In case a variable is not deleted the management message has a
0352:             *         ERROR task status message giving the details of the failure.
0353:             * @throws ManagementRemoteException
0354:             *             if there is a jmx error accessing the instance
0355:             *
0356:             * @see com.sun.esb.management.api.configuration.ConfigurationService#deleteApplicationVariables(java.lang.String,
0357:             *      java.lang.String, java.lang.String[])
0358:             */
0359:            public String deleteApplicationVariables(String componentName,
0360:                    String targetName, String[] appVariableNames)
0361:                    throws ManagementRemoteException {
0362:                ObjectName mbeanName = this 
0363:                        .getConfigurationServiceMBeanObjectName();
0364:                String result = null;
0365:
0366:                Object[] params = new Object[3];
0367:                params[0] = componentName;
0368:                params[1] = targetName;
0369:                params[2] = appVariableNames;
0370:
0371:                String[] signature = new String[3];
0372:                signature[0] = "java.lang.String";
0373:                signature[1] = "java.lang.String";
0374:                signature[2] = "[Ljava.lang.String;";
0375:
0376:                result = (String) this .invokeMBeanOperation(mbeanName,
0377:                        "deleteApplicationVariables", params, signature);
0378:
0379:                return result;
0380:            }
0381:
0382:            /**
0383:             * This method is used to export the application variables and application
0384:             * configuration objects used by the given application in the specified
0385:             * target.
0386:             *
0387:             * @param applicationName
0388:             *            the name of the application
0389:             * @param targetName
0390:             *            the target whose configuration has to be exported
0391:             * @param configDir
0392:             *            the dir to store the configurations
0393:             * @returns String the id for the zip file with exported configurations
0394:             *
0395:             * @throws ManagementRemoteException
0396:             *             if the application configuration could not be exported
0397:             *
0398:             * Note: param configDir is used between ant/cli and common client client.
0399:             * The return value is used between common client server and common client
0400:             * client.
0401:             *
0402:             * @see com.sun.esb.management.api.configuration.ConfigurationService#exportApplicationConfiguration(java.lang.String,
0403:             *      java.lang.String, java.lang.String)
0404:             */
0405:            public String exportApplicationConfiguration(
0406:                    String applicationName, String targetName, String configDir)
0407:                    throws ManagementRemoteException {
0408:                ObjectName mbeanName = this 
0409:                        .getConfigurationServiceMBeanObjectName();
0410:                String result = null;
0411:
0412:                Object[] params = new Object[3];
0413:                params[0] = applicationName;
0414:                params[1] = targetName;
0415:                params[2] = configDir;
0416:
0417:                String[] signature = new String[3];
0418:                signature[0] = "java.lang.String";
0419:                signature[1] = "java.lang.String";
0420:                signature[2] = "java.lang.String";
0421:
0422:                result = (String) this .invokeMBeanOperation(mbeanName,
0423:                        "exportApplicationConfiguration", params, signature);
0424:
0425:                downloadAndExtractZip(result, configDir);
0426:
0427:                return result;
0428:            }
0429:
0430:            /**
0431:             * Get a specific named configuration. If the named configuration does not
0432:             * exist in the component the returned properties is an empty set.
0433:             *
0434:             * @param componentName
0435:             *            component identification
0436:             * @param targetName
0437:             *            identification of the target. Can be a standalone server,
0438:             *            cluster or clustered instance.
0439:             * @return the application configuration represented as a set of properties.
0440:             * @throws ManagementRemoteException
0441:             *             if there is a jmx error accessing the instance
0442:             *
0443:             * @see com.sun.esb.management.api.configuration.ConfigurationService#getApplicationConfiguration(java.lang.String,
0444:             *      java.lang.String, java.lang.String)
0445:             */
0446:            public Properties getApplicationConfiguration(String componentName,
0447:                    String name, String targetName)
0448:                    throws ManagementRemoteException {
0449:                ObjectName mbeanName = this 
0450:                        .getConfigurationServiceMBeanObjectName();
0451:                Properties appConfig = new Properties();
0452:
0453:                Object[] params = new Object[3];
0454:                params[0] = componentName;
0455:                params[1] = name;
0456:                params[2] = targetName;
0457:
0458:                String[] signature = new String[3];
0459:                signature[0] = "java.lang.String";
0460:                signature[1] = "java.lang.String";
0461:                signature[2] = "java.lang.String";
0462:
0463:                appConfig = (Properties) this .invokeMBeanOperation(mbeanName,
0464:                        "getApplicationConfiguration", params, signature);
0465:
0466:                return appConfig;
0467:            }
0468:
0469:            /**
0470:             * Get all the application configurations set on a component.
0471:             *
0472:             * @param componentName
0473:             *            component identification
0474:             * @param targetName
0475:             *            identification of the target. Can be a standalone server,
0476:             *            cluster or clustered instance.
0477:             * @return a map of all the application configurations keyed by the
0478:             *         configuration name.
0479:             *
0480:             * @see com.sun.esb.management.api.configuration.ConfigurationService#getApplicationConfigurations(java.lang.String,
0481:             *      java.lang.String)
0482:             */
0483:            @SuppressWarnings("unchecked")
0484:            public Map<String, Properties> getApplicationConfigurations(
0485:                    String componentName, String targetName)
0486:                    throws ManagementRemoteException {
0487:                ObjectName mbeanName = this 
0488:                        .getConfigurationServiceMBeanObjectName();
0489:                Map<String, Properties> appConfigMap = new HashMap<String, Properties>();
0490:
0491:                Object[] params = new Object[2];
0492:                params[0] = componentName;
0493:                params[1] = targetName;
0494:
0495:                String[] signature = new String[2];
0496:                signature[0] = "java.lang.String";
0497:                signature[1] = "java.lang.String";
0498:
0499:                appConfigMap = (Map<String, Properties>) this 
0500:                        .invokeMBeanOperation(mbeanName,
0501:                                "getApplicationConfigurations", params,
0502:                                signature);
0503:
0504:                return appConfigMap;
0505:            }
0506:
0507:            /**
0508:             * Get all the application variables set on a component.
0509:             *
0510:             * @return all the application variables et on the component. The return
0511:             *         proerties set has the name="[type]value" pairs for the
0512:             *         application variables.
0513:             * @throws a
0514:             *             JBI Management message indicating the status of the
0515:             *             operation.
0516:             * @see com.sun.esb.management.api.configuration.ConfigurationService#getApplicationVariables(java.lang.String,
0517:             *      java.lang.String)
0518:             */
0519:            public Properties getApplicationVariables(String componentName,
0520:                    String targetName) throws ManagementRemoteException {
0521:                ObjectName mbeanName = this 
0522:                        .getConfigurationServiceMBeanObjectName();
0523:                Properties appVarProps = new Properties();
0524:
0525:                Object[] params = new Object[2];
0526:                params[0] = componentName;
0527:                params[1] = targetName;
0528:
0529:                String[] signature = new String[2];
0530:                signature[0] = "java.lang.String";
0531:                signature[1] = "java.lang.String";
0532:
0533:                appVarProps = (Properties) this .invokeMBeanOperation(mbeanName,
0534:                        "getApplicationVariables", params, signature);
0535:
0536:                return appVarProps;
0537:            }
0538:
0539:            /**
0540:             * Retrieve component configuration
0541:             *
0542:             * @param componentName
0543:             * @param targetName
0544:             * @return the targetName as key and the name/value pairs as properties
0545:             *
0546:             * @see com.sun.esb.management.api.configuration.ConfigurationService#getComponentConfiguration(java.lang.String,
0547:             *      java.lang.String)
0548:             */
0549:            public Properties getComponentConfiguration(String componentName,
0550:                    String targetName) throws ManagementRemoteException {
0551:                ObjectName mbeanName = this 
0552:                        .getConfigurationServiceMBeanObjectName();
0553:                Properties resultObject = null;
0554:
0555:                Object[] params = new Object[2];
0556:                params[0] = componentName;
0557:                params[1] = targetName;
0558:
0559:                String[] signature = new String[2];
0560:                signature[0] = "java.lang.String";
0561:                signature[1] = "java.lang.String";
0562:
0563:                resultObject = (Properties) this .invokeMBeanOperation(
0564:                        mbeanName, "getComponentConfiguration", params,
0565:                        signature);
0566:
0567:                return resultObject;
0568:            }
0569:
0570:            /**
0571:             * Gets the extension MBean object names
0572:             *
0573:             * @param componentName
0574:             *            name of the component
0575:             * @param extensionName
0576:             *            the name of the extension (e.g., Configuration, Logger, etc.)
0577:             * @param targetName
0578:             *            name of the target (e.g., cluster1, server, etc.)
0579:             * @return
0580:             * @throws ManagementRemoteException
0581:             *             on error
0582:             * @see com.sun.esb.management.api.configuration.ConfigurationService#getComponentExtensionMBeanObjectNames(java.lang.String,
0583:             *      java.lang.String, java.lang.String)
0584:             */
0585:            @SuppressWarnings("unchecked")
0586:            public Map<String, ObjectName[]> getComponentExtensionMBeanObjectNames(
0587:                    String componentName, String extensionName,
0588:                    String targetName) throws ManagementRemoteException {
0589:                Map<String, ObjectName[]> result = new HashMap<String, ObjectName[]>();
0590:
0591:                ObjectName mbeanName = this 
0592:                        .getConfigurationServiceMBeanObjectName();
0593:                Map<String, ObjectName[]> resultObject = null;
0594:
0595:                // Retrieve list of entension MBeans for all targets
0596:                Object[] params = new Object[3];
0597:                params[0] = componentName;
0598:                params[1] = extensionName;
0599:                params[2] = targetName;
0600:
0601:                String[] signature = new String[3];
0602:                signature[0] = "java.lang.String";
0603:                signature[1] = "java.lang.String";
0604:                signature[2] = "java.lang.String";
0605:
0606:                resultObject = (Map<String, ObjectName[]>) this 
0607:                        .invokeMBeanOperation(mbeanName,
0608:                                "getComponentExtensionMBeanObjectNames",
0609:                                params, signature);
0610:
0611:                // Retrieve list of target to instances
0612:                Map<String /*targetName*/, String[] /*targetInstanceNames*/> targetToInstanceMap = null;
0613:                try {
0614:                    targetToInstanceMap = super .listTargetNames();
0615:                    if (targetToInstanceMap != null) {
0616:                        String[] targetInstanceNames = targetToInstanceMap
0617:                                .get(targetName);
0618:                        if ((targetInstanceNames != null)
0619:                                && (resultObject != null)) {
0620:                            for (String instanceName : targetInstanceNames) {
0621:                                if (instanceName != null) {
0622:                                    ObjectName[] values = resultObject
0623:                                            .get(instanceName);
0624:                                    if (values != null) {
0625:                                        result.put(instanceName, values);
0626:                                    }
0627:                                }
0628:                            }
0629:                            resultObject = result;
0630:                        } else if (resultObject != null) {
0631:                            ObjectName[] values = resultObject.get(targetName);
0632:                            if (values != null) {
0633:                                result.put(targetName, values);
0634:                            }
0635:                            resultObject = result;
0636:                        }
0637:                    }
0638:                } catch (ManagementRemoteException e) {
0639:                    // Ignore the exception
0640:                }
0641:
0642:                return resultObject;
0643:            }
0644:
0645:            /**
0646:             * Gets the extension MBean object names
0647:             *
0648:             * @param componentName
0649:             *            name of the component
0650:             * @param extensionName
0651:             *            the name of the extension (e.g., Configuration, Logger, etc.)
0652:             * @param targetName
0653:             *            name of the target (e.g., cluster1, server, etc.)
0654:             * @param targetInstanceName
0655:             *            name of the target instance (e.g., cluster1-instance1, etc.)
0656:             * @return an array of ObjectName(s)
0657:             * @throws ManagementRemoteException
0658:             *             on error
0659:             *
0660:             * @see com.sun.esb.management.api.configuration.ConfigurationService#getComponentExtensionMBeanObjectNames(java.lang.String,
0661:             *      java.lang.String, java.lang.String, java.lang.String)
0662:             */
0663:            public ObjectName[] getComponentExtensionMBeanObjectNames(
0664:                    String componentName, String extensionName,
0665:                    String targetName, String targetInstanceName)
0666:                    throws ManagementRemoteException {
0667:                ObjectName mbeanName = this 
0668:                        .getConfigurationServiceMBeanObjectName();
0669:                ObjectName[] resultObject = null;
0670:
0671:                Object[] params = new Object[4];
0672:                params[0] = componentName;
0673:                params[1] = extensionName;
0674:                params[2] = targetName;
0675:                params[3] = targetInstanceName;
0676:
0677:                String[] signature = new String[4];
0678:                signature[0] = "java.lang.String";
0679:                signature[1] = "java.lang.String";
0680:                signature[2] = "java.lang.String";
0681:                signature[3] = "java.lang.String";
0682:
0683:                resultObject = (ObjectName[]) this .invokeMBeanOperation(
0684:                        mbeanName, "getComponentExtensionMBeanObjectNames",
0685:                        params, signature);
0686:
0687:                return resultObject;
0688:            }
0689:
0690:            /**
0691:             * Gets the component custom loggers and their levels
0692:             *
0693:             * @param componentName
0694:             *            name of the component
0695:             * @param targetName
0696:             *            name of the target (e.g., cluster1, server, etc.)
0697:             * @param targetInstanceName
0698:             *            name of the target instance (e.g., cluster1-instance1, etc.)
0699:             * @return a Map of loggerCustomName to their log levels
0700:             * @throws ManagementRemoteException
0701:             *             on error
0702:             *
0703:             * @see com.sun.esb.management.api.configuration.ConfigurationService#getComponentLoggerLevels(java.lang.String,
0704:             *      java.lang.String, java.lang.String)
0705:             */
0706:            @SuppressWarnings("unchecked")
0707:            public Map<String, Level> getComponentLoggerLevels(
0708:                    String componentName, String targetName,
0709:                    String targetInstanceName) throws ManagementRemoteException {
0710:                ObjectName mbeanName = this 
0711:                        .getConfigurationServiceMBeanObjectName();
0712:                Map<String, Level> resultObject = null;
0713:
0714:                Object[] params = new Object[3];
0715:                params[0] = componentName;
0716:                params[1] = targetName;
0717:                params[2] = targetInstanceName;
0718:
0719:                String[] signature = new String[3];
0720:                signature[0] = "java.lang.String";
0721:                signature[1] = "java.lang.String";
0722:                signature[2] = "java.lang.String";
0723:
0724:                resultObject = (Map<String, Level>) this .invokeMBeanOperation(
0725:                        mbeanName, "getComponentLoggerLevels", params,
0726:                        signature);
0727:
0728:                return resultObject;
0729:            }
0730:
0731:            /**
0732:             * Gets the component custom loggers and their display names.
0733:             *
0734:             * @param componentName
0735:             *            name of the component
0736:             * @param targetName
0737:             *            name of the target (e.g., cluster1, server, etc.)
0738:             * @param targetInstanceName
0739:             *            name of the target instance (e.g., cluster1-instance1, etc.)
0740:             * @return a Map of loggerCustomName to their display names
0741:             * @throws ManagementRemoteException
0742:             *             on error
0743:             *
0744:             * @see com.sun.esb.management.api.configuration.ConfigurationService#getComponentLoggerDisplayNames(java.lang.String,
0745:             *      java.lang.String, java.lang.String)
0746:             */
0747:            @SuppressWarnings("unchecked")
0748:            public Map<String, String> getComponentLoggerDisplayNames(
0749:                    String componentName, String targetName,
0750:                    String targetInstanceName) throws ManagementRemoteException {
0751:                ObjectName mbeanName = this 
0752:                        .getConfigurationServiceMBeanObjectName();
0753:                Map<String, String> resultObject = null;
0754:
0755:                Object[] params = new Object[3];
0756:                params[0] = componentName;
0757:                params[1] = targetName;
0758:                params[2] = targetInstanceName;
0759:
0760:                String[] signature = new String[3];
0761:                signature[0] = "java.lang.String";
0762:                signature[1] = "java.lang.String";
0763:                signature[2] = "java.lang.String";
0764:
0765:                resultObject = (Map<String, String>) this .invokeMBeanOperation(
0766:                        mbeanName, "getComponentLoggerDisplayNames", params,
0767:                        signature);
0768:
0769:                return resultObject;
0770:            }
0771:
0772:            /**
0773:             * This method returns a tabular data of a complex open data objects that
0774:             * represent the runtime configuration parameter descriptor. The parameter
0775:             * descriptor should contain the following data that represents the
0776:             * parameter.
0777:             *
0778:             * name : name of the parameter value : value of the parameter as a String
0779:             * type. type : type of the parameter. Basic data types only. description:
0780:             * (optional) description of the parameter. displayName: (optional) display
0781:             * name of the parameter readOnly : true/false validValues : (optional) list
0782:             * of string values with ',' as delimiter. or a range value with - with a
0783:             * '-' as delimiter. min and max strings will be converted to the parameter
0784:             * type and then used to validate the value of the parameter.
0785:             *
0786:             * @param targetName
0787:             *            cluster or instance name ( e.g. cluster1, instance1 ) on which
0788:             *            configuration parameters will be set. null to represent the
0789:             *            default instance which is admin server
0790:             *
0791:             * @return Map<String, Object> that represents the list of configuration
0792:             *         parameter descriptors.
0793:             *
0794:             * @throws ManagementRemoteException
0795:             *             if there is a jmx error accessing the instance
0796:             *
0797:             * @see com.sun.esb.management.api.configuration.ConfigurationService#getDefaultRuntimeConfiguration()
0798:             */
0799:            public Properties getDefaultRuntimeConfiguration()
0800:                    throws ManagementRemoteException {
0801:                ObjectName mbeanName = this 
0802:                        .getConfigurationServiceMBeanObjectName();
0803:                Properties resultObject = null;
0804:
0805:                Object[] params = null;
0806:                String[] signature = null;
0807:
0808:                resultObject = (Properties) this .invokeMBeanOperation(
0809:                        mbeanName, "getDefaultRuntimeConfiguration", params,
0810:                        signature);
0811:
0812:                return resultObject;
0813:            }
0814:
0815:            /**
0816:             * This method returns a tabular data of a complex open data objects that
0817:             * represent the runtime configuration parameter descriptor. The parameter
0818:             * descriptor should contain the following data that represents the
0819:             * parameter.
0820:             *
0821:             * name : name of the parameter value : value of the parameter as a String
0822:             * type. type : type of the parameter. Basic data types only. description:
0823:             * (optional) description of the parameter. displayName: (optional) display
0824:             * name of the parameter readOnly : true/false validValues : (optional) list
0825:             * of string values with ',' as delimiter. or a range value with - with a
0826:             * '-' as delimiter. min and max strings will be converted to the parameter
0827:             * type and then used to validate the value of the parameter.
0828:             *
0829:             * @param targetName
0830:             *            cluster or instance name ( e.g. cluster1, instance1 ) on which
0831:             *            configuration parameters will be set. null to represent the
0832:             *            default instance which is admin server
0833:             *
0834:             * @return Map<String, Object> that represents the list of configuration
0835:             *         parameter descriptors.
0836:             *
0837:             * @throws ManagementRemoteException
0838:             *             if there is a jmx error accessing the instance
0839:             * @see com.sun.esb.management.api.configuration.ConfigurationService#getRuntimeConfiguration(java.lang.String)
0840:             */
0841:            public Properties getRuntimeConfiguration(String targetName)
0842:                    throws ManagementRemoteException {
0843:                ObjectName mbeanName = this 
0844:                        .getConfigurationServiceMBeanObjectName();
0845:                Properties resultObject = null;
0846:
0847:                Object[] params = new Object[1];
0848:                params[0] = targetName;
0849:
0850:                String[] signature = new String[1];
0851:                signature[0] = "java.lang.String";
0852:
0853:                resultObject = (Properties) this 
0854:                        .invokeMBeanOperation(mbeanName,
0855:                                "getRuntimeConfiguration", params, signature);
0856:
0857:                return resultObject;
0858:            }
0859:
0860:            /**
0861:             * This method returns the runtime configuration metadata associated with
0862:             * the specified property. The metadata contain name-value pairs like:
0863:             * default, descriptionID, descriptorType, displayName, displayNameId,
0864:             * isStatic, name, resourceBundleName, tooltip, tooltipId, etc.
0865:             *
0866:             * @param propertyKeyName
0867:             * @return Properties that represent runtime configuration metadata
0868:             * @throws ManagementRemoteException
0869:             *
0870:             * @see com.sun.esb.management.api.configuration.ConfigurationService#getRuntimeConfigurationMetaData(java.lang.String)
0871:             */
0872:            public Properties getRuntimeConfigurationMetaData(
0873:                    String propertyKeyName) throws ManagementRemoteException {
0874:                ObjectName mbeanName = this 
0875:                        .getConfigurationServiceMBeanObjectName();
0876:                Properties resultObject = null;
0877:
0878:                Object[] params = new Object[1];
0879:                params[0] = propertyKeyName;
0880:
0881:                String[] signature = new String[1];
0882:                signature[0] = "java.lang.String";
0883:
0884:                resultObject = (Properties) this .invokeMBeanOperation(
0885:                        mbeanName, "getRuntimeConfigurationMetaData", params,
0886:                        signature);
0887:
0888:                return resultObject;
0889:            }
0890:
0891:            /**
0892:             * Lookup the level of one runtime logger
0893:             *
0894:             * @param runtimeLoggerName
0895:             *            name of the runtime logger (e.g. com.sun.jbi.framework
0896:             * @param targetName
0897:             *            name of the target (e.g., cluster1, server, etc.)
0898:             * @param targetInstanceName
0899:             *            name of the target instance (e.g., cluster1-instance1, etc.)
0900:             * @return a Map of loggerCustomName to their log levels
0901:             * @throws ManagementRemoteException
0902:             *             on error
0903:             *
0904:             * @see com.sun.esb.management.api.configuration.ConfigurationService#getRuntimeLoggerLevel(java.lang.String,
0905:             *      java.lang.String, java.lang.String)
0906:             * @deprecated
0907:             */
0908:            public Level getRuntimeLoggerLevel(String runtimeLoggerName,
0909:                    String targetName, String targetInstanceName)
0910:                    throws ManagementRemoteException {
0911:                ObjectName mbeanName = this 
0912:                        .getConfigurationServiceMBeanObjectName();
0913:                Level resultObject = null;
0914:
0915:                Object[] params = new Object[3];
0916:                params[0] = runtimeLoggerName;
0917:                params[1] = targetName;
0918:                params[2] = targetInstanceName;
0919:
0920:                String[] signature = new String[3];
0921:                signature[0] = "java.lang.String";
0922:                signature[1] = "java.lang.String";
0923:                signature[2] = "java.lang.String";
0924:
0925:                resultObject = (Level) this .invokeMBeanOperation(mbeanName,
0926:                        "getRuntimeLoggerLevel", params, signature);
0927:
0928:                return resultObject;
0929:            }
0930:
0931:            /**
0932:             * Lookup the level of one runtime logger
0933:             *
0934:             * @param runtimeLoggerName
0935:             *            name of the runtime logger (e.g. com.sun.jbi.framework
0936:             * @param targetName
0937:             *            name of the target (e.g., cluster1, server, etc.)
0938:             * @return a Map of loggerCustomName to their log levels
0939:             * @throws ManagementRemoteException
0940:             *             on error
0941:             *
0942:             * @see com.sun.esb.management.api.configuration.ConfigurationService#getRuntimeLoggerLevel(java.lang.String,
0943:             *      java.lang.String)
0944:             */
0945:            public Level getRuntimeLoggerLevel(String runtimeLoggerName,
0946:                    String targetName) throws ManagementRemoteException {
0947:                ObjectName mbeanName = this 
0948:                        .getConfigurationServiceMBeanObjectName();
0949:                Level resultObject = null;
0950:
0951:                Object[] params = new Object[2];
0952:                params[0] = runtimeLoggerName;
0953:                params[1] = targetName;
0954:
0955:                String[] signature = new String[2];
0956:                signature[0] = "java.lang.String";
0957:                signature[1] = "java.lang.String";
0958:
0959:                resultObject = (Level) this .invokeMBeanOperation(mbeanName,
0960:                        "getRuntimeLoggerLevel", params, signature);
0961:
0962:                return resultObject;
0963:            }
0964:
0965:            /**
0966:             * Gets all the runtime loggers and their levels
0967:             *
0968:             * @param targetName
0969:             *            name of the target (e.g., cluster1, server, etc.)
0970:             * @param targetInstanceName
0971:             *            name of the target instance (e.g., cluster1-instance1, etc.)
0972:             * @return a Map of loggerCustomName to their log levels
0973:             * @throws ManagementRemoteException
0974:             *             on error
0975:             *
0976:             * @see com.sun.esb.management.api.configuration.ConfigurationService#getRuntimeLoggerLevels(java.lang.String,
0977:             *      java.lang.String)
0978:             */
0979:            @SuppressWarnings("unchecked")
0980:            public Map<String, Level> getRuntimeLoggerLevels(String targetName,
0981:                    String targetInstanceName) throws ManagementRemoteException {
0982:                ObjectName mbeanName = this 
0983:                        .getConfigurationServiceMBeanObjectName();
0984:                Map<String, Level> resultObject = null;
0985:
0986:                Object[] params = new Object[2];
0987:                params[0] = targetName;
0988:                params[1] = targetInstanceName;
0989:
0990:                String[] signature = new String[2];
0991:                signature[0] = "java.lang.String";
0992:                signature[1] = "java.lang.String";
0993:
0994:                resultObject = (Map<String, Level>) this .invokeMBeanOperation(
0995:                        mbeanName, "getRuntimeLoggerLevels", params, signature);
0996:
0997:                return resultObject;
0998:            }
0999:
1000:            /**
1001:             * Gets all the runtime loggers and their levels
1002:             *
1003:             * @param targetName
1004:             *            name of the target (e.g., cluster1, server, etc.)
1005:             * @return a Map of loggerCustomName to their log levels
1006:             * @throws ManagementRemoteException
1007:             *             on error
1008:             *
1009:             * @see com.sun.esb.management.api.configuration.ConfigurationService#getRuntimeLoggerLevels(java.lang.String)
1010:             */
1011:            @SuppressWarnings("unchecked")
1012:            public Map<String, Level> getRuntimeLoggerLevels(String targetName)
1013:                    throws ManagementRemoteException {
1014:                ObjectName mbeanName = this 
1015:                        .getConfigurationServiceMBeanObjectName();
1016:                Map<String, Level> resultObject = null;
1017:
1018:                Object[] params = new Object[1];
1019:                params[0] = targetName;
1020:
1021:                String[] signature = new String[1];
1022:                signature[0] = "java.lang.String";
1023:
1024:                resultObject = (Map<String, Level>) this .invokeMBeanOperation(
1025:                        mbeanName, "getRuntimeLoggerLevels", params, signature);
1026:
1027:                return resultObject;
1028:            }
1029:
1030:            /**
1031:             * checks if the server need to be restarted to apply the changes made to
1032:             * some of the configuration parameters.
1033:             *
1034:             * @return true if server need to be restarted for updated configuration to
1035:             *         take effect. false if no server restart is needed.
1036:             *
1037:             * @see com.sun.esb.management.api.configuration.ConfigurationService#isServerRestartRequired()
1038:             */
1039:            public boolean isServerRestartRequired()
1040:                    throws ManagementRemoteException {
1041:                ObjectName mbeanName = this 
1042:                        .getConfigurationServiceMBeanObjectName();
1043:                Boolean resultObject = null;
1044:
1045:                Object[] params = null;
1046:                String[] signature = null;
1047:                resultObject = (Boolean) this .invokeMBeanOperation(mbeanName,
1048:                        "isServerRestartRequired", params, signature);
1049:
1050:                return resultObject;
1051:            }
1052:
1053:            /**
1054:             * List all the application configurations in a component.
1055:             *
1056:             * @param componentName
1057:             *            component identification
1058:             * @param targetName
1059:             *            identification of the target. Can be a standalone server,
1060:             *            cluster or clustered instance.
1061:             * @return an array of names of all the application configurations.
1062:             * @throws ManagementRemoteException
1063:             *             if there is a jmx error accessing the instance
1064:             *
1065:             * @see com.sun.esb.management.api.configuration.ConfigurationService#listApplicationConfigurationNames(java.lang.String,
1066:             *      java.lang.String)
1067:             */
1068:            public String[] listApplicationConfigurationNames(
1069:                    String componentName, String targetName)
1070:                    throws ManagementRemoteException {
1071:                ObjectName mbeanName = this 
1072:                        .getConfigurationServiceMBeanObjectName();
1073:                String[] appConfigNames = new String[] {};
1074:
1075:                Object[] params = new Object[2];
1076:                params[0] = componentName;
1077:                params[1] = targetName;
1078:
1079:                String[] signature = new String[2];
1080:                signature[0] = "java.lang.String";
1081:                signature[1] = "java.lang.String";
1082:
1083:                appConfigNames = (String[]) this .invokeMBeanOperation(
1084:                        mbeanName, "listApplicationConfigurationNames", params,
1085:                        signature);
1086:
1087:                return appConfigNames;
1088:            }
1089:
1090:            /**
1091:             * Update a named application configuration in a component installed on a
1092:             * given target.
1093:             *
1094:             * @param componentName
1095:             *            component identification
1096:             * @param name
1097:             *            application configuration name
1098:             * @param config
1099:             *            application configuration represented as a set of properties.
1100:             * @param targetName
1101:             *            identification of the target. Can be a standalone server,
1102:             *            cluster or clustered instance.
1103:             * @return a JBI Management message indicating the status of the operation.
1104:             * @throws ManagementRemoteException
1105:             *             if there is a jmx error accessing the instance
1106:             *
1107:             * @see com.sun.esb.management.api.configuration.ConfigurationService#setApplicationConfiguration(java.lang.String,
1108:             *      java.lang.String, java.util.Properties, java.lang.String)
1109:             */
1110:            public String setApplicationConfiguration(String componentName,
1111:                    String name, Properties config, String targetName)
1112:                    throws ManagementRemoteException {
1113:                ObjectName mbeanName = this 
1114:                        .getConfigurationServiceMBeanObjectName();
1115:                String jbiMgtMsgResponse = null;
1116:
1117:                Object[] params = new Object[4];
1118:                params[0] = componentName;
1119:                params[1] = name;
1120:                params[2] = config;
1121:                params[3] = targetName;
1122:
1123:                String[] signature = new String[4];
1124:                signature[0] = "java.lang.String";
1125:                signature[1] = "java.lang.String";
1126:                signature[2] = "java.util.Properties";
1127:                signature[3] = "java.lang.String";
1128:
1129:                jbiMgtMsgResponse = (String) this .invokeMBeanOperation(
1130:                        mbeanName, "setApplicationConfiguration", params,
1131:                        signature);
1132:
1133:                return jbiMgtMsgResponse;
1134:            }
1135:
1136:            /**
1137:             * Set application variables on a component installed on a given target. If
1138:             * even a variable from the set has not been added to the component, this
1139:             * operation fails.
1140:             *
1141:             * @param componentName
1142:             *            component identification
1143:             * @param appVariables -
1144:             *            set of application variables to update. The values of the
1145:             *            application variables have the application variable type and
1146:             *            value and the format is "[type]value"
1147:             * @param targetName
1148:             *            identification of the target. Can be a standalone server,
1149:             *            cluster or clustered instance.
1150:             * @return a JBI Management message indicating the status of the operation.
1151:             *         In case a variable is not set the management message has a ERROR
1152:             *         task status message giving the details of the failure.
1153:             * @throws ManagementRemoteException
1154:             *             if there is a jmx error accessing the instance
1155:             *
1156:             * @see com.sun.esb.management.api.configuration.ConfigurationService#setApplicationVariables(java.lang.String,
1157:             *      java.util.Properties, java.lang.String)
1158:             */
1159:            public String setApplicationVariables(String componentName,
1160:                    Properties appVariables, String targetName)
1161:                    throws ManagementRemoteException {
1162:                ObjectName mbeanName = this 
1163:                        .getConfigurationServiceMBeanObjectName();
1164:                String result = null;
1165:
1166:                Object[] params = new Object[3];
1167:                params[0] = componentName;
1168:                params[1] = appVariables;
1169:                params[2] = targetName;
1170:
1171:                String[] signature = new String[3];
1172:                signature[0] = "java.lang.String";
1173:                signature[1] = "java.util.Properties";
1174:                signature[2] = "java.lang.String";
1175:
1176:                result = (String) this .invokeMBeanOperation(mbeanName,
1177:                        "setApplicationVariables", params, signature);
1178:
1179:                return result;
1180:            }
1181:
1182:            /**
1183:             * Will return jbi mgmt message with success, failure, or partial success
1184:             * per instance. The entry per instance will have value as part of the
1185:             * management message (XML) String.
1186:             *
1187:             * @param targetName
1188:             *            the name of the JBI target
1189:             * @param componentName
1190:             *            the component name
1191:             * @param configurationValues
1192:             *            the configuration properties
1193:             * @return
1194:             *
1195:             * @see com.sun.esb.management.api.configuration.ConfigurationService#setComponentConfiguration(java.lang.String,
1196:             *      java.util.Properties, java.lang.String)
1197:             */
1198:            public String setComponentConfiguration(String componentName,
1199:                    Properties configurationValues, String targetName)
1200:                    throws ManagementRemoteException {
1201:                ObjectName mbeanName = this 
1202:                        .getConfigurationServiceMBeanObjectName();
1203:                String resultObject = null;
1204:
1205:                Object[] params = new Object[3];
1206:                params[0] = componentName;
1207:                params[1] = configurationValues;
1208:                params[2] = targetName;
1209:
1210:                String[] signature = new String[3];
1211:                signature[0] = "java.lang.String";
1212:                signature[1] = "java.util.Properties";
1213:                signature[2] = "java.lang.String";
1214:
1215:                resultObject = (String) this .invokeMBeanOperation(mbeanName,
1216:                        "setComponentConfiguration", params, signature);
1217:                return resultObject;
1218:            }
1219:
1220:            /**
1221:             * Sets the component log level for a given custom logger
1222:             *
1223:             * @param componentName
1224:             *            name of the component
1225:             * @param loggerCustomName
1226:             *            the custom logger name
1227:             * @param logLevel
1228:             *            the level to set the logger
1229:             * @param targetName
1230:             *            name of the target (e.g., cluster1, server, etc.)
1231:             * @param targetInstanceName
1232:             *            name of the target instance (e.g., cluster1-instance1, etc.)
1233:             * @throws ManagementRemoteException
1234:             *             on error
1235:             *
1236:             * @see com.sun.esb.management.api.configuration.ConfigurationService#setComponentLoggerLevel(java.lang.String,
1237:             *      java.lang.String, java.util.logging.Level, java.lang.String,
1238:             *      java.lang.String)
1239:             */
1240:            public void setComponentLoggerLevel(String componentName,
1241:                    String loggerCustomName, Level logLevel, String targetName,
1242:                    String targetInstanceName) throws ManagementRemoteException {
1243:                ObjectName mbeanName = this 
1244:                        .getConfigurationServiceMBeanObjectName();
1245:
1246:                Object[] params = new Object[5];
1247:                params[0] = componentName;
1248:                params[1] = loggerCustomName;
1249:                params[2] = logLevel;
1250:                params[3] = targetName;
1251:                params[4] = targetInstanceName;
1252:
1253:                String[] signature = new String[5];
1254:                signature[0] = "java.lang.String";
1255:                signature[1] = "java.lang.String";
1256:                signature[2] = "java.util.logging.Level";
1257:                signature[3] = "java.lang.String";
1258:                signature[4] = "java.lang.String";
1259:
1260:                this .invokeMBeanOperation(mbeanName, "setComponentLoggerLevel",
1261:                        params, signature);
1262:            }
1263:
1264:            /**
1265:             * This method sets one or more configuration parameters on the runtime with
1266:             * a list of name/value pairs passed as a properties object. The property
1267:             * name in the properties object should be an existing configuration
1268:             * parameter name. If user try to set the parameter that is not in the
1269:             * configuration parameters list, this method will throw an exception.
1270:             *
1271:             * The value of the property can be any object. If the value is non string
1272:             * object, its string value (Object.toString()) will be used as a value that
1273:             * will be set on the configuration.
1274:             *
1275:             * This method first validates whether all the paramters passed in
1276:             * properties object exist in the runtime configuration or not. If any one
1277:             * the parameters passed is not existing, it will return an error without
1278:             * settings the parameters that are passed in the properties including a
1279:             * valid parameters.
1280:             *
1281:             * If there is an error in setting a paramter, this method throws an
1282:             * exception with the list of parameters that were not set.
1283:             *
1284:             * @param Map
1285:             *            <String, Object> params Properties object that contains
1286:             *            name/value pairs corresponding to the configuration parameters
1287:             *            to be set on the runtime.
1288:             *
1289:             * @param targetName
1290:             *            cluster or instance name ( e.g. cluster1, instance1 ) on which
1291:             *            configuration parameters will be set. null to represent the
1292:             *            default instance which is admin server
1293:             *
1294:             * @return true if server restart is required, false if not
1295:             *
1296:             * @throws ManagementRemoteException
1297:             *             if there is a jmx error or a invalid parameter is passed in
1298:             *             the params properties object. In case of an error setting the
1299:             *             a particular parameter, the error message should list the
1300:             *             invalid parameters.
1301:             * @see com.sun.esb.management.api.configuration.ConfigurationService#setRuntimeConfiguration(java.util.Properties,
1302:             *      java.lang.String)
1303:             */
1304:            public boolean setRuntimeConfiguration(Properties parameters,
1305:                    String targetName) throws ManagementRemoteException {
1306:                ObjectName mbeanName = this 
1307:                        .getConfigurationServiceMBeanObjectName();
1308:                Boolean resultObject = null;
1309:
1310:                Object[] params = new Object[2];
1311:                params[0] = parameters;
1312:                params[1] = targetName;
1313:
1314:                String[] signature = new String[2];
1315:                signature[0] = "java.util.Properties";
1316:                signature[1] = "java.lang.String";
1317:
1318:                resultObject = (Boolean) this .invokeMBeanOperation(mbeanName,
1319:                        "setRuntimeConfiguration", params, signature);
1320:                return resultObject.booleanValue();
1321:            }
1322:
1323:            /**
1324:             * Sets the log level for a given runtime logger
1325:             *
1326:             * @param runtimeLoggerName
1327:             *            name of the runtime logger
1328:             * @param logLevel
1329:             *            the level to set the logger
1330:             * @param targetName
1331:             *            name of the target (e.g., cluster1, server, etc.)
1332:             * @param targetInstanceName
1333:             *            name of the target instance (e.g., cluster1-instance1, etc.)
1334:             * @throws ManagementRemoteException
1335:             *             on error
1336:             *
1337:             * @see com.sun.esb.management.api.configuration.ConfigurationService#setRuntimeLoggerLevel(java.lang.String,
1338:             *      java.util.logging.Level, java.lang.String, java.lang.String)
1339:             * @deprecated
1340:             */
1341:            public void setRuntimeLoggerLevel(String runtimeLoggerName,
1342:                    Level logLevel, String targetName, String targetInstanceName)
1343:                    throws ManagementRemoteException {
1344:                ObjectName mbeanName = this 
1345:                        .getConfigurationServiceMBeanObjectName();
1346:
1347:                Object[] params = new Object[4];
1348:                params[0] = runtimeLoggerName;
1349:                params[1] = logLevel;
1350:                params[2] = targetName;
1351:                params[3] = targetInstanceName;
1352:
1353:                String[] signature = new String[4];
1354:                signature[0] = "java.lang.String";
1355:                signature[1] = "java.util.logging.Level";
1356:                signature[2] = "java.lang.String";
1357:                signature[3] = "java.lang.String";
1358:
1359:                this .invokeMBeanOperation(mbeanName, "setRuntimeLoggerLevel",
1360:                        params, signature);
1361:            }
1362:
1363:            /**
1364:             * Sets the log level for a given runtime logger
1365:             *
1366:             * @param runtimeLoggerName
1367:             *            name of the runtime logger
1368:             * @param logLevel
1369:             *            the level to set the logger
1370:             * @param targetName
1371:             *            name of the target (e.g., cluster1, server, etc.)
1372:             * @throws ManagementRemoteException
1373:             *             on error
1374:             *
1375:             * @see com.sun.esb.management.api.configuration.ConfigurationService#setRuntimeLoggerLevel(java.lang.String,
1376:             *      java.util.logging.Level, java.lang.String)
1377:             */
1378:            public void setRuntimeLoggerLevel(String runtimeLoggerName,
1379:                    Level logLevel, String targetName)
1380:                    throws ManagementRemoteException {
1381:                ObjectName mbeanName = this 
1382:                        .getConfigurationServiceMBeanObjectName();
1383:
1384:                Object[] params = new Object[3];
1385:                params[0] = runtimeLoggerName;
1386:                params[1] = logLevel;
1387:                params[2] = targetName;
1388:
1389:                String[] signature = new String[3];
1390:                signature[0] = "java.lang.String";
1391:                signature[1] = "java.util.logging.Level";
1392:                signature[2] = "java.lang.String";
1393:
1394:                this .invokeMBeanOperation(mbeanName, "setRuntimeLoggerLevel",
1395:                        params, signature);
1396:            }
1397:
1398:            /**
1399:             * Gets all the runtime loggers and their display names
1400:             *
1401:             * @param targetName
1402:             *            name of the target (e.g., cluster1, server, etc.)
1403:             * @param targetInstanceName
1404:             *            name of the target instance (e.g., cluster1-instance1, etc.)
1405:             * @return a Map of display names to their logger names
1406:             * @throws ManagementRemoteException
1407:             *             on error
1408:             * @deprecated
1409:             */
1410:            @SuppressWarnings("unchecked")
1411:            public Map<String /* display name */, String /* logger name */> getRuntimeLoggerNames(
1412:                    String targetName, String targetInstanceName)
1413:                    throws ManagementRemoteException {
1414:                ObjectName mbeanName = this 
1415:                        .getConfigurationServiceMBeanObjectName();
1416:
1417:                Map<String, String> resultObject = null;
1418:
1419:                Object[] params = new Object[2];
1420:                params[0] = targetName;
1421:                params[1] = targetInstanceName;
1422:
1423:                String[] signature = new String[2];
1424:                signature[0] = "java.lang.String";
1425:                signature[1] = "java.lang.String";
1426:
1427:                resultObject = (Map<String, String>) this .invokeMBeanOperation(
1428:                        mbeanName, "getRuntimeLoggerNames", params, signature);
1429:
1430:                return resultObject;
1431:            }
1432:
1433:            /**
1434:             * Gets all the runtime loggers and their display names
1435:             *
1436:             * @param targetName
1437:             *            name of the target (e.g., cluster1, server, etc.)
1438:             * @return a Map of display names to their logger names
1439:             * @throws ManagementRemoteException
1440:             *             on error
1441:             */
1442:            @SuppressWarnings("unchecked")
1443:            public Map<String /* display name */, String /* logger name */> getRuntimeLoggerNames(
1444:                    String targetName) throws ManagementRemoteException {
1445:                ObjectName mbeanName = this 
1446:                        .getConfigurationServiceMBeanObjectName();
1447:
1448:                Map<String, String> resultObject = null;
1449:
1450:                Object[] params = new Object[1];
1451:                params[0] = targetName;
1452:
1453:                String[] signature = new String[1];
1454:                signature[0] = "java.lang.String";
1455:
1456:                resultObject = (Map<String, String>) this .invokeMBeanOperation(
1457:                        mbeanName, "getRuntimeLoggerNames", params, signature);
1458:
1459:                return resultObject;
1460:            }
1461:
1462:            /**
1463:             * Return the display name for a runtime logger
1464:             *
1465:             * @param runtimeLoggerName
1466:             *            name of the logger (e.g. com.sun.jbi.framework)
1467:             * @param targetName
1468:             *            name of the target (e.g., cluster1, server, etc.)
1469:             * @param targetInstanceName
1470:             *            name of the target instance (e.g., cluster1-instance1, etc.)
1471:             * @return the display name for the given logger
1472:             * @throws JBIRemoteException
1473:             *             on error
1474:             * @deprecated
1475:             */
1476:            public String getRuntimeLoggerDisplayName(String runtimeLoggerName,
1477:                    String targetName, String targetInstanceName)
1478:                    throws ManagementRemoteException {
1479:                ObjectName mbeanName = this 
1480:                        .getConfigurationServiceMBeanObjectName();
1481:
1482:                String resultString = null;
1483:
1484:                Object[] params = new Object[3];
1485:                params[0] = runtimeLoggerName;
1486:                params[1] = targetName;
1487:                params[2] = targetInstanceName;
1488:
1489:                String[] signature = new String[3];
1490:                signature[0] = "java.lang.String";
1491:                signature[1] = "java.lang.String";
1492:                signature[2] = "java.lang.String";
1493:
1494:                resultString = (String) this .invokeMBeanOperation(mbeanName,
1495:                        "getRuntimeLoggerDisplayName", params, signature);
1496:
1497:                return resultString;
1498:            }
1499:
1500:            /**
1501:             * Return the display name for a runtime logger
1502:             *
1503:             * @param runtimeLoggerName
1504:             *            name of the logger (e.g. com.sun.jbi.framework)
1505:             * @param targetName
1506:             *            name of the target (e.g., cluster1, server, etc.)
1507:             * @return the display name for the given logger
1508:             * @throws JBIRemoteException
1509:             *             on error
1510:             */
1511:            public String getRuntimeLoggerDisplayName(String runtimeLoggerName,
1512:                    String targetName) throws ManagementRemoteException {
1513:                ObjectName mbeanName = this 
1514:                        .getConfigurationServiceMBeanObjectName();
1515:
1516:                String resultString = null;
1517:
1518:                Object[] params = new Object[2];
1519:                params[0] = runtimeLoggerName;
1520:                params[1] = targetName;
1521:
1522:                String[] signature = new String[2];
1523:                signature[0] = "java.lang.String";
1524:                signature[1] = "java.lang.String";
1525:
1526:                resultString = (String) this .invokeMBeanOperation(mbeanName,
1527:                        "getRuntimeLoggerDisplayName", params, signature);
1528:
1529:                return resultString;
1530:            }
1531:
1532:            /**
1533:             * This method is used to verify if the application variables and
1534:             * application configuration objects used in the given application are
1535:             * available in JBI runtime in the specified target. Also this method
1536:             * verifies if all necessary components are installed. If generateTemplates
1537:             * is true templates for missing application variables and application
1538:             * configurations are generated. A command script that uses the template
1539:             * files to set configuration objects is generated.
1540:             *
1541:             * @param applicationURL
1542:             *            the URL for the application zip file
1543:             * @param generateTemplates
1544:             *            true if templates have to be generated
1545:             * @param templateDir
1546:             *            the dir to store the generated templates
1547:             * @param includeDeployCommand
1548:             *            true if the generated script should include deploy command
1549:             * @param targetName
1550:             *            the target on which the application has to be verified
1551:             *
1552:             * @returns XML string corresponding to the verification report
1553:             *
1554:             * CompositeType of verification report String - "ServiceAssemblyName",
1555:             * String - "ServiceAssemblyDescription", Integer - "NumServiceUnits",
1556:             * Boolean - "AllComponentsInstalled", String[] - "MissingComponentsList",
1557:             * CompositeData[] - "EndpointInfo", String - "TemplateZIPID"
1558:             *
1559:             * CompositeType of each EndpointInfo String - "EndpointName", String -
1560:             * "ServiceUnitName", String - "ComponentName", String - "Status"
1561:             *
1562:             * @throws ManagementRemoteException
1563:             *             if the application could not be verified
1564:             *
1565:             * Note: param templateDir is used between ant/cli and common client client
1566:             * TemplateZIPID is used between common client server and common client
1567:             * client
1568:             *
1569:             * @see com.sun.esb.management.api.configuration.ConfigurationService#verifyApplication(java.lang.String,
1570:             *      boolean, java.lang.String, boolean, java.lang.String)
1571:             */
1572:            public String verifyApplication(String applicationURL,
1573:                    boolean generateTemplates, String templateDir,
1574:                    boolean includeDeployCommand, String targetName)
1575:                    throws ManagementRemoteException {
1576:                ObjectName mbeanName = this 
1577:                        .getConfigurationServiceMBeanObjectName();
1578:                String appFilePath = applicationURL;
1579:                if (this .isRemoteConnection() == true) {
1580:                    appFilePath = uploadFile(applicationURL);
1581:                }
1582:
1583:                Object[] params = new Object[5];
1584:                params[0] = appFilePath;
1585:                params[1] = Boolean.valueOf(generateTemplates);
1586:                params[2] = templateDir;
1587:                params[3] = Boolean.valueOf(includeDeployCommand);
1588:                params[4] = targetName;
1589:
1590:                String[] signature = new String[5];
1591:                signature[0] = "java.lang.String";
1592:                signature[1] = "boolean";
1593:                signature[2] = "java.lang.String";
1594:                signature[3] = "boolean";
1595:                signature[4] = "java.lang.String";
1596:
1597:                String rawXMLData = (String) this .invokeMBeanOperation(
1598:                        mbeanName, "verifyApplication", params, signature);
1599:
1600:                ApplicationVerificationReport report = null;
1601:                try {
1602:                    report = ApplicationVerificationReportReader
1603:                            .parseFromXMLData(rawXMLData);
1604:                } catch (MalformedURLException e) {
1605:                    throw new ManagementRemoteException(e);
1606:                } catch (ParserConfigurationException e) {
1607:                    throw new ManagementRemoteException(e);
1608:                } catch (SAXException e) {
1609:                    throw new ManagementRemoteException(e);
1610:                } catch (URISyntaxException e) {
1611:                    throw new ManagementRemoteException(e);
1612:                } catch (IOException e) {
1613:                    throw new ManagementRemoteException(e);
1614:                }
1615:
1616:                if (generateTemplates) {
1617:                    downloadAndExtractZip(report.getTemplateZipId(),
1618:                            templateDir);
1619:                }
1620:                return rawXMLData;
1621:            }
1622:
1623:            /**
1624:             * This method is used to download the template zip from the server and
1625:             * extract it in the specified dir
1626:             *
1627:             * @param filePath
1628:             *            the path to the template zip in the server
1629:             * @param templateDir
1630:             *            the dir to extract the zip into
1631:             */
1632:            protected void downloadAndExtractZip(String filePath,
1633:                    String templateDir) throws ManagementRemoteException {
1634:                try {
1635:                    File directory = new File(templateDir);
1636:                    if (false == directory.exists()) {
1637:                        directory.mkdirs();
1638:                    }
1639:                    String fileName = downloadFile(templateDir, filePath);
1640:                    JarFactory jarFactory = new JarFactory(templateDir);
1641:                    File templateZip = new File(templateDir, fileName);
1642:                    ZipFile zipFile = new ZipFile(templateZip);
1643:                    jarFactory.unJar(zipFile);
1644:
1645:                    //after extracting the files, delete the zip file
1646:                    if (templateZip.isFile()) {
1647:                        zipFile = null;
1648:                        if (!templateZip.delete()) {
1649:                            templateZip.deleteOnExit();
1650:                        }
1651:                    }
1652:                } catch (Exception ex) {
1653:                    throw new ManagementRemoteException(ex);
1654:                }
1655:            }
1656:
1657:            /*---------------------------------------------------------------------------------*\
1658:             *            Operations Component Configuration meta-data Management              *
1659:            \*---------------------------------------------------------------------------------*/
1660:            /**
1661:             * Get the CompositeType definition for the components application
1662:             * configuration
1663:             *
1664:             * @param componentName
1665:             *            component identification
1666:             * @param targetName
1667:             *            identification of the target. Can be a standalone server,
1668:             *            cluster or clustered instance.
1669:             * @return the CompositeType for the components application configuration.
1670:             */
1671:            public CompositeType queryApplicationConfigurationType(
1672:                    String componentName, String targetName)
1673:                    throws ManagementRemoteException {
1674:                ObjectName mbeanName = this 
1675:                        .getConfigurationServiceMBeanObjectName();
1676:                javax.management.openmbean.CompositeType appCfgType = null;
1677:
1678:                Object[] params = new Object[2];
1679:                params[0] = componentName;
1680:                params[1] = targetName;
1681:
1682:                String[] signature = new String[2];
1683:                signature[0] = "java.lang.String";
1684:                signature[1] = "java.lang.String";
1685:
1686:                appCfgType = (CompositeType) this .invokeMBeanOperation(
1687:                        mbeanName, "queryApplicationConfigurationType", params,
1688:                        signature);
1689:
1690:                return appCfgType;
1691:            }
1692:
1693:            /**
1694:             * Retrieves the component specific configuration schema.
1695:             *
1696:             * @param componentName
1697:             *            component identification
1698:             * @param targetName
1699:             *            identification of the target. Can be a standalone server,
1700:             *            cluster or clustered instance.
1701:             * @return a String containing the configuration schema.
1702:             * @throws ManagementRemoteException
1703:             *             on errors.
1704:             */
1705:            public String retrieveConfigurationDisplaySchema(
1706:                    String componentName, String targetName)
1707:                    throws ManagementRemoteException {
1708:                ObjectName mbeanName = this 
1709:                        .getConfigurationServiceMBeanObjectName();
1710:                String schema = "";
1711:
1712:                Object[] params = new Object[2];
1713:                params[0] = componentName;
1714:                params[1] = targetName;
1715:
1716:                String[] signature = new String[2];
1717:                signature[0] = "java.lang.String";
1718:                signature[1] = "java.lang.String";
1719:
1720:                schema = (String) this 
1721:                        .invokeMBeanOperation(mbeanName,
1722:                                "retrieveConfigurationDisplaySchema", params,
1723:                                signature);
1724:
1725:                return schema;
1726:            }
1727:
1728:            /**
1729:             * Retrieves the component configuration metadata. The XML data conforms to
1730:             * the component configuration schema.
1731:             *
1732:             * @param componentName
1733:             *            component identification
1734:             * @param targetName
1735:             *            identification of the target. Can be a standalone server,
1736:             *            cluster or clustered instance.
1737:             * @return a String containing the configuration metadata.
1738:             * @throws ManagementRemoteException
1739:             *             on errors
1740:             */
1741:            public String retrieveConfigurationDisplayData(
1742:                    String componentName, String targetName)
1743:                    throws ManagementRemoteException {
1744:                ObjectName mbeanName = this 
1745:                        .getConfigurationServiceMBeanObjectName();
1746:
1747:                String data = "";
1748:
1749:                Object[] params = new Object[2];
1750:                params[0] = componentName;
1751:                params[1] = targetName;
1752:
1753:                String[] signature = new String[2];
1754:                signature[0] = "java.lang.String";
1755:                signature[1] = "java.lang.String";
1756:
1757:                data = (String) this .invokeMBeanOperation(mbeanName,
1758:                        "retrieveConfigurationDisplayData", params, signature);
1759:
1760:                return data;
1761:            }
1762:
1763:            /**
1764:             * Add an application configuration. The configuration name is a part of the
1765:             * CompositeData. The itemName for the configuration name is
1766:             * "configurationName" and the type is SimpleType.STRING
1767:             *
1768:             * @param componentName
1769:             * @param targetName
1770:             * @param name -
1771:             *            configuration name, must match the value of the field "name"
1772:             *            in the namedConfig
1773:             * @param appConfig -
1774:             *            application configuration composite
1775:             * @return management message string which gives the status of the
1776:             *         operation. For target=cluster, instance specific details are
1777:             *         included.
1778:             * @throws ManagementRemoteException
1779:             *             if the application configuration cannot be added.
1780:             */
1781:            public String addApplicationConfiguration(String componentName,
1782:                    String targetName, String name, CompositeData appConfig)
1783:                    throws ManagementRemoteException {
1784:                ObjectName mbeanName = this 
1785:                        .getConfigurationServiceMBeanObjectName();
1786:
1787:                String data = "";
1788:
1789:                Object[] params = new Object[4];
1790:                params[0] = componentName;
1791:                params[1] = targetName;
1792:                params[2] = name;
1793:                params[3] = appConfig;
1794:
1795:                String[] signature = new String[4];
1796:                signature[0] = "java.lang.String";
1797:                signature[1] = "java.lang.String";
1798:                signature[2] = "java.lang.String";
1799:                signature[3] = "javax.management.openmbean.CompositeData";
1800:
1801:                data = (String) this .invokeMBeanOperation(mbeanName,
1802:                        "addApplicationConfiguration", params, signature);
1803:
1804:                return data;
1805:            }
1806:
1807:            /**
1808:             * Update a application configuration. The configuration name is a part of
1809:             * the CompositeData. The itemName for the configuration name is
1810:             * "configurationName" and the type is SimpleType.STRING
1811:             *
1812:             * @param componentName
1813:             * @param targetName
1814:             * @param name -
1815:             *            configuration name, must match the value of the field
1816:             *            "configurationName" in the appConfig
1817:             * @param appConfig -
1818:             *            application configuration composite
1819:             * @return management message string which gives the status of the
1820:             *         operation. For target=cluster, instance specific details are
1821:             *         included.
1822:             * @throws ManagementRemoteException
1823:             *             if there are errors encountered when updating the
1824:             *             configuration.
1825:             */
1826:            public String setApplicationConfiguration(String componentName,
1827:                    String targetName, String name, CompositeData appConfig)
1828:                    throws ManagementRemoteException {
1829:                ObjectName mbeanName = this 
1830:                        .getConfigurationServiceMBeanObjectName();
1831:
1832:                String data = "";
1833:
1834:                Object[] params = new Object[4];
1835:                params[0] = componentName;
1836:                params[1] = targetName;
1837:                params[2] = name;
1838:                params[3] = appConfig;
1839:
1840:                String[] signature = new String[4];
1841:                signature[0] = "java.lang.String";
1842:                signature[1] = "java.lang.String";
1843:                signature[2] = "java.lang.String";
1844:                signature[3] = "javax.management.openmbean.CompositeData";
1845:
1846:                data = (String) this .invokeMBeanOperation(mbeanName,
1847:                        "setApplicationConfiguration", params, signature);
1848:
1849:                return data;
1850:            }
1851:
1852:            /**
1853:             * Get a Map of all application configurations for the component.
1854:             *
1855:             * @param componentName
1856:             * @param targetName
1857:             * @return a TabularData of all the application configurations for a
1858:             *         component keyed by the configuration name.
1859:             * @throws ManagementRemoteException
1860:             *             if there are errors encountered when updating the
1861:             *             configuration.
1862:             */
1863:            public TabularData getApplicationConfigurationsAsTabularData(
1864:                    String componentName, String targetName)
1865:                    throws ManagementRemoteException {
1866:                ObjectName mbeanName = this 
1867:                        .getConfigurationServiceMBeanObjectName();
1868:
1869:                TabularData data = null;
1870:
1871:                Object[] params = new Object[2];
1872:                params[0] = componentName;
1873:                params[1] = targetName;
1874:
1875:                String[] signature = new String[2];
1876:                signature[0] = "java.lang.String";
1877:                signature[1] = "java.lang.String";
1878:
1879:                data = (TabularData) this .invokeMBeanOperation(mbeanName,
1880:                        "getApplicationConfigurationsAsTabularData", params,
1881:                        signature);
1882:
1883:                return data;
1884:            }
1885:
1886:            /**
1887:             * Get the Application Variable set for a component.
1888:             *
1889:             * @param componentName
1890:             * @param targetName
1891:             * @return a TabularData which has all the application variables set on the
1892:             *         component.
1893:             * @throws ManagementRemoteException
1894:             */
1895:            public TabularData getApplicationVariablesAsTabularData(
1896:                    String componentName, String targetName)
1897:                    throws ManagementRemoteException {
1898:                ObjectName mbeanName = this 
1899:                        .getConfigurationServiceMBeanObjectName();
1900:
1901:                TabularData data = null;
1902:
1903:                Object[] params = new Object[2];
1904:                params[0] = componentName;
1905:                params[1] = targetName;
1906:
1907:                String[] signature = new String[2];
1908:                signature[0] = "java.lang.String";
1909:                signature[1] = "java.lang.String";
1910:
1911:                data = (TabularData) this .invokeMBeanOperation(mbeanName,
1912:                        "getApplicationVariablesAsTabularData", params,
1913:                        signature);
1914:
1915:                return data;
1916:            }
1917:
1918:            /**
1919:             * This operation adds a new application variable. If a variable already
1920:             * exists with the same name as that specified then the operation fails.
1921:             *
1922:             * @param componentName
1923:             * @param targetName
1924:             * @param name -
1925:             *            name of the application variable
1926:             * @param appVar -
1927:             *            this is the application variable compoiste
1928:             * @return management message string which gives the status of the
1929:             *         operation. For target=cluster, instance specific details are
1930:             *         included.
1931:             * @throws ManagementRemoteException
1932:             *             if an error occurs in adding the application variables to the
1933:             *         component.
1934:             */
1935:            public String addApplicationVariable(String componentName,
1936:                    String targetName, String name, CompositeData appVar)
1937:                    throws ManagementRemoteException {
1938:                ObjectName mbeanName = this 
1939:                        .getConfigurationServiceMBeanObjectName();
1940:
1941:                String data = "";
1942:
1943:                Object[] params = new Object[4];
1944:                params[0] = componentName;
1945:                params[1] = targetName;
1946:                params[2] = name;
1947:                params[3] = appVar;
1948:
1949:                String[] signature = new String[4];
1950:                signature[0] = "java.lang.String";
1951:                signature[1] = "java.lang.String";
1952:                signature[2] = "java.lang.String";
1953:                signature[3] = "javax.management.openmbean.CompositeData";
1954:
1955:                data = (String) this .invokeMBeanOperation(mbeanName,
1956:                        "addApplicationVariable", params, signature);
1957:
1958:                return data;
1959:            }
1960:
1961:            /**
1962:             * This operation sets an application variable. If a variable does not exist
1963:             * with the same name, its an error.
1964:             *
1965:             * @param componentName
1966:             * @param targetName
1967:             * @param name -
1968:             *            name of the application variable
1969:             * @param appVar -
1970:             *            this is the application variable compoiste to be updated.
1971:             * @return management message string which gives the status of the
1972:             *         operation. For target=cluster, instance specific details are
1973:             *         included.
1974:             * @throws ManagementRemoteException
1975:             *             if one or more application variables cannot be deleted
1976:             */
1977:            public String setApplicationVariable(String componentName,
1978:                    String targetName, String name, CompositeData appVar)
1979:                    throws ManagementRemoteException {
1980:                ObjectName mbeanName = this 
1981:                        .getConfigurationServiceMBeanObjectName();
1982:
1983:                String data = "";
1984:
1985:                Object[] params = new Object[4];
1986:                params[0] = componentName;
1987:                params[1] = targetName;
1988:                params[2] = name;
1989:                params[3] = appVar;
1990:
1991:                String[] signature = new String[4];
1992:                signature[0] = "java.lang.String";
1993:                signature[1] = "java.lang.String";
1994:                signature[2] = "java.lang.String";
1995:                signature[3] = "javax.management.openmbean.CompositeData";
1996:
1997:                data = (String) this .invokeMBeanOperation(mbeanName,
1998:                        "setApplicationVariable", params, signature);
1999:
2000:                return data;
2001:            }
2002:
2003:            /////////////////
2004:
2005:            /**
2006:             * This method returns a tabular data of a complex open data objects that
2007:             * represent the runtime configuration parameter descriptor. The parameter
2008:             * descriptor should contain the following data that represents the
2009:             * parameter.
2010:             *
2011:             * name : name of the parameter value : value of the parameter as a String
2012:             * type. type : type of the parameter. Basic data types only. description:
2013:             * (optional) description of the parameter. displayName: (optional) display
2014:             * name of the parameter readOnly : true/false validValues : (optional) list
2015:             * of string values with ',' as delimiter. or a range value with - with a
2016:             * '-' as delimiter. min and max strings will be converted to the parameter
2017:             * type and then used to validate the value of the parameter.
2018:             *
2019:             * @param targetName
2020:             *            cluster or instance name ( e.g. cluster1, instance1 ) on which
2021:             *            configuration parameters will be set. null to represent the
2022:             *            default instance which is admin server
2023:             *
2024:             * @return Map that represents the list of configuration parameter
2025:             *         descriptors.
2026:             *
2027:             * @throws ManagementRemoteException
2028:             *             if there is a jmx error accessing the instance
2029:             */
2030:            @SuppressWarnings("unchecked")
2031:            public Map<String /*attributeName*/, Object /*attributeValue*/> getDefaultRuntimeConfigurationAsMap()
2032:                    throws ManagementRemoteException {
2033:                ObjectName mbeanName = this 
2034:                        .getConfigurationServiceMBeanObjectName();
2035:
2036:                Map<String /* attributeName */, Object /* attributeValue */> data = null;
2037:
2038:                Object[] params = null;
2039:
2040:                String[] signature = null;
2041:
2042:                data = (Map<String /* attributeName */, Object /* attributeValue */>) this 
2043:                        .invokeMBeanOperation(mbeanName,
2044:                                "getDefaultRuntimeConfigurationAsMap", params,
2045:                                signature);
2046:
2047:                return data;
2048:            }
2049:
2050:            /**
2051:             * This method returns a tabular data of a complex open data objects that
2052:             * represent the runtime configuration parameter descriptor. The parameter
2053:             * descriptor should contain the following data that represents the
2054:             * parameter.
2055:             *
2056:             * name : name of the parameter value : value of the parameter as a String
2057:             * type. type : type of the parameter. Basic data types only. description:
2058:             * (optional) description of the parameter. displayName: (optional) display
2059:             * name of the parameter readOnly : true/false validValues : (optional) list
2060:             * of string values with ',' as delimiter. or a range value with - with a
2061:             * '-' as delimiter. min and max strings will be converted to the parameter
2062:             * type and then used to validate the value of the parameter.
2063:             *
2064:             * @param targetName
2065:             *            cluster or instance name ( e.g. cluster1, instance1 ) on which
2066:             *            configuration parameters will be set. null to represent the
2067:             *            default instance which is admin server
2068:             *
2069:             * @return Map that represents the list of configuration parameter
2070:             *         descriptors.
2071:             *
2072:             * @throws ManagementRemoteException
2073:             *             if there is a jmx error accessing the instance
2074:             */
2075:            @SuppressWarnings("unchecked")
2076:            public Map<String /* attributeName */, Object /* attributeValue */> getRuntimeConfigurationAsMap(
2077:                    String targetName) throws ManagementRemoteException {
2078:                ObjectName mbeanName = this 
2079:                        .getConfigurationServiceMBeanObjectName();
2080:
2081:                Map<String /* attributeName */, Object /* attributeValue */> data = null;
2082:
2083:                Object[] params = new Object[1];
2084:                params[0] = targetName;
2085:
2086:                String[] signature = new String[1];
2087:                signature[0] = "java.lang.String";
2088:
2089:                data = (Map<String /* attributeName */, Object /* attributeValue */>) this 
2090:                        .invokeMBeanOperation(mbeanName,
2091:                                "getRuntimeConfigurationAsMap", params,
2092:                                signature);
2093:
2094:                return data;
2095:            }
2096:
2097:            /**
2098:             * This method sets one or more configuration parameters on the runtime with
2099:             * a list of name/value pairs passed as a properties object. The property
2100:             * name in the properties object should be an existing configuration
2101:             * parameter name. If user try to set the parameter that is not in the
2102:             * configuration parameters list, this method will throw an exception.
2103:             *
2104:             * The value of the property can be any object. If the value is non string
2105:             * object, its string value (Object.toString()) will be used as a value that
2106:             * will be set on the configuration.
2107:             *
2108:             * This method first validates whether all the paramters passed in
2109:             * properties object exist in the runtime configuration or not. If any one
2110:             * the parameters passed is not existing, it will return an error without
2111:             * settings the parameters that are passed in the properties including a
2112:             * valid parameters.
2113:             *
2114:             * If there is an error in setting a paramter, this method throws an
2115:             * exception with the list of parameters that were not set.
2116:             *
2117:             * @param params
2118:             *            Map object that contains name/value pairs corresponding to the
2119:             *            configuration parameters to be set on the runtime.
2120:             *
2121:             * @param targetName
2122:             *            cluster or instance name ( e.g. cluster1, instance1 ) on which
2123:             *            configuration parameters will be set. null to represent the
2124:             *            default instance which is admin server
2125:             *
2126:             * @return true if server restart is required, false if not
2127:             *
2128:             * @throws ManagementRemoteException
2129:             *             if there is a jmx error or a invalid parameter is passed in
2130:             *             the params properties object. In case of an error setting the
2131:             *             a particular parameter, the error message should list the
2132:             *             invalid parameters.
2133:             */
2134:            public boolean setRuntimeConfiguration(
2135:                    Map<String /* attributeName */, Object /* attributeValue */> parameters,
2136:                    String targetName) throws ManagementRemoteException {
2137:                ObjectName mbeanName = this 
2138:                        .getConfigurationServiceMBeanObjectName();
2139:
2140:                Boolean data = null;
2141:
2142:                Object[] params = new Object[2];
2143:                params[0] = parameters;
2144:                params[1] = targetName;
2145:
2146:                String[] signature = new String[2];
2147:                signature[0] = "java.util.Map";
2148:                signature[1] = "java.lang.String";
2149:
2150:                data = (Boolean) this .invokeMBeanOperation(mbeanName,
2151:                        "setRuntimeConfiguration", params, signature);
2152:
2153:                return data;
2154:            }
2155:
2156:            /**
2157:             * Retrieve component configuration
2158:             *
2159:             * @param componentName
2160:             * @param targetName
2161:             * @return the targetName as key and the name/value pairs as Map
2162:             * @throws ManagementRemoteException
2163:             *             on error
2164:             */
2165:            @SuppressWarnings("unchecked")
2166:            public Map<String /* attributeName */, Object /* attributeValue */> getComponentConfigurationAsMap(
2167:                    String componentName, String targetName)
2168:                    throws ManagementRemoteException {
2169:                ObjectName mbeanName = this 
2170:                        .getConfigurationServiceMBeanObjectName();
2171:
2172:                Map<String /* attributeName */, Object /* attributeValue */> data = null;
2173:
2174:                Object[] params = new Object[2];
2175:                params[0] = componentName;
2176:                params[1] = targetName;
2177:
2178:                String[] signature = new String[2];
2179:                signature[0] = "java.lang.String";
2180:                signature[1] = "java.lang.String";
2181:
2182:                data = (Map<String /* attributeName */, Object /* attributeValue */>) this 
2183:                        .invokeMBeanOperation(mbeanName,
2184:                                "getComponentConfigurationAsMap", params,
2185:                                signature);
2186:
2187:                return data;
2188:            }
2189:
2190:            /**
2191:             * Will return jbi mgmt message with success, failure, or partial success
2192:             * per instance. The entry per instance will have value as part of the
2193:             * management message (XML) String.
2194:             *
2195:             * @param componentName
2196:             * @param configurationValues
2197:             * @param targetName
2198:             * @return value as part of the management message (XML) String.
2199:             * @throws ManagementRemoteException
2200:             *             on error
2201:             */
2202:            public String setComponentConfiguration(
2203:                    String componentName,
2204:                    Map<String /* attributeName */, Object /* attributeValue */> configurationValues,
2205:                    String targetName) throws ManagementRemoteException {
2206:                ObjectName mbeanName = this 
2207:                        .getConfigurationServiceMBeanObjectName();
2208:
2209:                String data = null;
2210:
2211:                Object[] params = new Object[3];
2212:                params[0] = componentName;
2213:                params[1] = configurationValues;
2214:                params[2] = targetName;
2215:
2216:                String[] signature = new String[3];
2217:                signature[0] = "java.lang.String";
2218:                signature[1] = "java.util.Map";
2219:                signature[2] = "java.lang.String";
2220:
2221:                data = (String) this .invokeMBeanOperation(mbeanName,
2222:                        "setComponentConfiguration", params, signature);
2223:
2224:                return data;
2225:            }
2226:
2227:            /////////////////
2228:
2229:            /**
2230:             * Invokes an operation on an Extension MBean.
2231:             * @param componentName
2232:             * @param extensionName the name of the extension (e.g., Configuration, Logger, etc.)
2233:             * @param operationName The name of the operation to be invoked.
2234:             * @param parameters An array containing the parameters to be set when the operation is invoked
2235:             * @param signature An array containing the signature of the operation. The class objects will be loaded using the same class loader as the one used for loading the MBean on which the operation was invoked.
2236:             * @param targetName name of the target (e.g., server, Cluster1, StandloneServer2, etc.)
2237:             * @param targetInstanceName name of the target instance (e.g., Cluster1-Instance1, Cluster2-Instance10, etc.)
2238:             * @return The object returned by the operation, which represents the result of invoking the operation on the Extension MBean specified.
2239:             * @throws ManagementRemoteException
2240:             */
2241:            public Object invokeExtensionMBeanOperation(String componentName,
2242:                    String extensionName, String operationName,
2243:                    Object[] parameters, String[] signature, String targetName,
2244:                    String targetInstanceName) throws ManagementRemoteException {
2245:                Object result = null;
2246:                ObjectName mbeanName = this 
2247:                        .getConfigurationServiceMBeanObjectName();
2248:
2249:                Object[] params = new Object[7];
2250:                params[0] = componentName;
2251:                params[1] = extensionName;
2252:                params[2] = operationName;
2253:                params[3] = parameters;
2254:                params[4] = signature;
2255:                params[5] = targetName;
2256:                params[6] = targetInstanceName;
2257:
2258:                String[] signatureArray = new String[7];
2259:                signatureArray[0] = "java.lang.String";
2260:                signatureArray[1] = "java.lang.String";
2261:                signatureArray[2] = "java.lang.String";
2262:                signatureArray[3] = "[Ljava.lang.Object;";
2263:                signatureArray[4] = "[Ljava.lang.String;";
2264:                signatureArray[5] = "java.lang.String";
2265:                signatureArray[6] = "java.lang.String";
2266:
2267:                result = this 
2268:                        .invokeMBeanOperation(mbeanName,
2269:                                "invokeExtensionMBeanOperation", params,
2270:                                signatureArray);
2271:                return result;
2272:            }
2273:
2274:            /**
2275:             * @param args
2276:             */
2277:            public static void main(String[] args) {
2278:
2279:            }
2280:
2281:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.