1 23 24 package com.sun.enterprise.connectors.util; 25 26 import com.sun.enterprise.deployment.*; 27 import com.sun.enterprise.config.serverbeans.ElementProperty; 28 import com.sun.enterprise.connectors.*; 29 import com.sun.enterprise.util.*; 30 import com.sun.logging.LogDomains; 31 import java.util.logging.*; 32 import java.util.*; 33 import java.lang.*; 34 import java.lang.reflect.*; 35 import java.io.IOException ; 36 import org.xml.sax.SAXParseException ; 37 38 46 47 public class MCFConfigParserImpl implements MCFConfigParser { 48 49 static Logger _logger = LogDomains.getLogger(LogDomains.RSR_LOGGER); 50 51 55 56 public MCFConfigParserImpl() { 57 58 } 59 60 71 72 public String [] getConnectionDefinitionNames(ConnectorDescriptor desc) 73 throws ConnectorRuntimeException 74 { 75 76 if(desc == null) { 77 throw new ConnectorRuntimeException("Invalid arguments"); 78 } 79 80 ConnectionDefDescriptor cdd[] = ddTransformUtil.getConnectionDefs(desc); 81 82 String [] connDefNames = null; 83 if(cdd != null) { 84 connDefNames = new String [cdd.length]; 85 for(int i=0;i<cdd.length;++i) { 86 connDefNames[i] = cdd[i].getConnectionFactoryIntf(); 87 } 88 } 89 return connDefNames; 90 } 91 92 119 120 public Properties getJavaBeanProps(ConnectorDescriptor desc, 121 String connectionDefName, String rarName) throws ConnectorRuntimeException 122 { 123 124 if(desc == null || connectionDefName == null) { 125 throw new ConnectorRuntimeException("Invalid arguments"); 126 } 127 OutboundResourceAdapter ora = 128 desc.getOutboundResourceAdapter(); 129 if(ora == null || ora.getConnectionDefs().size() == 0) { 130 return null; 131 } 132 Set connectionDefs = ora.getConnectionDefs(); 133 if(connectionDefs== null || connectionDefs.size() == 0) { 134 return null; 135 } 136 Iterator iter = connectionDefs.iterator(); 137 ConnectionDefDescriptor cdd = null; 138 boolean connectionDefFound=false; 139 while(iter.hasNext()) { 140 cdd = (ConnectionDefDescriptor)iter.next(); 141 if(connectionDefName.equals(cdd.getConnectionFactoryIntf())) { 142 connectionDefFound=true; 143 break; 144 } 145 } 146 147 if(connectionDefFound == false) { 148 _logger.log(Level.FINE, 149 "No such connectiondefinition found in ra.xml", 150 connectionDefName); 151 throw new ConnectorRuntimeException( 152 "No such connectiondefinition found in ra.xml : " + 153 connectionDefName); 154 } 155 156 163 164 Properties mergedVals = null; 165 Set ddVals = cdd.getConfigProperties(); 166 String className = cdd.getManagedConnectionFactoryImpl(); 167 if(className != null && className.length() != 0) { 168 Properties introspectedVals = configParserUtil.introspectJavaBean( 169 className,ddVals, true, rarName); 170 mergedVals = configParserUtil.mergeProps(ddVals,introspectedVals); 171 } 172 return mergedVals; 173 } 174 175 } 176 | Popular Tags |