1 2 24 25 package com.sun.enterprise.connectors.util; 26 27 import com.sun.enterprise.deployment.*; 28 import com.sun.enterprise.config.serverbeans.ElementProperty; 29 import com.sun.enterprise.connectors.*; 30 import com.sun.enterprise.util.*; 31 import com.sun.logging.LogDomains; 32 import java.util.logging.*; 33 import java.util.*; 34 import java.lang.*; 35 import java.lang.reflect.*; 36 import java.io.IOException ; 37 import org.xml.sax.SAXParseException ; 38 import com.sun.enterprise.util.i18n.StringManager; 39 40 48 49 public class AdminObjectConfigParserImpl implements AdminObjectConfigParser { 50 51 static Logger _logger = LogDomains.getLogger(LogDomains.RSR_LOGGER); 52 53 57 58 public AdminObjectConfigParserImpl() { 59 60 } 61 62 86 87 public Properties getJavaBeanProps(ConnectorDescriptor desc, 88 String adminObjectInterface, String rarName) throws ConnectorRuntimeException 89 { 90 91 if(desc == null || adminObjectInterface == null) { 92 throw new ConnectorRuntimeException("Invalid arguments"); 93 } 94 95 Set adminObjectSet = desc.getAdminObjects(); 96 if(adminObjectSet== null || adminObjectSet.size() == 0) { 97 return null; 98 } 99 AdminObject adminObject = null; 100 Iterator iter = adminObjectSet.iterator(); 101 Properties mergedVals = null; 102 boolean adminInterfaceFound = false; 103 while(iter.hasNext()) { 104 adminObject = (AdminObject)iter.next(); 105 if(adminObjectInterface.equals( 106 adminObject.getAdminObjectInterface())) { 107 adminInterfaceFound = true; 108 break; 109 } 110 } 111 112 if(adminInterfaceFound == false) { 113 StringManager localStrings = 114 StringManager.getManager(AdminObjectConfigParserImpl.class); 115 String msg = localStrings.getString( 116 "no_adminobject_interface_found_in_raxml", adminObjectInterface); 117 _logger.log(Level.FINE, msg); 118 throw new ConnectorRuntimeException(msg); 119 } 120 121 128 Set ddVals = adminObject.getConfigProperties(); 129 String className = adminObject.getAdminObjectClass(); 130 if(className != null && className.length() != 0) { 131 Properties introspectedVals = 132 configParserUtil.introspectJavaBean(className, ddVals); 133 mergedVals = configParserUtil.mergeProps(ddVals,introspectedVals); 134 } 135 return mergedVals; 136 } 137 138 144 public String [] getAdminObjectInterfaceNames(ConnectorDescriptor desc) 145 throws ConnectorRuntimeException 146 { 147 148 if(desc == null) { 149 throw new ConnectorRuntimeException("Invalid arguments"); 150 } 151 152 Set adminObjectSet = desc.getAdminObjects(); 153 if(adminObjectSet == null || adminObjectSet.size() == 0) { 154 return null; 155 } 156 String [] adminObjectInterfaceNames = new String [adminObjectSet.size()]; 157 Iterator it = adminObjectSet.iterator(); 158 AdminObject aor = null; 159 for(int i=0;it.hasNext();++i) { 160 aor = (AdminObject) it.next(); 161 adminObjectInterfaceNames[i] = aor.getAdminObjectInterface(); 162 } 163 return adminObjectInterfaceNames; 164 } 165 166 } 167 | Popular Tags |