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 di...@apache.org on 2008/02/25 20:09:05 UTC

svn commit: r630959 [3/4] - in /webservices/axis2/trunk/java/modules: jaxws/ jaxws/test-resources/catalog/ jaxws/test-resources/catalog/dir1/ jaxws/test-resources/catalog/dir2/ jaxws/test-resources/catalog/dir3/ jaxws/test-resources/catalog/fail/ jaxws...

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?rev=630959&r1=630958&r2=630959&view=diff
==============================================================================
--- 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 Mon Feb 25 11:09:01 2008
@@ -989,7 +989,7 @@
     }
 
     /**
-     * find the defintion object for given name
+     * find the definition object for given name
      * @param parentDefinition
      * @param name
      * @return wsdl definition

Modified: webservices/axis2/trunk/java/modules/metadata/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/pom.xml?rev=630959&r1=630958&r2=630959&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/metadata/pom.xml Mon Feb 25 11:09:01 2008
@@ -18,88 +18,92 @@
   ~ under the License.
   -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-	<parent>
-		<groupId>org.apache.axis2</groupId>
-		<artifactId>axis2-parent</artifactId>
-		<version>SNAPSHOT</version>
-		<relativePath>../parent/pom.xml</relativePath>
-	</parent>
-	<artifactId>axis2-metadata</artifactId>
-	<name>Apache Axis 2.0 - Metadata</name>
-	<description>JSR-181 and JSR-224 Annotations Processing</description>
-	<dependencies>
-		<dependency>
-			<groupId>org.apache.axis2</groupId>
-			<artifactId>axis2-kernel</artifactId>
-			<version>${version}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.axis2</groupId>
-			<artifactId>axis2-jws-api</artifactId>
-			<version>${version}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.axis2</groupId>
-			<artifactId>axis2-jaxws-api</artifactId>
-			<version>${version}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.axis2</groupId>
-			<artifactId>axis2-saaj</artifactId>
-			<version>${version}</version>
-		</dependency>
-		<dependency>
-			<groupId>com.sun.xml.bind</groupId>
-			<artifactId>jaxb-impl</artifactId>
-			<exclusions>
-				<exclusion>
-					<artifactId>jsr173</artifactId>
-					<groupId>javax.xml</groupId>
-				</exclusion>
-			</exclusions>
-		</dependency>
-		<dependency>
-			<groupId>com.sun.xml.bind</groupId>
-			<artifactId>jaxb-xjc</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>log4j</groupId>
-			<artifactId>log4j</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>javax.xml.bind</groupId>
-			<artifactId>jaxb-api</artifactId>
-			<exclusions>
-				<exclusion>
-					<artifactId>jsr173</artifactId>
-					<groupId>javax.xml</groupId>
-				</exclusion>
-			</exclusions>
-		</dependency>
-		<dependency>
-			<groupId>com.sun.xml.ws</groupId> 
-			<artifactId>jaxws-rt</artifactId>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.axis2</groupId>
+        <artifactId>axis2-parent</artifactId>
+        <version>SNAPSHOT</version>
+        <relativePath>../parent/pom.xml</relativePath>
+    </parent>
+    <artifactId>axis2-metadata</artifactId>
+    <name>Apache Axis 2.0 - Metadata</name>
+    <description>JSR-181 and JSR-224 Annotations Processing</description>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.axis2</groupId>
+            <artifactId>axis2-kernel</artifactId>
+            <version>${version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.axis2</groupId>
+            <artifactId>axis2-jws-api</artifactId>
+            <version>${version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.axis2</groupId>
+            <artifactId>axis2-jaxws-api</artifactId>
+            <version>${version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.axis2</groupId>
+            <artifactId>axis2-saaj</artifactId>
+            <version>${version}</version>
+        </dependency>
+        <dependency>
+            <groupId>xml-resolver</groupId>
+            <artifactId>xml-resolver</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-impl</artifactId>
+            <exclusions>
+                <exclusion>
+                    <artifactId>jsr173</artifactId>
+                    <groupId>javax.xml</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-xjc</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>javax.xml.bind</groupId>
+            <artifactId>jaxb-api</artifactId>
+            <exclusions>
+                <exclusion>
+                    <artifactId>jsr173</artifactId>
+                    <groupId>javax.xml</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.xml.ws</groupId> 
+            <artifactId>jaxws-rt</artifactId>
             <scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>com.sun.xml.ws</groupId> 
-			<artifactId>jaxws-tools</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.xml.ws</groupId> 
+            <artifactId>jaxws-tools</artifactId>
             <scope>provided</scope>
-		</dependency>
-	</dependencies>
-	<build>
-		<sourceDirectory>src</sourceDirectory>
-		<testSourceDirectory>test</testSourceDirectory>
-		<resources>
-			<resource>
-				<directory>src</directory>
-				<excludes>
-					<exclude>*.java</exclude>
-				</excludes>
-			</resource>
-		</resources>
-		<plugins>
+        </dependency>
+    </dependencies>
+    <build>
+        <sourceDirectory>src</sourceDirectory>
+        <testSourceDirectory>test</testSourceDirectory>
+        <resources>
+            <resource>
+                <directory>src</directory>
+                <excludes>
+                    <exclude>*.java</exclude>
+                </excludes>
+            </resource>
+        </resources>
+        <plugins>
             <plugin>
                 <artifactId>maven-compiler-plugin</artifactId>
                 <inherited>true</inherited>
@@ -110,89 +114,89 @@
                     <target>1.5</target>
                 </configuration>
             </plugin>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-antrun-plugin</artifactId>
-				<executions>
-					<execution>
-						<id>gen-ts</id>
-						<phase>generate-test-sources</phase>
-						<configuration>
-							<tasks>
-								<!-- Theres got to be a better way to do this -->
-								<property name="schema.source.dir" value="test-resources/xsd"/>
-								<property name="wsdl.source.dir" value="test-resources/wsdl"/>
-								<property name="schema.output.base.dir" value="target/schema"/>
-								<property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
-								<property name="schema.generated.classes.dir" value="${schema.output.base.dir}/classes"/>
-								<!-- make the dirs -->
-								<mkdir dir="${schema.output.base.dir}"/>
-								<mkdir dir="${schema.generated.src.dir}"/>
-								<mkdir dir="${schema.generated.classes.dir}"/>
-								<!-- Run JAXB schema compiler with designated schemas -->
-								<echo>Generating JAX-B classes from XSDs</echo>
-								<echo>Generating java from ProxyDocLitWrapped.wsdl</echo>
-								<java classname="com.sun.tools.xjc.Driver" fork="true">
-									<classpath refid="maven.runtime.classpath"/>
-									<classpath location="${compiled.classes.dir}"/>
-									<arg line="-d ${schema.generated.src.dir} -quiet -p org.test.proxy.doclitwrapped -quiet -wsdl ${wsdl.source.dir}/ProxyDocLitWrapped.wsdl"/>
-								</java>
-							</tasks>
-						</configuration>
-						<goals>
-							<goal>run</goal>
-						</goals>
-					</execution>
-					<execution>
-						<id>build-repo</id>
-						<phase>test-compile</phase>
-						<configuration>
-							<tasks>
-								<copy toDir="target/test-classes/">
-									<fileset dir="test-resources/">
-										<include name="**/*.properties"/>
-									</fileset>
-									<fileset dir="test">
-										<include name="org/apache/axis2/jaxws/description/HandlerConfigFile.xml"/>
-									</fileset>
-								</copy>
-							</tasks>
-						</configuration>
-						<goals>
-							<goal>run</goal>
-						</goals>
-					</execution>
-					
-				</executions>
-			</plugin>
-			<plugin>
-				<groupId>org.codehaus.mojo</groupId>
-				<artifactId>build-helper-maven-plugin</artifactId>
-				<executions>
-					<execution>
-						<id>add-test-source</id>
-						<phase>process-test-resources</phase>
-						<goals>
-							<goal>add-test-source</goal>
-						</goals>
-						<configuration>
-							<sources>
-								<source>${basedir}/target/schema/src</source>
-							</sources>
-						</configuration>
-					</execution>
-				</executions>
-			</plugin>
-			<plugin>
-				<artifactId>maven-surefire-plugin</artifactId>
-				<inherited>true</inherited>
-				<configuration>
-					<skip>false</skip>
-					<includes>
-						<include>**/*Tests.java</include>
-					</includes>
-				</configuration>
-			</plugin>
-		</plugins>
-	</build>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>gen-ts</id>
+                        <phase>generate-test-sources</phase>
+                        <configuration>
+                            <tasks>
+                                <!-- Theres got to be a better way to do this -->
+                                <property name="schema.source.dir" value="test-resources/xsd"/>
+                                <property name="wsdl.source.dir" value="test-resources/wsdl"/>
+                                <property name="schema.output.base.dir" value="target/schema"/>
+                                <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
+                                <property name="schema.generated.classes.dir" value="${schema.output.base.dir}/classes"/>
+                                <!-- make the dirs -->
+                                <mkdir dir="${schema.output.base.dir}"/>
+                                <mkdir dir="${schema.generated.src.dir}"/>
+                                <mkdir dir="${schema.generated.classes.dir}"/>
+                                <!-- Run JAXB schema compiler with designated schemas -->
+                                <echo>Generating JAX-B classes from XSDs</echo>
+                                <echo>Generating java from ProxyDocLitWrapped.wsdl</echo>
+                                <java classname="com.sun.tools.xjc.Driver" fork="true">
+                                    <classpath refid="maven.runtime.classpath"/>
+                                    <classpath location="${compiled.classes.dir}"/>
+                                    <arg line="-d ${schema.generated.src.dir} -quiet -p org.test.proxy.doclitwrapped -quiet -wsdl ${wsdl.source.dir}/ProxyDocLitWrapped.wsdl"/>
+                                </java>
+                            </tasks>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>build-repo</id>
+                        <phase>test-compile</phase>
+                        <configuration>
+                            <tasks>
+                                <copy toDir="target/test-classes/">
+                                    <fileset dir="test-resources/">
+                                        <include name="**/*.properties"/>
+                                    </fileset>
+                                    <fileset dir="test">
+                                        <include name="org/apache/axis2/jaxws/description/HandlerConfigFile.xml"/>
+                                    </fileset>
+                                </copy>
+                            </tasks>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+                    
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>add-test-source</id>
+                        <phase>process-test-resources</phase>
+                        <goals>
+                            <goal>add-test-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>${basedir}/target/schema/src</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <inherited>true</inherited>
+                <configuration>
+                    <skip>false</skip>
+                    <includes>
+                        <include>**/*Tests.java</include>
+                    </includes>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>

Added: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/catalog/JAXWSCatalogManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/catalog/JAXWSCatalogManager.java?rev=630959&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/catalog/JAXWSCatalogManager.java (added)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/catalog/JAXWSCatalogManager.java Mon Feb 25 11:09:01 2008
@@ -0,0 +1,97 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.jaxws.catalog;
+
+import java.util.Vector;
+
+import org.apache.xml.resolver.Catalog;
+
+public abstract interface JAXWSCatalogManager {
+
+  /**
+   * What is the current verbosity?
+   */
+  abstract public int getVerbosity();
+
+  /**
+   * Set the current verbosity.
+   */
+  abstract public void setVerbosity (int verbosity);
+
+  /**
+   * Return the current list of catalog files.
+   *
+   * @return A vector of the catalog file names or null if no catalogs
+   * are available in the properties.
+   */
+  abstract public Vector getCatalogFiles();
+  
+  /**
+   * Set the list of catalog files.
+   */
+  abstract public void setCatalogFiles(String fileList);
+
+  /**
+   * Return the current prefer public setting.
+   *
+   * @return True if public identifiers are preferred.
+   */
+  abstract public boolean getPreferPublic ();
+  
+  /**
+   * Set the prefer public setting.
+   */
+  abstract public void setPreferPublic (boolean preferPublic);
+
+  /**
+   * Get the current use static catalog setting.
+   */
+  abstract public boolean getUseStaticCatalog();
+
+  /**
+   * Set the use static catalog setting.
+   */
+  abstract public void setUseStaticCatalog(boolean useStatic);
+
+  /**
+   * Get a new catalog instance.
+   *
+   * This method always returns a new instance of the underlying catalog class.
+   */
+  abstract public Catalog getPrivateCatalog(); 
+  
+  /**
+   * Get a catalog instance.
+   *
+   * If this manager uses static catalogs, the same static catalog will
+   * always be returned. Otherwise a new catalog will be returned.
+   */
+  abstract public Catalog getCatalog();
+
+  /**
+   * Get the current Catalog class name.
+   */
+  abstract public String getCatalogClassName();
+
+  /**
+   * Set the Catalog class name.
+   */
+  abstract public void setCatalogClassName(String className); 
+}

Added: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/catalog/impl/OASISCatalogManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/catalog/impl/OASISCatalogManager.java?rev=630959&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/catalog/impl/OASISCatalogManager.java (added)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/catalog/impl/OASISCatalogManager.java Mon Feb 25 11:09:01 2008
@@ -0,0 +1,141 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.jaxws.catalog.impl;
+
+import java.util.logging.Logger;
+
+import org.apache.axis2.jaxws.catalog.JAXWSCatalogManager;
+import org.apache.xml.resolver.Catalog;
+import org.apache.xml.resolver.CatalogManager;
+
+/**
+ *  OASISCatalogManager provides an interface to the catalog properties.
+ *  The primary difference between this and the 
+ *  org.apache.xml.resolver.CatalogManger is that the staticCatalog is not
+ *  a static data member in the OASISCatalogManger class.  This enables the use
+ *  of a static catalog per CatalogManager.  
+ */
+public class OASISCatalogManager extends CatalogManager implements JAXWSCatalogManager {
+    public static final String DEFAULT_CATALOG_NAME = "WEB-INF/jax-ws-catalog.xml";
+    public static final String CATALOG_DEBUG_KEY = "OASISCatalogManager.catalog.debug.level";
+
+    private static final Logger LOG =
+    	Logger.getLogger(OASISCatalogManager.class.getName());
+    private static final String DEBUG_LEVEL = System.getProperty(CATALOG_DEBUG_KEY);
+
+    /** The static catalog used by this manager. */
+    private Catalog staticCatalog = null;
+
+    /**
+     * Default constructor with no arguments.
+     * This constructor will use the defaults specified for Axis2 in the
+     * acceptDefaults method.
+     */
+    public OASISCatalogManager() {
+    	super();
+    	this.acceptDefaults();
+    	if (DEBUG_LEVEL != null) {
+    		this.debug.setDebug(Integer.parseInt(DEBUG_LEVEL)); 
+    	}
+    }
+
+    /**
+     * Constructor that specifies an explicit property file.
+     * @param propertyFileName
+     */
+    public OASISCatalogManager(String propertyFileName) {
+    	super(propertyFileName);
+        if (DEBUG_LEVEL != null) {
+            this.debug.setDebug(Integer.parseInt(DEBUG_LEVEL));            
+        }
+    }
+    
+    private void acceptDefaults() {
+    	this.setUseStaticCatalog(true);
+    	this.setIgnoreMissingProperties(true);
+    	this.setCatalogFiles(DEFAULT_CATALOG_NAME);
+    }
+    
+    /**
+     * Get a catalog instance.
+     *
+     * If this manager uses static catalogs, the same static catalog will
+     * always be returned. Otherwise a new catalog will be returned.
+     */
+    public Catalog getCatalog() {
+        Catalog catalog = staticCatalog;
+
+        if (catalog == null || !super.getUseStaticCatalog()) {
+            catalog = getPrivateCatalog();
+        }
+        return catalog;
+    }
+    
+    /**
+     * Get a new catalog instance.
+     *
+     * This method returns an instance of the underlying catalog class.
+     */
+    public Catalog getPrivateCatalog() {
+        Catalog catalog = staticCatalog;
+        boolean useStatic = super.getUseStaticCatalog();
+
+        if (catalog == null || !useStatic) {
+            try {
+  	            String catalogClassName = getCatalogClassName();
+  	            if (catalogClassName == null) {
+  	                catalog = new Catalog();
+  	            } else {
+  	                try {
+  	                    catalog = (Catalog) Class.forName(catalogClassName).newInstance();
+  	                } catch (ClassNotFoundException cnfe) {
+  	                    debug.message(1,"Catalog class named '"
+  			                          + catalogClassName
+  			                          + "' could not be found. Using default.");
+  	                    catalog = new Catalog();
+  	                } catch (ClassCastException cnfe) {
+  	                    debug.message(1,"Class named '"
+  			                          + catalogClassName
+  			                          + "' is not a Catalog. Using default.");
+  	                    catalog = new Catalog();
+  	                }
+  	            }
+
+  	            catalog.setCatalogManager(this);
+  	            catalog.setupReaders();
+  	            catalog.loadSystemCatalogs();
+            } catch (Exception ex) {
+  	            ex.printStackTrace();
+            }
+
+  	        staticCatalog = catalog;
+        }
+
+        return catalog;
+    }
+    
+    /**
+     * Set the list of catalog files.
+     * This method will reset the staticCatalog for this CatalogManager.
+     */
+    public void setCatalogFiles(String fileList) {
+    	staticCatalog = null;
+    	super.setCatalogFiles(fileList);
+    }
+}

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java?rev=630959&r1=630958&r2=630959&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java Mon Feb 25 11:09:01 2008
@@ -127,7 +127,7 @@
      * This is the same as calling getHandlerChain(null).
      * @see #getHandlerChain(Object)
      */
-public abstract HandlerChainsType getHandlerChain();
+    public abstract HandlerChainsType getHandlerChain();
 
     /**
      * Set the binding type FOR A CLIENT.  The BindingType annotation is not valid on the client per

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/ServiceDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/ServiceDescription.java?rev=630959&r1=630958&r2=630959&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/ServiceDescription.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/ServiceDescription.java Mon Feb 25 11:09:01 2008
@@ -21,6 +21,7 @@
 import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.jaxws.description.xml.handler.HandlerChainsType;
+import org.apache.axis2.jaxws.catalog.JAXWSCatalogManager;
 import javax.xml.namespace.QName;
 import java.util.Collection;
 import java.util.List;
@@ -141,4 +142,6 @@
     public boolean isMTOMEnabled(Object key);
     
     public QName getPreferredPort(Object key);
-}
\ No newline at end of file
+    
+    public JAXWSCatalogManager getCatalogManager();
+}

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java?rev=630959&r1=630958&r2=630959&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java Mon Feb 25 11:09:01 2008
@@ -24,6 +24,7 @@
 
 import org.apache.axis2.java.security.AccessController;
 import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.catalog.JAXWSCatalogManager;
 import org.apache.axis2.jaxws.description.xml.handler.HandlerChainsType;
 import org.apache.axis2.jaxws.util.WSDL4JWrapper;
 import org.apache.commons.logging.Log;
@@ -131,6 +132,9 @@
     // resource.
     private WeakHashMap<Object, DescriptionBuilderComposite> sparseCompositeMap = new WeakHashMap<Object, DescriptionBuilderComposite>();
     
+    // Allow a unique XML CatalogManager per service description.
+    private JAXWSCatalogManager catalogManager = null;
+    
     public void setSparseComposite(Object key, DescriptionBuilderComposite sparseComposite) {
         if (key != null && sparseComposite != null) {
             this.sparseCompositeMap.put(key, sparseComposite);
@@ -696,6 +700,22 @@
         return theCorrespondingClass;
     }
 
+    /**
+     * Set the Catalog Manager associated with this composite.  
+     * @param theCatalogManger
+     */
+    public void setCatalogManager(JAXWSCatalogManager theCatalogManager) {
+    	this.catalogManager = theCatalogManager;
+    }
+    
+    /**
+     * Returns the catalog manager associated with this composite, if any.
+     * @return
+     */
+    public JAXWSCatalogManager getCatalogManager() {
+    	return catalogManager;
+    }
+    
     /**
      * @deprecated
      */

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java?rev=630959&r1=630958&r2=630959&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java Mon Feb 25 11:09:01 2008
@@ -1,569 +1,600 @@
-package org.apache.axis2.jaxws.description.builder;
-
-import com.sun.tools.ws.spi.WSToolsObjectFactory;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.util.SchemaUtil;
-import org.apache.axis2.dataretrieval.SchemaSupplier;
-import org.apache.axis2.dataretrieval.WSDLSupplier;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.transport.http.HTTPConstants;
-import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
-import org.xml.sax.InputSource;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.wsdl.Definition;
-import javax.wsdl.WSDLException;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.soap.SOAPBinding;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.net.URLDecoder;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-import java.util.jar.Attributes;
-import java.util.jar.JarFile;
-import java.util.jar.JarInputStream;
-import java.util.jar.Manifest;
-
-/**
- * This class will implement an interface that is defined by the
- * MDQ code. It will be registered within the MDQ framework, and the
- * MDQ code will call this when it finds an application that was
- * deployed without WSDL. This class will use the WsGen tool to
- * generate a WSDL Definition based on the Java source for the application.
- */
-public class JAXWSRIWSDLGenerator implements SchemaSupplier, WSDLSupplier {
-
-    private static final Log log = LogFactory.getLog(JAXWSRIWSDLGenerator.class);
-
-    private String classPath;
-
-    private AxisService axisService;
-    private boolean init = false;
-    private HashMap<String, XmlSchema> docMap;
-    private HashMap<String, Definition> wsdlDefMap;
-
-    public JAXWSRIWSDLGenerator(AxisService axisService) {
-        this.axisService = axisService;
-    }
-
-    /**
-     * This method will drive the call to WsGen to generate a WSDL file for
-     * applications deployed without WSDL. We will then read this file in from
-     * disk and create a Definition. After we are done with the file we will
-     * remove it from disk.
-     */
-    public void generateWsdl(String className, String bindingType) throws
-            WebServiceException {
-
-        AxisConfiguration axisConfiguration = axisService.getAxisConfiguration();
-        File tempFile = (File) axisConfiguration.getParameterValue(
-                Constants.Configuration.ARTIFACTS_TEMP_DIR);
-        if (tempFile == null) {
-            tempFile = new File(System.getProperty("java.io.tmpdir"), "_axis2");
-        }
-
-        Parameter servletConfigParam = axisConfiguration
-                .getParameter(HTTPConstants.HTTP_SERVLETCONFIG);
-
-        if (servletConfigParam == null) {
-            throw new WebServiceException("Axis2 Can't find ServletConfigParameter");
-        }
-        Object obj = servletConfigParam.getValue();
-        ServletContext servletContext;
-        String webBase = null;
-
-        if (obj instanceof ServletConfig) {
-            ServletConfig servletConfig = (ServletConfig) obj;
-            servletContext = servletConfig.getServletContext();
-            webBase = servletContext.getRealPath("/WEB-INF");
-        } else {
-            throw new WebServiceException("Axis2 Can't find ServletConfig");
-        }
-
-        this.classPath = getDefaultClasspath(webBase);
-        if (log.isDebugEnabled()) {
-            log.debug("For implementation class " + className +
-                    " WsGen classpath: " +
-                    classPath);
-        }
-        String localOutputDirectory = tempFile.getAbsolutePath() + className;
-        if (log.isDebugEnabled()) {
-            log.debug("Output directory for generated WSDL file: " + localOutputDirectory);
-        }
-        boolean errorOnRead = false;
-        try {
-
-            if (log.isDebugEnabled()) {
-                log.debug("Generating new WSDL Definition");
-            }
-
-            createOutputDirectory(localOutputDirectory);
-            WSToolsObjectFactory factory = WSToolsObjectFactory.newInstance();
-            String[] arguments = getWsGenArguments(className, bindingType, localOutputDirectory);
-            OutputStream os = new ByteArrayOutputStream();
-            factory.wsgen(os, arguments);
-            os.close();
-            wsdlDefMap = readInWSDL(localOutputDirectory);
-            if (wsdlDefMap.isEmpty()) {
-                throw new Exception("A WSDL Definition could not be generated for " +
-                        "the implementation class: " + className);
-            }
-            docMap = readInSchema(localOutputDirectory);
-        }
-        catch (Throwable t) {
-            String msg =
-                    "Error occurred generating WSDL file for Web service implementation class " +
-                            "{" + className + "}: {" + t + "}";
-            log.error(msg);
-            throw new WebServiceException(msg, t);
-        }
-    }
-
-    /**
-     * This will set up the arguments that will be used by the WsGen tool.
-     */
-    private String[] getWsGenArguments(String className, String bindingType, String localOutputDirectory) throws
-            WebServiceException {
-        String[] arguments = null;
-        if (bindingType == null || bindingType.equals("") || bindingType.equals(
-                SOAPBinding.SOAP11HTTP_BINDING) || bindingType.equals(
-                SOAPBinding.SOAP11HTTP_MTOM_BINDING)) {
-            if (log.isDebugEnabled()) {
-                log.debug("Generating WSDL with SOAP 1.1 binding type");
-            }
-            arguments = new String[]{"-cp", classPath, className, "-keep", "-wsdl:soap1.1", "-d",
-                    localOutputDirectory};
-        } else if (bindingType.equals(SOAPBinding.SOAP12HTTP_BINDING) || bindingType.equals(
-                SOAPBinding.SOAP12HTTP_MTOM_BINDING)) {
-            if (log.isDebugEnabled()) {
-                log.debug("Generating WSDL with SOAP 1.2 binding type");
-            }
-            arguments = new String[]{"-cp", classPath, className, "-keep", "-extension",
-                    "-wsdl:Xsoap1.2", "-d", localOutputDirectory};
-        } else {
-            throw new WebServiceException("The binding " + bindingType + " specified by the " +
-                    "class " + className + " cannot be used to generate a WSDL. Please choose " +
-                    "a supported binding type.");
-        }
-        return arguments;
-    }
-
-    /**
-     * This method will be used to create a Definition based on the
-     * WSDL file generated by WsGen.
-     */
-    private HashMap<String, Definition> readInWSDL(String localOutputDirectory) throws Exception {
-        List<File> wsdlFiles = getWSDLFiles(localOutputDirectory);
-        HashMap<String, Definition> wsdlDefMap = new HashMap<String, Definition>();
-        for (File wsdlFile : wsdlFiles) {
-            if (wsdlFile != null) {
-                try {
-                    WSDLFactory wsdlFactory = WSDLFactory.newInstance();
-                    WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
-                    InputStream is = wsdlFile.toURL().openStream();
-                    Definition definition = wsdlReader.readWSDL(localOutputDirectory,
-                            new InputSource(is));
-                    try {
-                        definition.setDocumentBaseURI(wsdlFile.toURI().toString());
-                        if (log.isDebugEnabled()) {
-                            log.debug("Set base document URI for generated WSDL: " +
-                                    wsdlFile.toURI().toString());
-                        }
-                    }
-                    catch (Throwable t) {
-                        if (log.isDebugEnabled()) {
-                            log.debug("Could not set base document URI for generated " +
-                                    "WSDL: " + wsdlFile.getAbsolutePath() + " : " +
-                                    t.toString());
-                        }
-                    }
-                    wsdlDefMap.put(wsdlFile.getName().toLowerCase(), definition);
-                }
-                catch (WSDLException e) {
-                    String msg = "Error occurred while attempting to create Definition from " +
-                            "generated WSDL file {" + wsdlFile.getName() + "}: {" + e + "}";
-                    log.error(msg);
-                    throw new Exception(msg);
-                }
-                catch (IOException e) {
-                    String msg = "Error occurred while attempting to create Definition from " +
-                            "generated WSDL file  {" + wsdlFile.getName() + "}: {" + e + "}";
-                    log.error(msg);
-                    throw new Exception(msg);
-                }
-            }
-        }
-        return wsdlDefMap;
-    }
-
-    /**
-     * This method will be used to locate the WSDL file that was
-     * generated by WsGen. There should be only one file with the
-     * ".wsdl" extension in this directory.
-     */
-    private List<File> getWSDLFiles(String localOutputDirectory) {
-        File classDirectory = new File(localOutputDirectory);
-        ArrayList<File> wsdlFiles = new ArrayList<File>();
-        if (classDirectory.isDirectory()) {
-            File[] files = classDirectory.listFiles();
-            for (File file : files) {
-                String fileName = file.getName();
-                if (fileName.endsWith(".wsdl")) {
-                    if (log.isDebugEnabled()) {
-                        log.debug("Located generated WSDL file: " + fileName);
-                    }
-                    wsdlFiles.add(file);
-                }
-            }
-        }
-        return wsdlFiles;
-    }
-
-    /**
-     * This file will create the directory we will use as the output
-     * directory argument in our call to WsGen.
-     */
-    private void createOutputDirectory(String localOutputDirectory) {
-        File directory = new File(localOutputDirectory);
-        if (!directory.isDirectory()) {
-            directory.mkdirs();
-        }
-    }
-
-    /**
-     * This method will read in all of the schema files that were generated
-     * for a given application.
-     */
-    private HashMap<String, XmlSchema> readInSchema(String localOutputDirectory) throws Exception {
-        try {
-
-            XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
-            schemaCollection.setBaseUri(new File(localOutputDirectory).getAbsolutePath());
-
-
-            HashMap<String, XmlSchema> docMap = new HashMap<String, XmlSchema>();
-            List<File> schemaFiles = getSchemaFiles(localOutputDirectory);
-            for (File schemaFile : schemaFiles) {
-                XmlSchema doc = schemaCollection.read(new InputSource(schemaFile.toURL().toString()), null);
-                if (log.isDebugEnabled()) {
-                    log.debug("Read in schema file: " + schemaFile.getName());
-                }
-                docMap.put(schemaFile.getName(), doc);
-            }
-            return docMap;
-        }
-        catch (Exception e) {
-            String msg =
-                    "Error occurred while attempting to read generated schema file {" + e + "}";
-            log.error(msg);
-            throw new Exception(msg);
-        }
-    }
-
-    /**
-     * This method will return a list of file objects that represent all the
-     * schema files in the current directory.
-     */
-    private List<File> getSchemaFiles(String localOutputDirectory) {
-        ArrayList<File> schemaFiles = new ArrayList<File>();
-        File classDirectory = new File(localOutputDirectory);
-        if (classDirectory.isDirectory()) {
-            File[] files = classDirectory.listFiles();
-            for (File file : files) {
-                String fileName = file.getName();
-                if (fileName.endsWith(".xsd")) {
-                    if (log.isDebugEnabled()) {
-                        log.debug("Located generated schema file: " + fileName);
-                    }
-                    schemaFiles.add(file);
-                }
-            }
-        }
-        return schemaFiles;
-    }
-
-    public Definition getWSDL(AxisService service) throws AxisFault {
-        Parameter wsdlParameter = service.getParameter(WSDLConstants.WSDL_4_J_DEFINITION);
-        if (wsdlParameter != null) {
-            Object value = wsdlParameter.getValue();
-            if (value != null) {
-                return (Definition) value;
-            }
-        }
-        initialize();
-        return wsdlDefMap.values().iterator().next();
-    }
-
-    private synchronized void initialize() {
-        String className = (String) axisService.getParameter(Constants.SERVICE_CLASS).getValue();
-        if (!init) {
-            generateWsdl(className, SOAPBinding.SOAP11HTTP_BINDING);
-            init = true;
-        }
-    }
-
-    public XmlSchema getSchema(AxisService service, String xsd) throws AxisFault {
-        Parameter wsdlParameter = service.getParameter(WSDLConstants.WSDL_4_J_DEFINITION);
-        if (wsdlParameter != null) {
-            ArrayList list = service.getSchema();
-            if (list.size() > 0) {
-                if (xsd == null || xsd.length() == 0) {
-                    return (XmlSchema) list.get(0);
-                }
-
-                for (Iterator iterator = list.iterator(); iterator.hasNext();) {
-                    XmlSchema schema = (XmlSchema) iterator.next();
-                    XmlSchema[] schemas = SchemaUtil.getAllSchemas(schema);
-                    for (int i = 0; i < schemas.length; i++) {
-                        String uri = schemas[i].getSourceURI();
-                        if (uri != null && uri.endsWith(xsd)) {
-                            return schemas[i];
-                        }
-                    }
-                }
-                return (XmlSchema) list.get(0);
-            }
-        }
-        initialize();
-        XmlSchema schema = docMap.get(xsd);
-        if (schema == null) {
-            docMap.values().iterator().next();
-        }
-        return schema;
-    }
-
-    /**
-     * Expand a directory path or list of directory paths (File.pathSeparator
-     * delimited) into a list of file paths of all the jar files in those
-     * directories.
-     *
-     * @param dirPaths The string containing the directory path or list of
-     *                 directory paths.
-     * @return The file paths of the jar files in the directories. This is an
-     *         empty string if no files were found, and is terminated by an
-     *         additional pathSeparator in all other cases.
-     */
-    public static String expandDirs(String dirPaths) {
-        StringTokenizer st = new StringTokenizer(dirPaths, File.pathSeparator);
-        StringBuffer buffer = new StringBuffer();
-        while (st.hasMoreTokens()) {
-            String d = st.nextToken();
-            File dir = new File(d);
-            if (dir.isDirectory()) {
-                File[] files = dir.listFiles(new JavaArchiveFilter());
-                for (int i = 0; i < files.length; i++) {
-                    buffer.append(files[i]).append(File.pathSeparator);
-                }
-            }
-        }
-        return buffer.toString();
-    }
-
-    /**
-     * Check if this inputstream is a jar/zip
-     *
-     * @param is
-     * @return true if inputstream is a jar
-     */
-    public static boolean isJar(InputStream is) {
-        try {
-            JarInputStream jis = new JarInputStream(is);
-            if (jis.getNextEntry() != null) {
-                return true;
-            }
-        } catch (IOException ioe) {
-        }
-        return false;
-    }
-
-    /**
-     * Get the default classpath from various thingies in the message context
-     *
-     * @param msgContext
-     * @return default classpath
-     */
-    public static String getDefaultClasspath(String webBase) {
-        HashSet classpath = new HashSet();
-        ClassLoader cl = Thread.currentThread().getContextClassLoader();
-        fillClassPath(cl, classpath);
-
-        // Just to be safe (the above doesn't seem to return the webapp
-        // classpath in all cases), manually do this:
-        if (webBase != null) {
-            addPath(classpath, webBase + File.separatorChar + "classes");
-            try {
-                String libBase = webBase + File.separatorChar + "lib";
-                File libDir = new File(libBase);
-                String[] jarFiles = libDir.list();
-                for (int i = 0; i < jarFiles.length; i++) {
-                    String jarFile = jarFiles[i];
-                    if (jarFile.endsWith(".jar")) {
-                        addPath(classpath, libBase +
-                                File.separatorChar +
-                                jarFile);
-                    }
-                }
-            } catch (Exception e) {
-                // Oh well.  No big deal.
-            }
-        }
-
-        // axis.ext.dirs can be used in any appserver
-        getClassPathFromDirectoryProperty(classpath, "axis.ext.dirs");
-
-        // classpath used by Jasper 
-        getClassPathFromProperty(classpath, "org.apache.catalina.jsp_classpath");
-
-        // websphere stuff.
-        getClassPathFromProperty(classpath, "ws.ext.dirs");
-        getClassPathFromProperty(classpath, "com.ibm.websphere.servlet.application.classpath");
-
-        // java class path
-        getClassPathFromProperty(classpath, "java.class.path");
-
-        // Load jars from java external directory
-        getClassPathFromDirectoryProperty(classpath, "java.ext.dirs");
-
-        // boot classpath isn't found in above search
-        getClassPathFromProperty(classpath, "sun.boot.class.path");
-        
-        StringBuffer path = new StringBuffer();
-        for (Iterator iterator = classpath.iterator(); iterator.hasNext();) {
-            String s = (String) iterator.next();
-            path.append(s);
-            path.append(File.pathSeparatorChar);
-        }
-        log.debug(path);
-        return path.toString();
-    }
-
-    private static void addPath(HashSet classpath, String s) {
-        String path = s.replace(((File.separatorChar == '/') ? '\\' : '/'), File.separatorChar).trim();
-        File file = new File(path);
-        if (file.exists()) {
-            path = file.getAbsolutePath();
-            classpath.add(path);
-        }
-    }
-
-    /**
-     * Add all files in the specified directory to the classpath
-     *
-     * @param classpath
-     * @param property
-     */
-    private static void getClassPathFromDirectoryProperty(HashSet classpath, String property) {
-        String dirs = System.getProperty(property);
-        String path = null;
-        try {
-            path = expandDirs(dirs);
-        } catch (Exception e) {
-            // Oh well.  No big deal.
-        }
-        if (path != null) {
-            addPath(classpath, path);
-        }
-    }
-
-    /**
-     * Add a classpath stored in a property.
-     *
-     * @param classpath
-     * @param property
-     */
-    private static void getClassPathFromProperty(HashSet classpath, String property) {
-        String path = System.getProperty(property);
-        if (path != null) {
-            addPath(classpath, path);
-        }
-    }
-
-    /**
-     * Walk the classloader hierarchy and add to the classpath
-     *
-     * @param cl
-     * @param classpath
-     */
-    private static void fillClassPath(ClassLoader cl, HashSet classpath) {
-        while (cl != null) {
-            if (cl instanceof URLClassLoader) {
-                URL[] urls = ((URLClassLoader) cl).getURLs();
-                for (int i = 0; (urls != null) && i < urls.length; i++) {
-                    String path = urls[i].getPath();
-                    //If it is a drive letter, adjust accordingly.
-                    if (path.length() >= 3 && path.charAt(0) == '/' && path.charAt(2) == ':')
-                        path = path.substring(1);
-                    addPath(classpath, URLDecoder.decode(path));
-
-                    // if its a jar extract Class-Path entries from manifest
-                    File file = new File(urls[i].getFile());
-                    if (file.isFile()) {
-                        FileInputStream fis = null;
-                        try {
-                            fis = new FileInputStream(file);
-                            if (isJar(fis)) {
-                                JarFile jar = new JarFile(file);
-                                Manifest manifest = jar.getManifest();
-                                if (manifest != null) {
-                                    Attributes attributes = manifest.getMainAttributes();
-                                    if (attributes != null) {
-                                        String s = attributes.getValue(Attributes.Name.CLASS_PATH);
-                                        String base = file.getParent();
-                                        if (s != null) {
-                                            StringTokenizer st = new StringTokenizer(s, " ");
-                                            while (st.hasMoreTokens()) {
-                                                String t = st.nextToken();
-                                                addPath(classpath, base + File.separatorChar + t);
-                                            }
-                                        }
-                                    }
-                                }
-                            }
-                        } catch (IOException ioe) {
-                        } finally {
-                            if (fis != null) {
-                                try {
-                                    fis.close();
-                                } catch (IOException ioe2) {
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-            cl = cl.getParent();
-        }
-    }
-
-    /**
-     * Filter for zip/jar
-     */
-    private static class JavaArchiveFilter implements FileFilter {
-        public boolean accept(File file) {
-            String name = file.getName().toLowerCase();
-            return (name.endsWith(".jar") || name.endsWith(".zip"));
-        }
-    }
+package org.apache.axis2.jaxws.description.builder;
+
+import com.sun.tools.ws.spi.WSToolsObjectFactory;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.util.SchemaUtil;
+import org.apache.axis2.dataretrieval.SchemaSupplier;
+import org.apache.axis2.dataretrieval.WSDLSupplier;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.jaxws.catalog.impl.OASISCatalogManager;
+import org.apache.axis2.jaxws.catalog.JAXWSCatalogManager;
+import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.axis2.jaxws.util.CatalogURIResolver;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.xml.sax.InputSource;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.soap.SOAPBinding;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.jar.Attributes;
+import java.util.jar.JarFile;
+import java.util.jar.JarInputStream;
+import java.util.jar.Manifest;
+
+/**
+ * This class will implement an interface that is defined by the
+ * MDQ code. It will be registered within the MDQ framework, and the
+ * MDQ code will call this when it finds an application that was
+ * deployed without WSDL. This class will use the WsGen tool to
+ * generate a WSDL Definition based on the Java source for the application.
+ */
+public class JAXWSRIWSDLGenerator implements SchemaSupplier, WSDLSupplier {
+
+    private static final Log log = LogFactory.getLog(JAXWSRIWSDLGenerator.class);
+
+    private String classPath;
+
+    private AxisService axisService;
+    private boolean init = false;
+    private HashMap<String, XmlSchema> docMap;
+    private HashMap<String, Definition> wsdlDefMap;
+
+    public JAXWSRIWSDLGenerator(AxisService axisService) {
+        this.axisService = axisService;
+    }
+
+    /**
+     * This method will drive the call to WsGen to generate a WSDL file for
+     * applications deployed without WSDL. We will then read this file in from
+     * disk and create a Definition. After we are done with the file we will
+     * remove it from disk.
+     */
+    public void generateWsdl(String className, String bindingType) throws WebServiceException {
+    	generateWsdl(className, bindingType, null);
+    }
+    
+    /**
+     * This method will drive the call to WsGen to generate a WSDL file for
+     * applications deployed without WSDL. We will then read this file in from
+     * disk and create a Definition. After we are done with the file we will
+     * remove it from disk.  This method accepts a CatalogManager as a parameter
+     * for the eventual use in by an XMLSchemaCollection.
+     */
+    public void generateWsdl(String className, String bindingType, JAXWSCatalogManager catalogManager) throws
+            WebServiceException {
+
+        AxisConfiguration axisConfiguration = axisService.getAxisConfiguration();
+        File tempFile = (File) axisConfiguration.getParameterValue(
+                Constants.Configuration.ARTIFACTS_TEMP_DIR);
+        if (tempFile == null) {
+            tempFile = new File(System.getProperty("java.io.tmpdir"), "_axis2");
+        }
+
+        Parameter servletConfigParam = axisConfiguration
+                .getParameter(HTTPConstants.HTTP_SERVLETCONFIG);
+
+        if (servletConfigParam == null) {
+            throw new WebServiceException("Axis2 Can't find ServletConfigParameter");
+        }
+        Object obj = servletConfigParam.getValue();
+        ServletContext servletContext;
+        String webBase = null;
+
+        if (obj instanceof ServletConfig) {
+            ServletConfig servletConfig = (ServletConfig) obj;
+            servletContext = servletConfig.getServletContext();
+            webBase = servletContext.getRealPath("/WEB-INF");
+        } else {
+            throw new WebServiceException("Axis2 Can't find ServletConfig");
+        }
+
+        this.classPath = getDefaultClasspath(webBase);
+        if (log.isDebugEnabled()) {
+            log.debug("For implementation class " + className +
+                    " WsGen classpath: " +
+                    classPath);
+        }
+        String localOutputDirectory = tempFile.getAbsolutePath() + className;
+        if (log.isDebugEnabled()) {
+            log.debug("Output directory for generated WSDL file: " + localOutputDirectory);
+        }
+        boolean errorOnRead = false;
+        try {
+
+            if (log.isDebugEnabled()) {
+                log.debug("Generating new WSDL Definition");
+            }
+
+            createOutputDirectory(localOutputDirectory);
+            WSToolsObjectFactory factory = WSToolsObjectFactory.newInstance();
+            String[] arguments = getWsGenArguments(className, bindingType, localOutputDirectory);
+            OutputStream os = new ByteArrayOutputStream();
+            factory.wsgen(os, arguments);
+            os.close();
+            wsdlDefMap = readInWSDL(localOutputDirectory);
+            if (wsdlDefMap.isEmpty()) {
+                throw new Exception("A WSDL Definition could not be generated for " +
+                        "the implementation class: " + className);
+            }
+            docMap = readInSchema(localOutputDirectory, catalogManager);
+        }
+        catch (Throwable t) {
+            String msg =
+                    "Error occurred generating WSDL file for Web service implementation class " +
+                            "{" + className + "}: {" + t + "}";
+            log.error(msg);
+            throw new WebServiceException(msg, t);
+        }
+    }
+
+    /**
+     * This will set up the arguments that will be used by the WsGen tool.
+     */
+    private String[] getWsGenArguments(String className, String bindingType, String localOutputDirectory) throws
+            WebServiceException {
+        String[] arguments = null;
+        if (bindingType == null || bindingType.equals("") || bindingType.equals(
+                SOAPBinding.SOAP11HTTP_BINDING) || bindingType.equals(
+                SOAPBinding.SOAP11HTTP_MTOM_BINDING)) {
+            if (log.isDebugEnabled()) {
+                log.debug("Generating WSDL with SOAP 1.1 binding type");
+            }
+            arguments = new String[]{"-cp", classPath, className, "-keep", "-wsdl:soap1.1", "-d",
+                    localOutputDirectory};
+        } else if (bindingType.equals(SOAPBinding.SOAP12HTTP_BINDING) || bindingType.equals(
+                SOAPBinding.SOAP12HTTP_MTOM_BINDING)) {
+            if (log.isDebugEnabled()) {
+                log.debug("Generating WSDL with SOAP 1.2 binding type");
+            }
+            arguments = new String[]{"-cp", classPath, className, "-keep", "-extension",
+                    "-wsdl:Xsoap1.2", "-d", localOutputDirectory};
+        } else {
+            throw new WebServiceException("The binding " + bindingType + " specified by the " +
+                    "class " + className + " cannot be used to generate a WSDL. Please choose " +
+                    "a supported binding type.");
+        }
+        return arguments;
+    }
+
+    /**
+     * This method will be used to create a Definition based on the
+     * WSDL file generated by WsGen.
+     */
+    private HashMap<String, Definition> readInWSDL(String localOutputDirectory) throws Exception {
+        List<File> wsdlFiles = getWSDLFiles(localOutputDirectory);
+        HashMap<String, Definition> wsdlDefMap = new HashMap<String, Definition>();
+        for (File wsdlFile : wsdlFiles) {
+            if (wsdlFile != null) {
+                try {
+                    WSDLFactory wsdlFactory = WSDLFactory.newInstance();
+                    WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
+                    InputStream is = wsdlFile.toURL().openStream();
+                    Definition definition = wsdlReader.readWSDL(localOutputDirectory,
+                            new InputSource(is));
+                    try {
+                        definition.setDocumentBaseURI(wsdlFile.toURI().toString());
+                        if (log.isDebugEnabled()) {
+                            log.debug("Set base document URI for generated WSDL: " +
+                                    wsdlFile.toURI().toString());
+                        }
+                    }
+                    catch (Throwable t) {
+                        if (log.isDebugEnabled()) {
+                            log.debug("Could not set base document URI for generated " +
+                                    "WSDL: " + wsdlFile.getAbsolutePath() + " : " +
+                                    t.toString());
+                        }
+                    }
+                    wsdlDefMap.put(wsdlFile.getName().toLowerCase(), definition);
+                }
+                catch (WSDLException e) {
+                    String msg = "Error occurred while attempting to create Definition from " +
+                            "generated WSDL file {" + wsdlFile.getName() + "}: {" + e + "}";
+                    log.error(msg);
+                    throw new Exception(msg);
+                }
+                catch (IOException e) {
+                    String msg = "Error occurred while attempting to create Definition from " +
+                            "generated WSDL file  {" + wsdlFile.getName() + "}: {" + e + "}";
+                    log.error(msg);
+                    throw new Exception(msg);
+                }
+            }
+        }
+        return wsdlDefMap;
+    }
+
+    /**
+     * This method will be used to locate the WSDL file that was
+     * generated by WsGen. There should be only one file with the
+     * ".wsdl" extension in this directory.
+     */
+    private List<File> getWSDLFiles(String localOutputDirectory) {
+        File classDirectory = new File(localOutputDirectory);
+        ArrayList<File> wsdlFiles = new ArrayList<File>();
+        if (classDirectory.isDirectory()) {
+            File[] files = classDirectory.listFiles();
+            for (File file : files) {
+                String fileName = file.getName();
+                if (fileName.endsWith(".wsdl")) {
+                    if (log.isDebugEnabled()) {
+                        log.debug("Located generated WSDL file: " + fileName);
+                    }
+                    wsdlFiles.add(file);
+                }
+            }
+        }
+        return wsdlFiles;
+    }
+
+    /**
+     * This file will create the directory we will use as the output
+     * directory argument in our call to WsGen.
+     */
+    private void createOutputDirectory(String localOutputDirectory) {
+        File directory = new File(localOutputDirectory);
+        if (!directory.isDirectory()) {
+            directory.mkdirs();
+        }
+    }
+
+    /**
+     * This method will read in all of the schema files that were generated
+     * for a given application.
+     */
+    private HashMap<String, XmlSchema> readInSchema(String localOutputDirectory, 
+    		                                        JAXWSCatalogManager catalogManager) throws Exception {
+        try {
+
+            XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
+            if (catalogManager != null)
+                schemaCollection.setSchemaResolver(new CatalogURIResolver(catalogManager));
+            schemaCollection.setBaseUri(new File(localOutputDirectory).getAbsolutePath());
+
+            HashMap<String, XmlSchema> docMap = new HashMap<String, XmlSchema>();
+            List<File> schemaFiles = getSchemaFiles(localOutputDirectory);
+            for (File schemaFile : schemaFiles) {
+                XmlSchema doc = schemaCollection.read(new InputSource(schemaFile.toURL().toString()), null);
+                if (log.isDebugEnabled()) {
+                    log.debug("Read in schema file: " + schemaFile.getName());
+                }
+                docMap.put(schemaFile.getName(), doc);
+            }
+            return docMap;
+        }
+        catch (Exception e) {
+            String msg =
+                    "Error occurred while attempting to read generated schema file {" + e + "}";
+            log.error(msg);
+            throw new Exception(msg);
+        }
+    }
+
+    /**
+     * This method will return a list of file objects that represent all the
+     * schema files in the current directory.
+     */
+    private List<File> getSchemaFiles(String localOutputDirectory) {
+        ArrayList<File> schemaFiles = new ArrayList<File>();
+        File classDirectory = new File(localOutputDirectory);
+        if (classDirectory.isDirectory()) {
+            File[] files = classDirectory.listFiles();
+            for (File file : files) {
+                String fileName = file.getName();
+                if (fileName.endsWith(".xsd")) {
+                    if (log.isDebugEnabled()) {
+                        log.debug("Located generated schema file: " + fileName);
+                    }
+                    schemaFiles.add(file);
+                }
+            }
+        }
+        return schemaFiles;
+    }
+
+    public Definition getWSDL(AxisService service) throws AxisFault {
+        Parameter wsdlParameter = service.getParameter(WSDLConstants.WSDL_4_J_DEFINITION);
+        if (wsdlParameter != null) {
+            Object value = wsdlParameter.getValue();
+            if (value != null) {
+                return (Definition) value;
+            }
+        }
+        initialize(service);
+        return wsdlDefMap.values().iterator().next();
+    }
+
+    private synchronized void initialize(AxisService service) {
+        String className = (String) axisService.getParameter(Constants.SERVICE_CLASS).getValue();
+        if (!init) {
+            generateWsdl(className, SOAPBinding.SOAP11HTTP_BINDING, getCatalogManager(service));
+            init = true;
+        }
+    }
+
+    public XmlSchema getSchema(AxisService service, String xsd) throws AxisFault {
+        Parameter wsdlParameter = service.getParameter(WSDLConstants.WSDL_4_J_DEFINITION);
+        if (wsdlParameter != null) {
+            ArrayList list = service.getSchema();
+            if (list.size() > 0) {
+                if (xsd == null || xsd.length() == 0) {
+                    return (XmlSchema) list.get(0);
+                }
+
+                for (Iterator iterator = list.iterator(); iterator.hasNext();) {
+                    XmlSchema schema = (XmlSchema) iterator.next();
+                    XmlSchema[] schemas = SchemaUtil.getAllSchemas(schema);
+                    for (int i = 0; i < schemas.length; i++) {
+                        String uri = schemas[i].getSourceURI();
+                        if (uri != null && uri.endsWith(xsd)) {
+                            return schemas[i];
+                        }
+                    }
+                }
+                return (XmlSchema) list.get(0);
+            }
+        }
+        initialize(service);
+        XmlSchema schema = docMap.get(xsd);
+        if (schema == null) {
+            docMap.values().iterator().next();
+        }
+        return schema;
+    }
+
+    /**
+     * Expand a directory path or list of directory paths (File.pathSeparator
+     * delimited) into a list of file paths of all the jar files in those
+     * directories.
+     *
+     * @param dirPaths The string containing the directory path or list of
+     *                 directory paths.
+     * @return The file paths of the jar files in the directories. This is an
+     *         empty string if no files were found, and is terminated by an
+     *         additional pathSeparator in all other cases.
+     */
+    public static String expandDirs(String dirPaths) {
+        StringTokenizer st = new StringTokenizer(dirPaths, File.pathSeparator);
+        StringBuffer buffer = new StringBuffer();
+        while (st.hasMoreTokens()) {
+            String d = st.nextToken();
+            File dir = new File(d);
+            if (dir.isDirectory()) {
+                File[] files = dir.listFiles(new JavaArchiveFilter());
+                for (int i = 0; i < files.length; i++) {
+                    buffer.append(files[i]).append(File.pathSeparator);
+                }
+            }
+        }
+        return buffer.toString();
+    }
+
+    /**
+     * Check if this inputstream is a jar/zip
+     *
+     * @param is
+     * @return true if inputstream is a jar
+     */
+    public static boolean isJar(InputStream is) {
+        try {
+            JarInputStream jis = new JarInputStream(is);
+            if (jis.getNextEntry() != null) {
+                return true;
+            }
+        } catch (IOException ioe) {
+        }
+        return false;
+    }
+
+    /**
+     * Get the CatalogManager associated with an AxisService
+     * @return the CatalogManager in use for this AxisService
+     */
+    public static JAXWSCatalogManager getCatalogManager(AxisService service) {
+    	Parameter param = service.getParameter(EndpointDescription.AXIS_SERVICE_PARAMETER);
+
+    	if (param != null) {
+            EndpointDescription ed = (EndpointDescription)param.getValue();
+            return ed.getServiceDescription().getCatalogManager();
+    	} else
+    	    return new OASISCatalogManager();
+    }
+    
+    /**
+     * Get the default classpath from various thingies in the message context
+     *
+     * @param msgContext
+     * @return default classpath
+     */
+    public static String getDefaultClasspath(String webBase) {
+        HashSet classpath = new HashSet();
+        ClassLoader cl = Thread.currentThread().getContextClassLoader();
+        fillClassPath(cl, classpath);
+
+        // Just to be safe (the above doesn't seem to return the webapp
+        // classpath in all cases), manually do this:
+        if (webBase != null) {
+            addPath(classpath, webBase + File.separatorChar + "classes");
+            try {
+                String libBase = webBase + File.separatorChar + "lib";
+                File libDir = new File(libBase);
+                String[] jarFiles = libDir.list();
+                for (int i = 0; i < jarFiles.length; i++) {
+                    String jarFile = jarFiles[i];
+                    if (jarFile.endsWith(".jar")) {
+                        addPath(classpath, libBase +
+                                File.separatorChar +
+                                jarFile);
+                    }
+                }
+            } catch (Exception e) {
+                // Oh well.  No big deal.
+            }
+        }
+
+        // axis.ext.dirs can be used in any appserver
+        getClassPathFromDirectoryProperty(classpath, "axis.ext.dirs");
+
+        // classpath used by Jasper 
+        getClassPathFromProperty(classpath, "org.apache.catalina.jsp_classpath");
+
+        // websphere stuff.
+        getClassPathFromProperty(classpath, "ws.ext.dirs");
+        getClassPathFromProperty(classpath, "com.ibm.websphere.servlet.application.classpath");
+
+        // java class path
+        getClassPathFromProperty(classpath, "java.class.path");
+
+        // Load jars from java external directory
+        getClassPathFromDirectoryProperty(classpath, "java.ext.dirs");
+
+        // boot classpath isn't found in above search
+        getClassPathFromProperty(classpath, "sun.boot.class.path");
+        
+        StringBuffer path = new StringBuffer();
+        for (Iterator iterator = classpath.iterator(); iterator.hasNext();) {
+            String s = (String) iterator.next();
+            path.append(s);
+            path.append(File.pathSeparatorChar);
+        }
+        log.debug(path);
+        return path.toString();
+    }
+
+    private static void addPath(HashSet classpath, String s) {
+        String path = s.replace(((File.separatorChar == '/') ? '\\' : '/'), File.separatorChar).trim();
+        File file = new File(path);
+        if (file.exists()) {
+            path = file.getAbsolutePath();
+            classpath.add(path);
+        }
+    }
+
+    /**
+     * Add all files in the specified directory to the classpath
+     *
+     * @param classpath
+     * @param property
+     */
+    private static void getClassPathFromDirectoryProperty(HashSet classpath, String property) {
+        String dirs = System.getProperty(property);
+        String path = null;
+        try {
+            path = expandDirs(dirs);
+        } catch (Exception e) {
+            // Oh well.  No big deal.
+        }
+        if (path != null) {
+            addPath(classpath, path);
+        }
+    }
+
+    /**
+     * Add a classpath stored in a property.
+     *
+     * @param classpath
+     * @param property
+     */
+    private static void getClassPathFromProperty(HashSet classpath, String property) {
+        String path = System.getProperty(property);
+        if (path != null) {
+            addPath(classpath, path);
+        }
+    }
+
+    /**
+     * Walk the classloader hierarchy and add to the classpath
+     *
+     * @param cl
+     * @param classpath
+     */
+    private static void fillClassPath(ClassLoader cl, HashSet classpath) {
+        while (cl != null) {
+            if (cl instanceof URLClassLoader) {
+                URL[] urls = ((URLClassLoader) cl).getURLs();
+                for (int i = 0; (urls != null) && i < urls.length; i++) {
+                    String path = urls[i].getPath();
+                    //If it is a drive letter, adjust accordingly.
+                    if (path.length() >= 3 && path.charAt(0) == '/' && path.charAt(2) == ':')
+                        path = path.substring(1);
+                    addPath(classpath, URLDecoder.decode(path));
+
+                    // if its a jar extract Class-Path entries from manifest
+                    File file = new File(urls[i].getFile());
+                    if (file.isFile()) {
+                        FileInputStream fis = null;
+                        try {
+                            fis = new FileInputStream(file);
+                            if (isJar(fis)) {
+                                JarFile jar = new JarFile(file);
+                                Manifest manifest = jar.getManifest();
+                                if (manifest != null) {
+                                    Attributes attributes = manifest.getMainAttributes();
+                                    if (attributes != null) {
+                                        String s = attributes.getValue(Attributes.Name.CLASS_PATH);
+                                        String base = file.getParent();
+                                        if (s != null) {
+                                            StringTokenizer st = new StringTokenizer(s, " ");
+                                            while (st.hasMoreTokens()) {
+                                                String t = st.nextToken();
+                                                addPath(classpath, base + File.separatorChar + t);
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        } catch (IOException ioe) {
+                        } finally {
+                            if (fis != null) {
+                                try {
+                                    fis.close();
+                                } catch (IOException ioe2) {
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            cl = cl.getParent();
+        }
+    }
+
+    /**
+     * Filter for zip/jar
+     */
+    private static class JavaArchiveFilter implements FileFilter {
+        public boolean accept(File file) {
+            String name = file.getName().toLowerCase();
+            return (name.endsWith(".jar") || name.endsWith(".zip"));
+        }
+    }
 }

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java?rev=630959&r1=630958&r2=630959&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/ServiceDescriptionImpl.java Mon Feb 25 11:09:01 2008
@@ -27,6 +27,8 @@
 import org.apache.axis2.java.security.AccessController;
 import org.apache.axis2.jaxws.ClientConfigurationFactory;
 import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.catalog.JAXWSCatalogManager;
+import org.apache.axis2.jaxws.catalog.impl.OASISCatalogManager;
 import org.apache.axis2.jaxws.description.DescriptionFactory;
 import org.apache.axis2.jaxws.description.EndpointDescription;
 import org.apache.axis2.jaxws.description.EndpointInterfaceDescription;
@@ -109,6 +111,9 @@
     private DescriptionBuilderComposite composite = null;
     private boolean isServerSide = false;
 
+    // Allow a unique XML CatalogManager per service description.
+    private JAXWSCatalogManager catalogManager = null;
+    
     // RUNTIME INFORMATION
     Map<String, ServiceRuntimeDescription> runtimeDescMap =
             new ConcurrentHashMap<String, ServiceRuntimeDescription>();
@@ -150,6 +155,12 @@
         if (log.isDebugEnabled()) {
             log.debug("ServiceDescriptionImpl(URL,QName,Class,DescriptionBuilderComposite,Object)");
         }
+    	
+    	if (sparseComposite != null)
+    	    catalogManager = sparseComposite.getCatalogManager();
+    	else
+    		catalogManager = new OASISCatalogManager();
+    	
         if (serviceQName == null) {
             throw ExceptionFactory.makeWebServiceException(Messages.getMessage("serviceDescErr0"));
         }
@@ -231,7 +242,7 @@
 
 
     /**
-     * * Create a service-provider side ServiceDesciption.  Create a service Description
+     * Create a service-provider side ServiceDesciption.  Create a service Description
      * based on a service implementation class.  Note this is for test-only code; it should not be 
      * used in production code.  And it is being removed from the test code as well.
      *
@@ -674,7 +685,8 @@
                         }
                         this.wsdlWrapper = new WSDL4JWrapper(this.wsdlURL,
                                                              composite.getWsdlDefinition(), 
-                                                             configContext);
+                                                             configContext,
+                                                             this.catalogManager);
                     } catch (WSDLException e) {
                         throw ExceptionFactory.makeWebServiceException(
                                 Messages.getMessage("wsdlException", e.getMessage()), e);
@@ -723,7 +735,8 @@
                         this.wsdlWrapper =
                                 new WSDL4JWrapper(seic.getWsdlURL(), 
                                                   seic.getWsdlDefinition(), 
-                                                  configContext);
+                                                  configContext,
+                                                  this.catalogManager);
                             
                     } else if (composite.getWsdlDefinition() != null) {
                         //set the wsdl def from the impl. class composite
@@ -740,7 +753,8 @@
                         this.wsdlURL = composite.getWsdlURL();
                         this.wsdlWrapper = new WSDL4JWrapper(composite.getWsdlURL(),
                                                              composite.getWsdlDefinition(), 
-                                                             configContext);
+                                                             configContext,
+                                                             this.catalogManager);
                                                             
                     } else {
                     	String wsdlLocation = null;
@@ -789,7 +803,8 @@
                         log.debug("new WSDL4JWrapper-ConfigContext null4"); 
                     }
                 }
-                this.wsdlWrapper = new WSDL4JWrapper(this.wsdlURL,configContext);
+                this.wsdlWrapper = new WSDL4JWrapper(this.wsdlURL,configContext,
+                		                             this.catalogManager);
              
             }
             catch (FileNotFoundException e) {
@@ -845,7 +860,7 @@
                         }
                     }
 		    URL url = getWSDLURL(wsdlLocation);
-			this.wsdlWrapper = new WSDL4JWrapper(url);
+			this.wsdlWrapper = new WSDL4JWrapper(url, this.catalogManager);
 			composite.setWsdlDefinition(wsdlWrapper.getDefinition());
 		}
 		catch(Exception e) {
@@ -1008,6 +1023,10 @@
 
     void setServiceQName(QName theName) {
         serviceQName = theName;
+    }
+    
+    public JAXWSCatalogManager getCatalogManager() {
+    	return catalogManager;
     }
 
     /* (non-Javadoc)



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