You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by pr...@apache.org on 2007/06/27 18:46:04 UTC
svn commit: r551228 [12/23] - in /webservices/axis2/branches/java/jaxws21:
./ etc/ modules/adb-codegen/src/org/apache/axis2/schema/
modules/adb-codegen/src/org/apache/axis2/schema/template/
modules/adb-codegen/src/org/apache/axis2/schema/writer/ module...
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java Wed Jun 27 09:45:37 2007
@@ -1,49 +1,21 @@
package org.apache.axis2.description.java2wsdl;
-import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
-import org.apache.ws.commons.schema.XmlSchemaComplexContent;
-import org.apache.ws.commons.schema.XmlSchemaComplexContentExtension;
-import org.apache.ws.commons.schema.XmlSchemaComplexType;
-import org.apache.ws.commons.schema.XmlSchemaElement;
-import org.apache.ws.commons.schema.XmlSchemaForm;
-import org.apache.ws.commons.schema.XmlSchemaImport;
-import org.apache.ws.commons.schema.XmlSchemaSequence;
-import org.apache.ws.commons.schema.XmlSchemaType;
-import org.apache.ws.commons.schema.XmlSchemaObject;
-import org.apache.ws.commons.schema.utils.NamespaceMap;
-import org.apache.ws.commons.schema.utils.NamespacePrefixList;
-import org.apache.axis2.description.java2wsdl.bytecode.MethodTable;
-import org.apache.axis2.description.java2wsdl.TypeTable;
-import org.apache.axis2.description.java2wsdl.AnnotationConstants;
-import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.deployment.util.Utils;
+import org.apache.axis2.description.AxisMessage;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.java2wsdl.bytecode.MethodTable;
+import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.codehaus.jam.JAnnotation;
-import org.codehaus.jam.JClass;
-import org.codehaus.jam.JField;
-import org.codehaus.jam.JMethod;
-import org.codehaus.jam.JPackage;
-import org.codehaus.jam.JParameter;
-import org.codehaus.jam.JProperty;
-import org.codehaus.jam.JamClassIterator;
-import org.codehaus.jam.JamService;
-import org.codehaus.jam.JamServiceFactory;
-import org.codehaus.jam.JamServiceParams;
+import org.apache.ws.commons.schema.*;
+import org.apache.ws.commons.schema.utils.NamespaceMap;
+import org.apache.ws.commons.schema.utils.NamespacePrefixList;
+import org.codehaus.jam.*;
import javax.xml.namespace.QName;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.List;
-import java.util.Iterator;
+import java.util.*;
/*
* Copyright 2004,2005 The Apache Software Foundation.
@@ -79,39 +51,40 @@
protected ClassLoader classLoader;
- private String className;
+ protected String className;
protected TypeTable typeTable = new TypeTable();
// to keep loadded method using JAM
- private JMethod methods[];
+ protected JMethod methods[];
//to store byte code method using Axis 1.x codes
- private MethodTable methodTable;
+ protected MethodTable methodTable;
- private String schemaTargetNameSpace;
+ protected String schemaTargetNameSpace;
- private String schema_namespace_prefix;
+ protected String schema_namespace_prefix;
- private String attrFormDefault = null;
+ protected String attrFormDefault = null;
- private String elementFormDefault = null;
+ protected String elementFormDefault = null;
- private ArrayList excludeMethods = new ArrayList();
+ protected ArrayList excludeMethods = new ArrayList();
protected ArrayList extraClasses = null;
- private boolean useWSDLTypesNamespace = false;
+ protected boolean useWSDLTypesNamespace = false;
protected Map pkg2nsmap = null;
- private NamespaceGenerator nsGen = null;
+ protected NamespaceGenerator nsGen = null;
- private String targetNamespace = null;
+ protected String targetNamespace = null;
//to keep the list of operation which uses MR other than RPC MR
- private ArrayList nonRpcMethods = new ArrayList();
+ protected ArrayList nonRpcMethods = new ArrayList();
protected Class serviceClass = null;
+ protected AxisService service;
public NamespaceGenerator getNsGen() throws Exception {
if (nsGen == null) {
@@ -125,11 +98,13 @@
}
public DefaultSchemaGenerator(ClassLoader loader, String className,
- String schematargetNamespace,
- String schematargetNamespacePrefix)
+ String schematargetNamespace,
+ String schematargetNamespacePrefix,
+ AxisService service)
throws Exception {
this.classLoader = loader;
this.className = className;
+ this.service = service;
serviceClass = Class.forName(className, true, loader);
methodTable = new MethodTable(serviceClass);
@@ -171,14 +146,14 @@
jam_service_parms.includeClass(className);
for (int count = 0; count < getExtraClasses().size(); ++count) {
- jam_service_parms.includeClass((String)getExtraClasses().get(count));
+ jam_service_parms.includeClass((String) getExtraClasses().get(count));
}
JamService service = factory.createService(jam_service_parms);
QName extraSchemaTypeName;
JamClassIterator jClassIter = service.getClasses();
//all most all the time the ittr will have only one class in it
while (jClassIter.hasNext()) {
- JClass jclass = (JClass)jClassIter.next();
+ JClass jclass = (JClass) jClassIter.next();
if (getQualifiedName(jclass).equals(className)) {
/**
* Schema genertaion done in two stage 1. Load all the methods and
@@ -209,7 +184,7 @@
return schemaMap.values();
}
- private JMethod[] processMethods(JMethod[] declaredMethods) throws Exception {
+ protected JMethod[] processMethods(JMethod[] declaredMethods) throws Exception {
ArrayList list = new ArrayList();
//short the elements in the array
Arrays.sort(declaredMethods);
@@ -230,11 +205,11 @@
String methodName = getSimpleName(jMethod);
// no need to think abt this method , since that is system
// config method
- if (excludeMethods.contains(getSimpleName(jMethod))) {
+ if (excludeMethods.contains(methodName)) {
continue;
}
- if (uniqueMethods.get(getSimpleName(jMethod)) != null) {
+ if (uniqueMethods.get(methodName) != null) {
log.warn("We don't support method overloading. Ignoring [" +
jMethod.getQualifiedName() + "]");
continue;
@@ -244,35 +219,56 @@
// no need to generate Schema for non public methods
continue;
}
-
+ boolean addToService = false;
+ AxisOperation axisOperation = service.getOperation(new QName(methodName));
+ if (axisOperation == null) {
+ axisOperation = Utils.getAxisOperationForJmethod(jMethod);
+ addToService = true;
+ }
// Maintain a list of methods we actually work with
list.add(jMethod);
if (jMethod.getExceptionTypes().length > 0) {
- JClass[] extypes = jMethod.getExceptionTypes() ;
- for (int j= 0 ; j < extypes.length ; j++) {
- JClass extype = extypes[j] ;
- if(AxisFault.class.getName().equals(extype.getQualifiedName())){
+ JClass[] extypes = jMethod.getExceptionTypes();
+ for (int j = 0; j < extypes.length; j++) {
+ JClass extype = extypes[j];
+ if (AxisFault.class.getName().equals(extype.getQualifiedName())) {
continue;
}
- methodSchemaType = createSchemaTypeForMethodPart(extype.getSimpleName()+ "Fault");
+ String partQname = extype.getSimpleName() + "Fault";
+ methodSchemaType = createSchemaTypeForMethodPart(partQname);
sequence = new XmlSchemaSequence();
generateSchemaForType(sequence, extype, extype.getSimpleName());
methodSchemaType.setParticle(sequence);
+ if (AxisFault.class.getName().equals(extype.getQualifiedName())) {
+ continue;
+ }
+ AxisMessage faultMessage = new AxisMessage();
+ if (extypes.length > 1) {
+ faultMessage.setName(methodName + "Fault" + j);
+ } else {
+ faultMessage.setName(methodName + "Fault");
+ }
+ faultMessage.setElementQName(typeTable.getQNamefortheType(partQname));
+ axisOperation.setFaultMessages(faultMessage);
}
}
- uniqueMethods.put(getSimpleName(jMethod), jMethod);
- //create the schema type for the method wrapper
-
- uniqueMethods.put(getSimpleName(jMethod), jMethod);
+ uniqueMethods.put(methodName, jMethod);
JParameter[] paras = jMethod.getParameters();
String parameterNames[] = null;
+ AxisMessage inMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ if (inMessage != null) {
+ inMessage.setName(methodName + Java2WSDLConstants.MESSAGE_SUFFIX);
+ }
if (paras.length > 0) {
parameterNames = methodTable.getParameterNames(methodName);
sequence = new XmlSchemaSequence();
- methodSchemaType = createSchemaTypeForMethodPart(getSimpleName(jMethod));
+ methodSchemaType = createSchemaTypeForMethodPart(methodName);
methodSchemaType.setParticle(sequence);
+ inMessage.setElementQName(typeTable.getQNamefortheType(methodName));
+ service.addMessageElementQNameToOperationMapping(methodSchemaType.getQName(),
+ axisOperation);
}
for (int j = 0; j < paras.length; j++) {
@@ -300,8 +296,9 @@
JClass returnType = jMethod.getReturnType();
if (!returnType.isVoidType()) {
+ String partQname = methodName + RESPONSE;
methodSchemaType =
- createSchemaTypeForMethodPart(getSimpleName(jMethod) + RESPONSE);
+ createSchemaTypeForMethodPart(partQname);
sequence = new XmlSchemaSequence();
methodSchemaType.setParticle(sequence);
JAnnotation returnAnnon =
@@ -318,7 +315,15 @@
} else {
generateSchemaForType(sequence, returnType, returnName);
}
-
+ AxisMessage outMessage = axisOperation.getMessage(
+ WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+ outMessage.setElementQName(typeTable.getQNamefortheType(partQname));
+ outMessage.setName(partQname);
+ service.addMessageElementQNameToOperationMapping(methodSchemaType.getQName(),
+ axisOperation);
+ }
+ if (addToService) {
+ service.addOperation(axisOperation);
}
}
return (JMethod[]) list.toArray(new JMethod[list.size()]);
@@ -343,7 +348,7 @@
/**
* Generate schema construct for given type
- *
+ *
* @param javaType
*/
private QName generateSchema(JClass javaType) throws Exception {
@@ -356,10 +361,10 @@
String targetNameSpace = resolveSchemaNamespace(packageName);
XmlSchema xmlSchema = getXmlSchema(targetNameSpace);
- String targetNamespacePrefix = (String)targetNamespacePrefixMap.get(targetNameSpace);
+ String targetNamespacePrefix = (String) targetNamespacePrefixMap.get(targetNameSpace);
if (targetNamespacePrefix == null) {
targetNamespacePrefix = generatePrefix();
- targetNamespacePrefixMap.put(targetNameSpace, targetNamespacePrefix) ;
+ targetNamespacePrefixMap.put(targetNameSpace, targetNamespacePrefix);
}
XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema);
@@ -374,8 +379,8 @@
JClass sup = javaType.getSuperclass();
- if ((sup != null) && !( "java.lang.Object".compareTo(sup.getQualifiedName()) == 0) &&
- !("org.apache.axis2".compareTo(sup.getContainingPackage().getQualifiedName()) == 0)) {
+ if ((sup != null) && !("java.lang.Object".compareTo(sup.getQualifiedName()) == 0) &&
+ !("org.apache.axis2".compareTo(sup.getContainingPackage().getQualifiedName()) == 0)) {
String superClassName = sup.getQualifiedName();
String superclassname = getSimpleName(sup);
String tgtNamespace;
@@ -387,16 +392,16 @@
} else {
tgtNamespace =
resolveSchemaNamespace(sup.getContainingPackage().getQualifiedName());
- tgtNamespacepfx = (String)targetNamespacePrefixMap.get(tgtNamespace);
+ tgtNamespacepfx = (String) targetNamespacePrefixMap.get(tgtNamespace);
generateSchema(sup);
}
if (tgtNamespacepfx == null) {
tgtNamespacepfx = generatePrefix();
- targetNamespacePrefixMap.put(tgtNamespace, tgtNamespacepfx) ;
+ targetNamespacePrefixMap.put(tgtNamespace, tgtNamespacepfx);
}
- QName basetype = new QName(tgtNamespace,superclassname,tgtNamespacepfx) ;
+ QName basetype = new QName(tgtNamespace, superclassname, tgtNamespacepfx);
complexExtension.setBaseTypeName(basetype);
@@ -423,7 +428,7 @@
// adding this type to the table
typeTable.addComplexSchema(name, eltOuter.getQName());
- // adding this type's package to the table, to support inheritance.
+ // adding this type's package to the table, to support inheritance.
typeTable.addComplexSchema(javaType.getContainingPackage().getQualifiedName(),
eltOuter.getQName());
@@ -436,7 +441,7 @@
propertiesSet.add(tempProperties[i]);
}
- JProperty[] properties = (JProperty[])propertiesSet.toArray(new JProperty[0]);
+ JProperty[] properties = (JProperty[]) propertiesSet.toArray(new JProperty[0]);
Arrays.sort(properties);
for (int i = 0; i < properties.length; i++) {
JProperty property = properties[i];
@@ -448,7 +453,7 @@
propertiesNames.add(propname);
this.generateSchemaforFieldsandProperties(xmlSchema, sequence, property.getType(),
- propname, isArryType);
+ propname, isArryType);
}
@@ -484,7 +489,7 @@
}
// end patch for Annogen -21
- JField[] froperties = (JField[])FieldMap.values().toArray(new JField[0]);
+ JField[] froperties = (JField[]) FieldMap.values().toArray(new JField[0]);
Arrays.sort(froperties);
for (int i = 0; i < froperties.length; i++) {
@@ -493,7 +498,7 @@
boolean isArryType = field.getType().isArrayType();
this.generateSchemaforFieldsandProperties(xmlSchema, sequence, field.getType(),
- field.getSimpleName(), isArryType);
+ field.getSimpleName(), isArryType);
}
@@ -503,9 +508,9 @@
// moved code common to Fields & properties out of above method
- private void generateSchemaforFieldsandProperties(XmlSchema xmlSchema,
- XmlSchemaSequence sequence, JClass type,
- String name, boolean isArryType)
+ protected void generateSchemaforFieldsandProperties(XmlSchema xmlSchema,
+ XmlSchemaSequence sequence, JClass type,
+ String name, boolean isArryType)
throws Exception {
String propertyName;
@@ -525,12 +530,12 @@
elt1.setSchemaTypeName(typeTable.getSimpleSchemaTypeName(propertyName));
sequence.getItems().add(elt1);
- if (isArryType && (!propertyName.equals("base64Binary"))){
+ if (isArryType && (!propertyName.equals("base64Binary"))) {
elt1.setMaxOccurs(Long.MAX_VALUE);
}
- elt1.setMinOccurs(0) ;
- if(type.isPrimitiveType() == false) {
- elt1.setNillable(true) ;
+ elt1.setMinOccurs(0);
+ if (!type.isPrimitiveType()) {
+ elt1.setNillable(true);
}
} else {
if (isArryType) {
@@ -548,15 +553,15 @@
elt1.setMinOccurs(0);
elt1.setNillable(true);
- if (!((NamespaceMap)xmlSchema.getNamespaceContext()).values().
+ if (!((NamespaceMap) xmlSchema.getNamespaceContext()).values().
contains(typeTable.getComplexSchemaType(propertyName).getNamespaceURI())) {
XmlSchemaImport importElement = new XmlSchemaImport();
importElement.setNamespace(
typeTable.getComplexSchemaType(propertyName).getNamespaceURI());
xmlSchema.getItems().add(importElement);
- ((NamespaceMap)xmlSchema.getNamespaceContext()).
+ ((NamespaceMap) xmlSchema.getNamespaceContext()).
put(generatePrefix(),
- typeTable.getComplexSchemaType(propertyName).getNamespaceURI());
+ typeTable.getComplexSchemaType(propertyName).getNamespaceURI());
}
}
@@ -574,7 +579,7 @@
if (isArrayType) {
type = type.getArrayComponentType();
}
- if(AxisFault.class.getName().equals(type)){
+ if (AxisFault.class.getName().equals(type)) {
return null;
}
String classTypeName;
@@ -594,31 +599,33 @@
if (schemaTypeName == null) {
schemaTypeName = generateSchema(type);
addContentToMethodSchemaType(sequence,
- schemaTypeName,
- partName,
- isArrayType);
+ schemaTypeName,
+ partName,
+ isArrayType);
String schemaNamespace;
schemaNamespace = resolveSchemaNamespace(getQualifiedName(type.getContainingPackage()));
addImport(getXmlSchema(schemaNamespace), schemaTypeName);
} else {
addContentToMethodSchemaType(sequence,
- schemaTypeName,
- partName,
- isArrayType);
+ schemaTypeName,
+ partName,
+ isArrayType);
}
return schemaTypeName;
}
- private void addContentToMethodSchemaType(XmlSchemaSequence sequence,
- QName schemaTypeName,
- String paraName,
- boolean isArray) {
+ protected void addContentToMethodSchemaType(XmlSchemaSequence sequence,
+ QName schemaTypeName,
+ String paraName,
+ boolean isArray) {
XmlSchemaElement elt1 = new XmlSchemaElement();
elt1.setName(paraName);
elt1.setSchemaTypeName(schemaTypeName);
- sequence.getItems().add(elt1);
+ if (sequence != null) {
+ sequence.getItems().add(elt1);
+ }
if (isArray) {
elt1.setMaxOccurs(Long.MAX_VALUE);
@@ -633,9 +640,9 @@
new QName(this.schemaTargetNameSpace, localPartName, this.schema_namespace_prefix);
XmlSchemaComplexType complexType = getComplexTypeForElement(xmlSchema, elementName);
- if(complexType == null) {
+ if (complexType == null) {
complexType = new XmlSchemaComplexType(xmlSchema);
-
+
XmlSchemaElement globalElement = new XmlSchemaElement();
globalElement.setSchemaType(complexType);
globalElement.setName(localPartName);
@@ -648,12 +655,12 @@
return complexType;
}
- private XmlSchemaComplexType getComplexTypeForElement(XmlSchema xmlSchema, QName name) {
+ protected XmlSchemaComplexType getComplexTypeForElement(XmlSchema xmlSchema, QName name) {
Iterator iterator = xmlSchema.getItems().getIterator();
- while(iterator.hasNext()){
+ while (iterator.hasNext()) {
XmlSchemaObject object = (XmlSchemaObject) iterator.next();
- if(object instanceof XmlSchemaElement && ((XmlSchemaElement)object).getQName().equals(name)){
- return (XmlSchemaComplexType)((XmlSchemaElement)object).getSchemaType();
+ if (object instanceof XmlSchemaElement && ((XmlSchemaElement) object).getQName().equals(name)) {
+ return (XmlSchemaComplexType) ((XmlSchemaElement) object).getSchemaType();
}
}
return null;
@@ -662,7 +669,7 @@
private XmlSchema getXmlSchema(String targetNamespace) {
XmlSchema xmlSchema;
- if ((xmlSchema = (XmlSchema)schemaMap.get(targetNamespace)) == null) {
+ if ((xmlSchema = (XmlSchema) schemaMap.get(targetNamespace)) == null) {
String targetNamespacePrefix = null;
if (targetNamespace.equals(schemaTargetNameSpace) &&
@@ -698,7 +705,7 @@
return methods;
}
- private String generatePrefix() {
+ protected String generatePrefix() {
return NAME_SPACE_PREFIX + prefixCount++;
}
@@ -711,14 +718,14 @@
return schemaTargetNameSpace;
}
- private void addImport(XmlSchema xmlSchema, QName schemaTypeName) {
+ protected void addImport(XmlSchema xmlSchema, QName schemaTypeName) {
NamespacePrefixList map = xmlSchema.getNamespaceContext();
- if (map instanceof NamespaceMap && !((NamespaceMap)map).values().
+ if (map instanceof NamespaceMap && !((NamespaceMap) map).values().
contains(schemaTypeName.getNamespaceURI())) {
XmlSchemaImport importElement = new XmlSchemaImport();
importElement.setNamespace(schemaTypeName.getNamespaceURI());
xmlSchema.getItems().add(importElement);
- ((NamespaceMap)xmlSchema.getNamespaceContext()).
+ ((NamespaceMap) xmlSchema.getNamespaceContext()).
put(generatePrefix(), schemaTypeName.getNamespaceURI());
}
}
@@ -739,7 +746,7 @@
this.elementFormDefault = elementFormDefault;
}
- private XmlSchemaForm getAttrFormDefaultSetting() {
+ protected XmlSchemaForm getAttrFormDefaultSetting() {
if (FORM_DEFAULT_UNQUALIFIED.equals(getAttrFormDefault())) {
return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED);
} else {
@@ -747,7 +754,7 @@
}
}
- private XmlSchemaForm getElementFormDefaultSetting() {
+ protected XmlSchemaForm getElementFormDefaultSetting() {
if (FORM_DEFAULT_UNQUALIFIED.equals(getElementFormDefault())) {
return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED);
} else {
@@ -766,17 +773,17 @@
this.extraClasses = extraClasses;
}
- private String resolveSchemaNamespace(String packageName) throws Exception {
+ protected String resolveSchemaNamespace(String packageName) throws Exception {
//if all types must go into the wsdl types schema namespace
if (useWSDLTypesNamespace) {
//return schemaTargetNameSpace;
- return (String)pkg2nsmap.get("all");
+ return (String) pkg2nsmap.get("all");
} else {
if (pkg2nsmap != null && !pkg2nsmap.isEmpty()) {
//if types should go into namespaces that are mapped against the package name for the type
if (pkg2nsmap.get(packageName) != null) {
//return that mapping
- return (String)pkg2nsmap.get(packageName);
+ return (String) pkg2nsmap.get(packageName);
} else {
return getNsGen().schemaNamespaceFromPackageName(packageName).toString();
}
@@ -847,5 +854,9 @@
if (nonRpcMethods != null) {
this.nonRpcMethods = nonRpcMethods;
}
+ }
+
+ public void setAxisService(AxisService service) {
+ this.service = service;
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java Wed Jun 27 09:45:37 2007
@@ -27,6 +27,7 @@
String SCHEMA_NAMESPACE_PRFIX = "ns";
String FORM_DEFAULT_QUALIFIED = "qualified";
String FORM_DEFAULT_UNQUALIFIED = "unqualified";
+ String DOC_LIT_BARE_PARAMETER ="doclitBare";
String DEFAULT_TARGET_NAMESPACE = "http://ws.apache.org/axis2";
@@ -59,6 +60,7 @@
String MESSAGE_SUFFIX = "Request";
String REQUEST = "Request";
String RESPONSE = "Response";
+ String RESULT = "Result";
String PORT_TYPE_LOCAL_NAME = "portType";
String OPERATION_LOCAL_NAME = "operation";
String IN_PUT_LOCAL_NAME = "input";
@@ -107,6 +109,7 @@
String SCHEMA_GENERATOR_OPTION = "sg";
String JAVA_PKG_2_NSMAP_OPTION = "p2n";
String WSDL_VERSION_OPTION = "wv";
+ String DOC_LIT_BARE = "dlb";
//long option constants
String OUTPUT_LOCATION_OPTION_LONG = "output";
@@ -129,10 +132,12 @@
String SCHEMA_GENERATOR_OPTION_LONG = "schemaGenerator";
String JAVA_PKG_2_NSMAP_OPTION_LONG = "package2Namespace";
String WSDL_VERSION_OPTION_LONG = "wsdl-version";
+ String DOC_LIT_BARE_LONG = "doclitbare";
public static final String SOLE_INPUT = "SOLE_INPUT";
String WSDL_VERSION_2 = "2.0";
String WSDL_VERSION_2_OPTIONAL = "2";
String WSDL_VERSION_1 = "1.1";
+ String PARAMETERS = "parameters";
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/SchemaGenerator.java Wed Jun 27 09:45:37 2007
@@ -1,6 +1,7 @@
package org.apache.axis2.description.java2wsdl;
import org.codehaus.jam.JMethod;
+import org.apache.axis2.description.AxisService;
import java.util.Collection;
import java.util.ArrayList;
@@ -49,4 +50,6 @@
String getTargetNamespace();
void setNonRpcMethods(ArrayList nonRpcMethods);
+
+ void setAxisService(AxisService service);
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AddressingBasedDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AddressingBasedDispatcher.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AddressingBasedDispatcher.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AddressingBasedDispatcher.java Wed Jun 27 09:45:37 2007
@@ -14,95 +14,9 @@
package org.apache.axis2.engine;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.context.ServiceGroupContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.dispatchers.ActionBasedOperationDispatcher;
-import org.apache.axis2.dispatchers.RequestURIBasedServiceDispatcher;
-import org.apache.axis2.i18n.Messages;
-import org.apache.axis2.util.LoggingControl;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
/**
* Dispatcher based on the WS-Addressing properties.
+ * @deprecated use org.apache.axis2.dispatchers.AddressingBasedDispatcher
*/
-public class AddressingBasedDispatcher extends AbstractDispatcher implements AddressingConstants {
-
- /**
- * Field NAME
- */
- public static final String NAME = "AddressingBasedDispatcher";
- private static final Log log = LogFactory.getLog(AddressingBasedDispatcher.class);
- private RequestURIBasedServiceDispatcher rubsd = new RequestURIBasedServiceDispatcher();
- private ActionBasedOperationDispatcher abod = new ActionBasedOperationDispatcher();
-
- public AxisOperation findOperation(AxisService service, MessageContext messageContext)
- throws AxisFault {
- return abod.findOperation(service, messageContext);
- }
-
- public AxisService findService(MessageContext messageContext) throws AxisFault {
- return rubsd.findService(messageContext);
- }
-
- public void initDispatcher() {
- init(new HandlerDescription(NAME));
- }
-
- /**
- * @param msgctx
- * @throws org.apache.axis2.AxisFault
- * @noinspection MethodReturnOfConcreteClass
- */
- public InvocationResponse invoke(MessageContext msgctx) throws AxisFault {
- // first check we can dispatch using the relates to
- if (msgctx.getRelatesTo() != null) {
- String relatesTo = msgctx.getRelatesTo().getValue();
-
- if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
- log.debug(msgctx.getLogIDString() + " " + Messages.getMessage("checkingrelatesto",
- relatesTo));
- }
- if (relatesTo != null && !"".equals(relatesTo) && (msgctx.getOperationContext()==null)) {
- OperationContext operationContext =
- msgctx.getConfigurationContext()
- .getOperationContext(relatesTo);
-
- if (operationContext != null) //noinspection TodoComment
- {
-// if(operationContext.isComplete()){
-// // If the dispatch happens because of the RelatesTo and the mep is complete
-// // we should throw a more descriptive fault.
-// throw new AxisFault(Messages.getMessage("duplicaterelatesto",relatesTo));
-// }
- msgctx.setAxisOperation(operationContext.getAxisOperation());
- msgctx.setOperationContext(operationContext);
- msgctx.setServiceContext((ServiceContext) operationContext.getParent());
- msgctx.setAxisService(
- ((ServiceContext) operationContext.getParent()).getAxisService());
-
- // TODO : Is this necessary here?
- msgctx.getAxisOperation().registerMessageContext(msgctx, operationContext);
-
- msgctx.setServiceGroupContextId(
- ((ServiceGroupContext) msgctx.getServiceContext().getParent()).getId());
-
- if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
- log.debug(msgctx.getLogIDString() +
- " Dispatched successfully on the RelatesTo. operation=" +
- operationContext.getAxisOperation());
- }
- return InvocationResponse.CONTINUE;
- }
- }
- }
- return super.invoke(msgctx);
- }
+public class AddressingBasedDispatcher extends org.apache.axis2.dispatchers.AddressingBasedDispatcher {
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java Wed Jun 27 09:45:37 2007
@@ -84,11 +84,6 @@
*/
private List globalModuleList;
- /**
- * Field engagedModules
- */
- private final ArrayList engagedModules;
-
private Hashtable faultyModules;
/**
@@ -127,12 +122,13 @@
private ClusterManager clusterManager;
+ private AxisConfigurator configurator;
+
/**
- * Constructor AxisConfigurationImpl.
+ * Constructor AxisConfiguration.
*/
public AxisConfiguration() {
moduleConfigmap = new HashMap();
- engagedModules = new ArrayList();
globalModuleList = new ArrayList();
messageReceivers = new HashMap();
messageBuilders = new HashMap();
@@ -269,11 +265,6 @@
Iterator services = axisServiceGroup.getServices();
while (services.hasNext()) {
axisService = (AxisService) services.next();
- String serviceName = axisService.getName();
- if (allServices.get(serviceName) != null) {
- throw new AxisFault(Messages.getMessage("twoservicecannothavesamename",
- axisService.getName()));
- }
if (axisService.getSchematargetNamespace() == null) {
axisService.setSchemaTargetNamespace(Java2WSDLConstants.AXIS2_XSD);
}
@@ -289,17 +280,30 @@
}
}
}
- Iterator enModule = engagedModules.iterator();
+ Iterator enModule = getEngagedModules().iterator();
while (enModule.hasNext()) {
axisServiceGroup.engageModule((AxisModule)enModule.next());
}
services = axisServiceGroup.getServices();
+ ArrayList servicesIAdded = new ArrayList();
while (services.hasNext()) {
axisService = (AxisService) services.next();
Map endpoints = axisService.getEndpoints();
String serviceName = axisService.getName();
- addToAllServicesMap(serviceName, axisService);
+ try {
+ addToAllServicesMap(axisService);
+ } catch (AxisFault axisFault) {
+ // Whoops, must have been a duplicate! If we had a problem here, we have to
+ // remove all the ones we added...
+ for (Iterator i = servicesIAdded.iterator(); i.hasNext();) {
+ AxisService service = (AxisService)i.next();
+ allServices.remove(service.getName());
+ }
+ // And toss this in case anyone wants it?
+ throw axisFault;
+ }
+ servicesIAdded.add(axisService);
if (endpoints != null) {
Iterator endpointNameIter = endpoints.keySet().iterator();
while (endpointNameIter.hasNext()) {
@@ -317,8 +321,18 @@
addChild(axisServiceGroup);
}
- public void addToAllServicesMap(String serviceName, AxisService axisService) {
- allServices.put(serviceName, axisService);
+ public void addToAllServicesMap(AxisService axisService) throws AxisFault {
+ String serviceName = axisService.getName();
+ AxisService oldService = (AxisService)allServices.get(serviceName);
+ if (oldService == null) {
+ allServices.put(serviceName, axisService);
+ } else {
+ // If we were already there, that's fine. If not, fault!
+ if (oldService != axisService) {
+ throw new AxisFault(Messages.getMessage("twoservicecannothavesamename",
+ axisService.getName()));
+ }
+ }
}
public AxisServiceGroup removeServiceGroup(String serviceGroupName) throws AxisFault {
@@ -421,52 +435,28 @@
}
}
- public void engageModule(AxisModule module) throws AxisFault {
- boolean isEngagable;
- if (module != null) {
- String moduleName = module.getName();
- for (Iterator iterator = engagedModules.iterator(); iterator.hasNext();) {
- AxisModule thisModule = (AxisModule)iterator.next();
-
- isEngagable = Utils.checkVersion(moduleName, thisModule.getName());
- if (!isEngagable) {
- return;
- }
- }
- } else {
- throw new AxisFault(Messages.getMessage("refertoinvalidmodule"));
- }
+ public void onEngage(AxisModule module, AxisDescription engager) throws AxisFault {
Iterator servicegroups = getServiceGroups();
while (servicegroups.hasNext()) {
- AxisServiceGroup serviceGroup = (AxisServiceGroup) servicegroups
- .next();
- serviceGroup.engageModule(module);
+ AxisServiceGroup serviceGroup = (AxisServiceGroup) servicegroups.next();
+ serviceGroup.engageModule(module, engager);
}
- engagedModules.add(module);
}
/**
* To dis-engage a module from the system. This will remove all the handlers
* belonging to this module from all the handler chains.
*
- * @param module
+ * @param module module to disengage
*/
- public void disengageModule(AxisModule module) {
- if (module != null && isEngaged(module.getName())) {
- PhaseResolver phaseResolver = new PhaseResolver(this);
- phaseResolver.disengageModuleFromGlobalChains(module);
- Iterator serviceItr = getServices().values().iterator();
- while (serviceItr.hasNext()) {
- AxisService axisService = (AxisService) serviceItr.next();
- axisService.disengageModule(module);
- }
- Iterator serviceGroups = getServiceGroups();
- while (serviceGroups.hasNext()) {
- AxisServiceGroup axisServiceGroup = (AxisServiceGroup) serviceGroups
- .next();
- axisServiceGroup.removeFromEngageList(module.getName());
- }
- engagedModules.remove(module);
+ public void onDisengage(AxisModule module) throws AxisFault {
+ PhaseResolver phaseResolver = new PhaseResolver(this);
+ phaseResolver.disengageModuleFromGlobalChains(module);
+
+ Iterator serviceGroups = getServiceGroups();
+ while (serviceGroups.hasNext()) {
+ AxisServiceGroup axisServiceGroup = (AxisServiceGroup) serviceGroups.next();
+ axisServiceGroup.disengageModule(module);
}
}
@@ -533,25 +523,21 @@
}
/**
- * getEngagedModules() returns a copy of the list of engaged modules
- *
- * @return Collection a collection, containing AxisModules
- */
- public Collection getEngagedModules() {
- return (Collection)engagedModules.clone();
- }
-
- /**
* Add an AxisModule to the list of globally deployed modules.
*
* TODO: should this check for duplicate names?
*
- * @param module name of AxisModule to add to list.
+ * @param moduleName name of AxisModule to add to list.
*/
public void addGlobalModuleRef(String moduleName) {
globalModuleList.add(moduleName);
}
+ /**
+ * Engage all the previously added global modules.
+ *
+ * @throws AxisFault if an individual engageModule() fails
+ */
public void engageGlobalModules() throws AxisFault {
for (Iterator i = globalModuleList.iterator(); i.hasNext();) {
engageModule((String)i.next());
@@ -672,6 +658,16 @@
}
/**
+ * Get a list of the global modules
+ *
+ * @return the global module list. BE CAREFUL, this list is mutable.
+ * @deprecated please use addGlobalModule()
+ */
+ public List getGlobalModules() {
+ return globalModuleList;
+ }
+
+ /**
* @return Returns ArrayList.
*/
public ArrayList getOutFaultFlowPhases() {
@@ -748,18 +744,6 @@
// To get all the services in the system
public HashMap getServices() {
- Iterator sgs = getServiceGroups();
-
- while (sgs.hasNext()) {
- AxisServiceGroup axisServiceGroup = (AxisServiceGroup) sgs.next();
- Iterator servics = axisServiceGroup.getServices();
-
- while (servics.hasNext()) {
- AxisService axisService = (AxisService) servics.next();
- addToAllServicesMap(axisService.getName(), axisService);
- }
- }
-
return allServices;
}
@@ -788,10 +772,10 @@
public boolean isEngaged(String moduleName) {
AxisModule module = (AxisModule)allModules.get(moduleName);
if (module == null) return false;
- boolean isEngaged = engagedModules.contains(moduleName);
+ boolean isEngaged = super.isEngaged(moduleName);
if (!isEngaged) {
AxisModule defaultModule = getDefaultModule(moduleName);
- isEngaged = engagedModules.contains(defaultModule);
+ isEngaged = engagedModules != null && engagedModules.values().contains(defaultModule);
}
return isEngaged;
}
@@ -1042,5 +1026,19 @@
setInFaultPhases(phasesInfo.getGlobalInFaultPhases());
setGlobalOutPhase(phasesInfo.getGlobalOutPhaseList());
setOutFaultPhases(phasesInfo.getOUT_FaultPhases());
+ }
+
+ public AxisConfigurator getConfigurator() {
+ return configurator;
+ }
+
+ public void setConfigurator(AxisConfigurator configurator) {
+ this.configurator = configurator;
+ }
+
+ public void cleanup(){
+ if(configurator != null){
+ configurator.cleanup();
+ }
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisConfigurator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisConfigurator.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisConfigurator.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisConfigurator.java Wed Jun 27 09:45:37 2007
@@ -40,4 +40,9 @@
* @throws AxisFault
*/
void engageGlobalModules() throws AxisFault;
+
+ /**
+ * Clean up the mess
+ */
+ void cleanup();
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java Wed Jun 27 09:45:37 2007
@@ -70,11 +70,29 @@
while (headerBlocks.hasNext()) {
SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) headerBlocks.next();
+ QName headerQName = headerBlock.getQName();
// if this header block has been processed or mustUnderstand isn't
// turned on then its cool
if (headerBlock.isProcessed() || !headerBlock.getMustUnderstand()) {
continue;
+ }
+ // Check if another component, such as the message receiver, has registered that
+ // they will process this header
+ AxisOperation axisOperation = msgContext.getAxisOperation();
+ if (axisOperation != null) {
+ ArrayList understoodHeaderList = (ArrayList) axisOperation.getUnderstoodHeaderQNames();
+ if (understoodHeaderList != null && !understoodHeaderList.isEmpty()) {
+ if (understoodHeaderList.contains(headerQName)) {
+ if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
+ log.debug("MustUnderstand header registered as understood on AxisOperation: " + headerQName);
+ }
+ continue;
+ }
+ }
+ }
+ if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
+ log.debug("MustUnderstand header not processed or registered as understood " + headerQName);
}
// Oops, throw an appropriate MustUnderstand fault!!
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/DependencyManager.java Wed Jun 27 09:45:37 2007
@@ -19,6 +19,7 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
+import org.apache.axis2.service.Lifecycle;
import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.context.ServiceGroupContext;
import org.apache.axis2.description.AxisService;
@@ -39,11 +40,42 @@
public class DependencyManager {
private static final Log log = LogFactory.getLog(DependencyManager.class);
public final static String SERVICE_INIT_METHOD = "init";
- public final static String SERVICE_START_METHOD = "startUp";
public final static String SERVICE_DESTROY_METHOD = "destroy";
- public static void initServiceClass(Object obj,
- ServiceContext serviceContext) {
+ /**
+ * Initialize a new service object. Essentially, check to see if the object wants to receive
+ * an init() call - if so, call it.
+ *
+ * @param obj the service object
+ * @param serviceContext the active ServiceContext
+ * @throws AxisFault if there's a problem initializing
+ *
+ * @deprecated please use initServiceObject()
+ */
+ public static void initServiceClass(Object obj, ServiceContext serviceContext)
+ throws AxisFault {
+ initServiceObject(obj, serviceContext);
+ }
+
+ /**
+ * Initialize a new service object. Essentially, check to see if the object wants to receive
+ * an init() call - if so, call it.
+ *
+ * @param obj the service object
+ * @param serviceContext the active ServiceContext
+ * @throws AxisFault if there's a problem initializing
+ */
+ public static void initServiceObject(Object obj, ServiceContext serviceContext)
+ throws AxisFault {
+ // This is the way to do things into the future.
+ if (obj instanceof Lifecycle) {
+ ((Lifecycle)obj).init(serviceContext);
+ return;
+ }
+
+ // ...however, we also still support the old way for now. Note that introspecting for
+ // a method like this is something like 10 times slower than the above instanceof check.
+
Class classToLoad = obj.getClass();
// We can not call classToLoad.getDeclaredMethed() , since there
// can be insatnce where mutiple services extends using one class
@@ -73,8 +105,8 @@
/**
* To init all the services in application scope
*
- * @param serviceGroupContext
- * @throws AxisFault
+ * @param serviceGroupContext the ServiceGroupContext from which to extract all the services
+ * @throws AxisFault if there's a problem initializing
*/
public static void initService(ServiceGroupContext serviceGroupContext) throws AxisFault {
AxisServiceGroup serviceGroup = serviceGroupContext.getDescription();
@@ -92,7 +124,7 @@
((String) implInfoParam.getValue()).trim());
Object serviceImpl = implClass.newInstance();
serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, serviceImpl);
- initServiceClass(serviceImpl, serviceContext);
+ initServiceObject(serviceImpl, serviceContext);
} catch (Exception e) {
AxisFault.makeFault(e);
}
@@ -101,13 +133,20 @@
}
/**
- * To startup service when user puts load-on-startup parameter
+ * Notify a service object that it's on death row.
+ * @param serviceContext the active ServiceContext
*/
-
-
public static void destroyServiceObject(ServiceContext serviceContext) {
Object obj = serviceContext.getProperty(ServiceContext.SERVICE_OBJECT);
if (obj != null) {
+ // If this is a Lifecycle object, just call it.
+ if (obj instanceof Lifecycle) {
+ ((Lifecycle)obj).destroy(serviceContext);
+ return;
+ }
+
+ // For now, we also use "raw" introspection to try and find the destroy method.
+
Class classToLoad = obj.getClass();
Method method =
null;
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/HTTPLocationBasedDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/HTTPLocationBasedDispatcher.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/HTTPLocationBasedDispatcher.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/HTTPLocationBasedDispatcher.java Wed Jun 27 09:45:37 2007
@@ -17,117 +17,10 @@
package org.apache.axis2.engine;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisEndpoint;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.description.WSDL2Constants;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-
/**
* Dispatches the operation based on the information from the target endpoint URL.
+ *
+ * @deprecated use org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher
*/
-public class HTTPLocationBasedDispatcher extends AbstractDispatcher {
-
- public static final String NAME = "HTTPLocationBasedDispatcher";
- private static final Log log = LogFactory.getLog(HTTPLocationBasedDispatcher.class);
-
- /*
- * (non-Javadoc)
- * @see org.apache.axis2.engine.AbstractDispatcher#findOperation(org.apache.axis2.description.AxisService, org.apache.axis2.context.MessageContext)
- */
- public AxisOperation findOperation(AxisService service, MessageContext messageContext)
- throws AxisFault {
-
- AxisService axisService = messageContext.getAxisService();
- if (axisService != null) {
- String uri = messageContext.getTo().getAddress();
- String httpLocation = parseRequestURL(uri, messageContext
- .getConfigurationContext().getServiceContextPath());
-
- if (httpLocation != null) {
- AxisEndpoint axisEndpoint = (AxisEndpoint) messageContext
- .getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME);
- if (axisEndpoint != null) {
- Map httpLocationTable = (Map) axisEndpoint.getBinding()
- .getProperty(WSDL2Constants.HTTP_LOCATION_TABLE);
- if (httpLocationTable != null) {
- return getOperationFromHTTPLocation(httpLocation, httpLocationTable);
- }
- }
- } else {
- log.debug("Attempt to check for Operation using HTTP Location failed");
- return null;
- }
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext)
- */
- public AxisService findService(MessageContext messageContext) throws AxisFault {
- // This Dispatcher does not need to resolve the service, as that is handled
- // by the RequestURIBasedDispatcher.
- return null;
- }
-
- public void initDispatcher() {
- init(new HandlerDescription(NAME));
- }
-
- private String parseRequestURL(String path, String servicePath) {
-
- int index = path.lastIndexOf(servicePath);
- String service = null;
-
- if (-1 != index) {
- int serviceStart = index + servicePath.length();
- if (path.length() > serviceStart + 1) {
- service = path.substring(serviceStart + 1);
- }
- }
-
- if (service != null) {
- index = service.indexOf("/");
- if (-1 != index) {
- service = service.substring(index);
- } else {
- int queryIndex = service.indexOf("?");
- if (queryIndex != -1) {
- service = service.substring(queryIndex);
- }
- }
- }
- return service;
- }
-
- /**
- * Given the requestPath that the request came to his method returns the corresponding axisOperation
- *
- * @param requestPath - Part of the request url which is the part after the service name
- * @return AxisOperation - The corresponding AxisOperation
- */
- private AxisOperation getOperationFromHTTPLocation(String requestPath, Map httpLocationTable) {
-
- Collection httpLocations = httpLocationTable.keySet();
- Iterator iter = httpLocations.iterator();
- while (iter.hasNext()) {
- String location = (String) iter.next();
- int index = requestPath.indexOf(location);
- if (index == 0) {
- return (AxisOperation) httpLocationTable.get(location);
- }
-
- }
- return null;
- }
-}
\ No newline at end of file
+public class HTTPLocationBasedDispatcher extends org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher {
+}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/Phase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/Phase.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/Phase.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/Phase.java Wed Jun 27 09:45:37 2007
@@ -110,7 +110,7 @@
* @param handlerDesc the HandlerDescription to add
* @throws PhaseException if there is a problem
*/
- public void addHandler(HandlerDescription handlerDesc) throws PhaseException {
+ public synchronized void addHandler(HandlerDescription handlerDesc) throws PhaseException {
Iterator handlers_itr = getHandlers().iterator();
while (handlers_itr.hasNext()) {
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/RequestURIBasedDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/RequestURIBasedDispatcher.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/RequestURIBasedDispatcher.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/RequestURIBasedDispatcher.java Wed Jun 27 09:45:37 2007
@@ -13,41 +13,10 @@
*/
package org.apache.axis2.engine;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.dispatchers.RequestURIBasedServiceDispatcher;
-
/**
* Dispatches the service based on the information from the target endpoint URL.
+ *
+ * @deprecated use org.apache.axis2.dispatchers.RequestURIBasedDispatcher
*/
-public class RequestURIBasedDispatcher extends AbstractDispatcher {
-
- public static final String NAME = "RequestURIBasedDispatcher";
- private RequestURIBasedServiceDispatcher rubsd = new RequestURIBasedServiceDispatcher();
-
- /*
- * (non-Javadoc)
- * @see org.apache.axis2.engine.AbstractDispatcher#findOperation(org.apache.axis2.description.AxisService, org.apache.axis2.context.MessageContext)
- */
- public AxisOperation findOperation(AxisService service, MessageContext messageContext)
- throws AxisFault {
- // This Dispatcher does not need to resolve the operation, as that is handled
- // by the RequestURIOperationDispatcher.
- return null;
- }
-
- /*
- * (non-Javadoc)
- * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext)
- */
- public AxisService findService(MessageContext messageContext) throws AxisFault {
- return rubsd.findService(messageContext);
- }
-
- public void initDispatcher() {
- init(new HandlerDescription(NAME));
- }
+public class RequestURIBasedDispatcher extends org.apache.axis2.dispatchers.RequestURIBasedDispatcher {
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/RequestURIOperationDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/RequestURIOperationDispatcher.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/RequestURIOperationDispatcher.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/RequestURIOperationDispatcher.java Wed Jun 27 09:45:37 2007
@@ -13,41 +13,10 @@
*/
package org.apache.axis2.engine;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.dispatchers.RequestURIBasedOperationDispatcher;
-
/**
* Dispatches the operation based on the information from the target endpoint URL.
+ *
+ * @deprecated use org.apache.axis2.dispatchers.RequestURIOperationDispatcher
*/
-public class RequestURIOperationDispatcher extends AbstractDispatcher {
-
- public static final String NAME = "RequestURIOperationDispatcher";
- private RequestURIBasedOperationDispatcher rubod = new RequestURIBasedOperationDispatcher();
-
- /*
- * (non-Javadoc)
- * @see org.apache.axis2.engine.AbstractDispatcher#findOperation(org.apache.axis2.description.AxisService, org.apache.axis2.context.MessageContext)
- */
- public AxisOperation findOperation(AxisService service, MessageContext messageContext)
- throws AxisFault {
- return rubod.findOperation(service, messageContext);
- }
-
- /*
- * (non-Javadoc)
- * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext)
- */
- public AxisService findService(MessageContext messageContext) throws AxisFault {
- // This Dispatcher does not need to resolve the service, as that is handled
- // by the RequestURIBasedDispatcher.
- return null;
- }
-
- public void initDispatcher() {
- init(new HandlerDescription(NAME));
- }
+public class RequestURIOperationDispatcher extends org.apache.axis2.dispatchers.RequestURIOperationDispatcher {
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/SOAPActionBasedDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/SOAPActionBasedDispatcher.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/SOAPActionBasedDispatcher.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/SOAPActionBasedDispatcher.java Wed Jun 27 09:45:37 2007
@@ -13,47 +13,11 @@
*/
package org.apache.axis2.engine;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.dispatchers.ActionBasedOperationDispatcher;
-import org.apache.axis2.util.LoggingControl;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
/**
* Dispatches based on the SOAPAction.
+ *
+ * @deprecated use org.apache.axis2.dispatchers.SOAPActionBasedDispatcher
*/
-public class SOAPActionBasedDispatcher extends AbstractDispatcher {
-
- /**
- * Field NAME
- */
- public static final String NAME = "SOAPActionBasedDispatcher";
- private static final Log log = LogFactory.getLog(SOAPActionBasedDispatcher.class);
- private ActionBasedOperationDispatcher abod = new ActionBasedOperationDispatcher();
-
- public AxisOperation findOperation(AxisService service, MessageContext messageContext)
- throws AxisFault {
- return abod.findOperation(service, messageContext);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext)
- */
- public AxisService findService(MessageContext messageContext) throws AxisFault {
- if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
- log.debug(messageContext.getLogIDString() +
- " Checking for Service using SOAPAction is a TODO item");
- }
- return null;
- }
-
- public void initDispatcher() {
- init(new HandlerDescription(NAME));
- }
+public class SOAPActionBasedDispatcher extends org.apache.axis2.dispatchers.SOAPActionBasedDispatcher {
}
+
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java Wed Jun 27 09:45:37 2007
@@ -17,92 +17,11 @@
package org.apache.axis2.engine;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.util.LoggingControl;
-import org.apache.axis2.util.Utils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.xml.namespace.QName;
-
/**
* Dispatches based on the namespace URI of the first child of
* the body.
+ *
+ * @deprecated use org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher
*/
-public class SOAPMessageBodyBasedDispatcher extends AbstractDispatcher {
-
- /**
- * Field NAME
- */
- public static final String NAME = "SOAPMessageBodyBasedDispatcher";
- private static final Log log = LogFactory.getLog(SOAPMessageBodyBasedDispatcher.class);
-
- public AxisOperation findOperation(AxisService service, MessageContext messageContext)
- throws AxisFault {
-
- OMElement bodyFirstChild = messageContext.getEnvelope().getBody().getFirstElement();
-
- AxisOperation axisOperation = null;
- if (bodyFirstChild != null){
- axisOperation = service.getOperationByMessageElementQName(bodyFirstChild.getQName());
-
- // this is required for services uses the RPC message receiver
- if (axisOperation == null){
- QName operationName = new QName(bodyFirstChild.getLocalName());
- axisOperation = service.getOperation(operationName);
- }
-
- }
- return axisOperation;
- }
-
- /*
- * (non-Javadoc)
- * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext)
- */
- public AxisService findService(MessageContext messageContext) throws AxisFault {
- String serviceName;
-
- OMElement bodyFirstChild = messageContext.getEnvelope().getBody().getFirstElement();
-
- if (bodyFirstChild != null) {
- OMNamespace ns = bodyFirstChild.getNamespace();
-
- if (ns != null) {
- String filePart = ns.getNamespaceURI();
-
- if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
- log.debug(messageContext.getLogIDString() +
- " Checking for Service using SOAP message body's first child's namespace : "
- + filePart);
- }
- ConfigurationContext configurationContext =
- messageContext.getConfigurationContext();
- String[] values = Utils.parseRequestURLForServiceAndOperation(filePart,
- configurationContext.getServiceContextPath());
-
- if (values[0] != null) {
- serviceName = values[0];
-
- AxisConfiguration registry =
- configurationContext.getAxisConfiguration();
-
- return registry.getService(serviceName);
- }
- }
- }
-
- return null;
- }
-
- public void initDispatcher() {
- init(new HandlerDescription(NAME));
- }
+public class SOAPMessageBodyBasedDispatcher extends org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher {
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/i18n/resource.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/i18n/resource.properties?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/i18n/resource.properties (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/i18n/resource.properties Wed Jun 27 09:45:37 2007
@@ -253,3 +253,4 @@
wsaddressingrequirednotpresent=WS-Addressing is required, but it cannot be found.
nomessagereciever=Message Receiver not found for AxisOperation: {0}
duplicaterelatesto=The message is a duplicate (has the same reply relationship value) of an already processed message. RelatesTo = {0}
+mismatchedModuleVersions=Tried to deploy (to {0}) a module ''{1}'' when ''{2}'' was already deployed - version mismatch!
\ No newline at end of file
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/phaseresolver/PhaseResolver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/phaseresolver/PhaseResolver.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/phaseresolver/PhaseResolver.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/phaseresolver/PhaseResolver.java Wed Jun 27 09:45:37 2007
@@ -68,7 +68,7 @@
int flowType) throws PhaseException {
List phases = new ArrayList();
Flow flow = null;
- switch(flowType){
+ switch (flowType) {
case PhaseMetadata.IN_FLOW : {
phases.addAll(axisConfig.getInFlowPhases());
phases.addAll(axisOperation.getRemainingPhasesInFlow());
@@ -94,8 +94,9 @@
break;
}
}
- engageModuleToFlow(flow,phases);
+ engageModuleToFlow(flow, phases);
}
+
public void engageModuleToOperation(AxisOperation axisOperation, AxisModule module)
throws PhaseException {
for (int type = IN_FLOW; type < OUT_FAULT_FLOW; type++) {
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractMessageReceiver.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractMessageReceiver.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/receivers/AbstractMessageReceiver.java Wed Jun 27 09:45:37 2007
@@ -218,8 +218,7 @@
// create a new service impl class for that service
serviceimpl = makeNewServiceObject(msgContext);
//Service initialization
- DependencyManager.initServiceClass(serviceimpl,
- msgContext.getServiceContext());
+ DependencyManager.initServiceObject(serviceimpl, msgContext.getServiceContext());
serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, serviceimpl);
return serviceimpl;
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java Wed Jun 27 09:45:37 2007
@@ -81,8 +81,8 @@
public void init(ConfigurationContext confContext,
TransportOutDescription transportOut) throws AxisFault {
- // <parameter name="PROTOCOL" locked="false">HTTP/1.0</parameter> or
- // <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter> is
+ // <parameter name="PROTOCOL">HTTP/1.0</parameter> or
+ // <parameter name="PROTOCOL">HTTP/1.1</parameter> is
// checked
Parameter version = transportOut
.getParameter(HTTPConstants.PROTOCOL_VERSION);
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java Wed Jun 27 09:45:37 2007
@@ -262,9 +262,20 @@
//user specified no name and there is only one schema
//so pump that out
} else {
- XmlSchema schema = axisService.getSchema(0);
- if (schema != null) {
- schema.write(new OutputStreamWriter(out, "UTF8"));
+ ArrayList list = axisService.getSchema();
+ if (list.size() > 0) {
+ XmlSchema schema = axisService.getSchema(0);
+ if (schema != null) {
+ schema.write(new OutputStreamWriter(out, "UTF8"));
+ out.flush();
+ out.close();
+ }
+ } else {
+ res.setContentType("text/xml");
+ String xsdNotFound = "<error>" +
+ "<description>Unable to access schema for this service</description>" +
+ "</error>";
+ out.write(xsdNotFound.getBytes());
out.flush();
out.close();
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/DefaultHttpConnectionManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/DefaultHttpConnectionManager.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/DefaultHttpConnectionManager.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/DefaultHttpConnectionManager.java Wed Jun 27 09:45:37 2007
@@ -54,17 +54,23 @@
private static Log LOG = LogFactory.getLog(DefaultHttpConnectionManager.class);
private final ConfigurationContext configurationContext;
+
+ /** The thread pool used to execute processors. */
private final Executor executor;
+
private final WorkerFactory workerfactory;
+
private final HttpParams params;
+
+ /** The list of processors. */
+ // XXX: is this list really needed?
private final List processors;
private HttpFactory httpFactory = null;
- public DefaultHttpConnectionManager(
- final ConfigurationContext configurationContext,
- final Executor executor,
- final WorkerFactory workerfactory,
+
+ public DefaultHttpConnectionManager(final ConfigurationContext configurationContext,
+ final Executor executor, final WorkerFactory workerfactory,
final HttpParams params) {
super();
if (configurationContext == null) {
@@ -86,7 +92,7 @@
this.processors = new LinkedList();
}
- public DefaultHttpConnectionManager(
+ public DefaultHttpConnectionManager(
final ConfigurationContext configurationContext,
final Executor executor,
final WorkerFactory workerfactory,
@@ -97,6 +103,12 @@
}
+ /**
+ * Removes the destroyed processors.
+ *
+ * @see IOProcessor#destroy()
+ */
+ //XXX: is this method really needed? Processors are removed as soon as they complete
private synchronized void cleanup() {
for (Iterator i = this.processors.iterator(); i.hasNext();) {
IOProcessor processor = (IOProcessor) i.next();
@@ -106,20 +118,38 @@
}
}
+
+ /**
+ * Adds the specified {@linkplain IOProcessor} to the list of processors in
+ * progress.
+ *
+ * @param processor The processor to add.
+ * @throws NullPointerException If processor is <code>null</code>.
+ */
private synchronized void addProcessor(final IOProcessor processor) {
if (processor == null) {
- return;
+ throw new NullPointerException("The processor can't be null");
}
this.processors.add(processor);
}
- private synchronized void removeProcessor(final IOProcessor processor) {
+
+ /**
+ * Removes the specified {@linkplain IOProcessor} from the list of
+ * processors.
+ *
+ * @param processor The processor to remove.
+ * @throws NullPointerException If processor is <code>null</code>.
+ */
+ synchronized void removeProcessor(final IOProcessor processor)
+ throws NullPointerException {
if (processor == null) {
- return;
+ throw new NullPointerException("The processor can't be null");
}
this.processors.remove(processor);
}
+
public void process(final AxisHttpConnection conn) {
if (conn == null) {
throw new IllegalArgumentException("HTTP connection may not be null");
@@ -149,12 +179,8 @@
responseFactory = new DefaultHttpResponseFactory();
}
- AxisHttpService httpService = new AxisHttpService(
- httpProcessor,
- connStrategy,
- responseFactory,
- this.configurationContext,
- this.workerfactory.newWorker());
+ AxisHttpService httpService = new AxisHttpService(httpProcessor, connStrategy,
+ responseFactory, this.configurationContext, this.workerfactory.newWorker());
httpService.setParams(this.params);
// Create I/O processor to execute HTTP service
@@ -168,14 +194,12 @@
}
};
- IOProcessor processor = new HttpServiceProcessor(
- httpService,
- conn,
- callback);
+ IOProcessor processor = new HttpServiceProcessor(httpService, conn, callback);
addProcessor(processor);
this.executor.execute(processor);
}
+
public synchronized void shutdown() {
for (int i = 0; i < this.processors.size(); i++) {
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/HttpFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/HttpFactory.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/HttpFactory.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/HttpFactory.java Wed Jun 27 09:45:37 2007
@@ -138,7 +138,7 @@
originServer = getStringParam(PARAMETER_ORIGIN_SERVER, "Simple-Server/1.1");
requestSocketTimeout = getIntParam(PARAMETER_REQUEST_SOCKET_TIMEOUT, 20000);
requestTcpNoDelay = getBooleanParam(PARAMETER_REQUEST_TCP_NO_DELAY, true);
- requestCoreThreadPoolSize = getIntParam(PARAMETER_REQUEST_CORE_THREAD_POOL_SIZE, 25);
+ requestCoreThreadPoolSize = getIntParam(PARAMETER_REQUEST_CORE_THREAD_POOL_SIZE, 100);
requestMaxThreadPoolSize = getIntParam(PARAMETER_REQUEST_MAX_THREAD_POOL_SIZE, 150);
threadKeepAliveTime = getLongParam(PARAMETER_THREAD_KEEP_ALIVE_TIME, 180L);
threadKeepAliveTimeUnit =
@@ -266,6 +266,7 @@
.setBooleanParameter(HttpConnectionParams.TCP_NODELAY, requestTcpNoDelay)
.setIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, 4000)
.setIntParameter(HttpConnectionParams.MAX_HEADER_COUNT, 500)
+ .setIntParameter(HttpConnectionParams.SOCKET_BUFFER_SIZE, 8 * 1024)
.setParameter(HttpProtocolParams.ORIGIN_SERVER, originServer);
return params;
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/HttpServiceProcessor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/HttpServiceProcessor.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/HttpServiceProcessor.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/HttpServiceProcessor.java Wed Jun 27 09:45:37 2007
@@ -36,41 +36,62 @@
import org.apache.http.protocol.HttpContext;
import org.apache.http.protocol.HttpExecutionContext;
+import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean;
+import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicLong;
+
import java.io.IOException;
import java.net.SocketException;
import java.net.SocketTimeoutException;
/**
* I/O processor intended to process requests and fill in responses.
- *
+ *
* @author Chuck Williams
*/
public class HttpServiceProcessor implements IOProcessor {
private static final Log LOG = LogFactory.getLog(HttpServiceProcessor.class);
- private volatile boolean terminated;
+ /** Counter used to create unique IDs. */
+ private static AtomicLong counter = new AtomicLong(0L);
+
+ private AtomicBoolean terminated;
private final AxisHttpService httpservice;
+
private final AxisHttpConnection conn;
+
private final IOProcessorCallback callback;
- public HttpServiceProcessor(
- final AxisHttpService httpservice,
- final AxisHttpConnection conn,
- final IOProcessorCallback callback) {
+ /**
+ * Unique identifier used by {@linkplain #equals(Object)} and
+ * {@linkplain #hashCode()}.
+ * <p>
+ * This field is needed to allow the equals method to work properly when this
+ * HttpServiceProcessor has to be removed from the list of processors.
+ *
+ * @see DefaultHttpConnectionManager
+ */
+ private final long id;
+
+
+ public HttpServiceProcessor(final AxisHttpService httpservice,
+ final AxisHttpConnection conn, final IOProcessorCallback callback) {
super();
this.httpservice = httpservice;
this.conn = conn;
this.callback = callback;
- this.terminated = false;
+ this.terminated = new AtomicBoolean(false);
+
+ id = counter.incrementAndGet();
}
+
public void run() {
LOG.debug("New connection thread");
HttpContext context = new HttpExecutionContext(null);
try {
- while (!Thread.interrupted() && !isDestroyed() && this.conn.isOpen()) {
+ while (! Thread.interrupted() && ! isDestroyed() && this.conn.isOpen()) {
this.httpservice.handleRequest(this.conn, context);
}
} catch (ConnectionClosedException ex) {
@@ -89,30 +110,68 @@
}
} finally {
destroy();
- if (this.callback != null) {
- this.callback.completed(this);
+ if (this.callback == null) {
+ throw new NullPointerException("The callback object can't be null");
}
+ this.callback.completed(this);
}
}
+
public void close() throws IOException {
this.conn.close();
}
+
public void destroy() {
- if (this.terminated) {
- return;
- }
- this.terminated = true;
- try {
- this.conn.shutdown();
- } catch (IOException ex) {
- LOG.debug("I/O error shutting down connection");
+ if (this.terminated.compareAndSet(false, true)) {
+ try {
+// this.conn.shutdown();
+ close();
+ } catch (IOException ex) {
+ LOG.debug("I/O error shutting down connection");
+ }
}
}
+
public boolean isDestroyed() {
- return this.terminated;
+ return this.terminated.get();
+ }
+
+
+ // -------------------------------------------------- Methods from Object
+
+ /**
+ * Returns the unique ID of this HttpServiceProcessor.
+ *
+ * @return The unique ID of this HttpServiceProcessor.
+ */
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = 1;
+ result = PRIME * result + (int) (id ^ (id >>> 32));
+ return result;
+ }
+
+
+ /**
+ * Indicates whether some other object is "equal to" this one.
+ *
+ * @return <code>true</code> if this HttpServiceProcessor refere to the same
+ * object as obj or they have the same {@linkplain #id}, <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final HttpServiceProcessor other = (HttpServiceProcessor) obj;
+ if (id != other.id)
+ return false;
+ return true;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org