You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by pr...@apache.org on 2007/06/27 18:46:04 UTC
svn commit: r551228 [11/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/deployment/scheduler/Scheduler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/scheduler/Scheduler.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/scheduler/Scheduler.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/scheduler/Scheduler.java Wed Jun 27 09:45:37 2007
@@ -63,6 +63,10 @@
}
}
+ public void cleanup(){
+ timer.cancel();
+ }
+
public class SchedulerTimerTask extends TimerTask {
private DeploymentIterator iterator;
private SchedulerTask schedulerTask;
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java Wed Jun 27 09:45:37 2007
@@ -6,24 +6,12 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.deployment.DeploymentException;
import org.apache.axis2.deployment.DeploymentClassLoader;
+import org.apache.axis2.deployment.DeploymentException;
import org.apache.axis2.deployment.repository.util.ArchiveReader;
import org.apache.axis2.deployment.repository.util.DeploymentFileData;
-import org.apache.axis2.description.AxisMessage;
-import org.apache.axis2.description.AxisModule;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisOperationFactory;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisServiceGroup;
-import org.apache.axis2.description.Flow;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.java2wsdl.TypeTable;
-import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
-import org.apache.axis2.description.java2wsdl.AnnotationConstants;
-import org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator;
-import org.apache.axis2.description.java2wsdl.SchemaGenerator;
+import org.apache.axis2.description.*;
+import org.apache.axis2.description.java2wsdl.*;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.engine.Handler;
import org.apache.axis2.engine.MessageReceiver;
@@ -34,29 +22,15 @@
import org.apache.ws.commons.schema.utils.NamespaceMap;
import org.codehaus.jam.JAnnotation;
import org.codehaus.jam.JMethod;
-import org.codehaus.jam.JClass;
import javax.xml.namespace.QName;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
+import java.io.*;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.Stack;
-import java.util.StringTokenizer;
-import java.util.List;
+import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@@ -111,6 +85,10 @@
try {
handlerClass = Loader.loadClass(loader1, handlername);
+ if(handlerClass.getPackage().getName().equals("org.apache.axis2.engine")){
+ log.warn("Dispatcher " + handlerClass.getName() + " is now deprecated. Please edit axis2.xml " +
+ "and replace with the same class in org.apache.axis2.dispatchers package");
+ }
handler = (Handler) handlerClass.newInstance();
handler.init(desc);
desc.setHandler(handler);
@@ -128,15 +106,15 @@
InputStream in = url.openStream();
String fileName = url.getFile();
int index = fileName.lastIndexOf('/');
- if(index != -1) {
- fileName = fileName.substring(index+1);
+ if (index != -1) {
+ fileName = fileName.substring(index + 1);
}
File f = createTempFile(fileName, in, tmpDir);
in.close();
ZipInputStream zin;
FileInputStream fin = new FileInputStream(f);
- array.add(f.toURL());
- zin = new ZipInputStream(fin);
+ array.add(f.toURL());
+ zin = new ZipInputStream(fin);
ZipEntry entry;
String entryName;
@@ -167,14 +145,14 @@
byte data[] = new byte[2048];
int count;
File f;
- if(tmpDir == null) {
+ if (tmpDir == null) {
new File(System.getProperty("java.io.tmpdir"), "_axis2").mkdirs();
File tempFile = new File(System.getProperty("java.io.tmpdir"), "_axis2");
- f = File.createTempFile("axis2", suffix,tempFile);
+ f = File.createTempFile("axis2", suffix, tempFile);
} else {
f = File.createTempFile("axis2", suffix, tmpDir);
}
- if(log.isDebugEnabled()) {
+ if (log.isDebugEnabled()) {
log.info("Created temporary file : " + f.getAbsolutePath());
}
f.deleteOnExit();
@@ -196,7 +174,7 @@
* files inside the "lib/" or "Lib/" subdirectory of the passed directory.
*
* @param parent parent ClassLoader which will be the parent of the result of this method
- * @param file a File which must be a directory for this to be useful
+ * @param file a File which must be a directory for this to be useful
* @return a new ClassLoader pointing to both the passed dir and jar files under lib/
* @throws DeploymentException if problems occur
*/
@@ -261,10 +239,11 @@
/**
* This guy will create a AxisService using java reflection
- * @param axisService the target AxisService
- * @param axisConfig the in-scope AxisConfiguration
+ *
+ * @param axisService the target AxisService
+ * @param axisConfig the in-scope AxisConfiguration
* @param excludeOperations a List of Strings (or null), each containing a method to exclude
- * @param nonRpcMethods a List of Strings (or null), each containing a non-rpc method name
+ * @param nonRpcMethods a List of Strings (or null), each containing a non-rpc method name
* @throws Exception if a problem occurs
*/
public static void fillAxisService(AxisService axisService,
@@ -283,20 +262,20 @@
// other looks.
implInfoParam = axisService.getParameter(Constants.SERVICE_OBJECT_SUPPLIER);
if (implInfoParam != null) {
- String className = ((String)implInfoParam.getValue()).trim();
+ String className = ((String) implInfoParam.getValue()).trim();
Class serviceObjectMaker = Loader.loadClass(serviceClassLoader, className);
- if(serviceObjectMaker.getModifiers() != Modifier.PUBLIC){
- throw new AxisFault("Service class "+ className + " must have public as access Modifier");
+ if (serviceObjectMaker.getModifiers() != Modifier.PUBLIC) {
+ throw new AxisFault("Service class " + className + " must have public as access Modifier");
}
// Find static getServiceObject() method, call it if there
Method method = serviceObjectMaker.
getMethod("getServiceObject",
- new Class[]{AxisService.class});
+ new Class[]{AxisService.class});
Object obj = null;
if (method != null) {
obj = method.invoke(serviceObjectMaker.newInstance(),
- new Object[]{axisService});
+ new Object[]{axisService});
}
if (obj == null) {
log.warn("ServiceObjectSupplier implmentation Object could not be found");
@@ -315,10 +294,19 @@
map.put(Java2WSDLConstants.DEFAULT_SCHEMA_NAMESPACE_PREFIX,
Java2WSDLConstants.URI_2001_SCHEMA_XSD);
axisService.setNameSpacesMap(map);
- SchemaGenerator schemaGenerator = new DefaultSchemaGenerator(serviceClassLoader,
- serviceClass.trim(),
- axisService.getSchematargetNamespace(),
- axisService.getSchemaTargetNamespacePrefix());
+ SchemaGenerator schemaGenerator;
+ Parameter generateBare = axisService.getParameter(Java2WSDLConstants.DOC_LIT_BARE_PARAMETER);
+ if (generateBare != null && "true".equals(generateBare.getValue())) {
+ schemaGenerator = new DocLitBareSchemaGenerator(serviceClassLoader,
+ serviceClass.trim(),
+ axisService.getSchematargetNamespace(),
+ axisService.getSchemaTargetNamespacePrefix(), axisService);
+ } else {
+ schemaGenerator = new DefaultSchemaGenerator(serviceClassLoader,
+ serviceClass.trim(),
+ axisService.getSchematargetNamespace(),
+ axisService.getSchemaTargetNamespacePrefix(), axisService);
+ }
schemaGenerator.setExcludeMethods(excludeOperations);
schemaGenerator.setNonRpcMethods(nonRpcMethods);
if (!axisService.isElementFormDefault()) {
@@ -335,8 +323,7 @@
axisService.setTargetNamespace(schemaGenerator.getTargetNamespace());
}
- JMethod [] method = schemaGenerator.getMethods();
- TypeTable table = schemaGenerator.getTypeTable();
+ JMethod[] method = schemaGenerator.getMethods();
PhasesInfo pinfo = axisConfig.getPhasesInfo();
@@ -345,112 +332,42 @@
String opName = jmethod.getSimpleName();
AxisOperation operation = axisService.getOperation(new QName(opName));
// if the operation there in services.xml then try to set it schema element name
- if (operation != null) {
- AxisMessage inMessage = operation.getMessage(
- WSDLConstants.MESSAGE_LABEL_IN_VALUE);
- if (inMessage != null) {
- inMessage.setName(opName + Java2WSDLConstants.MESSAGE_SUFFIX);
- QName complexSchemaType = table.getComplexSchemaType(jmethod.getSimpleName());
- inMessage.setElementQName(complexSchemaType);
- if (complexSchemaType != null) {
- axisService.addMessageElementQNameToOperationMapping(complexSchemaType,
- operation);
- }
- }
- if (!jmethod.getReturnType().isVoidType()) {
- AxisMessage outMessage = operation.getMessage(
- WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
- QName qNamefortheType = table.getQNamefortheType(jmethod.getSimpleName() +
- Java2WSDLConstants.RESPONSE);
- outMessage.setElementQName(qNamefortheType);
- if (qNamefortheType != null) {
- axisService.addMessageElementQNameToOperationMapping(qNamefortheType,
- operation);
- }
- outMessage.setName(opName + Java2WSDLConstants.RESPONSE);
- }
- 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())){
- continue;
- }
- AxisMessage faultMessage = new AxisMessage();
- String exname = extype.getSimpleName() ;
- if(extypes.length>1){
- faultMessage.setName(jmethod.getSimpleName() + "Fault" + j);
- } else{
- faultMessage.setName(jmethod.getSimpleName() + "Fault");
- }
- faultMessage.setElementQName(
- table.getComplexSchemaType(exname + "Fault"));
- operation.setFaultMessages(faultMessage);
- }
-
- }
+ if (operation == null) {
+ operation = axisService.getOperation(new QName(jmethod.getSimpleName()));
+ }
+ MessageReceiver mr = axisService.getMessageReceiver(
+ operation.getMessageExchangePattern());
+ if (mr != null) {
} else {
- operation = getAxisOperationforJmethod(jmethod, table);
- MessageReceiver mr = axisService.getMessageReceiver(
- operation.getMessageExchangePattern());
- if (mr != null) {
- operation.setMessageReceiver(mr);
- } else {
- mr = axisConfig.getMessageReceiver(operation.getMessageExchangePattern());
- operation.setMessageReceiver(mr);
- }
- pinfo.setOperationPhases(operation);
- axisService.addOperation(operation);
+ mr = axisConfig.getMessageReceiver(operation.getMessageExchangePattern());
+ }
+ if (operation.getMessageReceiver() == null) {
+ operation.setMessageReceiver(mr);
}
+ pinfo.setOperationPhases(operation);
+ axisService.addOperation(operation);
if (operation.getInputAction() == null) {
operation.setSoapAction("urn:" + opName);
}
}
}
- public static AxisOperation getAxisOperationforJmethod(JMethod jmethod,
- TypeTable table) throws AxisFault {
+ public static AxisOperation getAxisOperationForJmethod(JMethod jmethod) throws AxisFault {
AxisOperation operation;
- String opName = jmethod.getSimpleName();
if (jmethod.getReturnType().isVoidType()) {
if (jmethod.getExceptionTypes().length > 0) {
- operation = AxisOperationFactory.getAxisOperation(WSDLConstants.MEP_CONSTANT_ROBUST_IN_ONLY);
+ operation = AxisOperationFactory.getAxisOperation(
+ WSDLConstants.MEP_CONSTANT_ROBUST_IN_ONLY);
} else {
- operation = AxisOperationFactory.getAxisOperation(WSDLConstants.MEP_CONSTANT_IN_ONLY);
+ operation = AxisOperationFactory.getAxisOperation(
+ WSDLConstants.MEP_CONSTANT_IN_ONLY);
}
} else {
- operation = AxisOperationFactory.getAxisOperation(WSDLConstants.MEP_CONSTANT_IN_OUT);
- AxisMessage outMessage = operation.getMessage(
- WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
- outMessage.setElementQName(table.getQNamefortheType(jmethod.getSimpleName() +
- Java2WSDLConstants.RESPONSE));
- outMessage.setName(opName + Java2WSDLConstants.RESPONSE);
- }
- 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())){
- continue;
- }
- AxisMessage faultMessage = new AxisMessage();
- String exname = extype.getSimpleName() ;
- if(extypes.length >1){
- faultMessage.setName(jmethod.getSimpleName() + "Fault" + j);
- } else {
- faultMessage.setName(jmethod.getSimpleName() + "Fault" );
- }
- faultMessage.setElementQName(
- table.getComplexSchemaType(exname + "Fault"));
- operation.setFaultMessages(faultMessage);
- }
+ operation = AxisOperationFactory.getAxisOperation(
+ WSDLConstants.MEP_CONSTANT_IN_OUT);
}
+ String opName = jmethod.getSimpleName();
operation.setName(new QName(opName));
- AxisMessage inMessage = operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
- if (inMessage != null) {
- inMessage.setElementQName(table.getComplexSchemaType(jmethod.getSimpleName()));
- inMessage.setName(opName + Java2WSDLConstants.MESSAGE_SUFFIX);
- }
JAnnotation methodAnnon = jmethod.getAnnotation(AnnotationConstants.WEB_METHOD);
if (methodAnnon != null) {
String action = methodAnnon.getValue(AnnotationConstants.ACTION).asString();
@@ -514,12 +431,12 @@
}
File inputFile = Utils.createTempFile(servicename,
fin,
- (File)axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
+ (File) axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
DeploymentFileData filedata = new DeploymentFileData(inputFile);
filedata.setClassLoader(false,
- moduleClassLoader,
- (File)axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
+ moduleClassLoader,
+ (File) axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
HashMap wsdlservice = archiveReader.processWSDLs(filedata);
if (wsdlservice != null && wsdlservice.size() > 0) {
Iterator servicesitr = wsdlservice.values().iterator();
@@ -571,15 +488,15 @@
while (st.hasMoreTokens()) {
String token = st.nextToken();
if ("..".equals(token)) {
- if (! clean.isEmpty() && ! "..".equals(clean.getLast())) {
+ if (!clean.isEmpty() && !"..".equals(clean.getLast())) {
clean.removeLast();
- if (! st.hasMoreTokens()) {
+ if (!st.hasMoreTokens()) {
isDir = true;
}
} else {
clean.add("..");
}
- } else if (! ".".equals(token) && ! "".equals(token)) {
+ } else if (!".".equals(token) && !"".equals(token)) {
clean.add(token);
}
}
@@ -603,7 +520,7 @@
Stack parentStack = new Stack();
Stack childStack = new Stack();
if (parent != null) {
- String [] values = parent.split("/");
+ String[] values = parent.split("/");
if (values.length > 0) {
for (int i = 0; i < values.length; i++) {
String value = values[i];
@@ -611,7 +528,7 @@
}
}
}
- String [] values = childPath.split("/");
+ String[] values = childPath.split("/");
if (values.length > 0) {
for (int i = 0; i < values.length; i++) {
String value = values[i];
@@ -673,7 +590,7 @@
* To add the exclude method when generating scheams , here the exclude methods
* will be session releated axis2 methods
*/
- public static void addExcludeMethods(ArrayList excludeList){
+ public static void addExcludeMethods(ArrayList excludeList) {
excludeList.add("init");
excludeList.add("setOperationContext");
excludeList.add("startUp");
@@ -683,7 +600,7 @@
public static ClassLoader createClassLoader(URL[] urls, ClassLoader serviceClassLoader,
boolean extractJars, File tmpDir) {
- if(extractJars) {
+ if (extractJars) {
URL[] urls1 = Utils.getURLsForAllJars(urls[0], tmpDir);
return new DeploymentClassLoader(urls1, null, serviceClassLoader);
} else {
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisDescription.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisDescription.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisDescription.java Wed Jun 27 09:45:37 2007
@@ -18,6 +18,8 @@
import org.apache.axiom.om.OMElement;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.util.Utils;
+import org.apache.axis2.util.JavaUtils;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.i18n.Messages;
import org.apache.axis2.modules.Module;
@@ -31,6 +33,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Collection;
+import java.util.Map;
public abstract class AxisDescription implements ParameterInclude,
DescriptionConstants {
@@ -43,6 +46,8 @@
private HashMap children;
+ protected Map engagedModules;
+
// Holds the documentation details for each element
private String documentation;
@@ -101,6 +106,14 @@
return param.getValue();
}
+ public boolean isParameterTrue(String name) {
+ Parameter param = getParameter(name);
+ if (param == null) {
+ return false;
+ }
+ return JavaUtils.isTrue(param.getValue());
+ }
+
public ArrayList getParameters() {
return parameterInclude.getParameters();
}
@@ -397,12 +410,74 @@
* Engage a Module at this level
*
* @param axisModule the Module to engage
+ * @throws AxisFault if there's a problem engaging
*/
- public abstract void engageModule(AxisModule axisModule) throws AxisFault;
+ public void engageModule(AxisModule axisModule) throws AxisFault {
+ engageModule(axisModule, this);
+ }
- public abstract boolean isEngaged(String moduleName);
+ /**
+ * Engage a Module at this level, keeping track of which level the engage was originally
+ * called from. This is meant for internal use only.
+ *
+ * @param axisModule module to engage
+ * @param source the AxisDescription which originally called engageModule()
+ * @throws AxisFault if there's a problem engaging
+ */
+ public void engageModule(AxisModule axisModule, AxisDescription source) throws AxisFault {
+ if (engagedModules == null) engagedModules = new HashMap();
+ String moduleName = axisModule.getName();
+ for (Iterator iterator = engagedModules.values().iterator(); iterator.hasNext();) {
+ String existing = ((AxisModule)iterator.next()).getName();
+ if (!Utils.checkVersion(moduleName, existing)) {
+ throw new AxisFault(Messages.getMessage("mismatchedModuleVersions",
+ getClass().getName(),
+ moduleName,
+ existing));
+ }
+ }
+
+ // If we have anything specific to do, let that happen
+ onEngage(axisModule, source);
+
+ engagedModules.put(axisModule.getName(), axisModule);
+ }
-// public Collection getEngagedModules() { return null; }
+ protected void onEngage(AxisModule module, AxisDescription engager) throws AxisFault {
+ // Default version does nothing, feel free to override
+ }
+
+ static Collection NULL_MODULES = new ArrayList(0);
+ public Collection getEngagedModules() {
+ return engagedModules == null ? NULL_MODULES : engagedModules.values();
+ }
+
+ /**
+ * Check if a given module is engaged at this level.
+ *
+ * @param moduleName module to investigate.
+ * @return true if engaged, false if not.
+ * TODO: Handle versions? isEngaged("addressing") should be true even for versioned modulename...
+ */
+ public boolean isEngaged(String moduleName) {
+ if (engagedModules != null) {
+ return engagedModules.keySet().contains(moduleName);
+ }
+ return false;
+ }
+
+ public void disengageModule(AxisModule module) throws AxisFault {
+ if ((module == null) || (engagedModules == null)) return;
+ String moduleName = module.getName();
+ if (isEngaged(moduleName)) {
+ onDisengage(module);
+ engagedModules.remove(module.getName());
+ }
+ }
+
+ protected void onDisengage(AxisModule module) throws AxisFault {
+ // Base version does nothing
+ }
private Policy getApplicablePolicy(AxisDescription axisDescription) {
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisEndpoint.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisEndpoint.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisEndpoint.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisEndpoint.java Wed Jun 27 09:45:37 2007
@@ -110,7 +110,6 @@
public boolean isEngaged(String moduleName) {
throw new UnsupportedOperationException("axisMessage.isEngaged() is not supported");
-
}
public OMElement toWSDL20(OMNamespace wsdl, OMNamespace tns, OMNamespace whttp, String epr) {
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisMessage.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisMessage.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisMessage.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisMessage.java Wed Jun 27 09:45:37 2007
@@ -18,11 +18,14 @@
package org.apache.axis2.description;
import org.apache.axis2.AxisFault;
-import org.apache.axis2.modules.Module;
+import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
import org.apache.axis2.phaseresolver.PhaseResolver;
-import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.wsdl.SOAPHeaderMessage;
-import org.apache.ws.commons.schema.*;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaImport;
+import org.apache.ws.commons.schema.XmlSchemaInclude;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
import javax.xml.namespace.QName;
import java.util.ArrayList;
@@ -48,15 +51,10 @@
// To store deploy-time module refs
private ArrayList modulerefs;
-
- /**
- * list of engaged modules
- */
- private ArrayList engagedModules = new ArrayList();
+ private String partName = Java2WSDLConstants.PARAMETERS;
// private PolicyInclude policyInclude;
-
public String getMessagePartName() {
return messagePartName;
}
@@ -139,7 +137,7 @@
XmlSchemaObjectCollection includes = schema.getIncludes();
if (includes != null) {
Iterator includesIter = includes.getIterator();
- Object object = null;
+ Object object;
while (includesIter.hasNext()) {
object = includesIter.next();
if (object instanceof XmlSchemaImport) {
@@ -188,46 +186,15 @@
}
/**
- *
* We do not support adding module operations when engaging a module to an AxisMessage
+ *
* @param axisModule AxisModule to engage
+ * @param engager
* @throws AxisFault something went wrong
*/
- public void engageModule(AxisModule axisModule) throws AxisFault {
- if (axisModule == null) {
- return;
- }
- Iterator module_itr = engagedModules.iterator();
- boolean isEngagable;
- String moduleName = axisModule.getName();
- while (module_itr.hasNext()) {
- AxisModule module = (AxisModule) module_itr.next();
- String modu = module.getName();
- isEngagable = org.apache.axis2.util.Utils.checkVersion(moduleName, modu);
- if (!isEngagable) {
- return ;
- }
- }
-
- Module module = axisModule.getModule();
- if (module != null) {
- module.engageNotify(this);
- }
- AxisConfiguration axisConfig = getAxisConfiguration();
- PhaseResolver phaseResolver = new PhaseResolver(axisConfig);
+ public void onEngage(AxisModule axisModule, AxisDescription engager) throws AxisFault {
+ PhaseResolver phaseResolver = new PhaseResolver(getAxisConfiguration());
phaseResolver.engageModuleToMessage(this, axisModule);
- engagedModules.add(axisModule);
- }
-
- public boolean isEngaged(String moduleName) {
- Iterator engagedModuleItr = engagedModules.iterator();
- while (engagedModuleItr.hasNext()) {
- AxisModule axisModule = (AxisModule) engagedModuleItr.next();
- if (axisModule.getName().equals(moduleName)) {
- return true;
- }
- }
- return false;
}
public ArrayList getModulerefs() {
@@ -240,5 +207,14 @@
public AxisOperation getAxisOperation(){
return (AxisOperation) getParent();
+ }
+
+
+ public String getPartName() {
+ return partName;
+ }
+
+ public void setPartName(String partName) {
+ this.partName = partName;
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisOperation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisOperation.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisOperation.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisOperation.java Wed Jun 27 09:45:37 2007
@@ -17,14 +17,7 @@
package org.apache.axis2.description;
import org.apache.axiom.om.util.UUIDGenerator;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axis2.AxisFault;
-import org.apache.axis2.deployment.DeploymentConstants;
-import org.apache.axis2.util.WSDLSerializationUtil;
-import org.apache.axis2.util.JavaUtils;
import org.apache.axis2.client.OperationClient;
import org.apache.axis2.client.Options;
import org.apache.axis2.context.ConfigurationContext;
@@ -43,12 +36,9 @@
import javax.xml.namespace.QName;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
-import java.util.Map;
-import java.net.URI;
public abstract class AxisOperation extends AxisDescription
implements WSDLConstants {
@@ -63,17 +53,26 @@
*/
private int mep = WSDLConstants.MEP_CONSTANT_INVALID;
- /**
- * list of engaged modules
- */
- private ArrayList engagedModules = new ArrayList();
-
// to hide control operation , operation which added by RM like module
private boolean controlOperation = false;
private String style = STYLE_DOC;
// to store mepURL
private String mepURI;
+ // List of Header QNames that have been registered as understood, for example by message receivers.
+ // This list DOES NOT contain QNames for headers understood by handlers (e.g. security or sandesha)
+ // This list is used in the Axis2 Engine checkMustUnderstand processing to identify headers
+ // marked as mustUnderstand which have not yet been processed (via dispatch handlers),
+ // but which will be processed by the message receiver.
+ // REVIEW: (1) This only supports a single list of understood headers; should there be
+ // different lists for INPUT messages and OUTPUT messages?
+ // (2) This probably needs to support SOAP actors/roles
+ // (3) Strictly speaking, per the SOAP spec, all mustUnderstand checks should be performed
+ // before processing begins on the message. So, ideally, even the QoSes should register
+ // the headers (and roles) they understand and the mustUnderstand checks should be done before
+ // they are invoked. There are issues with that, however, in terms of targeting the operation, and
+ // the possible encryption of headers.
+ private ArrayList understoodHeaderQNames = new ArrayList();
private MessageReceiver messageReceiver;
@@ -146,136 +145,71 @@
}
/**
- * Engages a module. It is required to use this method.
+ * This is called when a module is engaged on this operation. Handle operation-specific
+ * tasks.
*
- * @param moduleref
+ * @param axisModule AxisModule
+ * @param engager
* @throws AxisFault
*/
- public final void engageModule(AxisModule moduleref)
- throws AxisFault {
- ArrayList moduleOperations = engageModuleToOperation(moduleref);
- AxisService service = (AxisService) getParent();
- if (service != null) {
- for (int i = 0; i < moduleOperations.size(); i++) {
- AxisOperation axisOperation = (AxisOperation) moduleOperations.get(i);
- service.addOperation(axisOperation);
+ public final void onEngage(AxisModule axisModule, AxisDescription engager) throws AxisFault {
+ // Am I the source of this engagement?
+ boolean selfEngaged = (engager == this);
+
+ // If I'm not, the operations will already have been added by someone above, so don't
+ // do it again.
+ if (selfEngaged) {
+ AxisService service = (AxisService)getParent();
+ if (service != null) {
+ service.addModuleOperations(axisModule);
}
}
- }
- private ArrayList engageModuleToOperation(AxisModule moduleref)
- throws AxisFault {
- if (moduleref == null) {
- return null;
- }
- Iterator module_itr = engagedModules.iterator();
- boolean isEngagable;
- String moduleName = moduleref.getName();
- while (module_itr.hasNext()) {
- AxisModule module = (AxisModule) module_itr.next();
- String modu = module.getName();
- isEngagable = org.apache.axis2.util.Utils.checkVersion(moduleName, modu);
- if (!isEngagable) {
- return new ArrayList();
- }
- }
AxisConfiguration axisConfig = getAxisConfiguration();
PhaseResolver phaseResolver = new PhaseResolver(axisConfig);
- phaseResolver.engageModuleToOperation(this, moduleref);
- Module module = moduleref.getModule();
+ phaseResolver.engageModuleToOperation(this, axisModule);
+ Module module = axisModule.getModule();
if (module != null) {
module.engageNotify(this);
}
- engagedModules.add(moduleref);
- return addModuleOperations(moduleref, axisConfig, (AxisService) getParent());
}
- public void disengageModule(AxisModule module) {
- if (module != null) {
- if (getParent() != null) {
- AxisService service = (AxisService) getParent();
- AxisConfiguration axiConfiguration = service.getAxisConfiguration();
- PhaseResolver phaseResolver = new PhaseResolver(axiConfiguration);
- if (service.isEngaged(module.getName())) {
- phaseResolver.disengageModuleFromOperationChain(module, this);
- } else if (axiConfiguration != null &&
- axiConfiguration.isEngaged(module.getName())) {
- phaseResolver.disengageModuleFromOperationChain(module, this);
- } else {
- if (axiConfiguration != null) {
- phaseResolver.disengageModuleFromGlobalChains(module);
- }
- phaseResolver.disengageModuleFromOperationChain(module, this);
- //removing operations added at the time of module engagemnt
- HashMap moduleOperations = module.getOperations();
- if (moduleOperations != null) {
- Iterator moduleOperations_itr = moduleOperations.values().iterator();
- while (moduleOperations_itr.hasNext()) {
- AxisOperation operation = (AxisOperation) moduleOperations_itr.next();
- service.removeOperation(operation.getName());
- }
- }
+ protected void onDisengage(AxisModule module) {
+ if (getParent() != null) {
+ AxisService service = (AxisService) getParent();
+ AxisConfiguration axisConfiguration = service.getAxisConfiguration();
+ PhaseResolver phaseResolver = new PhaseResolver(axisConfiguration);
+ if (!service.isEngaged(module.getName()) &&
+ (axisConfiguration != null && !axisConfiguration.isEngaged(module.getName()))) {
+ phaseResolver.disengageModuleFromGlobalChains(module);
+ }
+ phaseResolver.disengageModuleFromOperationChain(module, this);
+
+ //removing operations added at the time of module engagemnt
+ HashMap moduleOperations = module.getOperations();
+ if (moduleOperations != null) {
+ Iterator moduleOperations_itr = moduleOperations.values().iterator();
+ while (moduleOperations_itr.hasNext()) {
+ AxisOperation operation = (AxisOperation) moduleOperations_itr.next();
+ service.removeOperation(operation.getName());
}
}
- engagedModules.remove(module);
- log.debug("removed module from engaged modules list " + module.getName());
}
}
/**
* To remove module from engage module list
*
- * @param module
+ * @param module module to remove
+ * @deprecated please use disengageModule(), this method will disappear after 1.3
*/
public void removeFromEngagedModuleList(AxisModule module) {
- engagedModules.remove(module);
- log.debug("removed module from engaged modules list " + module.getName());
- }
-
-
- /**
- * Adds an operation to a service if a module is required to do so.
- *
- * @param module
- */
- public ArrayList addModuleOperations(AxisModule module, AxisConfiguration axisConfig,
- AxisService service)
- throws AxisFault {
- HashMap map = module.getOperations();
- Collection col = map.values();
- PhaseResolver phaseResolver = new PhaseResolver(axisConfig);
- //this array list is return , to avoid concurrent modifications , in the deployment engine
- ArrayList ops = new ArrayList();
- for (Iterator iterator = col.iterator(); iterator.hasNext();) {
- AxisOperation axisOperation = copyOperation((AxisOperation) iterator.next());
- axisOperation.setParent(service);
- ArrayList wsamappings = axisOperation.getWsamappingList();
- if (service.getOperation(axisOperation.getName()) == null) {
- // this operation is a control operation.
- Parameter expose = axisOperation.getParameter(DeploymentConstants.TAG_EXPOSE);
- if(expose!=null){
- if(JavaUtils.isTrue(expose.getValue(), false)){
- axisOperation.setControlOperation(true);
- }
- } else {
- axisOperation.setControlOperation(true);
- }
- Module moduleclazz = module.getModule();
- if (moduleclazz != null) {
- moduleclazz.engageNotify(axisOperation);
- }
- phaseResolver.engageModuleToOperation(axisOperation, module);
- ops.add(axisOperation);
- if (wsamappings != null) {
- for (int j = 0; j < wsamappings.size(); j++) {
- String mapping = (String) wsamappings.get(j);
-
- service.mapActionToOperation(mapping, axisOperation);
- }
- }
- }
+ try {
+ disengageModule(module);
+ } catch (AxisFault axisFault) {
+ // Can't do much here...
+ log.error(axisFault);
}
- return ops;
}
/**
@@ -301,7 +235,7 @@
operation.addParameter(parameter);
}
- operation.setWsamappingList(axisOperation.getWsamappingList());
+ operation.setWsamappingList(axisOperation.getWSAMappingList());
operation.setOutputAction(axisOperation.getOutputAction());
String[] faultActionNames = axisOperation.getFaultActionNames();
for (int i = 0; i < faultActionNames.length; i++) {
@@ -467,13 +401,6 @@
* @see org.apache.axis2.description.AxisService#getEngadgedModules()
*/
- /**
- * Method getEngagedModules.
- */
- public Collection getEngagedModules() {
- return engagedModules;
- }
-
public abstract AxisMessage getMessage(String label);
public String getMessageExchangePattern() {
@@ -508,7 +435,7 @@
return style;
}
- public ArrayList getWsamappingList() {
+ public ArrayList getWSAMappingList() {
return wsamappingList;
}
@@ -632,17 +559,6 @@
}
return result;
}
-
- public boolean isEngaged(String moduleName) {
- Iterator engagedModuleItr = engagedModules.iterator();
- while (engagedModuleItr.hasNext()) {
- AxisModule axisModule = (AxisModule) engagedModuleItr.next();
- if (axisModule.getName().equals(moduleName)) {
- return true;
- }
- }
- return false;
- }
/**
* All childerns of a AxisOperation must be Messages. So we just return it.
@@ -653,4 +569,29 @@
return getChildren();
}
+ /**
+ * Return the list of SOAP header QNames that have been registered as understood by
+ * message receivers, for example. Note that this list DOES NOT contain the QNames that are
+ * understood by handlers run prior to the message receiver. This is used in the Axis2
+ * Engine checkMustUnderstand processing to identify headers marked as mustUnderstand which
+ * have not yet been processed (via dispatch handlers), but which will be processed by
+ * the message receiver.
+ *
+ * @return ArrayList of handler QNAames registered as understood by the message receiver.
+ */
+ public ArrayList getUnderstoodHeaderQNames() {
+ return understoodHeaderQNames;
+ }
+
+ /**
+ * Add a SOAP header QName to the list of headers understood by this operation. This is used
+ * by other (non dispatch handler) components such as a message receiver to register that it
+ * will process a header.
+ * @param understoodHeader
+ */
+ public void registerUnderstoodHeaderQName(QName understoodHeader) {
+ if (understoodHeader != null) {
+ understoodHeaderQNames.add(understoodHeader);
+ }
+ }
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService.java Wed Jun 27 09:45:37 2007
@@ -20,10 +20,7 @@
import org.apache.axiom.om.OMElement;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
-import org.apache.axis2.description.java2wsdl.TypeTable;
-import org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator;
-import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
-import org.apache.axis2.description.java2wsdl.SchemaGenerator;
+import org.apache.axis2.description.java2wsdl.*;
import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
@@ -51,7 +48,6 @@
import org.apache.axis2.transport.http.server.HttpUtils;
import org.apache.axis2.util.Loader;
import org.apache.axis2.util.XMLUtils;
-import org.apache.axis2.util.JavaUtils;
import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -114,7 +110,9 @@
// Maps httpLocations to corresponding operations. Used to dispatch rest messages.
private HashMap httpLocationDispatcherMap = null;
+ /** Map from String(action URI) -> AxisOperation */
private HashMap operationsAliasesMap = null;
+
// Collection of aliases that are invalid for this service because they are duplicated across
// multiple operations under this service.
private List invalidOperationsAliases = null;
@@ -123,9 +121,6 @@
// to store module ref at deploy time parsing
private ArrayList moduleRefs = null;
- // to store engaged modules
- private ArrayList engagedModules = null;
-
// to store the wsdl definition , which is build at the deployment time
// to keep the time that last update time of the service
private long lastupdate;
@@ -308,7 +303,6 @@
httpLocationDispatcherMap = new HashMap();
messageReceivers = new HashMap();
moduleRefs = new ArrayList();
- engagedModules = new ArrayList();
schemaList = new ArrayList();
serviceClassLoader = (ClassLoader) org.apache.axis2.java.security.AccessController
.doPrivileged(new PrivilegedAction() {
@@ -468,32 +462,36 @@
}
/**
- * Adds an operation to a service if a module is required to do so.
+ * Add any control operations defined by a Module to this service.
*
- * @param module
+ * @param module the AxisModule which has just been engaged
+ * @throws AxisFault if a problem occurs
*/
- public void addModuleOperations(AxisModule module) throws AxisFault {
+ void addModuleOperations(AxisModule module) throws AxisFault {
HashMap map = module.getOperations();
Collection col = map.values();
+ PhaseResolver phaseResolver = new PhaseResolver(getAxisConfiguration());
for (Iterator iterator = col.iterator(); iterator.hasNext();) {
AxisOperation axisOperation = copyOperation((AxisOperation) iterator.next());
if (this.getOperation(axisOperation.getName()) == null) {
- ArrayList wsamappings = axisOperation.getWsamappingList();
+ ArrayList wsamappings = axisOperation.getWSAMappingList();
if (wsamappings != null) {
for (int j = 0, size = wsamappings.size(); j < size; j++) {
String mapping = (String) wsamappings.get(j);
mapActionToOperation(mapping, axisOperation);
}
}
- // this operation is a control operation.
- Parameter expose = axisOperation.getParameter(DeploymentConstants.TAG_EXPOSE);
- if(expose!=null){
- if(JavaUtils.isTrue(expose.getValue(), false)){
- axisOperation.setControlOperation(true);
- }
+ // If we've set the "expose" parameter for this operation, it's normal (non-
+ // control) and therefore it will appear in generated WSDL. If we haven't,
+ // it's a control operation and will be ignored at WSDL-gen time.
+ if (axisOperation.isParameterTrue(DeploymentConstants.TAG_EXPOSE)) {
+ axisOperation.setControlOperation(false);
} else {
axisOperation.setControlOperation(true);
}
+
+ phaseResolver.engageModuleToOperation(axisOperation, module);
+
this.addOperation(axisOperation);
}
}
@@ -521,8 +519,6 @@
while (modules.hasNext()) {
AxisModule module = (AxisModule) modules.next();
- AxisServiceGroup parent = (AxisServiceGroup) getParent();
-
try {
Module moduleImpl = module.getModule();
if (moduleImpl != null) {
@@ -568,7 +564,7 @@
mapActionToOperation(action, axisOperation);
}
- ArrayList wsamappings = axisOperation.getWsamappingList();
+ ArrayList wsamappings = axisOperation.getWSAMappingList();
if (wsamappings != null) {
for (int j = 0, size = wsamappings.size(); j < size; j++) {
String mapping = (String) wsamappings.get(j);
@@ -636,7 +632,7 @@
}
operation.setPolicyInclude(policyInclude);
- operation.setWsamappingList(axisOperation.getWsamappingList());
+ operation.setWsamappingList(axisOperation.getWSAMappingList());
operation.setRemainingPhasesInFlow(axisOperation.getRemainingPhasesInFlow());
operation.setPhasesInFaultFlow(axisOperation.getPhasesInFaultFlow());
operation.setPhasesOutFaultFlow(axisOperation.getPhasesOutFaultFlow());
@@ -662,39 +658,18 @@
* Engages a module. It is required to use this method.
*
* @param axisModule
+ * @param engager
*/
- public void engageModule(AxisModule axisModule)
+ public void onEngage(AxisModule axisModule, AxisDescription engager)
throws AxisFault {
- if (axisModule == null) {
- throw new AxisFault(Messages.getMessage("modulenf"));
- }
- Iterator itr_engageModules = engagedModules.iterator();
- boolean isEngagable;
- String moduleName = axisModule.getName();
- while (itr_engageModules.hasNext()) {
- AxisModule module = (AxisModule) itr_engageModules.next();
- String modu = module.getName();
- isEngagable = org.apache.axis2.util.Utils.checkVersion(moduleName, modu);
- if (!isEngagable) {
- return;
- }
- }
-
- Module moduleImpl = axisModule.getModule();
- if (moduleImpl != null) {
- // notyfying module for service engagement
- moduleImpl.engageNotify(this);
- }
// adding module operations
addModuleOperations(axisModule);
Iterator operations = getOperations();
-
while (operations.hasNext()) {
AxisOperation axisOperation = (AxisOperation) operations.next();
- axisOperation.engageModule(axisModule);
+ axisOperation.engageModule(axisModule, engager);
}
- engagedModules.add(axisModule);
}
/**
@@ -824,13 +799,6 @@
return schema;
}
- public AxisConfiguration getAxisConfiguration() {
- if (getParent() != null) {
- return (AxisConfiguration) getParent().getParent();
- }
- return null;
- }
-
public void setEPRs(String[] eprs) {
this.eprs = eprs;
}
@@ -1070,15 +1038,6 @@
return operationList;
}
- /**
- * Method getEngagedModules.
- *
- * @return Returns Collection.
- */
- public Collection getEngagedModules() {
- return engagedModules;
- }
-
public URL getFileName() {
return fileName;
}
@@ -1375,36 +1334,24 @@
return exposedTransports.contains(transport);
}
- public void disengageModule(AxisModule module) {
- AxisConfiguration axisConfig = getAxisConfiguration();
- if (axisConfig != null) {
- PhaseResolver phaseResolver = new PhaseResolver(axisConfig);
- if (axisConfig.isEngaged(module.getName())) {
- removeModuleOperations(module);
- Iterator operations = getChildren();
- while (operations.hasNext()) {
- AxisOperation axisOperation = (AxisOperation) operations.next();
- phaseResolver.disengageModuleFromOperationChain(module, axisOperation);
- axisOperation.removeFromEngagedModuleList(module);
- }
- } else {
- if (isEngaged(module.getName())) {
- phaseResolver.disengageModuleFromGlobalChains(module);
- removeModuleOperations(module);
- Iterator operations = getChildren();
- while (operations.hasNext()) {
- AxisOperation axisOperation = (AxisOperation) operations.next();
- phaseResolver.disengageModuleFromOperationChain(module, axisOperation);
- axisOperation.removeFromEngagedModuleList(module);
- }
- }
- }
+ public void onDisengage(AxisModule module) throws AxisFault {
+ Iterator operations = getChildren();
+ while (operations.hasNext()) {
+ AxisOperation axisOperation = (AxisOperation) operations.next();
+ axisOperation.disengageModule(module);
+ }
+ removeModuleOperations(module);
+ AxisConfiguration config = getAxisConfiguration();
+ if (!config.isEngaged(module.getName())) {
+ PhaseResolver phaseResolver = new PhaseResolver(config);
+ phaseResolver.disengageModuleFromGlobalChains(module);
}
- engagedModules.remove(module);
}
/**
- * To remove module operations added at the time of engagement
+ * Remove any operations which were added by a given module.
+ *
+ * @param module the module in question
*/
private void removeModuleOperations(AxisModule module) {
HashMap moduleOerations = module.getOperations();
@@ -1417,21 +1364,6 @@
}
}
- public boolean isEngaged(String moduleName) {
- AxisModule module = getAxisConfiguration().getModule(moduleName);
- if (module == null) {
- return false;
- }
- Iterator engagedModuleItr = engagedModules.iterator();
- while (engagedModuleItr.hasNext()) {
- AxisModule axisModule = (AxisModule) engagedModuleItr.next();
- if (axisModule.getName().equals(module.getName())) {
- return true;
- }
- }
- return false;
- }
-
//#######################################################################################
// APIs to create AxisService
@@ -1463,16 +1395,16 @@
return createClientSideAxisService(wsdlDefinition, wsdlServiceName, portName, options);
} catch (IOException e) {
log.error(e);
- throw new AxisFault("IOException : " + e.getMessage());
+ throw AxisFault.makeFault(e);
} catch (ParserConfigurationException e) {
log.error(e);
- throw new AxisFault("ParserConfigurationException : " + e.getMessage());
+ throw AxisFault.makeFault(e);
} catch (SAXException e) {
log.error(e);
- throw new AxisFault("SAXException : " + e.getMessage());
+ throw AxisFault.makeFault(e);
} catch (WSDLException e) {
log.error(e);
- throw new AxisFault("WSDLException : " + e.getMessage());
+ throw AxisFault.makeFault(e);
}
}
@@ -1528,11 +1460,15 @@
WSDL2Constants.MEP_URI_IN_OUT,
inOutmessageReceiver);
- return createService(implClass,axisConfig,messageReciverMap,null,null);
+ return createService(implClass,
+ axisConfig,
+ messageReciverMap,
+ null,
+ null,
+ axisConfig.getSystemClassLoader());
} catch (Exception e) {
- log.error(e);
+ throw AxisFault.makeFault(e);
}
- return null;
}
/**
@@ -1568,11 +1504,20 @@
SchemaGenerator schemaGenerator;
ArrayList excludeOpeartion = new ArrayList();
+ AxisService service = new AxisService();
+ service.setName(serviceName);
try {
- schemaGenerator = new DefaultSchemaGenerator(loader,
- implClass, schemaNamespace,
- Java2WSDLConstants.SCHEMA_NAMESPACE_PRFIX);
+ Parameter generateBare = service.getParameter(Java2WSDLConstants.DOC_LIT_BARE_PARAMETER);
+ if (generateBare!=null && "true".equals(generateBare.getValue())) {
+ schemaGenerator = new DocLitBareSchemaGenerator(loader,
+ implClass, schemaNamespace,
+ Java2WSDLConstants.SCHEMA_NAMESPACE_PRFIX,service);
+ } else {
+ schemaGenerator = new DefaultSchemaGenerator(loader,
+ implClass, schemaNamespace,
+ Java2WSDLConstants.SCHEMA_NAMESPACE_PRFIX,service);
+ }
schemaGenerator.setElementFormDefault(Java2WSDLConstants.FORM_DEFAULT_UNQUALIFIED);
Utils.addExcludeMethods(excludeOpeartion);
schemaGenerator.setExcludeMethods(excludeOpeartion);
@@ -1586,7 +1531,7 @@
messageReceiverClassMap,
targetNamespace,
loader,
- schemaGenerator);
+ schemaGenerator,service);
}
/**
* messageReceiverClassMap will hold the MessageReceivers for given meps. Key will be the
@@ -1610,11 +1555,11 @@
Map messageReceiverClassMap,
String targetNamespace,
ClassLoader loader,
- SchemaGenerator schemaGenerator) throws AxisFault {
+ SchemaGenerator schemaGenerator,
+ AxisService axisService) throws AxisFault {
Parameter parameter = new Parameter(Constants.SERVICE_CLASS, implClass);
OMElement paraElement = Utils.getParameter(Constants.SERVICE_CLASS, implClass, false);
parameter.setParameterElement(paraElement);
- AxisService axisService = new AxisService();
axisService.setUseDefaultChains(false);
axisService.addParameter(parameter);
axisService.setName(serviceName);
@@ -1640,15 +1585,11 @@
if (targetNamespace != null && !"".equals(targetNamespace)) {
axisService.setTargetNamespace(targetNamespace);
}
-
JMethod[] method = schemaGenerator.getMethods();
- TypeTable table = schemaGenerator.getTypeTable();
-
PhasesInfo pinfo = axisConfiguration.getPhasesInfo();
-
for (int i = 0; i < method.length; i++) {
JMethod jmethod = method[i];
- AxisOperation operation = Utils.getAxisOperationforJmethod(jmethod, table);
+ AxisOperation operation =axisService.getOperation(new QName(jmethod.getSimpleName()));
String mep = operation.getMessageExchangePattern();
MessageReceiver mr;
if (messageReceiverClassMap != null) {
@@ -1685,27 +1626,11 @@
}
-
- public static AxisService createService(String implClass,
- AxisConfiguration axisConfiguration,
- Map messageReceiverClassMap,
- String targetNamespace,
- String schemaNamespace) throws AxisFault {
- return createService(implClass,
- axisConfiguration,
- messageReceiverClassMap,
- targetNamespace,
- schemaNamespace,
- axisConfiguration.getServiceClassLoader());
-
-
- }
-
public void removeOperation(QName opName) {
AxisOperation operation = getOperation(opName);
if (operation != null) {
removeChild(opName);
- ArrayList mappingList = operation.getWsamappingList();
+ ArrayList mappingList = operation.getWSAMappingList();
if (mappingList != null) {
for (int i = 0; i < mappingList.size(); i++) {
String actionMapping = (String) mappingList.get(i);
@@ -2264,5 +2189,9 @@
public void setOperationsNameList(List operationsNameList) {
this.operationsNameList = operationsNameList;
+ }
+
+ public AxisServiceGroup getAxisServiceGroup() {
+ return (AxisServiceGroup)getParent();
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java Wed Jun 27 09:45:37 2007
@@ -279,7 +279,7 @@
if(axismessage.getMessagePartName() != null) {
messagePart.addAttribute(ATTRIBUTE_NAME, axismessage.getMessagePartName(), null);
} else {
- messagePart.addAttribute(ATTRIBUTE_NAME, "parameters", null);
+ messagePart.addAttribute(ATTRIBUTE_NAME, axismessage.getPartName(), null);
}
messagePart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
WSDLSerializationUtil.getPrefix(schemaElementName.getNamespaceURI(), axisService.getNameSpacesMap()) + ":"
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisServiceGroup.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisServiceGroup.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisServiceGroup.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisServiceGroup.java Wed Jun 27 09:45:37 2007
@@ -22,7 +22,6 @@
import org.apache.axis2.engine.AxisEvent;
import org.apache.axis2.i18n.Messages;
import org.apache.axis2.modules.Module;
-import org.apache.axis2.util.Utils;
import java.util.ArrayList;
import java.util.HashMap;
@@ -35,9 +34,6 @@
// to store module ref at deploy time parsing
private ArrayList modulesList = new ArrayList();
- // to store service Group engagedModules name
- private ArrayList engagedModules;
-
// to store modeule configuration info
private HashMap moduleConfigmap;
@@ -49,7 +45,6 @@
public AxisServiceGroup() {
moduleConfigmap = new HashMap();
- engagedModules = new ArrayList();
}
public AxisServiceGroup(AxisConfiguration axisDescription) {
@@ -89,94 +84,65 @@
AxisConfiguration axisConfig = (AxisConfiguration) getParent();
if (axisConfig != null) {
- Iterator modules = this.engagedModules.iterator();
-
- while (modules.hasNext()) {
- String moduleName = (String) modules.next();
- AxisModule axisModule = axisConfig.getModule(moduleName);
-
- if (axisModule != null) {
- Module moduleImpl = axisModule.getModule();
- if (moduleImpl != null) {
- // notyfying module for service engagement
- moduleImpl.engageNotify(service);
+ for (Iterator iterator = getEngagedModules().iterator(); iterator.hasNext();) {
+ Object o = iterator.next();
+ AxisModule axisModule;
+ if (o instanceof AxisModule) {
+ axisModule = (AxisModule) o;
+ } else if (o instanceof String) { //Should this be checked
+ String moduleName = (String) o;
+ axisModule = axisConfig.getModule(moduleName);
+ if (axisModule == null) {
+ throw new AxisFault(Messages.getMessage("modulenotavailble", moduleName));
}
- service.engageModule(axisModule);
} else {
- throw new AxisFault(Messages.getMessage("modulenotavailble", moduleName));
+ throw new AxisFault(Messages.getMessage("modulenotavailble"));
}
- }
- }
-
- service.setLastupdate();
- addChild(service);
- }
-
- public void addToGroup(AxisService service) throws Exception {
- if (service == null) {
- return;
- }
- service.setParent(this);
-
- AxisConfiguration axisConfig = (AxisConfiguration) getParent();
-
- if (axisConfig != null) {
- Iterator modules = this.engagedModules.iterator();
-
- while (modules.hasNext()) {
- String moduleName = (String) modules.next();
- AxisModule axisModule = axisConfig.getModule(moduleName);
-
- if (axisModule != null) {
- Module moduleImpl = axisModule.getModule();
- if (moduleImpl != null) {
- // notyfying module for service engagement
- moduleImpl.engageNotify(service);
- }
- service.engageModule(axisModule);
- } else {
- throw new AxisFault(Messages.getMessage("modulenotavailble", moduleName));
+ Module moduleImpl = axisModule.getModule();
+ if (moduleImpl != null) {
+ // notyfying module for service engagement
+ moduleImpl.engageNotify(service);
}
+ service.engageModule(axisModule);
}
}
+
service.setLastupdate();
addChild(service);
if (axisConfig != null) {
- axisConfig.addToAllServicesMap(service.getName(), service);
+ axisConfig.addToAllServicesMap(service);
}
}
- public void addToengagedModules(String moduleName) {
- engagedModules.add(moduleName);
- }
-
- public void removeFromEngageList(String moduleName) {
- engagedModules.remove(moduleName);
+ /**
+ *
+ * @param service
+ * @throws Exception
+ * @deprecated please use addService() instead
+ */
+ public void addToGroup(AxisService service) throws Exception {
+ addService(service);
}
- public void engageModule(AxisModule module) throws AxisFault {
- String moduleName = module.getName();
- boolean isEngagable;
- for (Iterator iterator = engagedModules.iterator(); iterator.hasNext();) {
- String modu = (String) iterator.next();
- isEngagable = Utils.checkVersion(moduleName, modu);
- if (!isEngagable) {
- return;
- }
- }
+ /**
+ * When a module gets engaged on a ServiceGroup, we have to engage it for each Service.
+ *
+ * @param module the newly-engaged AxisModule
+ * @param engager
+ * @throws AxisFault if there is a problem
+ */
+ protected void onEngage(AxisModule module, AxisDescription engager) throws AxisFault {
for (Iterator serviceIter = getServices(); serviceIter.hasNext();) {
AxisService axisService = (AxisService) serviceIter.next();
- axisService.engageModule(module);
+ axisService.engageModule(module, engager);
}
- addToengagedModules(moduleName);
}
- public void disengageModule(AxisModule module) throws AxisFault {
+ public void onDisengage(AxisModule module) throws AxisFault {
for (Iterator serviceIter = getServices(); serviceIter.hasNext();) {
AxisService axisService = (AxisService) serviceIter.next();
axisService.disengageModule(module);
}
- removeFromEngageList(module.getName());
}
public void removeService(String name) throws AxisFault {
@@ -189,14 +155,6 @@
removeChild(name);
}
- public AxisConfiguration getAxisDescription() {
- return (AxisConfiguration) getParent();
- }
-
- public ArrayList getEngagedModules() {
- return engagedModules;
- }
-
public ModuleConfiguration getModuleConfig(String moduleName) {
return (ModuleConfiguration) moduleConfigmap.get(moduleName);
}
@@ -243,23 +201,7 @@
return this.serviceGroupName;
}
- public boolean isEngaged(String moduleName) {
- AxisModule module = getAxisDescription().getModule(moduleName);
- if (module == null) {
- return false;
- }
-
- for (Iterator engagedModuleItr = engagedModules.iterator();
- engagedModuleItr.hasNext();) {
- String axisModule = (String) engagedModuleItr.next();
- if (axisModule.equals(module.getName())) {
- return true;
- }
- }
- return false;
- }
-
- public boolean isFoundWebResources() {
+ public boolean isFoundWebResources() {
return foundWebResources;
}
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/HandlerDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/HandlerDescription.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/HandlerDescription.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/HandlerDescription.java Wed Jun 27 09:45:37 2007
@@ -34,25 +34,10 @@
*/
private String className;
- /**
- * Field handler
- */
private Handler handler;
-
- /**
- * Field name
- */
private String name;
-
- /**
- * Field parameterInclude
- */
private final ParameterInclude parameterInclude;
private ParameterInclude parent;
-
- /**
- * Field rules
- */
private PhaseRule rules;
/**
@@ -66,7 +51,7 @@
/**
* Constructor HandlerDescription.
*
- * @param name
+ * @param name name of handler
*/
public HandlerDescription(String name) {
this();
@@ -74,7 +59,9 @@
}
/**
- * @param param
+ * Add a Parameter
+ *
+ * @param param the Parameter to associate with this HandlerDescription
*/
public void addParameter(Parameter param) throws AxisFault {
if (isParameterLocked(param.getName())) {
@@ -120,8 +107,10 @@
}
/**
- * @param name
- * @return Returns Parameter.
+ * Get a named Parameter
+ *
+ * @param name name of Parameter to search
+ * @return a Parameter, which may come from us or from some parent up the tree, or null.
*/
public Parameter getParameter(String name) {
Parameter parameter = parameterInclude.getParameter(name);
@@ -163,14 +152,16 @@
/**
* Method setClassName.
*
- * @param className
+ * @param className the class name of the Handler class
*/
public void setClassName(String className) {
this.className = className;
}
/**
- * @param handler
+ * Explicitly set the Handler object
+ *
+ * @param handler a Handler instance, which will be deployed wherever this HandlerDescription is
*/
public void setHandler(Handler handler) {
this.handler = handler;
@@ -178,7 +169,9 @@
}
/**
- * @param name
+ * Set the name
+ *
+ * @param name the desired name
*/
public void setName(String name) {
this.name = name;
@@ -189,9 +182,9 @@
}
/**
- * Method setRules.
+ * Set the deployment rules for this HandlerDescription
*
- * @param rules
+ * @param rules a PhaseRule object
*/
public void setRules(PhaseRule rules) {
this.rules = rules;
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java Wed Jun 27 09:45:37 2007
@@ -369,9 +369,6 @@
MessageContext responseMessageContext =
msgctx.getConfigurationContext().createMessageContext();
- // This is a hack - Needs to change
-// responseMessageContext.setOptions(options);
-
responseMessageContext.setServerSide(false);
responseMessageContext.setMessageID(msgctx.getMessageID());
addMessageContext(responseMessageContext);
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/Parameter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/Parameter.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/Parameter.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/Parameter.java Wed Jun 27 09:45:37 2007
@@ -98,7 +98,7 @@
/**
* to store the parameter element
- * <parameter name="ServiceClass1" locked="false">
+ * <parameter name="ServiceClass1">
* org.apache.axis2.sample.echo.EchoImpl</parameter>
*/
private OMElement parameterElement;
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/PolicyInclude.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/PolicyInclude.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/PolicyInclude.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/PolicyInclude.java Wed Jun 27 09:45:37 2007
@@ -17,6 +17,7 @@
package org.apache.axis2.description;
import org.apache.axiom.om.util.UUIDGenerator;
+import org.apache.axis2.util.AxisPolicyLocator;
import org.apache.neethi.Policy;
import org.apache.neethi.PolicyReference;
import org.apache.neethi.PolicyRegistry;
@@ -155,9 +156,9 @@
Policy p;
if (policyElement instanceof PolicyReference) {
- PolicyRegistry r = getPolicyRegistry();
+ AxisPolicyLocator locator = new AxisPolicyLocator(description);
p = (Policy) ((PolicyReference) policyElement)
- .normalize(getPolicyRegistry(), false);
+ .normalize(locator, false);
} else if (policyElement instanceof Policy) {
p = (Policy) policyElement;
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?view=diff&rev=551228&r1=551227&r2=551228
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java Wed Jun 27 09:45:37 2007
@@ -18,8 +18,6 @@
import org.apache.neethi.Constants;
import org.apache.neethi.Policy;
import org.apache.neethi.PolicyReference;
-import org.apache.neethi.PolicyRegistry;
-import org.apache.neethi.PolicyRegistryImpl;
import org.apache.ws.commons.schema.utils.NamespaceMap;
import org.apache.axiom.soap.SOAP12Constants;
import org.apache.axiom.soap.SOAP11Constants;
@@ -450,7 +448,7 @@
PortType portType = wsdl4jDefinition.getPortType(wsdl4jBinding.getPortType().getQName());
-
+ String targetNamespace = wsdl4jDefinition.getTargetNamespace();
for (Iterator iterator = wsdl4jBidingOperations.iterator(); iterator.hasNext();) {
@@ -461,7 +459,7 @@
axisBindingOperation.setName(new QName("", wsdl4jBindingOperation.getName()));
addDocumentation(axisBindingOperation, wsdl4jBindingOperation.getDocumentationElement());
- axisOperation = axisService.getOperation(new QName("", wsdl4jOperation.getName()));
+ axisOperation = axisService.getOperation(new QName(targetNamespace, wsdl4jOperation.getName()));
axisBindingOperation.setAxisOperation(axisOperation);
// process ExtensibilityElements of the wsdl4jBinding
@@ -479,7 +477,6 @@
if (wsdl4jBindingInput != null &&
WSDLUtil.isInputPresentForMEP(axisOperation.getMessageExchangePattern())) {
-
AxisBindingMessage axisBindingInMessage = new AxisBindingMessage();
addDocumentation(axisBindingInMessage, wsdl4jBindingInput.getDocumentationElement());
copyExtensibleElements(wsdl4jBindingInput.getExtensibilityElements(),
@@ -992,7 +989,7 @@
private AxisOperation populateOperations(Operation wsdl4jOperation,
PortType wsdl4jPortType, Definition dif)
throws AxisFault {
- QName opName = new QName(wsdl4jOperation.getName());
+ QName opName = new QName(dif.getTargetNamespace(),wsdl4jOperation.getName());
// Copy Name Attribute
AxisOperation axisOperation = axisService.getOperation(opName);
if (axisOperation == null) {
@@ -1024,7 +1021,7 @@
// Check if the action is already set as we don't want to
// override it
// with the Default Action Pattern
- ArrayList inputActions = axisOperation.getWsamappingList();
+ ArrayList inputActions = axisOperation.getWSAMappingList();
String action = null;
if (inputActions == null || inputActions.size() == 0) {
action = WSDL11ActionHelper
@@ -1116,7 +1113,7 @@
// Check if the action is already set as we don't want to
// override it
// with the Default Action Pattern
- ArrayList inputActions = axisOperation.getWsamappingList();
+ ArrayList inputActions = axisOperation.getWSAMappingList();
String action = null;
if (inputActions == null || inputActions.size() == 0) {
action = WSDL11ActionHelper.getActionFromOutputElement(dif,
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org