1 package org.apache.tools.ant.taskdefs.optional.jmx.connector.weblogic; 2 3 52 53 54 60 public class WebLogicMBeanValueConverter implements org.apache.tools.ant.taskdefs.optional.jmx.converter.ValueConverter { 61 62 private String [] supportedTypes = {weblogic.management.WebLogicMBean.class.getName()}; 63 private String defaultDomain = null; 64 private weblogic.management.MBeanHome home = null; 65 66 70 public WebLogicMBeanValueConverter(weblogic.management.MBeanHome home) { 71 this.home = home; 72 this.defaultDomain = home.getDomainName(); 73 } 74 75 81 public Object valueOf(String value, String type) throws Exception { 82 83 try { 84 javax.management.ObjectName objectName = new javax.management.ObjectName (value); 88 if ((defaultDomain != null) && ((objectName.getDomain() == null) || (objectName.getDomain().length() == 0)) ) { 89 objectName = new javax.management.ObjectName (defaultDomain + value); 90 } 91 return home.getMBean(objectName); 92 93 } catch (Exception x) { 94 throw new org.apache.tools.ant.BuildException("Invalid format. Expected format \"[domainName]:[property=value][,property=value]*\" E.g. mydomain:Name=myconnectionPool,Type=JDBCConnectionPool",x); 95 } 96 } 97 98 public String [] getSupportedTypes() { 99 return supportedTypes; 100 } 101 102 } 103 104 | Popular Tags |