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 MessageListenerConfigParserImpl implements 48 MessageListenerConfigParser { 49 50 static Logger _logger = LogDomains.getLogger(LogDomains.RSR_LOGGER); 51 52 56 57 public MessageListenerConfigParserImpl() { 58 59 } 60 61 68 69 public String getActivationSpecClass( ConnectorDescriptor desc, 70 String messageListenerType) throws ConnectorRuntimeException 71 { 72 if(desc == null) { 73 throw new ConnectorRuntimeException("Invalid arguments"); 74 } 75 76 MessageListener messageListeners[] = 77 ddTransformUtil.getMessageListeners(desc); 78 79 String messageListenerClass = null; 80 String [] messageListenerTypes = null; 81 if(messageListeners != null) { 82 messageListenerTypes = new String [messageListeners.length]; 83 for(int i=0;i<messageListeners.length;++i) { 84 if(messageListenerType.equals( 85 messageListeners[i].getMessageListenerType())){ 86 return messageListeners[i].getActivationSpecClass(); 87 } 88 } 89 } 90 return null; 91 } 92 93 101 102 public String [] getMessageListenerTypes(ConnectorDescriptor desc) 103 throws ConnectorRuntimeException 104 { 105 106 if(desc == null) { 107 throw new ConnectorRuntimeException("Invalid arguments"); 108 } 109 110 MessageListener messageListeners[] = 111 ddTransformUtil.getMessageListeners(desc); 112 113 String [] messageListenerTypes = null; 114 if(messageListeners != null) { 115 messageListenerTypes = new String [messageListeners.length]; 116 for(int i=0;i<messageListeners.length;++i) { 117 messageListenerTypes[i] = 118 messageListeners[i].getMessageListenerType(); 119 } 120 } 121 return messageListenerTypes; 122 } 123 124 152 153 public Properties getJavaBeanProps(ConnectorDescriptor desc, 154 String messageListenerType, String rarName) throws ConnectorRuntimeException 155 { 156 157 if(desc == null || messageListenerType == null) { 158 throw new ConnectorRuntimeException("Invalid arguments"); 159 } 160 161 MessageListener allMessageListeners[] = 162 ddTransformUtil.getMessageListeners(desc); 163 164 MessageListener messageListener = null; 165 for(int i=0;i<allMessageListeners.length;++i) { 166 if(messageListenerType.equals( 167 allMessageListeners[i].getMessageListenerType())) { 168 messageListener = allMessageListeners[i]; 169 } 170 } 171 172 if(messageListener == null) { 173 _logger.log(Level.FINE, 174 "No such MessageListener found in ra.xml", 175 messageListenerType); 176 throw new ConnectorRuntimeException( 177 "No such MessageListener found in ra.xml : " + 178 messageListenerType); 179 } 180 181 188 189 Properties mergedVals = null; 190 Set ddVals = messageListener.getConfigProperties(); 191 String className = messageListener.getActivationSpecClass(); 192 if(className != null && className.length() != 0) { 193 Properties introspectedVals = configParserUtil.introspectJavaBean( 194 className,ddVals); 195 mergedVals = configParserUtil.mergeProps(ddVals,introspectedVals); 196 } 197 return mergedVals; 198 } 199 200 212 public Properties getJavaBeanReturnTypes(ConnectorDescriptor desc, 213 String messageListenerType) throws ConnectorRuntimeException 214 { 215 216 if(desc == null || messageListenerType == null) { 217 throw new ConnectorRuntimeException("Invalid arguments"); 218 } 219 220 MessageListener allMessageListeners[] = 221 ddTransformUtil.getMessageListeners(desc); 222 223 MessageListener messageListener = null; 224 for(int i=0;i<allMessageListeners.length;++i) { 225 if(messageListenerType.equals( 226 allMessageListeners[i].getMessageListenerType())) { 227 messageListener = allMessageListeners[i]; 228 } 229 } 230 231 if(messageListener == null) { 232 _logger.log(Level.FINE, 233 "No such MessageListener found in ra.xml", 234 messageListenerType); 235 throw new ConnectorRuntimeException( 236 "No such MessageListener found in ra.xml : " + 237 messageListenerType); 238 } 239 240 247 248 Properties mergedVals = null; 249 Set ddVals = messageListener.getConfigProperties(); 250 String className = messageListener.getActivationSpecClass(); 251 if(className != null && className.length() != 0) { 252 Properties introspectedVals = 253 configParserUtil.introspectJavaBeanReturnTypes(className,ddVals); 254 mergedVals = configParserUtil.mergePropsReturnTypes( 255 ddVals,introspectedVals); 256 } 257 return mergedVals; 258 } 259 } 260 | Popular Tags |