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 he...@apache.org on 2004/09/02 07:45:14 UTC

cvs commit: ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils/packager ModulePackager.java

hemapani    2004/09/01 22:45:14

  Modified:    contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/toWs
                        Ws4J2eeEmitter.java
               contrib/ews/test/org/apache/geronimo/ews/ws4j2ee
                        AntExecuterTest.java
               contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/toWs/misc
                        BuildFileGenerator.java
               contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils
                        EWSTask.java AntDeployContext.java AntExecuter.java
               contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/wsutils
                        J2EEProvider.java
  Added:       contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/wsutils
                        EWSProvider.java
               contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils/packager
                        ModulePackager.java
  Log:
  add code to run the Ant without Build file. Time been both (with or without buid file) the mathods are avlible.
  
  Revision  Changes    Path
  1.4       +122 -122  ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/toWs/Ws4J2eeEmitter.java
  
  Index: Ws4J2eeEmitter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/toWs/Ws4J2eeEmitter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Ws4J2eeEmitter.java	11 Aug 2004 09:16:26 -0000	1.3
  +++ Ws4J2eeEmitter.java	2 Sep 2004 05:45:14 -0000	1.4
  @@ -1,122 +1,122 @@
  -/*
  - * 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.
  - */
  -
  -package org.apache.geronimo.ews.ws4j2ee.toWs;
  -
  -import java.io.File;
  -
  -import org.apache.commons.logging.Log;
  -import org.apache.commons.logging.LogFactory;
  -import org.apache.geronimo.ews.ws4j2ee.context.ContextValidator;
  -import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
  -
  -/**
  - * @author hemapani@opensource.lk
  - */
  -public class Ws4J2eeEmitter {
  -	protected static Log log =
  -			LogFactory.getLog(Ws4J2eeEmitter.class.getName());
  -	protected Ws4J2eeFactory factory;
  -	protected J2EEWebServiceContext wscontext;
  -	private boolean ejbBased;
  -	private boolean verbose;
  -	
  -	public Ws4J2eeEmitter(J2EEWebServiceContext wscontext){
  -		this.wscontext = wscontext;
  -		this.factory = wscontext.getFactory();
  -		this.ejbBased = wscontext.getMiscInfo().isImplwithEJB();
  -		this.verbose = wscontext.getMiscInfo().isVerbose();
  -	}	
  -
  -	public void prepareOutPutDir(){
  -		File file = new File(wscontext.getMiscInfo().getOutPutPath() + "/META-INF");
  -			if (!file.exists())
  -				file.mkdirs();
  -	}
  -	public void generatedSEIandtypes()throws GenerationFault{
  -		Generator seiAndTypegen =
  -		factory.getGenerationFactory().createServerSideWsGenerator(
  -				wscontext);
  -		seiAndTypegen.generate();
  -	}
  -	
  -	public void validateTheContext()throws GenerationFault{
  -		ContextValidator cvalidater = new ContextValidator(wscontext);
  -		cvalidater.validateWithWSDL();
  -	}
  -	
  -	public void generateEJB()throws GenerationFault{
  -		if (verbose){
  -			log.info("genarating ejb >>");
  -		}
  -		Generator ejbgen = factory.getGenerationFactory().createEJBGenerator(wscontext);
  -		ejbgen.generate();
  -		if (verbose){
  -			log.info("genarating j2ee dd >>");
  -		}
  -				Generator j2eeContainerDDGen =
  -		factory.getGenerationFactory()
  -			.createContainerSpecificDDGenerator(wscontext);
  -		j2eeContainerDDGen.generate();    
  -	}
  -	
  -	public void generateWrapperWs() throws GenerationFault{
  -		Generator wrapgen =
  -		factory.getGenerationFactory().createWrapperWsGenerator(
  -				wscontext);
  -		wrapgen.generate();
  -	}
  -	
  -	public void generatedHandlers()throws GenerationFault{
  -		Generator handlerGen =
  -		factory.getGenerationFactory().createHandlerGenerator(
  -				wscontext);
  -		handlerGen.generate();
  -	}
  -	public void generateBuildFile()throws GenerationFault{
  -		Generator buildFileGen =
  -		factory.getGenerationFactory().createBuildFileGenerator(
  -				wscontext);
  -        if(buildFileGen != null)  
  -		  buildFileGen.generate();
  -        Generator propertyFileGen =
  -                factory.getGenerationFactory().createPropertyFileGenerator(
  -                        wscontext);
  -        if(propertyFileGen!= null)       
  -            propertyFileGen.generate();                
  -	}
  -	
  -	public void executeAnt()throws GenerationFault{
  -        if(wscontext.getMiscInfo().isCompile()){
  -            org.apache.geronimo.ews.ws4j2ee.utils.AntExecuter executer 
  -                = new org.apache.geronimo.ews.ws4j2ee.utils.AntExecuter();
  -            executer.execute(wscontext.getMiscInfo().getOutPutPath() + "/build.xml");
  -        }
  -	}
  -	
  -	public void emmit()throws GenerationFault{
  -		prepareOutPutDir();
  -		generatedSEIandtypes();
  -		validateTheContext();
  -		if(ejbBased){
  -			generateEJB();
  -		}
  -		generateWrapperWs();
  -		generatedHandlers();
  -		generateBuildFile();
  -		executeAnt();
  -	}
  -}
  +/*
  + * 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.
  + */
  +
  +package org.apache.geronimo.ews.ws4j2ee.toWs;
  +
  +import java.io.File;
  +
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +import org.apache.geronimo.ews.ws4j2ee.context.ContextValidator;
  +import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
  +
  +/**
  + * @author hemapani@opensource.lk
  + */
  +public class Ws4J2eeEmitter {
  +	protected static Log log =
  +			LogFactory.getLog(Ws4J2eeEmitter.class.getName());
  +	protected Ws4J2eeFactory factory;
  +	protected J2EEWebServiceContext wscontext;
  +	private boolean ejbBased;
  +	private boolean verbose;
  +	
  +	public Ws4J2eeEmitter(J2EEWebServiceContext wscontext){
  +		this.wscontext = wscontext;
  +		this.factory = wscontext.getFactory();
  +		this.ejbBased = wscontext.getMiscInfo().isImplwithEJB();
  +		this.verbose = wscontext.getMiscInfo().isVerbose();
  +	}	
  +
  +	public void prepareOutPutDir(){
  +		File file = new File(wscontext.getMiscInfo().getOutPutPath() + "/META-INF");
  +			if (!file.exists())
  +				file.mkdirs();
  +	}
  +	public void generatedSEIandtypes()throws GenerationFault{
  +		Generator seiAndTypegen =
  +		factory.getGenerationFactory().createServerSideWsGenerator(
  +				wscontext);
  +		seiAndTypegen.generate();
  +	}
  +	
  +	public void validateTheContext()throws GenerationFault{
  +		ContextValidator cvalidater = new ContextValidator(wscontext);
  +		cvalidater.validateWithWSDL();
  +	}
  +	
  +	public void generateEJB()throws GenerationFault{
  +		if (verbose){
  +			log.info("genarating ejb >>");
  +		}
  +		Generator ejbgen = factory.getGenerationFactory().createEJBGenerator(wscontext);
  +		ejbgen.generate();
  +		if (verbose){
  +			log.info("genarating j2ee dd >>");
  +		}
  +				Generator j2eeContainerDDGen =
  +		factory.getGenerationFactory()
  +			.createContainerSpecificDDGenerator(wscontext);
  +		j2eeContainerDDGen.generate();    
  +	}
  +	
  +	public void generateWrapperWs() throws GenerationFault{
  +		Generator wrapgen =
  +		factory.getGenerationFactory().createWrapperWsGenerator(
  +				wscontext);
  +		wrapgen.generate();
  +	}
  +	
  +	public void generatedHandlers()throws GenerationFault{
  +		Generator handlerGen =
  +		factory.getGenerationFactory().createHandlerGenerator(
  +				wscontext);
  +		handlerGen.generate();
  +	}
  +	public void generateBuildFile()throws GenerationFault{
  +		Generator buildFileGen =
  +		factory.getGenerationFactory().createBuildFileGenerator(
  +				wscontext);
  +        if(buildFileGen != null)  
  +		  buildFileGen.generate();
  +        Generator propertyFileGen =
  +                factory.getGenerationFactory().createPropertyFileGenerator(
  +                        wscontext);
  +        if(propertyFileGen!= null)       
  +            propertyFileGen.generate();                
  +	}
  +	
  +	public void executeAnt()throws GenerationFault{
  +        if(wscontext.getMiscInfo().isCompile()){
  +            org.apache.geronimo.ews.ws4j2ee.utils.AntExecuter executer 
  +                = new org.apache.geronimo.ews.ws4j2ee.utils.AntExecuter(wscontext);
  +            executer.execute(wscontext.getMiscInfo().getOutPutPath() + "/build.xml");
  +        }
  +	}
  +	
  +	public void emmit()throws GenerationFault{
  +		prepareOutPutDir();
  +		generatedSEIandtypes();
  +		validateTheContext();
  +		if(ejbBased){
  +			generateEJB();
  +		}
  +		generateWrapperWs();
  +		generatedHandlers();
  +		generateBuildFile();
  +		executeAnt();
  +	}
  +}
  
  
  
  1.3       +5 -2      ws-axis/contrib/ews/test/org/apache/geronimo/ews/ws4j2ee/AntExecuterTest.java
  
  Index: AntExecuterTest.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/contrib/ews/test/org/apache/geronimo/ews/ws4j2ee/AntExecuterTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AntExecuterTest.java	27 Jun 2004 15:27:10 -0000	1.2
  +++ AntExecuterTest.java	2 Sep 2004 05:45:14 -0000	1.3
  @@ -58,8 +58,11 @@
   
   import org.apache.geronimo.ews.AbstractTestCase;
   import org.apache.geronimo.ews.ws4j2ee.utils.AntExecuter;
  +import org.apache.geronimo.ews.ws4j2ee.utils.packager.ModulePackager;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.taskdefs.Ant;
  +import org.apache.tools.ant.taskdefs.Javac;
  +import org.apache.tools.ant.types.Path;
   
   /**
    * @author hemapani
  @@ -74,7 +77,7 @@
   
   	public void testBuildFile() throws Exception{
   		try{
  -			AntExecuter exec = new AntExecuter();
  +			AntExecuter exec = new AntExecuter(null);
   			exec.execute(getTestFile(testDir + "testData/testBuildfile.xml"));
   		}catch(Exception e){
   			e.printStackTrace();
  @@ -100,5 +103,5 @@
   			throw e;
   		}
   	}
  -	
  +    
   }
  
  
  
  1.18      +328 -324  ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/toWs/misc/BuildFileGenerator.java
  
  Index: BuildFileGenerator.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/toWs/misc/BuildFileGenerator.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- BuildFileGenerator.java	11 Aug 2004 09:18:22 -0000	1.17
  +++ BuildFileGenerator.java	2 Sep 2004 05:45:14 -0000	1.18
  @@ -1,324 +1,328 @@
  -/*
  - * The Apache Software License, Version 1.1
  - *
  - *
  - * Copyright (c) 2001-2004 The Apache Software Foundation.  All rights
  - * reserved.
  - *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  - *
  - * 2. Redistributions in binary form must reproduce the above copyright
  - *    notice, this list of conditions and the following disclaimer in
  - *    the documentation and/or other materials provided with the
  - *    distribution.
  - *
  - * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  - *       "This product includes software developed by the
  - *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowledgment may appear in the software itself,
  - *    if and wherever such third-party acknowledgments normally appear.
  - *
  - * 4. The names "Axis" and "Apache Software Foundation" must
  - *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written
  - *    permission, please contact apache@apache.org.
  - *
  - * 5. Products derived from this software may not be called "Apache",
  - *    nor may "Apache" appear in their name, without prior written
  - *    permission of the Apache Software Foundation.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  - */
  - 
  - package org.apache.geronimo.ews.ws4j2ee.toWs.misc;
  -
  -import java.io.File;
  -import java.io.FileInputStream;
  -import java.io.FileWriter;
  -import java.io.IOException;
  -import java.io.InputStream;
  -import java.io.PrintWriter;
  -import java.util.Properties;
  -import java.util.StringTokenizer;
  -import java.util.Vector;
  -
  -import org.apache.commons.logging.Log;
  -import org.apache.commons.logging.LogFactory;
  -import org.apache.geronimo.ews.ws4j2ee.context.InputOutputFile;
  -import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
  -import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationConstants;
  -import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
  -import org.apache.geronimo.ews.ws4j2ee.toWs.Generator;
  -import org.apache.geronimo.ews.ws4j2ee.toWs.dd.JaxrpcMapperGenerator;
  -
  -/**
  - * @author Srinath Perera(hemapani@opensource.lk)
  - */
  -public class BuildFileGenerator implements Generator {
  -	private J2EEWebServiceContext j2eewscontext;
  -
  -	protected static Log log =
  -			LogFactory.getLog(JaxrpcMapperGenerator.class.getName());
  -
  -	public BuildFileGenerator(J2EEWebServiceContext j2eewscontext) throws GenerationFault {
  -		this.j2eewscontext = j2eewscontext;
  -	}
  -
  -	public void generate() throws GenerationFault {
  -		try {
  -			String buildfile = j2eewscontext.getMiscInfo().getOutPutPath() + "/build.xml";
  -			if(j2eewscontext.getMiscInfo().isVerbose())
  -				log.info("genarating " + buildfile + ".................");
  -            
  -			PrintWriter out = new PrintWriter(new FileWriter(buildfile));
  -
  -			out.write("<?xml version=\"1.0\"?>\n");
  -
  -			out.write("<project basedir=\".\" default=\"dist\">\n");
  -			out.write("	<property name=\"build.sysclasspath\" value=\"last\"/>\n");
  -			out.write("	<property name=\"src\" location=\".\"/>\n");
  -			out.write("	<property name=\"build\" location=\"build\"/>\n");
  -			out.write("	<property name=\"build.classes\" location=\"${build}/classes\"/>\n");
  -			out.write("	<property name=\"build.lib\" location=\"${build}/lib\"/>\n");
  -			out.write("	<property name=\"lib\" location=\"lib\"/>\n");
  -			
  -			Properties pro = new Properties();
  -			InputStream prpertyIn = null;
  -			File file = new File(GenerationConstants.WS4J2EE_PROPERTY_FILE);
  -			if(file.exists()){
  -				prpertyIn = new FileInputStream(file);
  -			}else{
  -				file = new File("modules/axis/target/"+GenerationConstants.WS4J2EE_PROPERTY_FILE);
  -				if(file.exists()){
  -					prpertyIn = new FileInputStream(file);
  -				}else{
  -					file = new File("target/"+GenerationConstants.WS4J2EE_PROPERTY_FILE);
  -					if(file.exists()){
  -						prpertyIn = new FileInputStream(file);
  -					}else{
  -						prpertyIn = getClass().getClassLoader().getResourceAsStream(GenerationConstants.WS4J2EE_PROPERTY_FILE);
  -					}				
  -				}
  -			}
  -			if(prpertyIn!= null){
  -				String location = null;
  -				try{
  -					pro.load(prpertyIn);
  -					location = pro.getProperty(GenerationConstants.MAVEN_LOCAL_REPOSITARY);
  -				}finally{
  -					prpertyIn.close();
  -				}
  -				if(location != null){
  -					out.write("	<property name=\"maven.repo.local\" location=\"" +location +"\"/>\n");
  -				}else{
  -					prpertyIn = null;
  -				}
  -
  -			}else{
  -				System.out.println("property file not found");
  -			}
  -			//out.write("	<property file=\"ws4j2ee.properties\"/>\n");
  -
  -			out.write("	<path id=\"classpath\" >\n");
  -			File tempfile = new File("./target/classes");
  -			out.write("		<pathelement location=\"/"+tempfile.getAbsolutePath()+"\"/>");
  -			tempfile = new File("target/test-classes");
  -			out.write("		<pathelement location=\"/"+tempfile.getAbsolutePath()+"\"/>");
  -			
  -			Vector classpathelements = j2eewscontext.getMiscInfo().getClasspathElements();
  -			if(classpathelements != null){
  -				for(int i = 0;i<classpathelements.size();i++){
  -					out.write("		<pathelement location=\"" 
  -						+ ((File)classpathelements.get(i)).getAbsolutePath() + "\"/>\n");				
  -				}
  -			}
  -			if(prpertyIn!= null){
  -				out.write("		<fileset dir=\"${maven.repo.local}\">\n");
  -				out.write("		    <include name=\"axis/**/*.jar\"/>\n");
  -				out.write("			<include name=\"geronimo-spec/**/*.jar\"/>\n");
  -				out.write("			<include name=\"geronimo/**/*.jar\"/>\n");
  -				out.write("			<include name=\"sec/**/*.jar\"/>\n");
  -				out.write("			<include name=\"dom4j/**/*.jar\"/>\n");
  -				out.write("			<include name=\"jaxb-ri/**/*.jar\"/>\n");
  -				out.write("			<include name=\"xerces/**/*.jar\"/>\n");
  -                out.write("         <include name=\"ews/**/*.jar\"/>\n");
  -                out.write("         <include name=\"openejb/**/*.jar\"/>\n");
  -				out.write("		</fileset>\n");
  -			}
  -			StringTokenizer tok = getClasspathComponets();
  -			while (tok.hasMoreTokens()) {
  -				out.write("		<pathelement location=\"" + tok.nextToken() + "\"/>\n");
  -			}
  -			out.write("	</path>\n");
  -
  -
  -			out.write("	<target name=\"compile\">\n");
  -			out.write("	   <mkdir dir=\"${build.classes}\"/>\n");
  -            out.write("    <delete>\n");
  -            out.write("         <fileset dir=\"${build.classes}\">\n");
  -            out.write("             <include name=\"**\"/>\n");
  -            out.write("         </fileset>\n");
  -            out.write("    </delete>\n");
  -
  -			out.write("	   <mkdir dir=\"${build.lib}\"/>\n");
  -			out.write("		<javac destdir=\"${build.classes}\" debug=\"on\">\n");
  -			out.write("			<classpath refid=\"classpath\" />\n");
  -			out.write("			<src path=\"${src}\"/>\n");
  -			out.write("		</javac>\n");
  -			out.write("	</target>\n");
  -
  -			out.write("	<target name=\"jar\" depends=\"compile\">\n");
  -			out.write("		<mkdir dir=\"${build.classes}/META-INF/\"/>\n");
  -	
  -			writeFileCopyStatement(j2eewscontext.getMiscInfo().getJaxrpcfile(),out);
  -			writeFileCopyStatement(j2eewscontext.getMiscInfo().getWsdlFile(),out);
  -			writeFileCopyStatement(j2eewscontext.getMiscInfo().getWsconffile(),out);
  -			
  -//			if(j2eewscontext.getMiscInfo().isImplwithEJB()){
  -//				File ejbDD = 	new File(j2eewscontext.getMiscInfo().getOutPutPath()+"/META-INF/ejb-jar.xml");
  -//				if(ejbDD.exists())
  -//					out.write("		<copy file =\""+ejbDD.getAbsolutePath()+"\" todir=\"${build.classes}/META-INF\"/>\n");
  -//				
  -//				File contianerDD = null;	
  -//				if(GenerationConstants.JBOSS_CONTAINER.equals(j2eewscontext.getMiscInfo().getTargetJ2EEContainer())){
  -//					contianerDD = new File(j2eewscontext.getMiscInfo().getOutPutPath()+"/META-INF/"+GenerationConstants.JBOSS_DD);
  -//				}else if(GenerationConstants.JONAS_CONTAINER.equals(j2eewscontext.getMiscInfo().getTargetJ2EEContainer())){
  -//					contianerDD = new File(j2eewscontext.getMiscInfo().getOutPutPath()+"/META-INF/"+GenerationConstants.JONAS_DD);
  -//				}else if(GenerationConstants.GERONIMO_CONTAINER.equals(j2eewscontext.getMiscInfo().getTargetJ2EEContainer())){
  -//					contianerDD = new File(j2eewscontext.getMiscInfo().getOutPutPath()+"/META-INF/"+GenerationConstants.GERONIMO_DD);
  -//				}	
  -//				if(contianerDD.exists()){
  -//						out.write("		<copy file =\""+contianerDD.getAbsolutePath()+"\" todir=\"${build.classes}/META-INF\"/>\n ");
  -//				}
  -//				
  -//									
  -//			}else{
  -//				File file = new File(j2eewscontext.getMiscInfo().getOutPutPath()+"/WEB-INF/web.xml");
  -//				if(file.exists()){
  -//					out.write("		<copy file =\"${src}/WEB-INF/web.xml\" todir=\"${build.classes}/META-INF\"/>\n ");				
  -//				}
  -//			}
  -			out.write("		<copy todir=\"${build.classes}\">\n");
  -			out.write("			<fileset dir=\"${src}\">\n");
  -            out.write("             <include name=\"*.properties\"/>\n");
  -			out.write("				<include name=\"META-INF/*.xml\"/>\n");
  -			out.write("				<include name=\"WEB-INF/*.xml\"/>\n");
  -			out.write("				<include name=\"META-INF/*.wsdl\"/>\n");
  -			out.write("				<include name=\"META-INF/*.wsdd\"/>\n");
  -            out.write("             <include name=\"WEB-INF/*.wsdl\"/>\n");
  -            out.write("             <include name=\"WEB-INF/*.wsdd\"/>\n");
  -            out.write("             <include name=\"*.wsdl\"/>\n");
  -            out.write("             <include name=\"*.wsdd\"/>\n");
  -            out.write("             <exclude name=\"build**\"/>\n");
  -			out.write("			</fileset>\n");
  -			out.write("		</copy>\n");
  -
  -
  -
  -			String jarName = j2eewscontext.getWSDLContext().getTargetPortType().getName().toLowerCase();
  -			int index = jarName.lastIndexOf(".");
  -			if(index>0){
  -				jarName = jarName.substring(index+1);
  -			} 
  -			
  -			String finalJarFile = j2eewscontext.getMiscInfo().getOutPutPath() + "/"+ jarName + "-ewsimpl.jar";
  -			File jarFile = new File(finalJarFile);
  -			String tempFile = "${build}/lib/"+jarName + "-temp.jar";
  -            
  -			out.write("		<jar jarfile=\""+ tempFile + "\" basedir=\"${build.classes}\" >\n");
  -			out.write("		<include name=\"**\" />\n");
  -			out.write("		<manifest>\n");
  -			out.write("			<section name=\"org/apache/ws4j2ee\">\n");
  -			out.write("			<attribute name=\"Implementation-Title\" value=\"Apache jsr109 impl\"/>\n");
  -			out.write("			<attribute name=\"Implementation-Vendor\" value=\"Apache Web Services\"/>\n");
  -			out.write("			</section>\n");
  -			out.write("		</manifest>\n");
  -			out.write("		</jar>\n");
  -			
  -			out.write("     <java classname=\"org.apache.geronimo.ews.ws4j2ee.utils.packager.Packager\" fork=\"no\" >\n");
  -			out.write("     	<arg value=\""+jarFile.getAbsolutePath()+"\"/>\n");
  -			out.write("     	<arg value=\""	+ tempFile + "\"/>\n");
  -			out.write("     	<classpath refid=\"classpath\" />\n");
  -			for(int i = 0;i<classpathelements.size();i++){
  -				out.write("     	<arg value=\""
  -					+ ((File)classpathelements.get(i)).getAbsolutePath() + "\"/>\n");				
  -			}
  -			out.write("     </java>\n");
  -//			out.write("		<delete dir=\"${build}\"/>\n");
  -			out.write("	</target>\n");
  -
  -
  -			out.write("	<target name=\"dist\" depends=\"jar\"/>\n  ");
  -
  -			out.write("	<target name=\"clean\">\n");
  -			out.write("		<delete dir=\"${build}\"/>\n");
  -			out.write("	</target>\n");
  -			
  -			
  -//			out.write("	<target name=\"deploy\" depends=\"jar\">\n");
  -//			out.write("		<copy file=\""+ jarName + 
  -//				".jar\" todir=\"${axis-webapps-lib}\"/>\n");
  -//				out.write("		<copy file=\""+ jarName + 
  -//					".jar\" todir=\"${ejb-deploy}\"/>\n");
  -//				
  -//			out.write("		<java classname=\"org.apache.axis.client.AdminClient\" fork=\"no\" >\n");
  -//			out.write("			<classpath refid=\"classpath\" />\n");
  -//
  -//			out.write("			<arg value=\"-h\"/>\n");
  -//			out.write("			<arg value=\"axis-host\"/>\n");
  -//			out.write("			<arg value=\"-p\"/>\n");
  -//			out.write("			<arg value=\"axis-port\"/>\n"); 
  -//			out.write("			<arg value=\"deploy.wsdd\"/>\n");
  -//			out.write("		</java>\n");
  -//			out.write("	</target>\n");
  -			
  -			out.write("</project>\n");
  -			out.close();
  -		} catch (IOException e) {
  -			throw GenerationFault.createGenerationFault(e);
  -		}
  -
  -	}
  -
  -	private StringTokenizer getClasspathComponets() {
  -		String classpath = System.getProperty("java.class.path");
  -		String spearator = System.getProperties().getProperty("path.separator");
  -		return new StringTokenizer(classpath, spearator);
  -	}
  -	
  -	private void writeFileCopyStatement(InputOutputFile file,PrintWriter out) throws GenerationFault{
  -		try{
  -			if(file != null){
  -				String fileName = file.fileName();
  -				if(fileName != null){
  -					File absFile = new File(fileName);
  -					if(absFile.exists())
  -						out.write("		<copy file =\""+absFile.getAbsolutePath()+"\" todir=\"${build.classes}/META-INF\"/>\n");
  -				} 
  -			}
  -		}catch(Exception e){}
  -	}
  -}
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 2001-2004 The Apache Software Foundation.  All rights
  + * reserved.
  + *
  + * Redistribution and use in source and binary forms, with or without
  + * modification, are permitted provided that the following conditions
  + * are met:
  + *
  + * 1. Redistributions of source code must retain the above copyright
  + *    notice, this list of conditions and the following disclaimer.
  + *
  + * 2. Redistributions in binary form must reproduce the above copyright
  + *    notice, this list of conditions and the following disclaimer in
  + *    the documentation and/or other materials provided with the
  + *    distribution.
  + *
  + * 3. The end-user documentation included with the redistribution,
  + *    if any, must include the following acknowledgment:
  + *       "This product includes software developed by the
  + *        Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself,
  + *    if and wherever such third-party acknowledgments normally appear.
  + *
  + * 4. The names "Axis" and "Apache Software Foundation" must
  + *    not be used to endorse or promote products derived from this
  + *    software without prior written permission. For written
  + *    permission, please contact apache@apache.org.
  + *
  + * 5. Products derived from this software may not be called "Apache",
  + *    nor may "Apache" appear in their name, without prior written
  + *    permission of the Apache Software Foundation.
  + *
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  + * SUCH DAMAGE.
  + * ====================================================================
  + *
  + * This software consists of voluntary contributions made by many
  + * individuals on behalf of the Apache Software Foundation.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
  + 
  + package org.apache.geronimo.ews.ws4j2ee.toWs.misc;
  +
  +import java.io.File;
  +import java.io.FileInputStream;
  +import java.io.FileWriter;
  +import java.io.IOException;
  +import java.io.InputStream;
  +import java.io.PrintWriter;
  +import java.util.Properties;
  +import java.util.StringTokenizer;
  +import java.util.Vector;
  +
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +import org.apache.geronimo.ews.ws4j2ee.context.InputOutputFile;
  +import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
  +import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationConstants;
  +import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
  +import org.apache.geronimo.ews.ws4j2ee.toWs.Generator;
  +import org.apache.geronimo.ews.ws4j2ee.toWs.dd.JaxrpcMapperGenerator;
  +
  +/**
  + * @author Srinath Perera(hemapani@opensource.lk)
  + */
  +public class BuildFileGenerator implements Generator {
  +	private J2EEWebServiceContext j2eewscontext;
  +
  +	protected static Log log =
  +			LogFactory.getLog(JaxrpcMapperGenerator.class.getName());
  +
  +	public BuildFileGenerator(J2EEWebServiceContext j2eewscontext) throws GenerationFault {
  +		this.j2eewscontext = j2eewscontext;
  +	}
  +
  +	public void generate() throws GenerationFault {
  +		try {
  +			String buildfile = j2eewscontext.getMiscInfo().getOutPutPath() + "/build.xml";
  +			if(j2eewscontext.getMiscInfo().isVerbose())
  +				log.info("genarating " + buildfile + ".................");
  +            
  +			PrintWriter out = new PrintWriter(new FileWriter(buildfile));
  +
  +			out.write("<?xml version=\"1.0\"?>\n");
  +
  +			out.write("<project basedir=\".\" default=\"dist\">\n");
  +			out.write("	<property name=\"build.sysclasspath\" value=\"last\"/>\n");
  +			out.write("	<property name=\"src\" location=\".\"/>\n");
  +			out.write("	<property name=\"build\" location=\"build\"/>\n");
  +			out.write("	<property name=\"build.classes\" location=\"${build}/classes\"/>\n");
  +			out.write("	<property name=\"build.lib\" location=\"${build}/lib\"/>\n");
  +			out.write("	<property name=\"lib\" location=\"lib\"/>\n");
  +			
  +			Properties pro = new Properties();
  +			InputStream prpertyIn = null;
  +			File file = new File(GenerationConstants.WS4J2EE_PROPERTY_FILE);
  +			if(file.exists()){
  +				prpertyIn = new FileInputStream(file);
  +			}else{
  +				file = new File("modules/axis/target/"+GenerationConstants.WS4J2EE_PROPERTY_FILE);
  +				if(file.exists()){
  +					prpertyIn = new FileInputStream(file);
  +				}else{
  +					file = new File("target/"+GenerationConstants.WS4J2EE_PROPERTY_FILE);
  +					if(file.exists()){
  +						prpertyIn = new FileInputStream(file);
  +					}else{
  +						prpertyIn = getClass().getClassLoader().getResourceAsStream(GenerationConstants.WS4J2EE_PROPERTY_FILE);
  +					}				
  +				}
  +			}
  +			if(prpertyIn!= null){
  +				String location = null;
  +				try{
  +					pro.load(prpertyIn);
  +					location = pro.getProperty(GenerationConstants.MAVEN_LOCAL_REPOSITARY);
  +				}finally{
  +					prpertyIn.close();
  +				}
  +				if(location != null){
  +					out.write("	<property name=\"maven.repo.local\" location=\"" +location +"\"/>\n");
  +                    if(!(new File(location)).exists()){
  +                        j2eewscontext.getMiscInfo().setCompile(false);
  +                    }
  +                    
  +				}else{
  +					prpertyIn = null;
  +				}
  +
  +			}else{
  +				System.out.println("property file not found");
  +			}
  +			//out.write("	<property file=\"ws4j2ee.properties\"/>\n");
  +
  +			out.write("	<path id=\"classpath\" >\n");
  +			File tempfile = new File("./target/classes");
  +			out.write("		<pathelement location=\"/"+tempfile.getAbsolutePath()+"\"/>");
  +			tempfile = new File("target/test-classes");
  +			out.write("		<pathelement location=\"/"+tempfile.getAbsolutePath()+"\"/>");
  +			
  +			Vector classpathelements = j2eewscontext.getMiscInfo().getClasspathElements();
  +			if(classpathelements != null){
  +				for(int i = 0;i<classpathelements.size();i++){
  +					out.write("		<pathelement location=\"" 
  +						+ ((File)classpathelements.get(i)).getAbsolutePath() + "\"/>\n");				
  +				}
  +			}
  +			if(prpertyIn!= null){
  +				out.write("		<fileset dir=\"${maven.repo.local}\">\n");
  +				out.write("		    <include name=\"axis/**/*.jar\"/>\n");
  +				out.write("			<include name=\"geronimo-spec/**/*.jar\"/>\n");
  +				out.write("			<include name=\"geronimo/**/*.jar\"/>\n");
  +				out.write("			<include name=\"sec/**/*.jar\"/>\n");
  +				out.write("			<include name=\"dom4j/**/*.jar\"/>\n");
  +				out.write("			<include name=\"jaxb-ri/**/*.jar\"/>\n");
  +				out.write("			<include name=\"xerces/**/*.jar\"/>\n");
  +                out.write("         <include name=\"ews/**/*.jar\"/>\n");
  +                out.write("         <include name=\"openejb/**/*.jar\"/>\n");
  +				out.write("		</fileset>\n");
  +			}
  +			StringTokenizer tok = getClasspathComponets();
  +			while (tok.hasMoreTokens()) {
  +				out.write("		<pathelement location=\"" + tok.nextToken() + "\"/>\n");
  +			}
  +			out.write("	</path>\n");
  +
  +
  +			out.write("	<target name=\"compile\">\n");
  +			out.write("	   <mkdir dir=\"${build.classes}\"/>\n");
  +            out.write("    <delete>\n");
  +            out.write("         <fileset dir=\"${build.classes}\">\n");
  +            out.write("             <include name=\"**\"/>\n");
  +            out.write("         </fileset>\n");
  +            out.write("    </delete>\n");
  +
  +			out.write("	   <mkdir dir=\"${build.lib}\"/>\n");
  +			out.write("		<javac destdir=\"${build.classes}\" debug=\"on\">\n");
  +			out.write("			<classpath refid=\"classpath\" />\n");
  +			out.write("			<src path=\"${src}\"/>\n");
  +			out.write("		</javac>\n");
  +			out.write("	</target>\n");
  +
  +			out.write("	<target name=\"jar\" depends=\"compile\">\n");
  +			out.write("		<mkdir dir=\"${build.classes}/META-INF/\"/>\n");
  +	
  +			writeFileCopyStatement(j2eewscontext.getMiscInfo().getJaxrpcfile(),out);
  +			writeFileCopyStatement(j2eewscontext.getMiscInfo().getWsdlFile(),out);
  +			writeFileCopyStatement(j2eewscontext.getMiscInfo().getWsconffile(),out);
  +			
  +//			if(j2eewscontext.getMiscInfo().isImplwithEJB()){
  +//				File ejbDD = 	new File(j2eewscontext.getMiscInfo().getOutPutPath()+"/META-INF/ejb-jar.xml");
  +//				if(ejbDD.exists())
  +//					out.write("		<copy file =\""+ejbDD.getAbsolutePath()+"\" todir=\"${build.classes}/META-INF\"/>\n");
  +//				
  +//				File contianerDD = null;	
  +//				if(GenerationConstants.JBOSS_CONTAINER.equals(j2eewscontext.getMiscInfo().getTargetJ2EEContainer())){
  +//					contianerDD = new File(j2eewscontext.getMiscInfo().getOutPutPath()+"/META-INF/"+GenerationConstants.JBOSS_DD);
  +//				}else if(GenerationConstants.JONAS_CONTAINER.equals(j2eewscontext.getMiscInfo().getTargetJ2EEContainer())){
  +//					contianerDD = new File(j2eewscontext.getMiscInfo().getOutPutPath()+"/META-INF/"+GenerationConstants.JONAS_DD);
  +//				}else if(GenerationConstants.GERONIMO_CONTAINER.equals(j2eewscontext.getMiscInfo().getTargetJ2EEContainer())){
  +//					contianerDD = new File(j2eewscontext.getMiscInfo().getOutPutPath()+"/META-INF/"+GenerationConstants.GERONIMO_DD);
  +//				}	
  +//				if(contianerDD.exists()){
  +//						out.write("		<copy file =\""+contianerDD.getAbsolutePath()+"\" todir=\"${build.classes}/META-INF\"/>\n ");
  +//				}
  +//				
  +//									
  +//			}else{
  +//				File file = new File(j2eewscontext.getMiscInfo().getOutPutPath()+"/WEB-INF/web.xml");
  +//				if(file.exists()){
  +//					out.write("		<copy file =\"${src}/WEB-INF/web.xml\" todir=\"${build.classes}/META-INF\"/>\n ");				
  +//				}
  +//			}
  +			out.write("		<copy todir=\"${build.classes}\">\n");
  +			out.write("			<fileset dir=\"${src}\">\n");
  +            out.write("             <include name=\"*.properties\"/>\n");
  +			out.write("				<include name=\"META-INF/*.xml\"/>\n");
  +			out.write("				<include name=\"WEB-INF/*.xml\"/>\n");
  +			out.write("				<include name=\"META-INF/*.wsdl\"/>\n");
  +			out.write("				<include name=\"META-INF/*.wsdd\"/>\n");
  +            out.write("             <include name=\"WEB-INF/*.wsdl\"/>\n");
  +            out.write("             <include name=\"WEB-INF/*.wsdd\"/>\n");
  +            out.write("             <include name=\"*.wsdl\"/>\n");
  +            out.write("             <include name=\"*.wsdd\"/>\n");
  +            out.write("             <exclude name=\"build**\"/>\n");
  +			out.write("			</fileset>\n");
  +			out.write("		</copy>\n");
  +
  +
  +
  +			String jarName = j2eewscontext.getWSDLContext().getTargetPortType().getName().toLowerCase();
  +			int index = jarName.lastIndexOf(".");
  +			if(index>0){
  +				jarName = jarName.substring(index+1);
  +			} 
  +			
  +			String finalJarFile = j2eewscontext.getMiscInfo().getOutPutPath() + "/"+ jarName + "-ewsimpl.jar";
  +			File jarFile = new File(finalJarFile);
  +			String tempFile = "${build}/lib/"+jarName + "-temp.jar";
  +            
  +			out.write("		<jar jarfile=\""+ tempFile + "\" basedir=\"${build.classes}\" >\n");
  +			out.write("		<include name=\"**\" />\n");
  +			out.write("		<manifest>\n");
  +			out.write("			<section name=\"org/apache/ws4j2ee\">\n");
  +			out.write("			<attribute name=\"Implementation-Title\" value=\"Apache jsr109 impl\"/>\n");
  +			out.write("			<attribute name=\"Implementation-Vendor\" value=\"Apache Web Services\"/>\n");
  +			out.write("			</section>\n");
  +			out.write("		</manifest>\n");
  +			out.write("		</jar>\n");
  +			
  +			out.write("     <java classname=\"org.apache.geronimo.ews.ws4j2ee.utils.packager.Packager\" fork=\"no\" >\n");
  +			out.write("     	<arg value=\""+jarFile.getAbsolutePath()+"\"/>\n");
  +			out.write("     	<arg value=\""	+ tempFile + "\"/>\n");
  +			out.write("     	<classpath refid=\"classpath\" />\n");
  +			for(int i = 0;i<classpathelements.size();i++){
  +				out.write("     	<arg value=\""
  +					+ ((File)classpathelements.get(i)).getAbsolutePath() + "\"/>\n");				
  +			}
  +			out.write("     </java>\n");
  +//			out.write("		<delete dir=\"${build}\"/>\n");
  +			out.write("	</target>\n");
  +
  +
  +			out.write("	<target name=\"dist\" depends=\"jar\"/>\n  ");
  +
  +			out.write("	<target name=\"clean\">\n");
  +			out.write("		<delete dir=\"${build}\"/>\n");
  +			out.write("	</target>\n");
  +			
  +			
  +//			out.write("	<target name=\"deploy\" depends=\"jar\">\n");
  +//			out.write("		<copy file=\""+ jarName + 
  +//				".jar\" todir=\"${axis-webapps-lib}\"/>\n");
  +//				out.write("		<copy file=\""+ jarName + 
  +//					".jar\" todir=\"${ejb-deploy}\"/>\n");
  +//				
  +//			out.write("		<java classname=\"org.apache.axis.client.AdminClient\" fork=\"no\" >\n");
  +//			out.write("			<classpath refid=\"classpath\" />\n");
  +//
  +//			out.write("			<arg value=\"-h\"/>\n");
  +//			out.write("			<arg value=\"axis-host\"/>\n");
  +//			out.write("			<arg value=\"-p\"/>\n");
  +//			out.write("			<arg value=\"axis-port\"/>\n"); 
  +//			out.write("			<arg value=\"deploy.wsdd\"/>\n");
  +//			out.write("		</java>\n");
  +//			out.write("	</target>\n");
  +			
  +			out.write("</project>\n");
  +			out.close();
  +		} catch (IOException e) {
  +			throw GenerationFault.createGenerationFault(e);
  +		}
  +
  +	}
  +
  +	private StringTokenizer getClasspathComponets() {
  +		String classpath = System.getProperty("java.class.path");
  +		String spearator = System.getProperties().getProperty("path.separator");
  +		return new StringTokenizer(classpath, spearator);
  +	}
  +	
  +	private void writeFileCopyStatement(InputOutputFile file,PrintWriter out) throws GenerationFault{
  +		try{
  +			if(file != null){
  +				String fileName = file.fileName();
  +				if(fileName != null){
  +					File absFile = new File(fileName);
  +					if(absFile.exists())
  +						out.write("		<copy file =\""+absFile.getAbsolutePath()+"\" todir=\"${build.classes}/META-INF\"/>\n");
  +				} 
  +			}
  +		}catch(Exception e){}
  +	}
  +}
  
  
  
  1.4       +36 -4     ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils/EWSTask.java
  
  Index: EWSTask.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils/EWSTask.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EWSTask.java	31 Aug 2004 17:35:50 -0000	1.3
  +++ EWSTask.java	2 Sep 2004 05:45:14 -0000	1.4
  @@ -21,6 +21,7 @@
   import java.io.IOException;
   import java.io.PrintWriter;
   
  +import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationConstants;
   import org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2ee;
   import org.apache.tools.ant.AntClassLoader;
   import org.apache.tools.ant.BuildException;
  @@ -37,19 +38,22 @@
   	private Path classpath;
       private File root;
       private boolean compile = false;
  +    private String implStyle = GenerationConstants.USE_INTERNALS;
  +    private String j2eeContainer =  GenerationConstants.GERONIMO_CONTAINER;
  +    
       
       public void execute() throws BuildException {
           try{
               if(module == null){
                   throw new BuildException("the module name not specifed");
               }
  -            root = getProject().getBaseDir();
  +            root = project.getBaseDir();
               File moduleFile = new File(root,module);
               File outDirFile = new File(root,outDir);
               
               AntClassLoader cl = new AntClassLoader(
                                   getClass().getClassLoader(),
  -                                getProject(),
  +                                project,
                                   classpath,
                                   true);
               Thread.currentThread().setContextClassLoader(cl);
  @@ -58,7 +62,7 @@
                   throw new Exception("error loding properties");
               AntDeployContext deployContext 
                   = new AntDeployContext(moduleFile.getAbsolutePath(),
  -                                outDirFile.getAbsolutePath(),cl);
  +                                outDirFile.getAbsolutePath(),cl,implStyle,j2eeContainer);
                    
              Ws4J2ee ws4j2ee = new Ws4J2ee(deployContext,null);
              ws4j2ee.generate();
  @@ -139,7 +143,7 @@
       }
       public Path createClasspath() {
         if (classpath == null) {
  -        classpath = new Path(getProject());
  +        classpath = new Path(project);
         }
         return classpath.createPath();
       }
  @@ -155,6 +159,34 @@
        */
       public void setCompile(boolean b) {
           compile = b;
  +    }
  +
  +    /**
  +     * @return
  +     */
  +    public String getImplStyle() {
  +        return implStyle;
  +    }
  +
  +    /**
  +     * @return
  +     */
  +    public String getJ2eeContainer() {
  +        return j2eeContainer;
  +    }
  +
  +    /**
  +     * @param string
  +     */
  +    public void setImplStyle(String string) {
  +        implStyle = string;
  +    }
  +
  +    /**
  +     * @param string
  +     */
  +    public void setJ2eeContainer(String string) {
  +        j2eeContainer = string;
       }
   
   }
  
  
  
  1.3       +152 -128  ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils/AntDeployContext.java
  
  Index: AntDeployContext.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils/AntDeployContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AntDeployContext.java	11 Aug 2004 09:18:29 -0000	1.2
  +++ AntDeployContext.java	2 Sep 2004 05:45:14 -0000	1.3
  @@ -1,128 +1,152 @@
  -/*
  - * 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.
  - */
  -
  -package org.apache.geronimo.ews.ws4j2ee.utils;
  -
  -import org.apache.axis.wsdl.fromJava.Emitter;
  -import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationConstants;
  -import org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2eeDeployContext;
  -import org.apache.geronimo.ews.ws4j2ee.utils.packager.load.PackageModule;
  -import org.apache.geronimo.ews.ws4j2ee.utils.packager.load.PackageModuleFactory;
  -
  -/**
  - * @author hemapani@opensource.lk
  - */
  -public class AntDeployContext implements Ws4J2eeDeployContext{
  -        private boolean compile = false;
  -		/**
  -		 * Field module
  -		 */
  -		private PackageModule module;
  -
  -		/**
  -		 * Field moduleLocation
  -		 */
  -		private String moduleLocation;
  -
  -		/**
  -		 * Field outputLocation
  -		 */
  -		private String outputLocation;
  -
  -		/**
  -		 * Constructor GeronimoWsDeployContext
  -		 *
  -		 * @param moduleLocation
  -		 * @param outputLocation
  -		 */
  -		public AntDeployContext(String moduleLocation,
  -									   String outputLocation,ClassLoader parentCL) {
  -			module =
  -					PackageModuleFactory.createPackageModule(moduleLocation,parentCL, true);
  -			this.moduleLocation = moduleLocation;
  -			this.outputLocation = outputLocation;
  -		}
  -
  -		/**
  -		 * Method getMode
  -		 *
  -		 * @return
  -		 */
  -		public int getMode() {
  -			return Emitter.MODE_ALL;
  -		}
  -
  -		/**
  -		 * Method getWsdlImplFilename
  -		 *
  -		 * @return
  -		 */
  -		public String getWsdlImplFilename() {
  -			return null;
  -		}
  -
  -		/**
  -		 * Method getModule
  -		 *
  -		 * @return
  -		 */
  -		public PackageModule getModule() {
  -			return module;
  -		}
  -
  -		/**
  -		 * Method getModuleLocation
  -		 *
  -		 * @return
  -		 */
  -		public String getModuleLocation() {
  -			return moduleLocation;
  -		}
  -
  -		/**
  -		 * Method getContanier
  -		 *
  -		 * @return
  -		 */
  -		public String getContanier() {
  -			return GenerationConstants.GERONIMO_CONTAINER;
  -		}
  -
  -		/**
  -		 * Method getImplStyle
  -		 *
  -		 * @return
  -		 */
  -		public String getImplStyle() {
  -			return GenerationConstants.USE_INTERNALS;
  -		}
  -
  -		/**
  -		 * Method getOutPutLocation
  -		 *
  -		 * @return
  -		 */
  -		public String getOutPutLocation() {
  -			return outputLocation;
  -		}
  -        /**
  -         * @return
  -         */
  -        public boolean isCompile() {
  -            return compile;
  -        }
  -
  -	}
  +/*
  + * 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.
  + */
  +
  +package org.apache.geronimo.ews.ws4j2ee.utils;
  +
  +import org.apache.axis.wsdl.fromJava.Emitter;
  +import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationConstants;
  +import org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2eeDeployContext;
  +import org.apache.geronimo.ews.ws4j2ee.utils.packager.load.PackageModule;
  +import org.apache.geronimo.ews.ws4j2ee.utils.packager.load.PackageModuleFactory;
  +
  +/**
  + * @author hemapani@opensource.lk
  + */
  +public class AntDeployContext implements Ws4J2eeDeployContext{
  +        private String implStyle = GenerationConstants.USE_INTERNALS;
  +        
  +        private String j2eeContainer =  GenerationConstants.GERONIMO_CONTAINER;
  +        
  +        private boolean compile = false;
  +		/**
  +		 * Field module
  +		 */
  +		private PackageModule module;
  +
  +		/**
  +		 * Field moduleLocation
  +		 */
  +		private String moduleLocation;
  +
  +		/**
  +		 * Field outputLocation
  +		 */
  +		private String outputLocation;
  +
  +        /**
  +         * Constructor GeronimoWsDeployContext
  +         *
  +         * @param moduleLocation
  +         * @param outputLocation
  +         */
  +        public AntDeployContext(String moduleLocation,
  +                                String outputLocation,
  +                                ClassLoader parentCL,
  +                                String implStyle,
  +                                String j2eeContiner) {
  +            module =
  +                    PackageModuleFactory.createPackageModule(moduleLocation,parentCL, true);
  +            this.moduleLocation = moduleLocation;
  +            this.outputLocation = outputLocation;
  +            this.implStyle = implStyle;
  +            this.j2eeContainer = j2eeContiner;
  +        }
  +
  +		/**
  +		 * Constructor GeronimoWsDeployContext
  +		 *
  +		 * @param moduleLocation
  +		 * @param outputLocation
  +		 */
  +		public AntDeployContext(String moduleLocation,
  +									   String outputLocation,
  +                                       ClassLoader parentCL) {
  +			module =
  +					PackageModuleFactory.createPackageModule(moduleLocation,parentCL, true);
  +			this.moduleLocation = moduleLocation;
  +			this.outputLocation = outputLocation;
  +		}
  +
  +		/**
  +		 * Method getMode
  +		 *
  +		 * @return
  +		 */
  +		public int getMode() {
  +			return Emitter.MODE_ALL;
  +		}
  +
  +		/**
  +		 * Method getWsdlImplFilename
  +		 *
  +		 * @return
  +		 */
  +		public String getWsdlImplFilename() {
  +			return null;
  +		}
  +
  +		/**
  +		 * Method getModule
  +		 *
  +		 * @return
  +		 */
  +		public PackageModule getModule() {
  +			return module;
  +		}
  +
  +		/**
  +		 * Method getModuleLocation
  +		 *
  +		 * @return
  +		 */
  +		public String getModuleLocation() {
  +			return moduleLocation;
  +		}
  +
  +		/**
  +		 * Method getContanier
  +		 *
  +		 * @return
  +		 */
  +		public String getContanier() {
  +			return j2eeContainer;
  +		}
  +
  +		/**
  +		 * Method getImplStyle
  +		 *
  +		 * @return
  +		 */
  +		public String getImplStyle() {
  +			return implStyle;
  +		}
  +
  +		/**
  +		 * Method getOutPutLocation
  +		 *
  +		 * @return
  +		 */
  +		public String getOutPutLocation() {
  +			return outputLocation;
  +		}
  +        /**
  +         * @return
  +         */
  +        public boolean isCompile() {
  +            return compile;
  +        }
  +
  +	}
  
  
  
  1.11      +169 -58   ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils/AntExecuter.java
  
  Index: AntExecuter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils/AntExecuter.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AntExecuter.java	11 Aug 2004 09:18:28 -0000	1.10
  +++ AntExecuter.java	2 Sep 2004 05:45:14 -0000	1.11
  @@ -1,58 +1,169 @@
  -/*
  - * 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.
  - */
  -
  -package org.apache.geronimo.ews.ws4j2ee.utils;
  -
  -import java.io.File;
  -
  -import org.apache.tools.ant.Project;
  -import org.apache.tools.ant.taskdefs.Ant;
  -
  -/**
  - * <p>To call this Class and execute a ant task the $JAVA_HOME/lib/tool.jar need
  - * to be in the class path. And so far I use the commnad line to call the Ant.
  - * It should be replaced by call to the Project class.</p>  
  - * @author hemapani
  - */
  -public class AntExecuter{
  -    public void execute(String buildFile) {
  -        //wait till the ant jar added
  -        try{
  -			Class.forName("com.sun.tools.javac.Main");
  -			Project project = new Project();
  -            project.setCoreLoader(Thread.currentThread().getContextClassLoader());
  -			project.init();
  -			Ant ant = new Ant();
  -			ant.setProject(project);
  -			ant.init();
  -			ant.setInheritAll(true);
  -			ant.setInheritRefs(true);
  -			File file = new File(buildFile);
  -			ant.setAntfile(file.getAbsolutePath());
  -			ant.setDir(file.getParentFile());
  -			ant.execute();        
  -		}catch(ClassNotFoundException e){
  -			System.out.println("Ant file will not be run programatcally as the " +
				"$JAVA_HOME/lib/tool.jar is not in the class path. To run the ant " +
				"prgramatically add that jar to classpath");
  -//NOW as the code is used by Geronimo we can not afford to let the build
  -//failure tests beside if you use maven it works fine. it will find your maven 
  -//repository itself :) 
  -//        }catch(BuildException e){
  -//			System.out.println(e.getMessage() +
  -//			"if it is a compile error you may not have set the maven reposiroty " +
  -//			"directory in the conf/ws4j2ee.propertites Build fill ignore the faliure");
  -        }
  -    }
  -}
  +/*
  + * 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.
  + */
  +
  +package org.apache.geronimo.ews.ws4j2ee.utils;
  +
  +import java.io.File;
  +import java.io.IOException;
  +import java.util.Vector;
  +import java.util.jar.JarOutputStream;
  +
  +import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
  +import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
  +import org.apache.geronimo.ews.ws4j2ee.utils.packager.ModulePackager;
  +import org.apache.tools.ant.Project;
  +import org.apache.tools.ant.taskdefs.Ant;
  +import org.apache.tools.ant.taskdefs.Javac;
  +import org.apache.tools.ant.types.Path;
  +
  +/**
  + * <p>To call this Class and execute a ant task the $JAVA_HOME/lib/tool.jar need
  + * to be in the class path. And so far I use the commnad line to call the Ant.
  + * It should be replaced by call to the Project class.</p>  
  + * @author hemapani
  + */
  +public class AntExecuter{
  +    private J2EEWebServiceContext wscontext;
  +    private JarOutputStream jarFile;
  +    public AntExecuter(J2EEWebServiceContext wscontext){
  +        this.wscontext = wscontext;
  +    }
  +    public void execute(String buildFile)throws GenerationFault {
  +        //wait till the ant jar added
  +        try{
  +			Class.forName("com.sun.tools.javac.Main");
  +			Project project = new Project();
  +            project.setCoreLoader(Thread.currentThread().getContextClassLoader());
  +			project.init();
  +			Ant ant = new Ant();
  +			ant.setProject(project);
  +			ant.init();
  +			ant.setInheritAll(true);
  +			ant.setInheritRefs(true);
  +			File file = new File(buildFile);
  +			ant.setAntfile(file.getAbsolutePath());
  +			ant.setDir(file.getParentFile());
  +			ant.execute();      
  +		}catch(ClassNotFoundException e){
  +			System.out.println("Ant file will not be run programatcally as the " +
				"$JAVA_HOME/lib/tool.jar is not in the class path. To run the ant " +
				"prgramatically add that jar to classpath");
  +//NOW as the code is used by Geronimo we can not afford to let the build
  +//failure tests beside if you use maven it works fine. it will find your maven 
  +//repository itself :) 
  +//        }catch(BuildException e){
  +//			System.out.println(e.getMessage() +
  +//			"if it is a compile error you may not have set the maven reposiroty " +
  +//			"directory in the conf/ws4j2ee.propertites Build fill ignore the faliure");
  +        }
  +    }
  +    public void execute()throws GenerationFault {
  +        try{
  +            Class.forName("com.sun.tools.javac.Main");
  +            File outDir = new File(wscontext.getMiscInfo().getOutPutPath());
  +            File dest = new File(outDir,"build/classes");
  +            
  +            Project project = new Project();
  +            project.init();
  +            project.setCoreLoader(Thread.currentThread().getContextClassLoader());
  +                
  +                
  +            Javac comp = new Javac();
  +            comp.setProject(project);
  +            
  +            dest.mkdirs();
  +            comp.setDestdir(dest);
  +                
  +            Path path = new Path(project);
  +            path.setLocation(outDir);
  +            comp.setSrcdir(path);
  +
  +                        
  +            comp.init();
  +            comp.execute();
  +        
  +            String jarName = wscontext.getWSDLContext().getTargetPortType().getName().toLowerCase();
  +            int index = jarName.lastIndexOf(".");
  +            if(index>0){
  +                jarName = jarName.substring(index+1);
  +            } 
  +
  +        
  +            ModulePackager module = new ModulePackager(new File(outDir,jarName+"-ewsImpl.jar"));
  +            module.addClassFiles(dest);
  +            
  +            Vector classpathelements = wscontext.getMiscInfo().getClasspathElements();
  +            if(classpathelements != null){
  +                for(int i = 0;i<classpathelements.size();i++){
  +                    module.addJarFile((File)classpathelements.get(i));               
  +                }
  +            }
  +
  +            File dir = outDir;
  +            File[] files = dir.listFiles();
  +            if(files != null){
  +                for(int i = 0;i<files.length;i++){
  +                    String file = files[i].getName();
  +                    if(files[i].isFile() && 
  +                        !(file.endsWith(".jar")||
  +                            file.endsWith(".zip")||
  +                            file.endsWith(".war")||
  +                            file.endsWith(".ear")||
  +                            file.endsWith(".java"))
  +                        ){
  +                            module.addFileToJar(file,files[i]);
  +                    }
  +                        
  +                }
  +            }
  +                
  +            dir = new File(outDir,"META-INF");
  +            files = dir.listFiles();
  +            if(files != null){
  +                for(int i = 0;i<files.length;i++){
  +                    String file = files[i].getName();
  +                    if(files[i].isFile() && 
  +                        !(file.endsWith(".jar")||
  +                            file.endsWith(".zip")||
  +                            file.endsWith(".war")||
  +                            file.endsWith(".ear")||
  +                            file.endsWith(".java"))
  +                        ){
  +                            module.addFileToJar("META-INF/"+file,files[i]);
  +                    }
  +                        
  +                }
  +            }
  +
  +            module.finalizeJar();
  +            
  +            
  +        }catch(IOException e){
  +            throw GenerationFault.createGenerationFault(e);
  +        }catch(ClassNotFoundException e){
  +            System.out.println("Ant file will not be run programatcally as the " +
  +                "$JAVA_HOME/lib/tool.jar is not in the class path. To run the ant " +
  +                "prgramatically add that jar to classpath");
  +//NOW as the code is used by Geronimo we can not afford to let the build
  +//failure tests beside if you use maven it works fine. it will find your maven 
  +//repository itself :) 
  +//        }catch(BuildException e){
  +//          System.out.println(e.getMessage() +
  +//          "if it is a compile error you may not have set the maven reposiroty " +
  +//          "directory in the conf/ws4j2ee.propertites Build fill ignore the faliure");
  +        }
  +    }
  +    
  +    
  +}
  
  
  
  1.7       +17 -17    ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/wsutils/J2EEProvider.java
  
  Index: J2EEProvider.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/wsutils/J2EEProvider.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- J2EEProvider.java	11 Aug 2004 09:17:34 -0000	1.6
  +++ J2EEProvider.java	2 Sep 2004 05:45:14 -0000	1.7
  @@ -63,23 +63,23 @@
    * register the MessageContext in the jax-rpc runtime of the JSR109 
    * @author Srinath Perera(hemapani@opensource.lk)
    */
  -public class J2EEProvider extends RPCProvider{
  -	protected Object makeNewServiceObject(
  -		MessageContext msgContext,
  -		String clsName)
  -		throws Exception {
  -			ContextAccssible webservice =  
  -				(ContextAccssible)super.makeNewServiceObject(msgContext, clsName);
  -			webservice.setMessageContext(msgContext);
  -			System.out.println("message Context set");
  -			return webservice;
  -	}
  +public class J2EEProvider extends RPCProvider {
  +    protected Object makeNewServiceObject(
  +        MessageContext msgContext,
  +        String clsName)
  +        throws Exception {
  +        ContextAccssible webservice =
  +            (ContextAccssible) super.makeNewServiceObject(msgContext, clsName);
  +        webservice.setMessageContext(msgContext);
  +        System.out.println("message Context set");
  +        return webservice;
  +    }
   
  -	/* (non-Javadoc)
  -	 * @see org.apache.axis.Handler#invoke(org.apache.axis.MessageContext)
  -	 */
  -	public void invoke(MessageContext msgContext) throws AxisFault {
  -		super.invoke(msgContext);
  -	}
  +    /* (non-Javadoc)
  +     * @see org.apache.axis.Handler#invoke(org.apache.axis.MessageContext)
  +     */
  +    public void invoke(MessageContext msgContext) throws AxisFault {
  +        super.invoke(msgContext);
  +    }
   
   }
  
  
  
  1.1                  ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/wsutils/EWSProvider.java
  
  Index: EWSProvider.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001-2004 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.geronimo.ews.ws4j2ee.wsutils;
  
  import java.io.InputStream;
  import java.lang.reflect.Method;
  
  import org.apache.axis.AxisFault;
  import org.apache.axis.MessageContext;
  import org.apache.axis.providers.java.RPCProvider;
  import org.apache.axis.utils.ClassUtils;
  
  /**
   * register the MessageContext in the jax-rpc runtime of the JSR109 
   * @author Srinath Perera(hemapani@opensource.lk)
   */
  public class EWSProvider extends RPCProvider{
      public static final String OPTION_BEANNAME = "beanJndiName";
      public static final String OPTION_HOMEINTERFACENAME = "homeInterfaceName";
      public static final String OPTION_REMOTEINTERFACENAME = "remoteInterfaceName";
      public static final String OPTION_LOCALHOMEINTERFACENAME = "localHomeInterfaceName";
      public static final String OPTION_LOCALINTERFACENAME = "localInterfaceName";
      
      public static final String OPTION_INITIAL_FACOTORY = "jndiContextClass";
      public static final String OPTION_JNDI_FACTORY = "jndiContextClass";
      public static final String OPTION_JNDI_URL = "jndiURL";
      public static final String OPTION_JNDI_USERNAME = "jndiUser";
      public static final String OPTION_JNDI_PASSWORD = "jndiPassword";
  
      private String ejblookupName;
      private String localhome;
      private String home;
      private String remote;
      private String local;
      
      private String jndiUrl;
      private String jndiFactory;
      private String jndiUser;
      private String jndiPassword; 
      private boolean ejbbased = true;
  
  
      protected Object makeNewServiceObject(
          MessageContext msgContext,
          String clsName)
          throws Exception {
              if(ejbbased){
                  java.util.Properties env = new java.util.Properties();
                  InputStream jndiIn = getClass().getClassLoader().getResourceAsStream("jndi.properties");
                  if(jndiIn != null){
                      env.load(jndiIn);
                  }else{
                      env.setProperty("java.naming.factory.initial",(String)getOption(OPTION_INITIAL_FACOTORY));
                      env.setProperty("java.naming.factory.url.pkgs",(String)getOption(OPTION_JNDI_FACTORY));
                      env.setProperty("java.naming.provider.url",(String)getOption(OPTION_JNDI_URL));
                  }
                  javax.naming.Context initial = new javax.naming.InitialContext(env);
                  if(remote != null && home != null && ejblookupName != null){
                      Object objref = initial.lookup(ejblookupName);
                      Class homeClass = ClassUtils.forName(home);
                      Object homeObj = javax.rmi.PortableRemoteObject.narrow(objref,homeClass);
                      Method method = homeClass.getMethod("create",new Class[]{}); 
                      return method.invoke(homeObj,new Object[]{});
                  }else if(local != null && localhome != null && ejblookupName != null){
                      Object homeObj = initial.lookup("java:comp/"+ejblookupName);
                      Class homeClass = ClassUtils.forName(localhome);
                      Method method = homeClass.getMethod("create",new Class[]{}); 
                      return method.invoke(homeObj,new Object[]{});
                  }
                  throw new AxisFault("Wrong configuration");
              }else{
                  return makeNewServiceObject(msgContext, clsName);
              
              }
  
      }
  
      /* (non-Javadoc)
       * @see org.apache.axis.providers.java.RPCProvider#invokeMethod(org.apache.axis.MessageContext, java.lang.reflect.Method, java.lang.Object, java.lang.Object[])
       */
      protected Object invokeMethod(
          MessageContext msgContext,
          Method method,
          Object obj,
          Object[] argValues)
          throws Exception {
              Method ejbMethod = obj.getClass().getMethod(method.getName(),method.getParameterTypes());
              return ejbMethod.invoke(obj,argValues);
      }
  
  }
  
  
  
  1.1                  ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils/packager/ModulePackager.java
  
  Index: ModulePackager.java
  ===================================================================
  /*
   * 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.
   */
  
  package org.apache.geronimo.ews.ws4j2ee.utils.packager;
  
  import java.io.BufferedOutputStream;
  import java.io.File;
  import java.io.FileInputStream;
  import java.io.FileOutputStream;
  import java.io.IOException;
  import java.io.InputStream;
  import java.util.Enumeration;
  import java.util.HashMap;
  import java.util.Iterator;
  import java.util.jar.JarFile;
  import java.util.jar.JarOutputStream;
  import java.util.zip.ZipEntry;
  
  /**
   * @author hemapani@opensource.lk
   */
  public class ModulePackager {
      private JarOutputStream jarFile;
      private byte[] buf = new byte[1024];
      private HashMap entries = new HashMap();
      
      public ModulePackager(File outjarName)throws IOException{
          BufferedOutputStream bo =
                   new BufferedOutputStream(new FileOutputStream(outjarName));
          jarFile = new JarOutputStream(bo);
  
      }
      
      public void addJarFile(File file)throws IOException{
          JarFile infile = new JarFile(file);
          Enumeration enu = infile.entries();
          while(enu.hasMoreElements()){
              ZipEntry zipentry  = (ZipEntry)enu.nextElement();
              InputStream in = infile.getInputStream(zipentry);
              addFileToJar(zipentry.getName(),in);
          }
      
      }
      
      public void addClassFiles(File dir)throws IOException{
          addClassFiles(dir,null);
      }
      
      private void addClassFiles(File file,String path)throws IOException{
          if(file.isDirectory()){
              if(path == null){
                  path = "";
              }else if("".equals(path)){
                  path = file.getName();
              }else{
                  path = path+"/"+file.getName();
              } 
              File[] files = file.listFiles();
              if(files != null){
                  for(int i = 0;i<files.length;i++){
                      addClassFiles(files[i],path);
                  }
              }
          }else{
              path = path + "/"+file.getName(); 
              addFileToJar(path,new FileInputStream(file));
          }
      }
      
      public void addFileToJar(String path,File input)throws IOException{
          
          addFileToJar(path,new FileInputStream(input));
      }
      
      private void addFileToJar(String entry,InputStream instream)throws IOException{
          if(entries.containsKey(entry)){
              entries.remove(entry);            
          }
          entries.put(entry,instream);
      }
      public void finalizeJar()throws IOException{
          Iterator jarentries = entries.keySet().iterator();
          while(jarentries.hasNext()){
              String entryName = (String)jarentries.next();
              ZipEntry entry = new ZipEntry(entryName);
  
              InputStream instream = (InputStream)entries.get(entryName);
              System.out.println(entry.getName());
              jarFile.putNextEntry(entry);
              int anz;
              while ((anz = instream.read(buf)) != -1) {
                  jarFile.write(buf, 0, anz);
              }
              jarFile.flush();
              jarFile.closeEntry();
              instream.close();
  
          }
  
          jarFile.close();
      }
  
  }