You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2005/02/11 01:04:51 UTC
svn commit: r153302 - in geronimo/trunk: ./ modules/assembly/
modules/axis-builder/src/java/org/apache/geronimo/axis/builder/
modules/axis-builder/src/test/org/apache/geronimo/axis/builder/
modules/axis-builder/src/test/org/apache/geronimo/axis/builder/mock/
modules/axis/src/java/org/apache/geronimo/axis/client/
modules/axis/src/test/org/apache/geronimo/axis/testUtils/
modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/
modules/j2ee-builder/
modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/
modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/
modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/
modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/
plugins/maven-xmlbeans-plugin/
Author: djencks
Date: Thu Feb 10 16:04:46 2005
New Revision: 153302
URL: http://svn.apache.org/viewcvs?view=rev&rev=153302
Log:
Speculative handler impl for service refs, some work on fault/exception mapping
Added:
geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/GeronimoAxisClient.java
Modified:
geronimo/trunk/modules/assembly/project.properties
geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java
geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/mock/MockSEIFactory.java
geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/GenericServiceEndpoint.java
geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/GenericServiceEndpointWrapper.java
geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactory.java
geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java
geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceEndpointMethodInterceptor.java
geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceImpl.java
geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceMethodInterceptor.java
geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/TestingUtils.java
geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
geronimo/trunk/modules/j2ee-builder/project.xml
geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/RefContext.java
geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ServiceReferenceBuilder.java
geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EJBRefContextTest.java
geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java
geronimo/trunk/plugins/maven-xmlbeans-plugin/plugin.jelly
geronimo/trunk/project.properties
Modified: geronimo/trunk/modules/assembly/project.properties
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/project.properties?view=diff&r1=153301&r2=153302
==============================================================================
--- geronimo/trunk/modules/assembly/project.properties (original)
+++ geronimo/trunk/modules/assembly/project.properties Thu Feb 10 16:04:46 2005
@@ -16,4 +16,5 @@
geronimo.assemble.delete.logs=true
#controls whether to remove previous versions even if clean was not explicitly called
-geronimo.assemble.clean=true
\ No newline at end of file
+geronimo.assemble.clean=true
+#geronimo.assemble.minimal=true
Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java?view=diff&r1=153301&r2=153302
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java (original)
+++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java Thu Feb 10 16:04:46 2005
@@ -36,6 +36,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.Arrays;
import java.util.jar.JarFile;
import javax.wsdl.Binding;
import javax.wsdl.BindingInput;
@@ -48,6 +49,7 @@
import javax.wsdl.PortType;
import javax.wsdl.Types;
import javax.wsdl.WSDLException;
+import javax.wsdl.Fault;
import javax.wsdl.extensions.ExtensibilityElement;
import javax.wsdl.extensions.UnknownExtensibilityElement;
import javax.wsdl.extensions.soap.SOAPAddress;
@@ -79,6 +81,7 @@
import javax.xml.rpc.holders.ShortHolder;
import javax.xml.rpc.holders.ShortWrapperHolder;
import javax.xml.rpc.holders.StringHolder;
+import javax.xml.rpc.handler.HandlerInfo;
import net.sf.cglib.core.DefaultGeneratorStrategy;
import net.sf.cglib.proxy.Callback;
@@ -90,13 +93,15 @@
import org.apache.axis.client.Service;
import org.apache.axis.description.OperationDesc;
import org.apache.axis.description.ParameterDesc;
+import org.apache.axis.description.FaultDesc;
import org.apache.axis.encoding.ser.ArrayDeserializerFactory;
import org.apache.axis.encoding.ser.ArraySerializerFactory;
import org.apache.axis.encoding.ser.BeanDeserializerFactory;
import org.apache.axis.encoding.ser.BeanSerializerFactory;
-import org.apache.axis.enum.Style;
-import org.apache.axis.enum.Use;
import org.apache.axis.soap.SOAPConstants;
+import org.apache.axis.constants.Style;
+import org.apache.axis.constants.Use;
+import org.apache.axis.handlers.HandlerInfoChainFactory;
import org.apache.geronimo.axis.client.GenericServiceEndpointWrapper;
import org.apache.geronimo.axis.client.NoOverrideCallbackFilter;
import org.apache.geronimo.axis.client.OperationInfo;
@@ -125,6 +130,11 @@
import org.apache.geronimo.xbeans.j2ee.ServiceEndpointMethodMappingType;
import org.apache.geronimo.xbeans.j2ee.WsdlMessageMappingType;
import org.apache.geronimo.xbeans.j2ee.WsdlReturnValueMappingType;
+import org.apache.geronimo.xbeans.j2ee.ExceptionMappingType;
+import org.apache.geronimo.xbeans.j2ee.ConstructorParameterOrderType;
+import org.apache.geronimo.xbeans.j2ee.ServiceRefHandlerType;
+import org.apache.geronimo.xbeans.j2ee.ParamValueType;
+import org.apache.geronimo.xbeans.j2ee.XsdQNameType;
import org.apache.geronimo.schema.SchemaConversionUtils;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
@@ -132,6 +142,8 @@
import org.objectweb.asm.Type;
import org.w3.x2001.xmlSchema.SchemaDocument;
import org.w3.x2001.xmlSchema.ComplexType;
+import org.w3.x2001.xmlSchema.ExplicitGroup;
+import org.w3.x2001.xmlSchema.LocalElement;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;
@@ -161,7 +173,7 @@
return new ServiceReference(enhanced, null, null, null);
}
- public Object createService(Class serviceInterface, URI wsdlURI, URI jaxrpcMappingURI, QName serviceQName, Map portComponentRefMap, List handlers, DeploymentContext deploymentContext, Module module, ClassLoader classLoader) throws DeploymentException {
+ public Object createService(Class serviceInterface, URI wsdlURI, URI jaxrpcMappingURI, QName serviceQName, Map portComponentRefMap, List handlerInfos, DeploymentContext deploymentContext, Module module, ClassLoader classLoader) throws DeploymentException {
JarFile moduleFile = module.getModuleFile();
Definition definition = null;
JavaWsdlMappingType mapping = null;
@@ -198,7 +210,7 @@
mapping = mappingDocument.getJavaWsdlMapping();
}
- Object service = createService(serviceInterface, definition, mapping, serviceQName, SOAP_VERSION, deploymentContext, module, classLoader);
+ Object service = createService(serviceInterface, definition, mapping, serviceQName, SOAP_VERSION, handlerInfos, deploymentContext, module, classLoader);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = null;
try {
@@ -213,12 +225,12 @@
return reference;
}
- public Object createService(Class serviceInterface, Definition definition, JavaWsdlMappingType mapping, QName serviceQName, SOAPConstants soapVersion, DeploymentContext context, Module module, ClassLoader classloader) throws DeploymentException {
+ public Object createService(Class serviceInterface, Definition definition, JavaWsdlMappingType mapping, QName serviceQName, SOAPConstants soapVersion, List handlerInfos, DeploymentContext context, Module module, ClassLoader classloader) throws DeploymentException {
Map seiPortNameToFactoryMap = new HashMap();
Map seiClassNameToFactoryMap = new HashMap();
Object serviceInstance = createService(serviceInterface, seiPortNameToFactoryMap, seiClassNameToFactoryMap, context, module, classloader);
if (definition != null) {
- buildSEIFactoryMap(serviceInterface, definition, mapping, serviceQName, soapVersion, seiPortNameToFactoryMap, seiClassNameToFactoryMap, serviceInstance, context, module, classloader);
+ buildSEIFactoryMap(serviceInterface, definition, mapping, handlerInfos, serviceQName, soapVersion, seiPortNameToFactoryMap, seiClassNameToFactoryMap, serviceInstance, context, module, classloader);
}
return serviceInstance;
}
@@ -255,7 +267,7 @@
}
}
- public void buildSEIFactoryMap(Class serviceInterface, Definition definition, JavaWsdlMappingType mapping, QName serviceQName, SOAPConstants soapVersion, Map seiPortNameToFactoryMap, Map seiClassNameToFactoryMap, Object serviceImpl, DeploymentContext context, Module module, ClassLoader classLoader) throws DeploymentException {
+ public void buildSEIFactoryMap(Class serviceInterface, Definition definition, JavaWsdlMappingType mapping, List handlerInfos, QName serviceQName, SOAPConstants soapVersion, Map seiPortNameToFactoryMap, Map seiClassNameToFactoryMap, Object serviceImpl, DeploymentContext context, Module module, ClassLoader classLoader) throws DeploymentException {
//find the service we are working with
javax.wsdl.Service service;
@@ -275,6 +287,7 @@
Map wsdlPortMap = service.getPorts();
Map complexTypeMap = getComplexTypesInWsdl(definition);
+ Map exceptionMap = getExceptionMap(mapping);
for (Iterator iterator = wsdlPortMap.entrySet().iterator(); iterator.hasNext();) {
Map.Entry entry = (Map.Entry) iterator.next();
@@ -319,7 +332,7 @@
operationInfos[i++] = operationInfo;
}
List typeMappings = new ArrayList();
- seiFactory = createSEIFactory(enhancedServiceEndpointClass, serviceImpl, typeMappings, location, operationInfos, context, classLoader);
+ seiFactory = createSEIFactory(portName, enhancedServiceEndpointClass, serviceImpl, typeMappings, location, operationInfos, handlerInfos, context, classLoader);
} else {
//complete jaxrpc mapping file supplied
QName portTypeQName = portType.getQName();
@@ -338,7 +351,7 @@
Operation operation = (Operation) ops.next();
BindingOperation bindingOperation = binding.getBindingOperation(operation.getName(), operation.getInput().getName(), operation.getOutput() == null ? null : operation.getOutput().getName());
ServiceEndpointMethodMappingType methodMapping = getMethodMappingForOperation(operation, methodMappings);
- OperationInfo operationInfo = buildOperationInfoHeavyweight(methodMapping, bindingOperation, portStyle, soapVersion, complexTypeMap, mapping, classLoader);
+ OperationInfo operationInfo = buildOperationInfoHeavyweight(methodMapping, bindingOperation, portStyle, soapVersion, exceptionMap, complexTypeMap, mapping, classLoader);
operationInfos[i++] = operationInfo;
}
JavaXmlTypeMappingType[] javaXmlTypeMappings = mapping.getJavaXmlTypeMappingArray();
@@ -380,13 +393,26 @@
}
- seiFactory = createSEIFactory(enhancedServiceEndpointClass, serviceImpl, typeMappings, location, operationInfos, context, classLoader);
+ seiFactory = createSEIFactory(portName, enhancedServiceEndpointClass, serviceImpl, typeMappings, location, operationInfos, handlerInfos, context, classLoader);
}
seiPortNameToFactoryMap.put(portName, seiFactory);
seiClassNameToFactoryMap.put(serviceEndpointInterface.getName(), seiFactory);
}
}
+ private Map getExceptionMap(JavaWsdlMappingType mapping) {
+ Map exceptionMap = new HashMap();
+ if (mapping != null) {
+ ExceptionMappingType[] exceptionMappings = mapping.getExceptionMappingArray();
+ for (int i = 0; i < exceptionMappings.length; i++) {
+ ExceptionMappingType exceptionMapping = exceptionMappings[i];
+ QName exceptionMessageQName = exceptionMapping.getWsdlMessage().getQNameValue();
+ exceptionMap.put(exceptionMessageQName, exceptionMapping);
+ }
+ }
+ return exceptionMap;
+ }
+
private ServiceEndpointMethodMappingType getMethodMappingForOperation(Operation operation, ServiceEndpointMethodMappingType[] methodMappings) throws DeploymentException {
String operationName = operation.getName();
for (int i = 0; i < methodMappings.length; i++) {
@@ -465,16 +491,32 @@
throw new DeploymentException("Namespace " + namespace + " was not mapped in jaxrpc mapping file");
}
- public SEIFactory createSEIFactory(Class enhancedServiceEndpointClass, Object serviceImpl, List typeMappings, URL location, OperationInfo[] operationInfos, DeploymentContext deploymentContext, ClassLoader classLoader) throws DeploymentException {
-
+ public SEIFactory createSEIFactory(String portName, Class enhancedServiceEndpointClass, Object serviceImpl, List typeMappings, URL location, OperationInfo[] operationInfos, List handlerInfos, DeploymentContext deploymentContext, ClassLoader classLoader) throws DeploymentException {
+ HandlerInfoChainFactory handlerInfoChainFactory = buildHandlerInfosForPort(portName, handlerInfos);
try {
- SEIFactory factory = new SEIFactoryImpl(enhancedServiceEndpointClass, operationInfos, serviceImpl, typeMappings, location, classLoader);
+ SEIFactory factory = new SEIFactoryImpl(portName, enhancedServiceEndpointClass, operationInfos, serviceImpl, typeMappings, location, handlerInfoChainFactory, classLoader);
return factory;
} catch (ClassNotFoundException e) {
throw new DeploymentException("Could not load GenericServiceEndpoint from application classloader", e);
}
}
+ private HandlerInfoChainFactory buildHandlerInfosForPort(String portName, List handlerInfoInfos) {
+ List handlerInfos = new ArrayList();
+ for (Iterator iterator = handlerInfoInfos.iterator(); iterator.hasNext();) {
+ HandlerInfoInfo handlerInfoInfo = (HandlerInfoInfo) iterator.next();
+ Set portNames = handlerInfoInfo.getPortNames();
+ if (portNames.isEmpty() || portNames.contains(portName)) {
+ HandlerInfo handlerInfo = new HandlerInfo(handlerInfoInfo.getHandlerClass(), handlerInfoInfo.getHandlerConfig(), handlerInfoInfo.getSoapHeaders());
+ handlerInfos.add(handlerInfo);
+
+ //TODO what about the soap roles??
+ }
+ }
+ HandlerInfoChainFactory handlerInfoChainFactory = new HandlerInfoChainFactory(handlerInfos);
+ return handlerInfoChainFactory;
+ }
+
public Class enhanceServiceEndpointInterface(Class serviceEndpointInterface, DeploymentContext deploymentContext, Module module, ClassLoader classLoader) throws DeploymentException {
Enhancer enhancer = new Enhancer();
enhancer.setClassLoader(classLoader);
@@ -519,17 +561,14 @@
throw new DeploymentException("Lightweight mapping has at most one part in the (optional) output message, not: " + outputMessage.getParts().size());
}
Class[] methodParamTypes = method.getParameterTypes();
- //TODO investigate getOrderedParts
- Map inputParts = inputMessage.getParts();
+ List inputParts = inputMessage.getOrderedParts(null);
if (methodParamTypes.length != inputParts.size()) {
throw new DeploymentException("mismatch in parameter counts: method has " + methodParamTypes.length + " whereas the input message has " + inputParts.size());
}
int i = 0;
- for (Iterator parts = inputParts.entrySet().iterator(); parts.hasNext();) {
- //TODO HOW IS THIS SUPPOSED TO WORK????? is the map ordered?
- Map.Entry entry = (Map.Entry) parts.next();
- String partName = (String) entry.getKey();
- Part part = (Part) entry.getValue();
+ for (Iterator parts = inputParts.iterator(); parts.hasNext();) {
+ Part part = (Part) parts.next();
+ String partName = part.getName();
QName name = new QName("", partName);
byte mode = ParameterDesc.IN;
QName typeQName = part.getTypeName() == null ? part.getElementName() : part.getTypeName();
@@ -578,7 +617,7 @@
return operationInfo;
}
- public OperationInfo buildOperationInfoHeavyweight(ServiceEndpointMethodMappingType methodMapping, BindingOperation bindingOperation, Style defaultStyle, SOAPConstants soapVersion, Map complexTypeMap, JavaWsdlMappingType mapping, ClassLoader classLoader) throws DeploymentException {
+ public OperationInfo buildOperationInfoHeavyweight(ServiceEndpointMethodMappingType methodMapping, BindingOperation bindingOperation, Style defaultStyle, SOAPConstants soapVersion, Map exceptionMap, Map complexTypeMap, JavaWsdlMappingType mapping, ClassLoader classLoader) throws DeploymentException {
//TODO how can bindingOperation be null?
Operation operation = bindingOperation.getOperation();
@@ -663,7 +702,7 @@
QName partQName = isWrappedElement ? part.getElementName() : new QName("", part.getName());
QName partTypeQName = part.getTypeName();
- //use complexTypeMap
+ //use complexTypeMap
boolean isComplexType = complexTypeMap.containsKey(partTypeQName);
String paramJavaTypeName = paramMapping.getParamType().getStringValue().trim();
Class actualParamJavaType = getHolderType(paramJavaTypeName, mode, partTypeQName, isComplexType, mapping, classLoader);
@@ -748,15 +787,81 @@
operationDesc.setStyle(style);
operationDesc.setUse(use);
//TODO add faults
-// TFault[] faults = tOperation.getFaultArray();
-// for (int i = 0; i < faults.length; i++) {
-// TFault fault = faults[i];
-// QName faultQName = new QName("", fault.getName());
-// String className = ;
-// QName faultTypeQName = ;
-// boolean isComplex = ;
-// FaultDesc faultDesc = new FaultDesc(faultQName, className, faultTypeQName, isComplex)
-// }
+
+ Map faultMap = operation.getFaults();
+ for (Iterator iterator = faultMap.entrySet().iterator(); iterator.hasNext();) {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ String faultName = (String) entry.getKey();
+ Fault fault = (Fault) entry.getValue();
+ Message message = fault.getMessage();
+ QName messageQName = message.getQName();
+ ExceptionMappingType exceptionMapping = (ExceptionMappingType) exceptionMap.get(messageQName);
+ if (exceptionMapping == null) {
+ throw new DeploymentException("No exception mapping for fault " + faultName + " and fault message " + messageQName + " for operation " + operationName);
+ }
+ String className = exceptionMapping.getExceptionType().getStringValue().trim();
+ //this is weird, but I can't figure out what it should be.
+ QName faultQName = new QName("", faultName);
+ Part part;
+ if (exceptionMapping.isSetWsdlMessagePartName()) {
+ //According to schema documentation, this will only be set when several headerfaults use the same message.
+ String headerFaultMessagePartName = exceptionMapping.getWsdlMessagePartName().getStringValue();
+ part = message.getPart(headerFaultMessagePartName);
+ } else {
+ part= (Part) message.getOrderedParts(null).iterator().next();
+ }
+ QName faultTypeQName = part.getElementName() == null? part.getTypeName(): part.getElementName();
+ boolean isComplex = part.getTypeName() != null && complexTypeMap.containsKey(part.getTypeName());
+ FaultDesc faultDesc = new FaultDesc(faultQName, className, faultTypeQName, isComplex);
+
+ //constructor parameters
+ if (exceptionMapping.isSetConstructorParameterOrder()) {
+ if (!isComplex) {
+ throw new DeploymentException("ConstructorParameterOrder can only be set for complex types, not " + faultTypeQName);
+ }
+ ComplexType complexType = (ComplexType) complexTypeMap.get(part.getTypeName());
+ Map elementMap = new HashMap();
+ ExplicitGroup explicitGroup = complexType.getSequence();
+ LocalElement[] elements = explicitGroup.getElementArray();
+ for (int i = 0; i < elements.length; i++) {
+ LocalElement element = elements[i];
+ String elementName = element.getName();
+ QName elementType = element.getType();
+ elementMap.put(elementName, elementType);
+ }
+ ArrayList parameterTypes = new ArrayList();
+ ConstructorParameterOrderType constructorParameterOrder = exceptionMapping.getConstructorParameterOrder();
+ for (int i = 0; i < constructorParameterOrder.getElementNameArray().length; i++) {
+ String elementName = constructorParameterOrder.getElementNameArray(i).getStringValue().trim();
+ QName elementType = (QName) elementMap.get(elementName);
+ String javaElementTypeName;
+ if (complexTypeMap.containsKey(elementType)) {
+ String packageName = getPackageFromNamespace(elementType.getNamespaceURI(), mapping);
+ javaElementTypeName = packageName + "." + elementType.getLocalPart();
+ } else {
+ //TODO finish this
+ if (elementType.getLocalPart().equals("String")) {
+ javaElementTypeName = String.class.getName();
+ } else {
+ throw new DeploymentException("most simple exception constructor types not yet implemented");
+ }
+ }
+ Class javaElementType;
+ try {
+ javaElementType = ClassLoading.loadClass(javaElementTypeName, classLoader);
+ } catch (ClassNotFoundException e) {
+ throw new DeploymentException("Could not load exception constructor parameter", e);
+ }
+ //todo faultTypeQName is speculative
+ //todo outheader might be true!
+ ParameterDesc parameterDesc = new ParameterDesc(faultTypeQName, ParameterDesc.OUT, elementType, javaElementType, false, false);
+ parameterTypes.add(parameterDesc);
+ }
+ faultDesc.setParameters(parameterTypes);
+ }
+ operationDesc.addFault(faultDesc);
+ }
+
boolean usesSOAPAction = (soapActionURI != null);
QName operationQName = new QName("", operation.getName());
@@ -766,6 +871,15 @@
return operationInfo;
}
+ /**
+ * Find all the top level complex types in the schemas in the definitions' types.
+ * Put them in a map from complex type QName to schema fragment.
+ * TODO it is not clear what happens with included schemas.
+ *
+ * @param definition
+ * @return
+ * @throws DeploymentException
+ */
Map getComplexTypesInWsdl(Definition definition) throws DeploymentException {
Map complexTypeMap = new HashMap();
Types types = definition.getTypes();
@@ -785,8 +899,8 @@
try {
cursor.toFirstContentToken();
for (Iterator namespaces = namespaceMap.entrySet().iterator(); namespaces.hasNext();) {
- Map.Entry entry = (Map.Entry) namespaces.next();
- cursor.insertNamespace((String)entry.getKey(), (String)entry.getValue());
+ Map.Entry entry = (Map.Entry) namespaces.next();
+ cursor.insertNamespace((String) entry.getKey(), (String) entry.getValue());
}
} finally {
cursor.dispose();
@@ -843,6 +957,7 @@
private Class getHolderType(String paramJavaTypeName, byte mode, QName typeQName, boolean isComplexType, JavaWsdlMappingType mapping, ClassLoader classLoader) throws DeploymentException {
Class paramJavaType = null;
if (mode == ParameterDesc.IN) {
+ //IN parameters just use their own type
try {
paramJavaType = ClassLoading.loadClass(paramJavaTypeName, classLoader);
} catch (ClassNotFoundException e) {
@@ -850,15 +965,20 @@
}
return paramJavaType;
} else {
+ //INOUT and OUT parameters use holders. See jaxrpc spec 4.3.5
String holderName;
if (isComplexType) {
+ //complex types get mapped:
+ //package is determined from the namespace to package map + ".holders"
+ //class name is the complex type QNMAne local part + "Holder", with the initial character uppercased.
String namespace = typeQName.getNamespaceURI();
- String packageName = getPackageFromNamespace(namespace, mapping);
- StringBuffer buf = new StringBuffer(packageName.length() + typeQName.getLocalPart().length() + 14);
- buf.append(packageName).append(".holders.").append(typeQName.getLocalPart()).append("Holder");
- buf.setCharAt(packageName.length() + 9, Character.toUpperCase(typeQName.getLocalPart().charAt(0)));
- holderName = buf.toString();
+ String packageName = getPackageFromNamespace(namespace, mapping);
+ StringBuffer buf = new StringBuffer(packageName.length() + typeQName.getLocalPart().length() + 14);
+ buf.append(packageName).append(".holders.").append(typeQName.getLocalPart()).append("Holder");
+ buf.setCharAt(packageName.length() + 9, Character.toUpperCase(typeQName.getLocalPart().charAt(0)));
+ holderName = buf.toString();
} else {
+ //see if it is in the primitive type and simple type mapping
try {
paramJavaType = ClassLoading.loadClass(paramJavaTypeName, classLoader);
} catch (ClassNotFoundException e) {
@@ -868,6 +988,9 @@
if (holder != null) {
return holder;
}
+ //Otherwise, the holder must be in:
+ //package same as type's package + ".holders"
+ //class name same as type name + "Holder"
String paramTypeName = paramJavaType.getName();
StringBuffer buf = new StringBuffer(paramTypeName.length() + 14);
int dot = paramTypeName.lastIndexOf(".");
Modified: geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java?view=diff&r1=153301&r2=153302
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java (original)
+++ geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java Thu Feb 10 16:04:46 2005
@@ -51,8 +51,8 @@
import javax.xml.rpc.Service;
import junit.framework.TestCase;
-import org.apache.axis.enum.Style;
import org.apache.axis.soap.SOAPConstants;
+import org.apache.axis.constants.Style;
import org.apache.geronimo.axis.builder.bookquote.BookQuote;
import org.apache.geronimo.axis.builder.bookquote.BookQuoteService;
import org.apache.geronimo.axis.builder.interop.InteropLab;
@@ -89,6 +89,7 @@
private final String operationName = "doMockOperation";
private final File wsdlDir = new File(basedir, "src/test-resources/interop");
private final File wsdlFile = new File(wsdlDir, "interop.wsdl");
+ private List handlerInfos = new ArrayList();
private Module module;
@@ -150,7 +151,8 @@
OperationInfo op = buildOperationInfoForMockOperation(builder);
OperationInfo[] operationInfos = new OperationInfo[]{op};
Class serviceEndpointClass = builder.enhanceServiceEndpointInterface(MockPort.class, context, module, isolatedCl);
- SEIFactory serviceInterfaceFactory = builder.createSEIFactory(serviceEndpointClass, serviceInstance, typeMappings, location, operationInfos, context, isolatedCl);
+ String portName = "foo";
+ SEIFactory serviceInterfaceFactory = builder.createSEIFactory(portName, serviceEndpointClass, serviceInstance, typeMappings, location, operationInfos, handlerInfos, context, isolatedCl);
assertNotNull(serviceInterfaceFactory);
Remote serviceInterface = serviceInterfaceFactory.createServiceEndpoint();
assertTrue(serviceInterface instanceof MockPort);
@@ -169,7 +171,7 @@
JavaWsdlMappingType mapping = buildLightweightMappingType();
QName serviceQName = new QName(NAMESPACE, "MockService");
AxisBuilder builder = new AxisBuilder();
- Object proxy = builder.createService(MockService.class, definition, mapping, serviceQName, SOAPConstants.SOAP11_CONSTANTS, context, module, isolatedCl);
+ Object proxy = builder.createService(MockService.class, definition, mapping, serviceQName, SOAPConstants.SOAP11_CONSTANTS, handlerInfos, context, module, isolatedCl);
assertNotNull(proxy);
assertTrue(proxy instanceof MockService);
MockPort mockPort = ((MockService) proxy).getMockPort();
@@ -186,7 +188,7 @@
JavaWsdlMappingType mapping = mappingDocument.getJavaWsdlMapping();
QName serviceQName = new QName("http://www.Monson-Haefel.com/jwsbook/BookQuote", "BookQuoteService");
AxisBuilder builder = new AxisBuilder();
- Object proxy = builder.createService(BookQuoteService.class, definition, mapping, serviceQName, SOAPConstants.SOAP11_CONSTANTS, context, module, isolatedCl);
+ Object proxy = builder.createService(BookQuoteService.class, definition, mapping, serviceQName, SOAPConstants.SOAP11_CONSTANTS, handlerInfos, context, module, isolatedCl);
assertNotNull(proxy);
assertTrue(proxy instanceof BookQuoteService);
BookQuote bookQuote = ((BookQuoteService) proxy).getBookQuotePort();
@@ -203,7 +205,7 @@
JavaWsdlMappingType mapping = mappingDocument.getJavaWsdlMapping();
QName serviceQName = new QName("http://tempuri.org/4s4c/1/3/wsdl/def/interopLab", "interopLab");
AxisBuilder builder = new AxisBuilder();
- Object proxy = builder.createService(InteropLab.class, definition, mapping, serviceQName, SOAPConstants.SOAP11_CONSTANTS, context, module, isolatedCl);
+ Object proxy = builder.createService(InteropLab.class, definition, mapping, serviceQName, SOAPConstants.SOAP11_CONSTANTS, handlerInfos, context, module, isolatedCl);
assertNotNull(proxy);
assertTrue(proxy instanceof InteropLab);
InteropTestPortType interopTestPort = ((InteropLab) proxy).getinteropTestPort();
Modified: geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/mock/MockSEIFactory.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/mock/MockSEIFactory.java?view=diff&r1=153301&r2=153302
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/mock/MockSEIFactory.java (original)
+++ geronimo/trunk/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/mock/MockSEIFactory.java Thu Feb 10 16:04:46 2005
@@ -19,6 +19,7 @@
import java.rmi.Remote;
import javax.xml.rpc.Service;
+import javax.xml.rpc.handler.HandlerChain;
import org.apache.geronimo.axis.client.SEIFactory;
@@ -28,5 +29,9 @@
public class MockSEIFactory implements SEIFactory {
public Remote createServiceEndpoint() {
return new MockPortImpl();
+ }
+
+ public HandlerChain createHandlerChain() {
+ return null;
}
}
Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/GenericServiceEndpoint.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/GenericServiceEndpoint.java?view=diff&r1=153301&r2=153302
==============================================================================
--- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/GenericServiceEndpoint.java (original)
+++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/GenericServiceEndpoint.java Thu Feb 10 16:04:46 2005
@@ -20,6 +20,8 @@
import java.util.Iterator;
import java.util.List;
+import javax.xml.namespace.QName;
+
import org.apache.axis.AxisFault;
import org.apache.axis.NoEndPointException;
import org.apache.axis.client.Call;
@@ -32,10 +34,11 @@
private final List typeMappings;
- public GenericServiceEndpoint(Service service, List typeMappings, URL location) {
+ public GenericServiceEndpoint(QName portQName, Service service, List typeMappings, URL location) {
this.service = service;
this.typeMappings = typeMappings;
cachedEndpoint = location;
+ cachedPortName = portQName;
}
Call createCall() throws java.rmi.RemoteException {
Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/GenericServiceEndpointWrapper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/GenericServiceEndpointWrapper.java?view=diff&r1=153301&r2=153302
==============================================================================
--- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/GenericServiceEndpointWrapper.java (original)
+++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/GenericServiceEndpointWrapper.java Thu Feb 10 16:04:46 2005
@@ -23,7 +23,6 @@
import org.apache.axis.message.SOAPHeaderElement;
import org.apache.axis.client.Call;
-import org.apache.axis.AxisFault;
import org.apache.axis.NoEndPointException;
/**
Added: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/GeronimoAxisClient.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/GeronimoAxisClient.java?view=auto&rev=153302
==============================================================================
--- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/GeronimoAxisClient.java (added)
+++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/GeronimoAxisClient.java Thu Feb 10 16:04:46 2005
@@ -0,0 +1,57 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.axis.client;
+
+import java.util.Map;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.handler.HandlerChain;
+
+import org.apache.axis.MessageContext;
+import org.apache.axis.EngineConfiguration;
+import org.apache.axis.client.AxisClient;
+import org.apache.axis.client.Call;
+import org.apache.axis.handlers.HandlerInfoChainFactory;
+
+/**
+ * @version $Rev: $ $Date: $
+ */
+public class GeronimoAxisClient extends AxisClient {
+
+ private final Map portNameToSEIFactoryMap;
+
+ public GeronimoAxisClient(EngineConfiguration engineConfiguration, Map portNameToSEIFactoryMap) {
+ super(engineConfiguration);
+ this.portNameToSEIFactoryMap = portNameToSEIFactoryMap;
+ }
+
+ protected HandlerChain getJAXRPChandlerChain(MessageContext context) {
+
+ QName portQName = (QName) context.getProperty(Call.WSDL_PORT_NAME);
+ if(portQName == null) {
+ throw new RuntimeException("No port name supplied");
+ }
+ String portName = portQName.getLocalPart();
+
+ SEIFactory seiFactory = (SEIFactory) portNameToSEIFactoryMap.get(portName);
+ if (seiFactory == null) {
+ return null;
+ }
+ HandlerChain handlerChain = seiFactory.createHandlerChain();
+ return handlerChain;
+
+ }
+}
Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactory.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactory.java?view=diff&r1=153301&r2=153302
==============================================================================
--- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactory.java (original)
+++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactory.java Thu Feb 10 16:04:46 2005
@@ -17,8 +17,8 @@
package org.apache.geronimo.axis.client;
import java.rmi.Remote;
-import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceException;
+import javax.xml.rpc.handler.HandlerChain;
/**
* @version $Rev: $ $Date: $
@@ -26,5 +26,6 @@
public interface SEIFactory {
Remote createServiceEndpoint() throws ServiceException;
-
+
+ HandlerChain createHandlerChain();
}
Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java?view=diff&r1=153301&r2=153302
==============================================================================
--- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java (original)
+++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java Thu Feb 10 16:04:46 2005
@@ -24,6 +24,8 @@
import java.util.List;
import java.net.URL;
import javax.xml.rpc.ServiceException;
+import javax.xml.rpc.handler.HandlerChain;
+import javax.xml.namespace.QName;
import net.sf.cglib.proxy.Callback;
import net.sf.cglib.proxy.Enhancer;
@@ -32,6 +34,7 @@
import net.sf.cglib.reflect.FastClass;
import net.sf.cglib.core.Signature;
import org.apache.axis.client.Service;
+import org.apache.axis.handlers.HandlerInfoChainFactory;
/**
* @version $Rev: $ $Date: $
@@ -39,15 +42,18 @@
public class SEIFactoryImpl implements SEIFactory, Serializable {
private static final Class[] SERVICE_ENDPOINT_CONSTRUCTOR_TYPES = new Class[]{GenericServiceEndpoint.class};
+ private final QName portQName;
private final Class serviceEndpointClass;
private final OperationInfo[] operationInfos;
private transient final FastConstructor constructor;
private final Object serviceImpl;
private final List typeMappings;
private final URL location;
+ private final HandlerInfoChainFactory handlerInfoChainFactory;
private transient OperationInfo[] sortedOperationInfos;
- public SEIFactoryImpl(Class serviceEndpointClass, OperationInfo[] operationInfos, Object serviceImpl, List typeMappings, URL location, ClassLoader classLoader) throws ClassNotFoundException {
+ public SEIFactoryImpl(String portName, Class serviceEndpointClass, OperationInfo[] operationInfos, Object serviceImpl, List typeMappings, URL location, HandlerInfoChainFactory handlerInfoChainFactory, ClassLoader classLoader) throws ClassNotFoundException {
+ this.portQName = new QName("", portName);
this.serviceEndpointClass = serviceEndpointClass;
this.operationInfos = operationInfos;
Class[] constructorTypes = new java.lang.Class[0];
@@ -56,6 +62,7 @@
this.serviceImpl = serviceImpl;
this.typeMappings = typeMappings;
this.location = location;
+ this.handlerInfoChainFactory = handlerInfoChainFactory;
sortedOperationInfos = new OperationInfo[FastClass.create(serviceEndpointClass).getMaxIndex() + 1];
for (int i = 0; i < operationInfos.length; i++) {
OperationInfo operationInfo = operationInfos[i];
@@ -71,7 +78,7 @@
public Remote createServiceEndpoint() throws ServiceException {
Service service = ((ServiceImpl)serviceImpl).getService();
- GenericServiceEndpoint serviceEndpoint = new GenericServiceEndpoint(service, typeMappings, location);
+ GenericServiceEndpoint serviceEndpoint = new GenericServiceEndpoint(portQName, service, typeMappings, location);
Callback callback = new ServiceEndpointMethodInterceptor(serviceEndpoint, sortedOperationInfos);
Callback[] callbacks = new Callback[]{SerializableNoOp.INSTANCE, callback};
Enhancer.registerCallbacks(serviceEndpointClass, callbacks);
@@ -83,9 +90,14 @@
}
}
+ public HandlerChain createHandlerChain() {
+ HandlerChain handlerChain = handlerInfoChainFactory.createHandlerChain();
+ return handlerChain;
+ }
+
private Object readResolve() throws ObjectStreamException {
try {
- return new SEIFactoryImpl(serviceEndpointClass, operationInfos, serviceImpl, typeMappings, location, null);
+ return new SEIFactoryImpl(portQName.getLocalPart(), serviceEndpointClass, operationInfos, serviceImpl, typeMappings, location, handlerInfoChainFactory, null);
} catch (ClassNotFoundException e) {
throw new InvalidClassException(GenericServiceEndpoint.class.getName(), "this is impossible");
}
Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceEndpointMethodInterceptor.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceEndpointMethodInterceptor.java?view=diff&r1=153301&r2=153302
==============================================================================
--- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceEndpointMethodInterceptor.java (original)
+++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceEndpointMethodInterceptor.java Thu Feb 10 16:04:46 2005
@@ -17,7 +17,6 @@
package org.apache.geronimo.axis.client;
import java.lang.reflect.Method;
-import java.io.Serializable;
import java.util.Arrays;
import net.sf.cglib.proxy.MethodInterceptor;
Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceImpl.java?view=diff&r1=153301&r2=153302
==============================================================================
--- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceImpl.java (original)
+++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceImpl.java Thu Feb 10 16:04:46 2005
@@ -30,6 +30,10 @@
import javax.xml.rpc.handler.HandlerRegistry;
import org.apache.axis.client.Service;
+import org.apache.axis.client.AxisClient;
+import org.apache.axis.EngineConfiguration;
+import org.apache.axis.configuration.EngineConfigurationFactoryFinder;
+import org.apache.axis.configuration.FileProvider;
/**
@@ -38,13 +42,24 @@
public class ServiceImpl implements javax.xml.rpc.Service, Serializable {
private transient Service delegate;
- private Map seiClassNameToFactoryMap;
+ private final Map seiClassNameToFactoryMap;
private final Map portToImplementationMap;
public ServiceImpl(Map portToImplementationMap, Map seiClassNameToFactoryMap) {
this.portToImplementationMap = portToImplementationMap;
this.seiClassNameToFactoryMap = seiClassNameToFactoryMap;
- this.delegate = new Service();
+ buildDelegateService();
+ }
+
+ private void buildDelegateService() {
+ delegate = new Service();
+
+ EngineConfiguration engineConfiguration = delegate.getEngine().getConfig();
+ //there must be a better way
+ ((FileProvider)engineConfiguration).setInputStream(AxisClient.class.getResourceAsStream("client-config.wsdd"));
+ GeronimoAxisClient engine = new GeronimoAxisClient(engineConfiguration, portToImplementationMap);
+ delegate.setEngine(engine);
+ delegate.setEngineConfiguration(engineConfiguration);
}
public Remote getPort(QName qName, Class portClass) throws ServiceException {
@@ -122,7 +137,7 @@
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
- delegate = new Service();
+ buildDelegateService();
}
Service getService() {
Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceMethodInterceptor.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceMethodInterceptor.java?view=diff&r1=153301&r2=153302
==============================================================================
--- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceMethodInterceptor.java (original)
+++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceMethodInterceptor.java Thu Feb 10 16:04:46 2005
@@ -16,12 +16,10 @@
*/
package org.apache.geronimo.axis.client;
+import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.Map;
-import java.io.Serializable;
-
import javax.xml.rpc.ServiceException;
-import javax.xml.rpc.Service;
import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;
Modified: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/TestingUtils.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/TestingUtils.java?view=diff&r1=153301&r2=153302
==============================================================================
--- geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/TestingUtils.java (original)
+++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/testUtils/TestingUtils.java Thu Feb 10 16:04:46 2005
@@ -45,6 +45,7 @@
import org.apache.geronimo.deployment.DeploymentContext;
import org.apache.geronimo.common.DeploymentException;
import org.apache.geronimo.jetty.JettyWebAppContext;
+import org.apache.geronimo.xbeans.j2ee.ServiceRefHandlerType;
import org.openejb.deployment.OpenEJBModuleBuilder;
/**
@@ -92,7 +93,7 @@
private static ServiceReferenceBuilder serviceReferenceBuilder = new ServiceReferenceBuilder() {
//it could return a Service or a Reference, we don't care
- public Object createService(Class serviceInterface, URI wsdlURI, URI jaxrpcMappingURI, QName serviceQName, Map portComponentRefMap, List handlers, DeploymentContext deploymentContext, Module module, ClassLoader classLoader) throws DeploymentException {
+ public Object createService(Class serviceInterface, URI wsdlURI, URI jaxrpcMappingURI, QName serviceQName, Map portComponentRefMap, List handlerInfos, DeploymentContext deploymentContext, Module module, ClassLoader classLoader) throws DeploymentException {
return null;
}
};
Modified: geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java?view=diff&r1=153301&r2=153302
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java (original)
+++ geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java Thu Feb 10 16:04:46 2005
@@ -73,6 +73,7 @@
import org.apache.geronimo.kernel.registry.BasicGBeanRegistry;
import org.apache.geronimo.kernel.repository.Repository;
import org.apache.geronimo.system.serverinfo.ServerInfo;
+import org.apache.geronimo.xbeans.j2ee.ServiceRefHandlerType;
import org.tranql.sql.jdbc.JDBCUtil;
/**
@@ -141,7 +142,7 @@
};
private ServiceReferenceBuilder serviceReferenceBuilder = new ServiceReferenceBuilder() {
//it could return a Service or a Reference, we don't care
- public Object createService(Class serviceInterface, URI wsdlURI, URI jaxrpcMappingURI, QName serviceQName, Map portComponentRefMap, List handlers, DeploymentContext deploymentContext, Module module, ClassLoader classLoader) {
+ public Object createService(Class serviceInterface, URI wsdlURI, URI jaxrpcMappingURI, QName serviceQName, Map portComponentRefMap, List handlerInfos, DeploymentContext deploymentContext, Module module, ClassLoader classLoader) {
return null;
}
};
Modified: geronimo/trunk/modules/j2ee-builder/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-builder/project.xml?view=diff&r1=153301&r2=153302
==============================================================================
--- geronimo/trunk/modules/j2ee-builder/project.xml (original)
+++ geronimo/trunk/modules/j2ee-builder/project.xml Thu Feb 10 16:04:46 2005
@@ -101,6 +101,12 @@
<version>${geronimo_spec_ejb_version}</version>
</dependency>
+ <dependency>
+ <groupId>geronimo-spec</groupId>
+ <artifactId>geronimo-spec-jaxrpc</artifactId>
+ <version>${geronimo_spec_jaxrpc_version}</version>
+ </dependency>
+
<!-- test only -->
<dependency>
<groupId>cglib</groupId>
Modified: geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/RefContext.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/RefContext.java?view=diff&r1=153301&r2=153302
==============================================================================
--- geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/RefContext.java (original)
+++ geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/RefContext.java Thu Feb 10 16:04:46 2005
@@ -36,6 +36,7 @@
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
import org.apache.geronimo.gbean.GBeanData;
import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.xbeans.j2ee.ServiceRefHandlerType;
/**
* @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
@@ -299,8 +300,8 @@
}
}
- public Object getServiceReference(Class serviceInterface, URI wsdlURI, URI jaxrpcMappingURI, QName serviceQName, Map portComponentRefMap, List handlers, DeploymentContext deploymentContext, Module module, ClassLoader classLoader) throws DeploymentException {
- return serviceReferenceBuilder.createService(serviceInterface, wsdlURI, jaxrpcMappingURI, serviceQName, portComponentRefMap, handlers, deploymentContext, module, classLoader);
+ public Object getServiceReference(Class serviceInterface, URI wsdlURI, URI jaxrpcMappingURI, QName serviceQName, Map portComponentRefMap, List handlerInfos, DeploymentContext deploymentContext, Module module, ClassLoader classLoader) throws DeploymentException {
+ return serviceReferenceBuilder.createService(serviceInterface, wsdlURI, jaxrpcMappingURI, serviceQName, portComponentRefMap, handlerInfos, deploymentContext, module, classLoader);
}
private String getContainerId(URI module, String ejbLink, Map references) throws AmbiguousEJBRefException, UnknownEJBRefException {
Modified: geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ServiceReferenceBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ServiceReferenceBuilder.java?view=diff&r1=153301&r2=153302
==============================================================================
--- geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ServiceReferenceBuilder.java (original)
+++ geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/ServiceReferenceBuilder.java Thu Feb 10 16:04:46 2005
@@ -19,11 +19,13 @@
import java.net.URI;
import java.util.Map;
import java.util.List;
+import java.util.Set;
import javax.naming.Reference;
import javax.xml.namespace.QName;
import org.apache.geronimo.common.DeploymentException;
import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.xbeans.j2ee.ServiceRefHandlerType;
/**
* @version $Rev$ $Date$
@@ -31,7 +33,43 @@
public interface ServiceReferenceBuilder {
//it could return a Service or a Reference, we don't care
- Object createService(Class serviceInterface, URI wsdlURI, URI jaxrpcMappingURI, QName serviceQName, Map portComponentRefMap, List handlers, DeploymentContext deploymentContext, Module module, ClassLoader classLoader) throws DeploymentException;
+ Object createService(Class serviceInterface, URI wsdlURI, URI jaxrpcMappingURI, QName serviceQName, Map portComponentRefMap, List handlerInfos, DeploymentContext deploymentContext, Module module, ClassLoader classLoader) throws DeploymentException;
//TODO a locate port method for links.
+
+ public class HandlerInfoInfo {
+ private final Set portNames;
+ private final Class handlerClass;
+ private final Map handlerConfig;
+ private final QName[] soapHeaders;
+ private final Set soapRoles;
+
+ public HandlerInfoInfo(Set portNames, Class handlerClass, Map handlerConfig, QName[] soapHeaders, Set soapRoles) {
+ this.portNames = portNames;
+ this.handlerClass = handlerClass;
+ this.handlerConfig = handlerConfig;
+ this.soapHeaders = soapHeaders;
+ this.soapRoles = soapRoles;
+ }
+
+ public Set getPortNames() {
+ return portNames;
+ }
+
+ public Class getHandlerClass() {
+ return handlerClass;
+ }
+
+ public Map getHandlerConfig() {
+ return handlerConfig;
+ }
+
+ public QName[] getSoapHeaders() {
+ return soapHeaders;
+ }
+
+ public Set getSoapRoles() {
+ return soapRoles;
+ }
+ }
}
Modified: geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EJBRefContextTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EJBRefContextTest.java?view=diff&r1=153301&r2=153302
==============================================================================
--- geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EJBRefContextTest.java (original)
+++ geronimo/trunk/modules/j2ee-builder/src/test/org/apache/geronimo/j2ee/deployment/EJBRefContextTest.java Thu Feb 10 16:04:46 2005
@@ -30,6 +30,7 @@
import org.apache.geronimo.common.UnresolvedEJBRefException;
import org.apache.geronimo.gbean.GBeanData;
import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.xbeans.j2ee.ServiceRefHandlerType;
/**
* @version $Rev$ $Date$
@@ -200,7 +201,7 @@
}
}, new ServiceReferenceBuilder() {
//it could return a Service or a Reference, we don't care
- public Object createService(Class serviceInterface, URI wsdlURI, URI jaxrpcMappingURI, QName serviceQName, Map portComponentRefMap, List handlers, DeploymentContext deploymentContext, Module module, ClassLoader classLoader) throws DeploymentException {
+ public Object createService(Class serviceInterface, URI wsdlURI, URI jaxrpcMappingURI, QName serviceQName, Map portComponentRefMap, List handlerInfos, DeploymentContext deploymentContext, Module module, ClassLoader classLoader) throws DeploymentException {
return null;
}
});
Modified: geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java?view=diff&r1=153301&r2=153302
==============================================================================
--- geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java (original)
+++ geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java Thu Feb 10 16:04:46 2005
@@ -64,6 +64,7 @@
import org.apache.geronimo.security.SecurityServiceImpl;
import org.apache.geronimo.transaction.context.TransactionContextManager;
import org.apache.geronimo.transaction.manager.TransactionManagerImpl;
+import org.apache.geronimo.xbeans.j2ee.ServiceRefHandlerType;
/**
* @version $Rev$ $Date$
@@ -179,7 +180,7 @@
},
new ServiceReferenceBuilder() {
//it could return a Service or a Reference, we don't care
- public Object createService(Class serviceInterface, URI wsdlURI, URI jaxrpcMappingURI, QName serviceQName, Map portComponentRefMap, List handlers, DeploymentContext deploymentContext, Module module, ClassLoader classLoader) throws DeploymentException {
+ public Object createService(Class serviceInterface, URI wsdlURI, URI jaxrpcMappingURI, QName serviceQName, Map portComponentRefMap, List handlerInfos, DeploymentContext deploymentContext, Module module, ClassLoader classLoader) throws DeploymentException {
return null;
}
}));
Modified: geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java?view=diff&r1=153301&r2=153302
==============================================================================
--- geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java (original)
+++ geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java Thu Feb 10 16:04:46 2005
@@ -28,6 +28,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.ArrayList;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.naming.NamingException;
@@ -40,9 +41,11 @@
import org.apache.geronimo.j2ee.deployment.EARContext;
import org.apache.geronimo.j2ee.deployment.Module;
import org.apache.geronimo.j2ee.deployment.RefContext;
+import org.apache.geronimo.j2ee.deployment.ServiceReferenceBuilder;
import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext;
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.ClassLoading;
import org.apache.geronimo.naming.java.ComponentContextBuilder;
import org.apache.geronimo.xbeans.geronimo.naming.GerEjbLocalRefType;
import org.apache.geronimo.xbeans.geronimo.naming.GerEjbRefType;
@@ -59,6 +62,8 @@
import org.apache.geronimo.xbeans.j2ee.ServiceRefHandlerType;
import org.apache.geronimo.xbeans.j2ee.ServiceRefType;
import org.apache.geronimo.xbeans.j2ee.XsdStringType;
+import org.apache.geronimo.xbeans.j2ee.ParamValueType;
+import org.apache.geronimo.xbeans.j2ee.XsdQNameType;
/**
* @version $Rev$ $Date$
@@ -84,7 +89,7 @@
ObjectName query = null;
try {
query = NameFactory.getComponentNameQuery(null, null, null, linkName, j2eeType, j2eeContext);
- } catch(MalformedObjectNameException e) {
+ } catch (MalformedObjectNameException e) {
throw new DeploymentException("Could not construct query for gbean name", e);
}
Set localMatches = context.listGBeans(query);
@@ -186,11 +191,9 @@
if ("javax.mail.Session".equals(type)) {
j2eeType = NameFactory.JAVA_MAIL_RESOURCE;
- }
- else if (JAXR_CONNECTION_FACTORY_CLASS.equals(type)) {
+ } else if (JAXR_CONNECTION_FACTORY_CLASS.equals(type)) {
j2eeType = NameFactory.JAXR_CONNECTION_FACTORY;
- }
- else {
+ } else {
j2eeType = NameFactory.JCA_MANAGED_CONNECTION_FACTORY;
}
String containerId = getResourceContainerId(name, j2eeType, uri, gerResourceRef, refContext, j2eeContext, earContext);
@@ -215,7 +218,7 @@
} else if (gerResourceRef.isSetResourceLink()) {
containerId = refContext.getConnectionFactoryContainerId(uri, gerResourceRef.getResourceLink().trim(), type, j2eeContext, context);
} else if (gerResourceRef.isSetTargetName()) {
- containerId = gerResourceRef.getTargetName().trim();
+ containerId = gerResourceRef.getTargetName().trim();
} else {
//construct name from components
try {
@@ -483,12 +486,11 @@
portComponentRefMap.put(serviceEndpointClass, portComponentLink);
}
}
- //TODO this sucks, but the handlers aren't implemented yet anyway.
- ServiceRefHandlerType[] handlerTypes = serviceRef.getHandlerArray();
- List handlers = Arrays.asList(handlerTypes);
+ ServiceRefHandlerType[] handlers = serviceRef.getHandlerArray();
+ List handlerInfos = buildHandlerInfoList(handlers, cl);
//we could get a Reference or the actual serializable Service back.
- Object ref = refContext.getServiceReference(serviceInterface, wsdlURI, jaxrpcMappingURI, serviceQName, portComponentRefMap, handlers, earContext, module, cl);
+ Object ref = refContext.getServiceReference(serviceInterface, wsdlURI, jaxrpcMappingURI, serviceQName, portComponentRefMap, handlerInfos, earContext, module, cl);
try {
builder.bind(name, ref);
} catch (NamingException e) {
@@ -498,6 +500,42 @@
}
+ private static List buildHandlerInfoList(ServiceRefHandlerType[] handlers, ClassLoader classLoader) throws DeploymentException {
+ List handlerInfos = new ArrayList();
+ for (int i = 0; i < handlers.length; i++) {
+ ServiceRefHandlerType handler = handlers[i];
+ Set portNames = new HashSet(Arrays.asList(handler.getPortNameArray()));
+ String handlerClassName = handler.getHandlerClass().getStringValue().trim();
+ Class handlerClass = null;
+ try {
+ handlerClass = ClassLoading.loadClass(handlerClassName, classLoader);
+ } catch (ClassNotFoundException e) {
+ throw new DeploymentException("Could not load handler class", e);
+ }
+ Map config = new HashMap();
+ ParamValueType[] paramValues = handler.getInitParamArray();
+ for (int j = 0; j < paramValues.length; j++) {
+ ParamValueType paramValue = paramValues[j];
+ String paramName = paramValue.getParamName().getStringValue().trim();
+ String paramStringValue = paramValue.getParamValue().getStringValue().trim();
+ config.put(paramName, paramStringValue);
+ }
+ XsdQNameType[] soapHeaderQNames = handler.getSoapHeaderArray();
+ QName[] headerQNames = new QName[soapHeaderQNames.length];
+ for (int j = 0; j < soapHeaderQNames.length; j++) {
+ XsdQNameType soapHeaderQName = soapHeaderQNames[j];
+ headerQNames[j] = soapHeaderQName.getQNameValue();
+ }
+ Set soapRoles = new HashSet();
+ for (int j = 0; j < handler.getSoapRoleArray().length; j++) {
+ String soapRole = handler.getSoapRoleArray(j).getStringValue().trim();
+ soapRoles.add(soapRole);
+ }
+ ServiceReferenceBuilder.HandlerInfoInfo handlerInfoInfo = new ServiceReferenceBuilder.HandlerInfoInfo(portNames, handlerClass, config, headerQNames, soapRoles);
+ handlerInfos.add(handlerInfoInfo);
+ }
+ return handlerInfos;
+ }
public static void assureEJBObjectInterface(String remote, ClassLoader cl) throws DeploymentException {
assureInterface(remote, "javax.ejb.EJBObject", "Remote", cl);
@@ -570,7 +608,7 @@
if (!URL.class.getName().equals(type)
&& !"javax.mail.Session".equals(type)
- && !JAXR_CONNECTION_FACTORY_CLASS.equals(type) ) {
+ && !JAXR_CONNECTION_FACTORY_CLASS.equals(type)) {
GerResourceRefType gerResourceRef = (GerResourceRefType) refMap.get(resourceRefType.getResRefName().getStringValue());
String containerId = getResourceContainerId(getStringValue(resourceRefType.getResRefName()), NameFactory.JCA_MANAGED_CONNECTION_FACTORY, uri, gerResourceRef, refContext, j2eeContext, earContext);
Modified: geronimo/trunk/plugins/maven-xmlbeans-plugin/plugin.jelly
URL: http://svn.apache.org/viewcvs/geronimo/trunk/plugins/maven-xmlbeans-plugin/plugin.jelly?view=diff&r1=153301&r2=153302
==============================================================================
--- geronimo/trunk/plugins/maven-xmlbeans-plugin/plugin.jelly (original)
+++ geronimo/trunk/plugins/maven-xmlbeans-plugin/plugin.jelly Thu Feb 10 16:04:46 2005
@@ -62,9 +62,9 @@
<touch file="${uptodateFile}"/>
</j:if>
+ <path id="maven.xmlbeans.compile.src.set"
+ location="${targetdir}"/>
<j:if test="${context.antProject.getReference('maven.compile.src.set') != null}">
- <path id="maven.xmlbeans.compile.src.set"
- location="${targetdir}"/>
<maven:addPath id="maven.compile.src.set"
refid="maven.xmlbeans.compile.src.set"/>
</j:if>
@@ -72,7 +72,9 @@
<echo message="Maven cannot find the generated sources unless you provide a dummy source directory in project.xml"/>
</j:if>
-
+ <!-- include the generated binary files from the current xmlbeans run -->
+ <maven:addPath id="maven.dependency.classpath"
+ refid="maven.xmlbeans.compile.src.set"/>
</j:jelly>
</define:tag>
Modified: geronimo/trunk/project.properties
URL: http://svn.apache.org/viewcvs/geronimo/trunk/project.properties?view=diff&r1=153301&r2=153302
==============================================================================
--- geronimo/trunk/project.properties (original)
+++ geronimo/trunk/project.properties Thu Feb 10 16:04:46 2005
@@ -44,20 +44,26 @@
openejb/modules/*/project.xml,\
applications/*/project.xml,\
modules/*/project.xml,\
-activemq/modules/core/project.xml,\
-activemq/modules/gbean/project.xml,\
-activemq/modules/ra/project.xml,\
-activemq/stores/jdbm/project.xml,\
-howl/logger/project.xml,\
-tranql/*/project.xml
+tranql/*/project.xml,
+#itests/naming/client/project.xml,\
+#itests/naming/common/project.xml,\
+#itests/naming/ejb/project.xml,\
+#itests/naming/war/project.xml
+#activemq/modules/*/project.xml,\
+#activemq/transports/*/project.xml,\
+#activemq/stores/*/project.xml,
+
+#howl/logger/project.xml,\
maven.multiproject.excludes=\
-itests/*/project.xml,\
openejb/modules/connector/project.xml,\
-openejb/modules/webadmin/project.xml
+openejb/modules/webadmin/project.xml,\
+activemq/modules/*/project.xml,\
+sandbox/*/project.xml
+#itests/*/project.xml,\
maven.idea.project.multiproject.includes=${maven.multiproject.includes}
-maven.idea.project.multiproject.excludes=sandbox/*/project.xml
+maven.idea.project.multiproject.excludes=${maven.multiproject.excludes}
#if you are a committer on all these projects use e.g. -Dgeronimo.otherproject.cvs.access=:ext:djencks
#if you are a committer on one of these projects set the appropriate property here or on the command line.