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 sa...@apache.org on 2007/02/16 12:24:56 UTC

svn commit: r508370 [1/3] - in /webservices/axis2/trunk/java: etc/ modules/addressing/ modules/kernel/src/org/apache/axis2/dataRetrieval/ modules/kernel/src/org/apache/axis2/dataRetrieval/client/ modules/kernel/src/org/apache/axis2/deployment/ modules/...

Author: sanka
Date: Fri Feb 16 03:24:46 2007
New Revision: 508370

URL: http://svn.apache.org/viewvc?view=rev&rev=508370
Log:
Applied the patch.
see: http://issues.apache.org/jira/browse/AXIS2-2120

Thanks Gee !!

Added:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/AxisDataLocator.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/AxisDataLocatorImpl.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/BaseAxisDataLocator.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DRConstants.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/Data.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DataLocatorFactory.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DataRetrievalException.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DataRetrievalRequest.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DataRetrievalUtil.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/LocatorType.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/OutputForm.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/PolicyDataLocator.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/SchemaDataLocator.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/ServiceData.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/WSDLDataLocator.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/client/
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/client/MexClient.java
    webservices/axis2/trunk/java/modules/mex/
    webservices/axis2/trunk/java/modules/mex/maven.xml
    webservices/axis2/trunk/java/modules/mex/project.properties
    webservices/axis2/trunk/java/modules/mex/project.xml
    webservices/axis2/trunk/java/modules/mex/src/
    webservices/axis2/trunk/java/modules/mex/src/META-INF/
    webservices/axis2/trunk/java/modules/mex/src/META-INF/module.xml
    webservices/axis2/trunk/java/modules/mex/src/org/
    webservices/axis2/trunk/java/modules/mex/src/org/apache/
    webservices/axis2/trunk/java/modules/mex/src/org/apache/axis2/
    webservices/axis2/trunk/java/modules/mex/src/org/apache/axis2/mex/
    webservices/axis2/trunk/java/modules/mex/src/org/apache/axis2/mex/MetadataExchangeModule.java
    webservices/axis2/trunk/java/modules/mex/src/org/apache/axis2/mex/MexConstants.java
    webservices/axis2/trunk/java/modules/mex/src/org/apache/axis2/mex/MexException.java
    webservices/axis2/trunk/java/modules/mex/src/org/apache/axis2/mex/MexMessageReceiver.java
    webservices/axis2/trunk/java/modules/mex/src/org/apache/axis2/mex/OM/
    webservices/axis2/trunk/java/modules/mex/src/org/apache/axis2/mex/OM/AnyURIType.java
    webservices/axis2/trunk/java/modules/mex/src/org/apache/axis2/mex/OM/Dialet.java
    webservices/axis2/trunk/java/modules/mex/src/org/apache/axis2/mex/OM/IMexOM.java
    webservices/axis2/trunk/java/modules/mex/src/org/apache/axis2/mex/OM/Identifier.java
    webservices/axis2/trunk/java/modules/mex/src/org/apache/axis2/mex/OM/Location.java
    webservices/axis2/trunk/java/modules/mex/src/org/apache/axis2/mex/OM/Metadata.java
    webservices/axis2/trunk/java/modules/mex/src/org/apache/axis2/mex/OM/MetadataReference.java
    webservices/axis2/trunk/java/modules/mex/src/org/apache/axis2/mex/OM/MetadataSection.java
    webservices/axis2/trunk/java/modules/mex/src/org/apache/axis2/mex/OM/MexOM.java
    webservices/axis2/trunk/java/modules/mex/src/org/apache/axis2/mex/OM/MexOMException.java
    webservices/axis2/trunk/java/modules/mex/src/org/apache/axis2/mex/util/
    webservices/axis2/trunk/java/modules/mex/src/org/apache/axis2/mex/util/MexUtil.java
    webservices/axis2/trunk/java/modules/samples/mex/
    webservices/axis2/trunk/java/modules/samples/mex/README.txt
    webservices/axis2/trunk/java/modules/samples/mex/build.xml
    webservices/axis2/trunk/java/modules/samples/mex/src/
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/clients/
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/clients/DemoDefaultDataLocator.java
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/clients/DemoServiceLevelDataLocator.java
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/clients/DemoWSDLServiceDataLocator.java
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/datalocators/
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/datalocators/GlobalDataLocator.java
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/datalocators/ServiceLevelDataLocator.java
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/datalocators/WSDLDataLocator.java
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/services/
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/services/example1/
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/services/example1/META-INF/
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/services/example1/META-INF/DefaultAxis2DataLocatorDemoService.wsdl
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/services/example1/META-INF/DefaultAxis2DataLocatorDemoService.xsd
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/services/example1/META-INF/ServiceData.xml
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/services/example1/META-INF/services.xml
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/services/example1/Version.java
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/services/example2/
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/services/example2/META-INF/
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/services/example2/META-INF/services.xml
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/services/example2/Version.java
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/services/example3/
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/services/example3/META-INF/
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/services/example3/META-INF/services.xml
    webservices/axis2/trunk/java/modules/samples/mex/src/userguide/mex/services/example3/Version.java
Modified:
    webservices/axis2/trunk/java/etc/project.properties
    webservices/axis2/trunk/java/modules/addressing/maven.xml
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java

Modified: webservices/axis2/trunk/java/etc/project.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/etc/project.properties?view=diff&rev=508370&r1=508369&r2=508370
==============================================================================
--- webservices/axis2/trunk/java/etc/project.properties (original)
+++ webservices/axis2/trunk/java/etc/project.properties Fri Feb 16 03:24:46 2007
@@ -23,6 +23,7 @@
 axis2_version=${version_number}
 addressing_version=${axis2_version}
 soapmonitor_version=${axis2_version}
+mex_version=${axis2_version}
 
 # -------------------------------------------------------------------
 #                Dependency Repositories
@@ -57,6 +58,7 @@
 modules/soapmonitor/project.xml,\
 modules/integration/project.xml,\
 modules/jibx/project.xml,\
+modules/mex/project.xml,\
 modules/mtompolicy/project.xml,\
 ${optional.includes}
 

Modified: webservices/axis2/trunk/java/modules/addressing/maven.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/maven.xml?view=diff&rev=508370&r1=508369&r2=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/maven.xml (original)
+++ webservices/axis2/trunk/java/modules/addressing/maven.xml Fri Feb 16 03:24:46 2007
@@ -15,7 +15,7 @@
         <copy file="../../LICENSE.txt"
             tofile="target/classes/META-INF/LICENSE.txt" overwrite="true"/>
         <copy file="../../NOTICE.txt"
-            tofile="target/classes/META-INF/LICENSE.txt" overwrite="true"/>
+            tofile="target/classes/META-INF/NOTICE.txt" overwrite="true"/>
         <copy file="./test-resources/axis2.xml"
             tofile="target/axis2.xml"/>
         <mkdir dir="target/modules"/>

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/AxisDataLocator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/AxisDataLocator.java?view=auto&rev=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/AxisDataLocator.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/AxisDataLocator.java Fri Feb 16 03:24:46 2007
@@ -0,0 +1,47 @@
+/*
+* Copyright 2007 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.axis2.dataRetrieval;
+
+import org.apache.axis2.context.MessageContext;
+
+/**
+ * <p>AxisDataLocator interface defines getData API for retrieving data particularly 
+ * metadata like WSDL, Policy, Schema. Web Service engines that have different methods in 
+ * storing metadata or different types of data to retrieve may code their version of
+ * Data Locator(s)by implementing the AxisDataLocator interface. Axis 2 support
+ * Data Locator plugin by configuring in Axis2.xml or services.xml. </p>  
+ * 
+ */
+
+public interface AxisDataLocator {
+	
+
+	/**
+	 * Retrieves and returns data based on the specified request.
+	 * 
+	 * @param request
+	 *            The {@link DataRetrievalRequest} allow to specify parameters
+	 *            about the request, and additional information to process the
+	 *            request.
+	 * @param msgContext
+	 *            The {@link MessageContext} from the original request.
+	 * @return {@link Data}[] for the request.
+	 * @throws DataRetrievalException
+	 */
+	
+	public Data[] getData(DataRetrievalRequest request, MessageContext msgContext) throws DataRetrievalException;
+	
+}

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/AxisDataLocatorImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/AxisDataLocatorImpl.java?view=auto&rev=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/AxisDataLocatorImpl.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/AxisDataLocatorImpl.java Fri Feb 16 03:24:46 2007
@@ -0,0 +1,151 @@
+/*
+* Copyright 2007 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.axis2.dataRetrieval;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import javax.xml.namespace.QName;
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * The Default Axis2 Data Locator implementation 
+ *
+ */
+
+public class AxisDataLocatorImpl implements AxisDataLocator {
+	private static final Log log = LogFactory.getLog(AxisDataLocatorImpl.class);
+
+	// HashMap to cache Data elements defined in ServiceData. 
+	private  HashMap dataMap=new HashMap(); 
+	
+	private AxisService axisService;
+	
+	
+	/**
+	 * Constructor
+	 * @throws DataRetrievalException 
+	 *
+	 */
+	public AxisDataLocatorImpl(AxisService in_axisService) throws  DataRetrievalException{
+		super();
+		axisService = in_axisService;
+	}
+
+	/**
+	 *
+     * Retrieves and returns data based on the specified request.
+	 */
+	public Data[] getData(DataRetrievalRequest request,
+			MessageContext msgContext) throws DataRetrievalException{
+		Data[] data = null;
+		String dialect = request.getDialect();
+		String identifier = request.getIdentifier();
+		String key = dialect;
+		ArrayList dataList = new ArrayList();
+		if (identifier != null){
+			key = key + identifier;
+			if (dataMap.get(key) != null)
+			    dataList.add(dataMap.get(key));
+		}
+		else {
+		   dataList = getDataList(dialect);
+		}
+
+		
+		AxisDataLocator dataLocator = DataLocatorFactory
+				.createDataLocator(dialect, (ServiceData[])dataList.toArray(new ServiceData[0]));
+	
+		if (dataLocator != null) {
+			try {
+			   data = dataLocator.getData(request, msgContext);
+			}
+			catch (Throwable e){
+			    log.info("getData request failed for dialect, " + dialect, e);	
+				throw new DataRetrievalException(e);
+			}
+		} else {
+			String message = "Failed to instantiate Data Locator for dialect, " + dialect;
+			log.info(message);
+			throw new DataRetrievalException(message);
+			}
+		return data; 
+	}
+	
+	/*
+	 * For AxisService use only!
+	 */	
+	public void loadServiceData(){
+		DataRetrievalUtil util = DataRetrievalUtil.getInstance();
+		
+		OMElement serviceData=null;
+		String file =  "META-INF/" + DRConstants.SERVICE_DATA.FILE_NAME;
+		try {
+			serviceData = util.buildOM(axisService.getClassLoader(), "META-INF/" + DRConstants.SERVICE_DATA.FILE_NAME);
+		} catch (DataRetrievalException e) {
+			// It is not required to define ServiceData for a Service, just log a warning message
+		
+			String message = "Check loading failure for file, " + file;
+			log.warn(message + ".Message = " + e.getMessage());
+			log.debug(message, e);
+		}
+		if (serviceData != null) {
+			cachingServiceData(serviceData);
+		}
+	}
+	
+	/*
+	 * caching ServiceData for Axis2 Data Locators
+	 */
+	private void cachingServiceData(OMElement e) {
+		Iterator i = e.getChildrenWithName(new QName(
+				DRConstants.SERVICE_DATA.DATA));
+		String saveKey = "";
+		while (i.hasNext()) {
+			ServiceData data = new ServiceData((OMElement) i.next());
+			saveKey = data.getDialect();
+
+			String identifier = data.getIdentifier();
+			if (identifier != null)
+				saveKey = saveKey + identifier;
+			dataMap.put(saveKey, data);
+
+			
+		}
+
+	}
+	
+	/*
+	 * Return ServiceData for specified dialect
+	 */
+	private ArrayList getDataList(String dialect){
+		ArrayList dataList = new ArrayList();
+		Iterator keys = dataMap.keySet().iterator();
+	
+		while (keys.hasNext()){
+		    String keyStr = (String)keys.next();
+		    // get all Data element that matching the dialect
+			if (keyStr.indexOf(dialect) == 0){
+				dataList.add(dataMap.get(keyStr));
+			}
+		}
+		return dataList;
+	}	
+}
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/BaseAxisDataLocator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/BaseAxisDataLocator.java?view=auto&rev=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/BaseAxisDataLocator.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/BaseAxisDataLocator.java Fri Feb 16 03:24:46 2007
@@ -0,0 +1,150 @@
+/*
+* Copyright 2007 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.axis2.dataRetrieval;
+
+import java.util.ArrayList;
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.dataRetrieval.OutputForm;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * BaseAxisDataLocator implements common code and serves as a base class
+ * for the supported default Axis2 dialect data locators.  
+ *
+ */
+
+public abstract class BaseAxisDataLocator  {
+	private static final Log log = LogFactory.getLog(BaseAxisDataLocator.class);
+
+	protected ServiceData[] dataList = null;
+    private OutputForm outputform= OutputForm.INLINE_FORM;
+    
+	/**
+	 * The default Axis2 Data locator getData API
+	 *   Checks data information configured in ServiceData.xml for the supported
+	 *   output forms: inline, url, EndpointReference.
+	 * 
+	 * Note: Subclass that has its implementation of outInlineForm, outputLocationForm,
+	 *       and outputReferenceForm logic must implement the getData API.
+	 */
+    
+	public Data[] getData(DataRetrievalRequest request,
+			MessageContext msgContext) throws DataRetrievalException {
+		log.trace("Default Base DataLocator getData starts");
+
+		OutputForm outputform = (OutputForm) request.getOutputForm();
+
+		if (outputform == null) { // not defined, defualt to inline
+			outputform = OutputForm.INLINE_FORM;
+		}
+
+		Data[] output = null;
+				
+		String outputFormString = outputform.getType();
+     
+		if (outputform == OutputForm.INLINE_FORM) {
+	    	output = outputInlineForm(msgContext, dataList);
+		}
+		else if (outputform == OutputForm.LOCATION_FORM) {
+	    	output = outputLocationForm(dataList);
+			
+		}
+		else if (outputform == OutputForm.REFERENCE_FORM) {
+			output = outputReferenceForm(msgContext, dataList);
+					
+		}
+		else {
+			output = outputInlineForm(msgContext, dataList);
+			
+		}
+	
+		if (output == null)
+				log.info("Null data return! Data Locator does not know how to handle request for dialect= " + (String) request.getDialect()
+					+ " in the form of " + outputFormString);
+		
+
+		log.trace("Default Base DataLocator getData ends");
+
+		return output;
+	}
+
+	/*
+	 * WSDL or a policy document
+	 */
+	protected Data[] outputInlineForm(MessageContext msgContext,
+			ServiceData[] serviceData) throws DataRetrievalException {
+		OMElement metaElement = null;
+		ArrayList result = new ArrayList();
+		if (serviceData != null) {
+			int size = serviceData.length;
+			for (int i = 0; i < size; i++) {
+				metaElement = serviceData[i].getFileContent(msgContext
+						.getAxisService().getClassLoader());
+				if (metaElement != null)
+					result.add(new Data(metaElement, serviceData[i].getIdentifier()));
+
+			}
+
+	
+		}
+		return (Data[]) result.toArray(new Data[0]);
+
+	}
+
+			                				
+	protected Data[] outputLocationForm(ServiceData[] serviceData)
+			throws DataRetrievalException {
+
+		ArrayList result = new ArrayList();
+		if (serviceData != null) {
+			for (int i = 0; i < serviceData.length; i++) {
+
+				String urlValue = serviceData[i].getURL();
+		        if (urlValue != null)
+				    result.add(new Data(urlValue, serviceData[i].getIdentifier()));
+			}
+		}
+		return (Data[]) result.toArray(new Data[0]);
+	}
+
+	protected Data[] outputReferenceForm(MessageContext msgContext,
+			ServiceData[] serviceData) throws DataRetrievalException {
+		OMElement epr = null;
+		ArrayList result = new ArrayList();
+		if (serviceData != null) {
+			for (int i = 0; i < serviceData.length; i++) {
+
+				epr = serviceData[i].getEndpointReference();
+                if (epr != null)
+				    result.add(new Data((epr), serviceData[i].getIdentifier()));
+			}
+		}
+		return (Data[]) result.toArray(new Data[0]);
+	}
+	
+
+	protected void setServiceData(ServiceData[] inServiceData) {
+		this.dataList = inServiceData;
+	}
+
+			
+	protected OutputForm getOutputForm(){
+		return outputform;
+	}
+
+}

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DRConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DRConstants.java?view=auto&rev=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DRConstants.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DRConstants.java Fri Feb 16 03:24:46 2007
@@ -0,0 +1,95 @@
+/*
+* Copyright 2007 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.axis2.dataRetrieval;
+
+/**
+ * Defines constants referenced in data retrieval classes. 
+ */ 
+public interface DRConstants {
+	public interface SPEC_VERSIONS {
+		String v1_0 = "Spec_2004_09";
+	}
+	
+ 
+    public interface SOAPVersion {
+     		int v1_1 = 1;
+
+    		int v1_2 = 2;
+    
+	}
+    
+    /**
+     * 
+     * Defines contants references in WS-Mex specification 
+     *
+     */
+    
+    public interface SPEC {
+    	String NS_URI = "http://schemas.xmlsoap.org/ws/2004/09/mex";
+
+	    public interface Actions {
+			String GET_METADATA_REQUEST = "http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata/Request";
+			String GET_METADATA_RESPONSE = "http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata/Response";
+			
+	    }
+	    
+		String NS_PREFIX = "mex";
+		String GET_METADATA = "GetMetadata";
+		String DIALET = "Dialect";
+		String IDENTIFIER = "Identifier";
+		String METADATA = "Metadata";
+		String METADATA_SECTION = "MetadataSection";
+		String METADATA_REFERENCE = "MetadataReference";
+		String LOCATION = "Location";
+		String TYPE = "type";
+		String DIALECT_TYPE_WSDL = "http://schemas.xmlsoap.org/wsdl/";
+		String DIALECT_TYPE_POLICY = "http://schemas.xmlsoap.org/ws/2004/09/policy";
+		String DIALECT_TYPE_SCHEMA = "http://www.w3.org/2001/XMLSchema";
+		
+	}
+    
+ 
+  // Following constants used for configuring Data Locator in axis.xml and services.xml	
+	String DATA_LOCATOR_ELEMENT = "dataLocator";
+	String DIALECT_LOCATOR_ELEMENT = "dialectLocator";
+	String DIALECT_ATTRIBUTE = "dialect";
+	String CLASS_ATTRIBUTE = "class";
+	
+  // Service level and Global level type Data Locator
+	String SERVICE_LEVEL = "ServiceLevel";
+	String GLOBAL_LEVEL = "GlobalLevel";
+
+  /**
+   * 
+   * Defines contants references in Service Data 
+   *
+   */
+	
+	 public interface SERVICE_DATA {
+		 String FILE_NAME = "ServiceData.xml";
+		 String FILE_TYPE = "svcData";
+			
+		 String DATA = "Data";
+         String ENDPOINT_REFERENCE = "EndpointReference";
+         String URL = "URL";
+         String FILE = "file";
+         String DIALECT = "dialect";
+         String IDENTIFIER = "identifier";
+         
+	 }
+    	
+}

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/Data.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/Data.java?view=auto&rev=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/Data.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/Data.java Fri Feb 16 03:24:46 2007
@@ -0,0 +1,55 @@
+/*
+* Copyright 2007 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.axis2.dataRetrieval;
+
+/**
+ * Data contains instance of the data Object for the specified identifier if applicable.
+ *
+ */
+
+public class Data {
+   Object data;
+   String identifier;
+       
+      
+   /**
+    * Constructor
+    * @param in_data          instance of Object about the data
+    * @param in_identifier    identifier of the data instance.
+    */
+   public Data(Object in_data, String in_identifier){
+	   super();
+	   data = in_data;
+	   identifier =in_identifier;
+   }
+   
+   /**
+    * Returns data
+    * @return data Object
+    */
+   
+   public Object getData(){
+	   return data;
+   }
+   
+   /**
+    * Returns string representing identifier of this data object.
+    * @return
+    */
+   public String getIdentifier(){
+	   return identifier;
+   }
+}

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DataLocatorFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DataLocatorFactory.java?view=auto&rev=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DataLocatorFactory.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DataLocatorFactory.java Fri Feb 16 03:24:46 2007
@@ -0,0 +1,72 @@
+/*
+* Copyright 2007 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.axis2.dataRetrieval;
+
+/**
+ * Factory to constructor Axis2 Data Locators based on the specified
+ * Dialect.
+ */
+
+public class DataLocatorFactory {
+  private static org.apache.axis2.dataRetrieval.WSDLDataLocator wsdlDataLocator = null;
+  private static org.apache.axis2.dataRetrieval.PolicyDataLocator policyDataLocator = null;
+  private static org.apache.axis2.dataRetrieval.SchemaDataLocator schemaDataLocator = null;
+ 	
+  /*
+   * Return instance of default Data Locator for the dialect.
+   */
+  protected static AxisDataLocator createDataLocator(String dialect) {
+	  return (createDataLocator(dialect, null));
+  }
+  
+  protected static AxisDataLocator createDataLocator(String dialect, ServiceData[] serviceDataArray) {
+	  AxisDataLocator dataLocator = null;
+	  if (dialect.equals(DRConstants.SPEC.DIALECT_TYPE_WSDL)){
+		  dataLocator = getWsdlDataLocator(serviceDataArray); 
+		  
+	  }
+	  else if (dialect.trim().equals(DRConstants.SPEC.DIALECT_TYPE_POLICY)){
+		  if (policyDataLocator == null)
+		      dataLocator = new PolicyDataLocator(serviceDataArray);
+		  else
+			  dataLocator = policyDataLocator;
+	  }
+	  else if (dialect.equals(DRConstants.SPEC.DIALECT_TYPE_SCHEMA)){
+		  if (schemaDataLocator == null)
+		      dataLocator = new SchemaDataLocator(serviceDataArray);
+		  else
+			  dataLocator = schemaDataLocator;
+	  }
+	  else {
+		  dataLocator = null;
+	  }
+	  return dataLocator;
+  }
+  
+  protected static AxisDataLocator getWsdlDataLocator(ServiceData[] serviceDataArray) {
+
+		if (wsdlDataLocator == null)
+			wsdlDataLocator = new org.apache.axis2.dataRetrieval.WSDLDataLocator(serviceDataArray);
+		else {
+			wsdlDataLocator.setServiceData(serviceDataArray);
+		}
+		return wsdlDataLocator;
+	}
+  
+  
+  
+}

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DataRetrievalException.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DataRetrievalException.java?view=auto&rev=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DataRetrievalException.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DataRetrievalException.java Fri Feb 16 03:24:46 2007
@@ -0,0 +1,39 @@
+/*
+* Copyright 2007 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.axis2.dataRetrieval;
+
+import org.apache.axis2.AxisFault;
+
+/**
+ * Exception class for reporting Data Retrieval problems 
+ *
+ */
+
+public class DataRetrievalException extends AxisFault {
+	 private static final long serialVersionUID = -374933082062124908L;
+	 public DataRetrievalException(String message) {
+			super(message);
+		}
+
+		public DataRetrievalException(Throwable e) {
+			super(e);
+		}
+
+		public DataRetrievalException(String message, Throwable e) {
+			super(message, e);
+		}
+}

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DataRetrievalRequest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DataRetrievalRequest.java?view=auto&rev=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DataRetrievalRequest.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DataRetrievalRequest.java Fri Feb 16 03:24:46 2007
@@ -0,0 +1,110 @@
+/*
+* Copyright 2007 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.axis2.dataRetrieval;
+
+import java.util.HashMap;
+
+/**
+ * Allow to specify options/parameters for getData request. The list is extensible
+ * based on the information needed for the Data Locator to process the request. 
+ *
+ */
+
+public class DataRetrievalRequest extends HashMap{
+
+	private static final long serialVersionUID = -374933082062124908L;
+	
+	/**
+	 * Key used to define Dialect of data to be retrieved.
+	 */
+	public final static String DIALET="Dialect";
+	/**
+	 * Key used to defined Identify of data to be retrieved.
+	 */
+	public final static String IDENTIFIER = "Identifier";
+	/**
+	 * Key used to define the output format of retrieved data to be returned. 
+	 */
+	public final static String OUTPUT_FORM = "OutputForm";
+	
+   
+ 
+	/**
+	 * Returns the Dialect value specified in the request.
+	 * @return a String that has dialect info.
+	 */
+	
+	public String getDialect() throws DataRetrievalException{
+		String dialect = (String)(get(DIALET));
+		if (dialect == null || dialect.length() == 0)
+			throw new DataRetrievalException("Empty dialect was detected. Dialect must have value.");
+	
+		return (dialect);
+	}
+	
+	/**
+	 * Returns the Identifier value specified in the request.
+	 * @return a String that has Identifier info.
+	 */
+	
+	public String getIdentifier(){
+		return (String)(get(IDENTIFIER));
+	}
+
+	/**
+	 * Returns the output format specified in the request.
+	 * @return output format of data retrieved.
+	 */
+
+	public OutputForm getOutputForm(){
+		return (OutputForm)(get(OUTPUT_FORM));
+	}
+	
+	/**
+	 * Allow to set the dialect of data to retrieve
+	 * @param dialect - Valid dialect value supported by the Data Locator.
+	 * @throws DataRetrievalException
+	 */
+	
+	public void putDialect(String dialect)throws DataRetrievalException {
+		if (dialect == null || dialect.length() == 0)
+			throw new DataRetrievalException("Empty dialect was detected. Dialect must have value.");
+		 put(DIALET, dialect);
+	}
+	
+	/**
+	 * Allow to set the identifier of data to retrieve
+	 * @param identifier - identifier value 
+	 * @throws DataRetrievalException
+	 */
+	
+	public void putIdentifier(String identifier) {
+		    put(IDENTIFIER, identifier);
+	}
+	
+	/**
+	 * Allow to set the output format of the data retrieved.
+	 * @param form - Valid output format types supported by the Data Locator.
+	 * @throws DataRetrievalException
+	 */
+	
+	public void putOutputForm(OutputForm form) {
+	    put(OUTPUT_FORM, form);
+}
+	
+	
+}

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DataRetrievalUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DataRetrievalUtil.java?view=auto&rev=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DataRetrievalUtil.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/DataRetrievalUtil.java Fri Feb 16 03:24:46 2007
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2007 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.dataRetrieval;
+
+import java.io.InputStream;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.util.StAXUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class DataRetrievalUtil {
+	private static final Log log = LogFactory.getLog(DataRetrievalUtil.class);
+
+	private static DataRetrievalUtil instance = null;
+
+	public static DataRetrievalUtil getInstance() {
+		if (instance == null) {
+			instance = new DataRetrievalUtil();
+		}
+		return instance;
+	}
+
+	/**
+	 * Loading xml file content and convert to OMElement.
+	 * @param file - file path relative to the Service Repository
+	 * @return OMElement format of the xml file content 
+	 * @throws DataRetrievalException 
+	 * 
+	 */
+	
+	public OMElement buildOM(ClassLoader classLoader, String file)
+			throws DataRetrievalException {
+		OMElement element = null;
+		InputStream servicexmlStream = null;
+		try {
+			servicexmlStream = getInputStream(classLoader, file);
+
+			element = convertToOMElement(servicexmlStream);
+		} catch (XMLStreamException e) {
+			throw new DataRetrievalException(e);
+		}
+
+		return element;
+	}
+
+	/**
+	 * Convert servicexmlStream to OMElement
+	 * @param servicexmlStream InputStream contain xml content
+	 * @return OMElement format of the xml content 
+	 * @throws XMLStreamException
+	 */
+
+	public static OMElement convertToOMElement(InputStream servicexmlStream)
+			throws XMLStreamException {
+		OMElement element = null;
+
+		XMLStreamReader xmlReader = StAXUtils
+				.createXMLStreamReader(servicexmlStream);
+		OMFactory fac = OMAbstractFactory.getOMFactory();
+		StAXOMBuilder staxOMBuilder = new StAXOMBuilder(fac, xmlReader);
+		element = staxOMBuilder.getDocumentElement();
+		element.build();
+		return element;
+	}
+
+	private static InputStream getInputStream(ClassLoader classLoader,
+			String file) throws XMLStreamException {
+
+		InputStream servicexmlStream = classLoader.getResourceAsStream(file);
+
+		if (servicexmlStream == null) {
+			String message = "File does not exist in the Service Repository! File="
+					+ file;
+			log.warn(message);
+			throw new XMLStreamException(message);
+		}
+		return servicexmlStream;
+
+	}
+
+}
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/LocatorType.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/LocatorType.java?view=auto&rev=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/LocatorType.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/LocatorType.java Fri Feb 16 03:24:46 2007
@@ -0,0 +1,52 @@
+/*
+* Copyright 2007 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.axis2.dataRetrieval;
+
+/**
+ * 
+ * Defines Data Locator types as described below:
+ * DEFAULT_AXIS - Default Axis2 data locator 
+ * GLOBAL_LEVEL - Global level data locator i.e.,plug-in data locator registered
+ *                using <dataLocator> element in axis2.xml.
+ * GLOBAL_DIALECT - Global level dialect specfic data locator i.e.,plug-in 
+ *                  data locator registered using <dialectLocator> element in axis2.xml.
+ * SERVICE_LEVEL - Service level data locator i.e. plug-in data locator registered
+ *                using <dataLocator> element in services.xml.
+ * SERVICE_DIALECT - Service level dialect specific data locator i.e. plug-in data locator registered
+ *                using <dialectLocator> element in services.xml.
+ *
+ */
+
+public class LocatorType {
+	int type;
+	public final static LocatorType  DEFAULT_AXIS = new LocatorType(0);
+	public final static LocatorType  GLOBAL_LEVEL = new LocatorType(1);
+	public final static LocatorType  GLOBAL_DIALECT = new LocatorType(2);
+	public final static LocatorType  SERVICE_LEVEL = new LocatorType(3);
+	public final static LocatorType  SERVICE_DIALECT = new LocatorType(4);
+	
+
+	protected LocatorType (int intype) {
+        this.type= intype;
+    }
+
+	public int getType() {
+        return type;
+    }
+
+
+}

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/OutputForm.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/OutputForm.java?view=auto&rev=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/OutputForm.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/OutputForm.java Fri Feb 16 03:24:46 2007
@@ -0,0 +1,40 @@
+/*
+* Copyright 2007 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.axis2.dataRetrieval;
+
+public class OutputForm {
+	String type;
+
+	/**
+     *  Possible Output formats as stated in <xs:choice> of <MetadataSection>
+     *  in the WS-MEX specification.
+     */
+	
+	public final static OutputForm  INLINE_FORM = new OutputForm("INLINE_FORM");
+	public final static OutputForm  LOCATION_FORM = new OutputForm("LOCATION_FORM");
+	public final static OutputForm  REFERENCE_FORM = new OutputForm("REFERENCE_FORM");
+	
+	protected OutputForm (String intype) {
+        this.type= intype;
+    }
+	
+    public String getType() {
+        return type;
+    }
+
+	
+}

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/PolicyDataLocator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/PolicyDataLocator.java?view=auto&rev=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/PolicyDataLocator.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/PolicyDataLocator.java Fri Feb 16 03:24:46 2007
@@ -0,0 +1,39 @@
+/*
+* Copyright 2007 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.axis2.dataRetrieval;
+
+/**
+ * 
+ * Axis 2 Data Locator responsibles for retrieving Policy  metadata. 
+ * The class is created as model for policy specific data locator; and also
+ * easier for any future implementation policy specific data retrieval logic.
+ *
+ */
+public class PolicyDataLocator  extends BaseAxisDataLocator implements AxisDataLocator {
+		
+	protected PolicyDataLocator() {
+
+	}
+
+	/**
+	 * Constructor
+	 */
+	protected PolicyDataLocator(ServiceData[] data) {
+		dataList = data;
+	}
+
+}

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/SchemaDataLocator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/SchemaDataLocator.java?view=auto&rev=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/SchemaDataLocator.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/SchemaDataLocator.java Fri Feb 16 03:24:46 2007
@@ -0,0 +1,39 @@
+/*
+* Copyright 2007 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.axis2.dataRetrieval;
+
+/**
+ * Axis 2 Data Locator responsibles for retrieving Schema metadata.
+ * The class is created as model for schema specific data locator; and also
+ * easier for any future implementation schema specific data retrieval logic.
+ *
+ */
+
+public class SchemaDataLocator  extends BaseAxisDataLocator  implements AxisDataLocator {
+	
+	protected SchemaDataLocator() {
+
+	}
+
+	/**
+	 * Constructor
+	 */
+	protected SchemaDataLocator(ServiceData[] data) {
+		dataList = data;
+	}
+	
+}

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/ServiceData.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/ServiceData.java?view=auto&rev=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/ServiceData.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/ServiceData.java Fri Feb 16 03:24:46 2007
@@ -0,0 +1,114 @@
+/*
+* Copyright 2007 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.axis2.dataRetrieval;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+
+/**
+ * 
+ * This represents the service data for a dialect and identifier if specified.
+ * Basically, the Data element defined in the ServiceData.xml packaged in 
+ * a Web Service's achieve file.
+ *
+ */
+
+public class ServiceData {
+	OMElement data;
+
+	String identifier;
+
+	String dialect;
+
+	String fileName;
+
+	/**
+	 * Constructor 
+	 * @param in_data an Data element in the ServiceData.
+	 * 
+	 */
+
+	protected ServiceData(OMElement in_data) {
+		data = in_data;
+		identifier = getAttributeValue(DRConstants.SERVICE_DATA.IDENTIFIER);
+		dialect = getAttributeValue(DRConstants.SERVICE_DATA.DIALECT);
+		fileName = getAttributeValue(DRConstants.SERVICE_DATA.FILE);
+	}
+
+	protected String getAttributeValue(String qName) {
+
+		String value = null;
+		OMAttribute attribute = data.getAttribute(new QName(qName));
+		if (attribute != null)
+			value = attribute.getAttributeValue();
+
+		return value;
+
+	}
+
+	// return identifier for this Data element
+	protected String getIdentifier() {
+		return identifier;
+	}
+
+	// return dialect for this Data element
+	protected String getDialect() {
+		return dialect;
+	}
+
+	// return the Data ELement
+	protected OMElement getOMData() {
+		return data;
+	}
+
+	
+	
+	// Get URL from data Element
+	protected String getURL() {
+
+		String urlValue = null;
+		OMElement url = data.getFirstChildWithName(new QName(
+				DRConstants.SERVICE_DATA.URL));
+		if (url != null)
+			urlValue = url.getText();
+
+		return urlValue;
+	}
+	
+	// Get ENDPOINT_REFERENCE from Data Element
+	protected OMElement getEndpointReference() {
+		OMElement epr = data.getFirstChildWithName(new QName(
+				DRConstants.SERVICE_DATA.ENDPOINT_REFERENCE));
+		return epr;
+	}
+	
+	// Load the file content of the file specified in the file attribute
+	// in the data element.
+	protected OMElement getFileContent(ClassLoader classloader)
+			throws DataRetrievalException {
+
+		OMElement metaElement = null;
+		if (fileName != null) {
+			DataRetrievalUtil util = DataRetrievalUtil.getInstance();
+
+			metaElement = util.buildOM(classloader, fileName);
+		}
+		return metaElement;
+	}
+}

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/WSDLDataLocator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/WSDLDataLocator.java?view=auto&rev=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/WSDLDataLocator.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/WSDLDataLocator.java Fri Feb 16 03:24:46 2007
@@ -0,0 +1,168 @@
+/*
+* Copyright 2007 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.axis2.dataRetrieval;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisService2OM;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Axis 2 Data Locator responsibles for retrieving WSDL metadata. 
+ *
+ */
+public class WSDLDataLocator extends BaseAxisDataLocator implements AxisDataLocator {
+	private static final Log log = LogFactory.getLog(WSDLDataLocator.class);
+    String serviceURL=null;
+    AxisService theService=null;
+    String request_Identifier=null;
+	    
+    
+    protected WSDLDataLocator(){
+    
+    }
+    
+    /**
+     * Constructor 
+     * @param data an array of ServiceData instance defined in the 
+     *             ServiceData.xml for the WSDL dialect.
+     */
+    protected WSDLDataLocator(ServiceData[] data){
+    	dataList = data;
+    }
+    
+	/**
+	 * getData API 
+	 * Implement data retrieval logic for WSDL dialect
+	 */
+	public Data[] getData(DataRetrievalRequest request,
+			MessageContext msgContext) throws DataRetrievalException {
+		log.trace("Default WSDL DataLocator getData starts");
+
+		request_Identifier = (String) request.getIdentifier();
+	
+		OutputForm outputform = (OutputForm) request.getOutputForm();
+
+		if (outputform == null) { // not defined, defualt to inline
+			outputform = OutputForm.INLINE_FORM;
+		}
+
+		Data[] output = null;
+				
+		String outputFormString = outputform.getType();
+     
+		if (outputform == OutputForm.INLINE_FORM) {
+	    	output = outputInlineForm(msgContext, dataList);
+		}
+		else if (outputform == OutputForm.LOCATION_FORM) {
+	    	output = outputLocationForm(dataList);
+			
+		}
+		else if (outputform == OutputForm.REFERENCE_FORM) {
+			output = outputReferenceForm(msgContext, dataList);
+					
+		}
+		else {
+			output = outputInlineForm(msgContext, dataList);
+			
+		}
+	
+		if (output == null)
+			if (log.isTraceEnabled())
+				log.trace("Null data return! Data Locator does not know how to handle request for dialect= " + (String) request.getDialect()
+					+ " in the form of " + outputFormString);
+		
+
+		log.trace("Default WSDL DataLocator getData ends");
+
+
+		return output;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.apache.axis2.dataRetrieval.BaseAxisDataLocator#outputInlineForm(org.apache.axis2.context.MessageContext, org.apache.axis2.dataRetrieval.ServiceData[])
+	 */
+	protected Data[] outputInlineForm(MessageContext msgContext, ServiceData[] dataList)
+			throws DataRetrievalException {
+		Data[]  result = super.outputInlineForm(msgContext, dataList);
+		
+		// Do not generate WSDL if Identifier was specified in the request as
+		// (1) this is to support ?wsdl request; 
+		// (2) Data for specified Identifier must be available to satisfy the GetMetadata request.
+		
+		if (result.length==0 && request_Identifier == null) {
+			log.trace("Default WSDL DataLocator attempt to generates WSDL.");		
+		      
+			if (msgContext != null) {
+				theService = msgContext.getAxisService();
+				serviceURL = msgContext.getTo().getAddress();
+			} else {
+				throw new DataRetrievalException("MessageContext was not set!");
+			}
+	
+			AxisService2OM axisService2WOM;
+			OMElement wsdlElement;
+            
+			try {
+				String[] exposedEPRs = theService.getEPRs();
+                if (exposedEPRs == null) {
+                    exposedEPRs = new String[] {theService.getEndpointName()};
+                }
+			    axisService2WOM = new AxisService2OM(theService,
+			    		exposedEPRs, "document", "literal",
+					"");
+			    wsdlElement = axisService2WOM.generateOM();
+			}
+			catch (Exception e){
+				log.debug(e);
+				throw new DataRetrievalException(e);
+			}
+
+			if (wsdlElement != null) {
+				log
+						.trace("Default WSDL DataLocator successfully generated WSDL.");
+				result = new Data[1];
+				result[0] = new Data(wsdlElement, null);
+			}
+		}
+		return result;
+	}
+
+	/*
+	 * 
+	 */	
+	protected Data[] outputLocationForm(ServiceData[] serviceData) throws DataRetrievalException {
+		Data[] result= super.outputLocationForm(serviceData);
+		
+		// Do not generate URL if Identifier was specified in the request as
+		// (1) Axis2 ?wsdl URL request is not supporting Identifier; 
+		// (2) URL data for specified Identifier must be available to satisfy
+		//     the GetMetadata request.
+	
+		if (result.length==0 && request_Identifier == null) {
+			   result = new Data[1];
+			   result[0] = new Data( serviceURL + "?wsdl", null);
+	    }
+		return result;
+	}
+	
+	
+}

Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/client/MexClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/client/MexClient.java?view=auto&rev=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/client/MexClient.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataRetrieval/client/MexClient.java Fri Feb 16 03:24:46 2007
@@ -0,0 +1,75 @@
+package org.apache.axis2.dataRetrieval.client;
+import java.net.URL;
+
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.dataRetrieval.DRConstants;
+import org.apache.axis2.description.AxisService;
+
+public class MexClient extends ServiceClient {
+
+	public MexClient(ConfigurationContext configContext, AxisService axisService)
+			throws AxisFault {
+		super(configContext, axisService);
+	}
+
+	public MexClient(ConfigurationContext configContext,
+			Definition wsdl4jDefinition, QName wsdlServiceName, String portName)
+			throws AxisFault {
+		super(configContext, wsdl4jDefinition, wsdlServiceName, portName);
+	}
+
+	public MexClient(ConfigurationContext configContext, URL wsdlURL,
+			QName wsdlServiceName, String portName) throws AxisFault {
+		super(configContext, wsdlURL, wsdlServiceName, portName);
+	}
+
+	public MexClient() throws AxisFault {
+	}
+
+	/**
+	 * Builds OMElement that makes up of SOAP body.
+	 */
+	public OMElement setupGetMetadataRequest(String dialect,
+			String identifier) throws AxisFault {
+		
+		// Attempt to engage MEX module
+	/*	try{
+	       super.engageModule(new QName("metadataExchange"));
+		}
+		catch (Exception e){
+		  throw new AxisFault ("Unable to proceed with GetMetadata Request!", e);  	
+		} */
+		
+		OMFactory fac = OMAbstractFactory.getOMFactory();
+
+		OMNamespace omNs = fac.createOMNamespace(
+				DRConstants.SPEC.NS_URI, DRConstants.SPEC.NS_PREFIX);
+
+		OMElement method = fac.createOMElement(DRConstants.SPEC.GET_METADATA,
+				omNs);
+		if (dialect != null) {
+			OMElement dialect_Elem = fac.createOMElement(
+					DRConstants.SPEC.DIALET, omNs);
+
+			dialect_Elem.setText(dialect);
+			method.addChild(dialect_Elem);
+		}
+		// create Identifier element
+		if (identifier != null) {
+			OMElement id_Elem = fac.createOMElement(
+					DRConstants.SPEC.IDENTIFIER, omNs);
+			id_Elem.setText(identifier);
+			method.addChild(id_Elem);
+		}
+		return method;
+	}
+}

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java?view=diff&rev=508370&r1=508369&r2=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java Fri Feb 16 03:24:46 2007
@@ -20,6 +20,7 @@
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.dataRetrieval.DRConstants;
 import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.deployment.util.Utils;
 import org.apache.axis2.description.*;
@@ -150,6 +151,14 @@
                 }
             }
 
+            //process dataLocator configuration
+            OMElement dataLocatorElement =
+            config_element.getFirstChildWithName(new QName(DRConstants.DATA_LOCATOR_ELEMENT));
+            
+            if (dataLocatorElement != null) {
+                processDataLocatorConfig(dataLocatorElement);
+            }
+            
             // process MessageFormatters
             OMElement messageFormattersElement = config_element.getFirstChildWithName(new QName(TAG_MESSAGE_FORMATTERS));
             if (messageFormattersElement != null) {
@@ -491,6 +500,34 @@
         }
     }
 
+    /*
+     * process data locator configuration for data retrieval.
+     */
+    private void processDataLocatorConfig(OMElement dataLocatorElement) {
+		OMAttribute serviceOverallDataLocatorclass = dataLocatorElement
+				.getAttribute(new QName(DRConstants.CLASS_ATTRIBUTE));
+		if (serviceOverallDataLocatorclass != null) {
+			String className = serviceOverallDataLocatorclass
+					.getAttributeValue();
+			axisConfig.addDataLocatorClassNames(DRConstants.GLOBAL_LEVEL,
+					className);
+		}
+		Iterator iterator = dataLocatorElement.getChildrenWithName(new QName(
+				DRConstants.DIALECT_LOCATOR_ELEMENT));
+
+		while (iterator.hasNext()) {
+			OMElement locatorElement = (OMElement) iterator.next();
+			OMAttribute dialect = locatorElement.getAttribute(new QName(
+					DRConstants.DIALECT_ATTRIBUTE));
+			OMAttribute dialectclass = locatorElement.getAttribute(new QName(
+					DRConstants.CLASS_ATTRIBUTE));
+			axisConfig.addDataLocatorClassNames(dialect.getAttributeValue(),
+					dialectclass.getAttributeValue());
+
+		}
+	}
+	
+    
     private Phase getPhase(String className)
             throws ClassNotFoundException, IllegalAccessException, InstantiationException {
         if (className == null) {

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java?view=diff&rev=508370&r1=508369&r2=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java Fri Feb 16 03:24:46 2007
@@ -21,6 +21,7 @@
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.dataRetrieval.DRConstants;
 import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.deployment.util.Utils;
 import org.apache.axis2.description.*;
@@ -340,6 +341,14 @@
             }
             Iterator moduleConfigs = service_element.getChildrenWithName(new QName(TAG_MODULE_CONFIG));
             processServiceModuleConfig(moduleConfigs, service, service);
+            
+            // Loading Data Locator(s) configured
+            OMElement dataLocatorElement =
+                service_element.getFirstChildWithName(new QName(DRConstants.DATA_LOCATOR_ELEMENT));
+            if (dataLocatorElement != null) {
+            	processDataLocatorConfig(dataLocatorElement, service);
+             }         
+        
         } catch (XMLStreamException e) {
             throw new DeploymentException(e);
         } catch (AxisFault axisFault) {
@@ -722,4 +731,26 @@
         }
     }
 
+    
+    
+    /*
+     * process data locator configuration for data retrieval.
+     */
+    private void processDataLocatorConfig(OMElement dataLocatorElement, AxisService service) {
+        OMAttribute serviceOverallDataLocatorclass = dataLocatorElement.getAttribute(new QName(DRConstants.CLASS_ATTRIBUTE));
+        if (serviceOverallDataLocatorclass != null){
+            String className = serviceOverallDataLocatorclass.getAttributeValue();
+            service.addDataLocatorClassNames(DRConstants.SERVICE_LEVEL, className);
+        }
+        Iterator iterator = dataLocatorElement.getChildrenWithName(new QName(DRConstants.DIALECT_LOCATOR_ELEMENT));
+        
+        while (iterator.hasNext()) {
+            OMElement locatorElement = (OMElement) iterator.next();
+            OMAttribute dialect = locatorElement.getAttribute(new QName(DRConstants.DIALECT_ATTRIBUTE));
+            OMAttribute dialectclass = locatorElement.getAttribute(new QName(DRConstants.CLASS_ATTRIBUTE));
+            service.addDataLocatorClassNames(dialect.getAttributeValue(), dialectclass.getAttributeValue());
+            
+          }
+
+    }
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java?view=diff&rev=508370&r1=508369&r2=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java Fri Feb 16 03:24:46 2007
@@ -23,6 +23,17 @@
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Options;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.dataRetrieval.AxisDataLocator;
+import org.apache.axis2.dataRetrieval.AxisDataLocatorImpl;
+import org.apache.axis2.dataRetrieval.DRConstants;
+import org.apache.axis2.dataRetrieval.DataRetrievalException;
+import org.apache.axis2.dataRetrieval.LocatorType;
+import org.apache.axis2.dataRetrieval.OutputForm;
+
+import org.apache.axis2.dataRetrieval.Data;
+import org.apache.axis2.dataRetrieval.DataRetrievalRequest;
 import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.deployment.util.Utils;
 import org.apache.axis2.engine.*;
@@ -194,6 +205,13 @@
 
     private TypeTable typeTable;
 
+    // Data Locators for  WS-Mex Support
+    private HashMap dataLocators;
+    private HashMap dataLocatorClassNames;
+    private AxisDataLocatorImpl defaultDataLocator;
+    // Define search sequence for datalocator based on Data Locator types. 
+	LocatorType[] availableDataLocatorTypes = new LocatorType[]{LocatorType.SERVICE_DIALECT, LocatorType.SERVICE_LEVEL,LocatorType.GLOBAL_DIALECT, LocatorType.GLOBAL_LEVEL, LocatorType.DEFAULT_AXIS};
+
     // name of the  binding used : use in codegeneration
     private String bindingName;
 
@@ -274,6 +292,9 @@
           }
         });
         objectSupplier = new DefaultObjectSupplier();
+        dataLocators = new HashMap();
+        dataLocatorClassNames = new HashMap();
+
     }
 
     /**
@@ -750,6 +771,9 @@
 
     private String[] getEPRs(String requestIP) {
         AxisConfiguration axisConfig = getAxisConfiguration();
+        if (axisConfig == null){
+            return null;
+        }
         ArrayList eprList = new ArrayList();
         if (enableAllTransports) {
             Iterator transports = axisConfig.getTransportsIn().values().iterator();
@@ -869,23 +893,37 @@
         }
     }
 
-    private void getWSDL(OutputStream out, String[] serviceURL, String servicePath) throws AxisFault {
-        if (this.wsdlFound) {
-            AxisService2OM axisService2WOM = new AxisService2OM(this,
-                    serviceURL, "document", "literal", servicePath);
-            try {
-                OMElement wsdlElement = axisService2WOM.generateOM();
-                wsdlElement.serialize(out);
-                out.flush();
-                out.close();
-            } catch (Exception e) {
-                throw new AxisFault(e);
-            }
-        } else {
-            printWSDLError(out);
-        }
+    private void getWSDL(OutputStream out, String[] serviceURL,
+			String servicePath) throws AxisFault {
+		if (this.wsdlFound) {
+		
+			// Retrieve WSDL using the same data retrieval path for GetMetadata request.
+			DataRetrievalRequest request = new DataRetrievalRequest();
+			request.putDialect(DRConstants.SPEC.DIALECT_TYPE_WSDL);
+			request.putOutputForm(OutputForm.INLINE_FORM);
+			            
+            MessageContext context = new MessageContext();
+			context.setAxisService(this);
+			context.setTo(new EndpointReference(serviceURL[0]));
+			
+            Data[] result = getData(request, context);
+			OMElement wsdlElement;
+			if (result != null && result[0] != null) {
+				wsdlElement = (OMElement) (result[0].getData());
+				try {
+					wsdlElement.serialize(out);
+					out.flush();
+					out.close();
+				} catch (Exception e) {
+					throw new AxisFault(e);
+				}
+			}
+
+		} else {
+			printWSDLError(out);
+		}
 
-    }
+	}
 
     private void printWSDLError(OutputStream out) throws AxisFault {
         try {
@@ -1968,7 +2006,192 @@
     public void setTypeTable(TypeTable typeTable) {
         this.typeTable = typeTable;
     }
+    
+  
+    /**
+     * Find a data locator from the available data locators (both configured and default ones) to retrieve Metadata or data
+     * specified in the request. 
+     * 
+     * @param request an {@link DataRetrievalRequest} object
+     * @param msgContext message context
+     * @return array of {@link Data} object for the request. 
+     * @throws AxisFault 
+     */
+    
+    public Data[] getData(DataRetrievalRequest request,
+			MessageContext msgContext) throws AxisFault {
+    	
+		Data[] data = null;
+		String dialect = request.getDialect();
+		AxisDataLocator dataLocator = null;
+		int nextDataLocatorIndex = 0;
+		int totalLocators = availableDataLocatorTypes.length;
+		for (int i = 0; i < totalLocators; i++) {
+			dataLocator = getDataLocator(availableDataLocatorTypes[i], dialect);
+			if (dataLocator != null) {
+				nextDataLocatorIndex = i + 1;
+				break;
+			}
+		}
+
+		data = dataLocator.getData(request, msgContext);
+		// Null means Data Locator not understood request. Automatically find
+		// Data Locator in the hierarchy to process the request.
+		if (data == null) {
+			if (nextDataLocatorIndex < totalLocators) {
+				data = bubbleupDataLocators(nextDataLocatorIndex, request,
+						msgContext);
+			}
+
+		}
+		return data;
+	}
+   
+    /*
+     * To search the next Data Locator from the available Data Locators that understood
+     * the data retrieval request.
+     */
+    private Data[] bubbleupDataLocators(int nextIndex,
+			DataRetrievalRequest request, MessageContext msgContext)
+			throws AxisFault {
+		Data[] data = null;
+		if (nextIndex < availableDataLocatorTypes.length) {
+			AxisDataLocator dataLocator = getDataLocator(
+					availableDataLocatorTypes[nextIndex], request.getDialect());
+			nextIndex++;
+			if (dataLocator != null) {
+				data = dataLocator.getData(request, msgContext);
+				if (data==null){
+					data = bubbleupDataLocators(nextIndex, request, msgContext);
+				}
+				else return data;
+
+			}
+			else data = bubbleupDataLocators(nextIndex, request, msgContext);
+			
+
+		}
+		return data;
+	}
+   
+     /**
+     * Save data Locator configured at service level for this Axis Service
+     * 
+     * @param dialect- an absolute URI represents the Dialect i.e. WSDL, Policy, Schema or
+     *                 "ServiceLevel" for non-dialect service level data locator.
+     * @param classname - class name of the Data Locator configured to support data retrieval 
+     *                  for the specified dialect.
+     */
+    public void addDataLocatorClassNames(String dialect, String dataLocatorClassName) {
+        dataLocatorClassNames.put(dialect, dataLocatorClassName);
+    }
+   
+   
+    /*
+     * Get data locator instance based on the LocatorType and dialect.
+     */
+    private AxisDataLocator getDataLocator(LocatorType locatorType, String dialect) throws AxisFault {
+    	AxisDataLocator locator = null;
+        if (locatorType == LocatorType.SERVICE_DIALECT)   
+        	 locator =  getServiceDataLocator( dialect);  
+        else if (locatorType == LocatorType.SERVICE_LEVEL)   
+          	 locator =  getServiceDataLocator( DRConstants.SERVICE_LEVEL); 
+        else if (locatorType == LocatorType.GLOBAL_DIALECT)   
+         	 locator =  getGlobalDataLocator( dialect); 	
+        else if (locatorType == LocatorType.GLOBAL_LEVEL)   
+        	 locator =  getGlobalDataLocator( DRConstants.GLOBAL_LEVEL);
+        else if (locatorType == LocatorType.DEFAULT_AXIS)   
+       	     locator =  getDefaultDataLocator();
+        else
+        	 locator =  getDefaultDataLocator();
+    
+      
+    	return locator;
+    }
+    	  
+    // Return default Axis2 Data Locator
+    private AxisDataLocator getDefaultDataLocator() throws DataRetrievalException {
+
+		if (defaultDataLocator == null)
+			defaultDataLocator = new AxisDataLocatorImpl(this);
+		
+		defaultDataLocator.loadServiceData();
+		
+		return defaultDataLocator;
+	}
+       
+    
+	/*
+	 * Checks if service level data locator configured for specified dialect.
+	 * Returns an instance of the data locator if exists, and null otherwise.
+	 */
+	private AxisDataLocator getServiceDataLocator(String dialect)
+			throws AxisFault {
+		AxisDataLocator locator = null;
+		locator = (AxisDataLocator)dataLocators.get(dialect);
+		if (locator == null) {
+			String className = (String)dataLocatorClassNames.get(dialect);
+			if (className != null) {
+				locator = loadDataLocator(className);
+				dataLocators.put(dialect, locator);
+			}
+
+		}
+
+		return locator;
+
+	}
+      
+	/*
+	 * Checks if global level data locator configured for specified dialect.
+	 * @param dialect- an absolute URI represents the Dialect i.e. WSDL, Policy, Schema or
+     *                 "GlobalLevel" for non-dialect Global level data locator.
+	 * Returns an instance of the data locator if exists, and null otherwise.
+	 */
+	
+	public AxisDataLocator getGlobalDataLocator(String dialect)
+			throws AxisFault {
+		AxisConfiguration axisConfig = getAxisConfiguration();
+		AxisDataLocator locator = null;
+		if (axisConfig != null) {
+			locator = axisConfig.getDataLocator(dialect);
+			if (locator == null) {
+			    String className = axisConfig.getDataLocatorClassName(dialect);
+			    if (className != null) {
+			        locator = loadDataLocator(className);
+			        axisConfig.addDataLocator(dialect, locator);
+			    }
+			} 
+        }
+
+		return locator;
+
+	}
+       
+    
+    protected AxisDataLocator loadDataLocator(String className)
+			throws AxisFault {
+
+		AxisDataLocator locator = null;
+
+		try {
+			Class dataLocator;
+			dataLocator = Class.forName(className, true, serviceClassLoader);
+			locator = (AxisDataLocator) dataLocator.newInstance();
+		} catch (ClassNotFoundException e) {
+			throw new AxisFault(e);
+		} catch (IllegalAccessException e) {
+			throw new AxisFault(e);
+		} catch (InstantiationException e) {
+			throw new AxisFault(e);
+
+		}
+
+		return locator;
+	}
+
 
+   
     /**
      * When we are trying to find out the operation by the QName of the SOAPBody first child, this
      * map will help to retrieve that data very fast.

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java?view=diff&rev=508370&r1=508369&r2=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java Fri Feb 16 03:24:46 2007
@@ -18,6 +18,7 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.dataRetrieval.AxisDataLocator;
 import org.apache.axis2.deployment.DeploymentException;
 import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.description.AxisDescription;
@@ -54,7 +55,11 @@
 public class AxisConfiguration extends AxisDescription {
 
     private static final Log log = LogFactory.getLog(AxisConfiguration.class);
-
+    /*
+     * To store data locators configured
+     */
+    private HashMap dataLocators = new HashMap();
+    private HashMap dataLocatorClassNames = new HashMap();
     /**
      * Field modules
      */
@@ -982,6 +987,45 @@
     public boolean isAssertionLocal(QName name) {
         return this.localPolicyAssertions.contains(name);
     }
+    
+    /**
+     * Allow to define/configure Data Locator for specified dialect at Axis 2 Configuration.
+     * 
+     * @param dialect- an absolute URI represents the format and version of data
+     * @param classname - class name of the Data Locator configured to support retrieval 
+     *                  for the specified dialect.
+     */
+    public void addDataLocatorClassNames(String dialect, String classname) {
+        dataLocatorClassNames.put(dialect, classname);
+    }
+   
+    /**
+     * For internal used only! To store instance of DataLocator when it is first loaded. This allows to 	
+     * re-use DataLocator after it is initially loaded. 
+     * @param dialect- an absolute URI represents the format and version of data
+     * @param dataLocator - specified an DataLocator instance  to support retrieval 
+     *                  of the specified dialect.
+     */
+    public void addDataLocator(String dialect, AxisDataLocator dataLocator) {
+        dataLocators.put(dialect, dataLocator);
+    }
+    
+     /**
+     * Return DataLocator instance for specified dialect.
+     */
+    public AxisDataLocator getDataLocator(String dialect) {
+        return (AxisDataLocator)dataLocators.get(dialect);
+    }
+    
+    
+    /**
+     * Return classname of DataLocator configured for specified dialect.
+     */
+    public String getDataLocatorClassName(String dialect) {
+        return (String) dataLocatorClassNames.get(dialect);
+    }
+
+
 
     /**
      * Checks whether some one has changed the system pre-defined phases

Added: webservices/axis2/trunk/java/modules/mex/maven.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/mex/maven.xml?view=auto&rev=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/mex/maven.xml (added)
+++ webservices/axis2/trunk/java/modules/mex/maven.xml Fri Feb 16 03:24:46 2007
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Copyright 2007 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ -->
+  
+<!-- $Revision: 1.21 $ $Date: 2004-10-27 20:54:09 +0600 (Wed, 27 Oct 2004) $ -->
+
+<project default="jar"
+    xmlns:j="jelly:core"
+    xmlns:u="jelly:util"
+    xmlns:maven="jelly:maven"
+    xmlns:deploy="deploy"
+    xmlns:ant="jelly:ant">
+    <postGoal name="java:compile">
+        <mkdir dir="target/classes/META-INF"/>
+        <copy file="src/META-INF/module.xml"
+            tofile="target/classes/META-INF/module.xml"/>
+         <copy file="../../LICENSE.txt"
+             tofile="target/classes/META-INF/LICENSE.txt" overwrite="true"/>
+          <copy file="../../NOTICE.txt"
+            tofile="target/classes/META-INF/LICENSE.txt" overwrite="true"/>
+        <mkdir dir="target/modules"/>
+        <jar jarfile="target/metadataExchange-${mex_version}.mar" basedir="target/classes">
+            <include name="**"/>
+        </jar>
+        <copy file="target/metadataExchange-${mex_version}.mar"
+            tofile="target/modules/metadataExchange-${mex_version}.mar"/>
+        <copy file="target/metadataExchange-${mex_version}.mar" 
+            tofile="${maven.repo.local}/org.apache.axis2/mars/metadataExchange-${mex_version}.mar"/>
+    </postGoal>
+   </project>

Added: webservices/axis2/trunk/java/modules/mex/project.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/mex/project.properties?view=auto&rev=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/mex/project.properties (added)
+++ webservices/axis2/trunk/java/modules/mex/project.properties Fri Feb 16 03:24:46 2007
@@ -0,0 +1,17 @@
+# -------------------------------------------------------------------
+# Copyright 2001-2004 The Apache Software Foundation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -------------------------------------------------------------------
+
+maven.multiproject.type=jar

Added: webservices/axis2/trunk/java/modules/mex/project.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/mex/project.xml?view=auto&rev=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/mex/project.xml (added)
+++ webservices/axis2/trunk/java/modules/mex/project.xml Fri Feb 16 03:24:46 2007
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ -->
+<project>
+    <pomVersion>3</pomVersion>
+    <extend>../../etc/project.xml</extend>
+
+    <name>Apache Axis 2.0 - Metadata Exchange</name>
+    <id>axis2-mex</id>
+    <groupId>org.apache.axis2</groupId>
+    <description>WS-MetadataExchange implementation</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.ws.commons.axiom</groupId>
+            <artifactId>axiom-api</artifactId>
+            <version>${axiom.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.ws.commons.axiom</groupId>
+            <artifactId>axiom-impl</artifactId>
+            <version>${axiom.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>wsdl4j</groupId>
+            <artifactId>wsdl4j</artifactId>
+            <version>${wsdl4j.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.axis2</groupId>
+            <artifactId>axis2-kernel</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
+        <!-- external JARs -->
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>${commons.logging.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>${stax.impl.groupid}</groupId>
+            <artifactId>${stax.impl.artifactid}</artifactId>
+            <version>${stax.impl.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>stax</groupId>
+            <artifactId>stax-api</artifactId>
+            <version>${stax.api.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+          <dependency>
+            <groupId>org.apache.neethi</groupId>
+            <artifactId>neethi</artifactId>
+            <version>${neethi.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+
+        </dependencies>
+
+    <reports/>
+</project>

Added: webservices/axis2/trunk/java/modules/mex/src/META-INF/module.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/mex/src/META-INF/module.xml?view=auto&rev=508370
==============================================================================
--- webservices/axis2/trunk/java/modules/mex/src/META-INF/module.xml (added)
+++ webservices/axis2/trunk/java/modules/mex/src/META-INF/module.xml Fri Feb 16 03:24:46 2007
@@ -0,0 +1,30 @@
+<!--
+/*
+ * Copyright 2007 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ -->
+
+<module name="metadataExchange" class="org.apache.axis2.mex.MetadataExchangeModule">
+   <operation name="getMetadata" mep="http://www.w3.org/2004/08/wsdl/in-out">
+         <messageReceiver class="org.apache.axis2.mex.MexMessageReceiver"/>
+
+        <!-- namespaces for the 2004-09 spec -->
+        
+         <actionMapping>http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata/Request</actionMapping>
+         <outputActionMapping>http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata/Response</outputActionMapping>
+       
+        </operation>
+
+</module>



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org