Hi All;

this patch has code to deploy the webservice in the geronimo.
there is a
1) WebServiceDeployerGbean and by calling deploy GBean  method one can
deploy a webservice. right now Axis service keep a seperate config-store
but that can be changed when we decide on the final thing

2)the Deployer accept a webservice jar file and generate the required code
using ews and deploy them. for time been the Axis GBean need to restart to
get the new deploymnet.

3)the complete senario is shown in the WebServiceTest.java test. But to
run this code need the JAVA_HOME/lib/tools.jar  in the classpth. Since
still can not get it in the classpath of maven I exclude the tests. If
somebody using IDE and add the tools.jar in the classpath they should work
fine :)

4) let me add some doc to the wiki about how this works.

Can somebody  verify this and check it in for me.
Thanks
Srinath



------------------------------------
Lanka Sofware Foundation
------------------------------------
Index: maven.xml
===================================================================
RCS file: maven.xml
diff -N maven.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ maven.xml	21 Jul 2004 12:10:55 -0000
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project default="jar"
+    xmlns:j="jelly:core"
+    xmlns:maven="jelly:maven"
+    xmlns:deploy="deploy"
+    xmlns:ant="jelly:ant">
+    <goal name="setclasspath">
+        <path id="test.classpath">
+            <path refid="maven.dependency.classpath"/>
+            <pathelement location="${tools.jar}"/>
+        </path>
+    </goal>
+
+    <preGoal name="test:test">
+	    <ant:java classname="org.apache.geronimo.ews.ws4j2ee.utils.PropertyStore" fork="no" >
+		   	<ant:arg value="${maven.repo.local}"/>
+  	     	<ant:classpath refid="maven.dependency.classpath"/>
+         </ant:java>
+        <j:jelly xmlns="jelly:ant">
+		<ant:ant antfile="build.xml" inheritall="true" inheritrefs="true" dir="src/samples/echo"/>
+		<taskdef name="ews" classname="org.apache.geronimo.ews.ws4j2ee.utils.EWSTask">
+            <classpath refid="maven.dependency.classpath"/>
+        </taskdef>
+        </j:jelly>
+    </preGoal> 
+</project>
Index: project.properties
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/axis/project.properties,v
retrieving revision 1.1
diff -u -r1.1 project.properties
--- project.properties	13 Jul 2004 17:21:55 -0000	1.1
+++ project.properties	21 Jul 2004 12:10:55 -0000
@@ -4,6 +4,7 @@
 
 # the directory containing the geronimo website in CVS
 
-maven.repo.remote=http://dist.codehaus.org, http://www.ibiblio.org/maven, http://ws.apache.org/~dims/maven
+maven.repo.remote=http://dist.codehaus.org, http://www.ibiblio.org/maven, http://ws.apache.org/~dims/maven,http://ws.apache.org/~dims/hemapani
 
-maven.junit.jvmargs=-Djava.security.auth.login.config=src/test-resources/data/login.config
\ No newline at end of file
+maven.junit.jvmargs=-Djava.security.auth.login.config=src/test-resources/data/login.config
+maven.compile.optimize=false
\ No newline at end of file
Index: project.xml
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/axis/project.xml,v
retrieving revision 1.2
diff -u -r1.2 project.xml
--- project.xml	18 Jul 2004 21:50:39 -0000	1.2
+++ project.xml	21 Jul 2004 12:10:56 -0000
@@ -6,16 +6,16 @@
     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at
-
+  
        http://www.apache.org/licenses/LICENSE-2.0
-
+  
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
 -->
-
+  
 
 <!-- $Revision: 1.2 $ $Date: 2004/07/18 21:50:39 $ -->
 
@@ -61,6 +61,14 @@
             <artifactId>geronimo-kernel</artifactId>
             <version>${pom.currentVersion}</version>
         </dependency>
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-core</artifactId>
+            <version>1.0-M1</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
 	  <dependency>
             <groupId>geronimo</groupId>
             <artifactId>geronimo-jetty</artifactId>
@@ -153,6 +161,11 @@
                 <xmlbeans>true</xmlbeans>
             </properties>
         </dependency>
+        <dependency>
+            <groupId>geronimo-spec</groupId>
+            <artifactId>geronimo-spec-ejb</artifactId>
+            <version>2.1-rc2</version>
+        </dependency>
 
         <dependency>
             <groupId>jetty</groupId>
@@ -171,6 +184,15 @@
             <artifactId>mx4j</artifactId>
             <version>2.0.1</version>
         </dependency>
+        
+         <dependency>
+            <groupId>dom4j</groupId>
+            <artifactId>dom4j</artifactId>
+            <version>1.4</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
 
         <!-- these are just needed to run the unit tests -->
         <dependency>
@@ -263,6 +285,62 @@
 
         <!-- Module Dependencies -->
         <dependency>
+            <groupId>ews</groupId>
+            <artifactId>ews</artifactId>
+            <version>1.0</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>jaxb-ri</groupId>
+            <artifactId>jaxb-api</artifactId>
+            <version>SNAPSHOT</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>jaxb-ri</groupId>
+            <artifactId>jaxb-impl</artifactId>
+            <version>SNAPSHOT</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>jaxb-ri</groupId>
+            <artifactId>jaxb-libs</artifactId>
+            <version>SNAPSHOT</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>jaxb-ri</groupId>
+            <artifactId>namespace</artifactId>
+            <version>SNAPSHOT</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>jaxb-ri</groupId>
+            <artifactId>relaxngDatatype</artifactId>
+            <version>SNAPSHOT</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>jaxb-ri</groupId>
+            <artifactId>xsdlib</artifactId>
+            <version>SNAPSHOT</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
             <groupId>axis</groupId>
             <artifactId>axis</artifactId>
             <version>SNAPSHOT</version>
@@ -310,7 +388,22 @@
                 <module>true</module>
             </properties>
         </dependency>
-
+        <dependency>
+            <groupId>ant</groupId>
+            <artifactId>ant</artifactId>
+            <version>1.5.3-1</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>openejb</groupId>
+            <artifactId>openejb-core-2.0</artifactId>
+            <version>SNAPSHOT</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
     </dependencies>
 
 
@@ -331,6 +424,11 @@
             </includes>
             <excludes>
                 <exclude>**/Abstract*.java</exclude>
+                <exclude>**/AdminClientDeploymentTest.java</exclude>
+                <exclude>**/DynamicEJBDeploymentTest.java</exclude>
+				<exclude>**/EWSTest.java</exclude>
+				<exclude>**/WebServiceDeploymentTest.java</exclude>
+				<exclude>**/WebServiceTest.java</exclude>
             </excludes>
             <resources>
                 <resource>
Index: src/java/org/apache/geronimo/axis/AxisGbean.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/axis/src/java/org/apache/geronimo/axis/AxisGbean.java,v
retrieving revision 1.1
diff -u -r1.1 AxisGbean.java
--- src/java/org/apache/geronimo/axis/AxisGbean.java	13 Jul 2004 17:21:55 -0000	1.1
+++ src/java/org/apache/geronimo/axis/AxisGbean.java	21 Jul 2004 12:10:56 -0000
@@ -53,16 +53,10 @@
         wscontiner = new WebServiceContainer(kernel, this.objectName);
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.geronimo.gbean.GBeanLifecycle#doFail()
-     */
     public void doFail() {
         System.out.println("Axis GBean has failed");
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.geronimo.gbean.GBeanLifecycle#doStart()
-     */
     public void doStart() throws WaitingException, Exception {
         System.out.println("Axis GBean has started");
         System.out.println(kernel);
@@ -70,9 +64,9 @@
         wscontiner.doStart();
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.geronimo.gbean.GBeanLifecycle#doStop()
-     */
+    private void startDependentEJBs(){
+    	
+    }
     public void doStop() throws WaitingException, Exception {
         System.out.println("Axis GBean has stoped");
         wscontiner.doStop();
Index: src/java/org/apache/geronimo/axis/AxisGeronimConstants.java
===================================================================
RCS file: src/java/org/apache/geronimo/axis/AxisGeronimConstants.java
diff -N src/java/org/apache/geronimo/axis/AxisGeronimConstants.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/java/org/apache/geronimo/axis/AxisGeronimConstants.java	21 Jul 2004 12:10:56 -0000
@@ -0,0 +1,33 @@
+/*
+ * 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.axis;
+
+/**
+ * @author [EMAIL PROTECTED]
+ */
+public class AxisGeronimConstants {
+	public static final String J2EE_DOMAIN_NAME = "openejb.server";
+	public static final String J2EE_SERVER_NAME = "TestOpenEJBServer";
+	public static final String WEB_CONTANER_NAME = "geronimo.jetty:role=Container";
+	public static final String WEB_CONNECTOR_NAME = "geronimo.jetty:role=Connector";
+	public static final String APPLICATION_NAME = "geronimo.jetty:app=test";
+	public static final String TRANSACTION_MANAGER_NAME = "geronimo.test:role=TransactionManager";
+	public static final String CONNTECTION_TRACKING_COORDINATOR = "geronimo.test:role=ConnectionTrackingCoordinator";
+	public static final String AXIS_CONFIG_STORE = "target/config-store"; 
+	public static final String TEMP_OUTPUT = "target/temp";
+	public static final int AXIS_SERVICE_PORT = 5678;
+}
Index: src/java/org/apache/geronimo/axis/AxisGeronimoUtils.java
===================================================================
RCS file: src/java/org/apache/geronimo/axis/AxisGeronimoUtils.java
diff -N src/java/org/apache/geronimo/axis/AxisGeronimoUtils.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/java/org/apache/geronimo/axis/AxisGeronimoUtils.java	21 Jul 2004 12:10:56 -0000
@@ -0,0 +1,65 @@
+/*
+ * 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.axis;
+
+import java.io.File;
+
+import javax.management.ObjectName;
+
+import org.apache.geronimo.deployment.DeploymentException;
+import org.apache.geronimo.gbean.jmx.GBeanMBean;
+import org.apache.geronimo.kernel.Kernel;
+
+public class AxisGeronimoUtils {
+    public static void startGBean(
+        ObjectName objectName,
+        GBeanMBean gbean,
+        Kernel kernel)
+        throws DeploymentException {
+        try {
+            kernel.loadGBean(objectName, gbean);
+            kernel.startGBean(objectName);
+        } catch (Exception e) {
+            throw new DeploymentException(e);
+        }
+    }
+	public static void stopGBean(
+		ObjectName objectName,
+		Kernel kernel)
+		throws DeploymentException {
+		try {
+			kernel.unloadGBean(objectName);
+			kernel.stopGBean(objectName);
+		} catch (Exception e) {
+			throw new DeploymentException(e);
+		}
+	}
+	
+	public static void delete(File file){
+		if(file.isFile()){
+			file.delete();
+		}else{
+			File[] files = file.listFiles();
+			if(files!= null){
+				for(int i = 0;i<files.length;i++){
+					delete(files[i]);
+				}
+			}
+			file.delete();
+		}
+	}
+}
Index: src/java/org/apache/geronimo/axis/DependancyEJBManager.java
===================================================================
RCS file: src/java/org/apache/geronimo/axis/DependancyEJBManager.java
diff -N src/java/org/apache/geronimo/axis/DependancyEJBManager.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/java/org/apache/geronimo/axis/DependancyEJBManager.java	21 Jul 2004 12:10:57 -0000
@@ -0,0 +1,182 @@
+/*
+ * 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.axis;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Properties;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator;
+import org.apache.geronimo.deployment.DeploymentException;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.jmx.GBeanMBean;
+import org.apache.geronimo.j2ee.management.impl.J2EEServerImpl;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.jmx.JMXUtil;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
+import org.apache.geronimo.transaction.GeronimoTransactionManager;
+import org.openejb.ContainerIndex;
+/**
+ * @author [EMAIL PROTECTED]
+ */
+public class DependancyEJBManager {
+	private ObjectName j2eeServerObjectName;
+    private static final String j2eeDomainName = AxisGeronimConstants.J2EE_DOMAIN_NAME;
+	private static final String j2eeServerName = AxisGeronimConstants.J2EE_SERVER_NAME;
+	private static final ObjectName transactionManagerObjectName = JMXUtil.getObjectName(j2eeDomainName + ":type=TransactionManager");
+	private static final ObjectName connectionTrackerObjectName = JMXUtil.getObjectName(j2eeDomainName + ":type=ConnectionTracker");
+	
+	private ObjectName containerIndexObjectName;
+	private ObjectName serverInfoObjectName; 
+	private Properties properites;
+	private File configStore;
+	private Vector dependedEJBs;
+	
+	private final Kernel kernel;
+	
+	public DependancyEJBManager(Kernel kernel)throws DeploymentException{
+		this.kernel = kernel;
+		configStore = new File(AxisGeronimConstants.AXIS_CONFIG_STORE);
+		dependedEJBs = new Vector();
+	}
+	
+	public void startDependancies(Hashtable properites)throws MalformedObjectNameException, DeploymentException{
+		startJ2EEServer();
+		startContainerIndex();
+		Enumeration enu = properites.keys();
+		while(enu.hasMoreElements()){
+			String dir = (String)enu.nextElement();
+			String serviceName = (String)properites.get(dir);
+			startDependancy(dir,serviceName);
+		}
+	}
+	
+	public void stopDependancies() throws DeploymentException{
+		//stop strated ejbs
+		for(int i = 0;i<dependedEJBs.size();i++){
+			AxisGeronimoUtils.stopGBean((ObjectName)dependedEJBs.get(i),kernel);
+		}
+		//stop the continer Index
+		stopCantainerIndex();
+		//stop the j2ee server
+		stopJ2EEServer();
+	}
+	
+	private void startDependancy(String outDir,String service)throws DeploymentException{
+        try {
+            File unpackedDir = new File(configStore,outDir);
+            
+            // load the configuration
+            GBeanMBean config = loadConfig(unpackedDir);
+            ObjectName objectName = ObjectName.getInstance("test:configuration="+service);
+			dependedEJBs.add(objectName);
+            kernel.loadGBean(objectName, config);
+            config.setAttribute("baseURL", unpackedDir.toURL());
+            // start the configuration
+            kernel.startRecursiveGBean(objectName);
+        } catch (Exception e) {
+			throw new DeploymentException(e);
+		}
+	}
+	 
+	private void startContainerIndex() 
+		throws DeploymentException, MalformedObjectNameException{
+		GBeanMBean containerIndexGBean = new GBeanMBean(ContainerIndex.GBEAN_INFO);
+		containerIndexObjectName = ObjectName.getInstance(j2eeDomainName + ":type=ContainerIndex");
+		Set ejbContainerNames = new HashSet();
+		ejbContainerNames.add(ObjectName.getInstance(j2eeDomainName + ":j2eeType=StatelessSessionBean,*"));
+		ejbContainerNames.add(ObjectName.getInstance(j2eeDomainName + ":j2eeType=StatefulSessionBean,*"));
+		ejbContainerNames.add(ObjectName.getInstance(j2eeDomainName + ":j2eeType=EntityBean,*"));
+		containerIndexGBean.setReferencePatterns("EJBContainers", ejbContainerNames);
+		AxisGeronimoUtils.startGBean(containerIndexObjectName, containerIndexGBean,kernel);
+	}
+	
+	private void stopCantainerIndex()throws DeploymentException{
+		AxisGeronimoUtils.stopGBean(containerIndexObjectName,kernel);
+	}
+	
+	private void startJ2EEServer()throws DeploymentException{
+        try {
+    		String str = System.getProperty(javax.naming.Context.URL_PKG_PREFIXES);
+    		if (str == null) {
+    			str = ":org.apache.geronimo.naming";
+    		} else {
+    			str = str + ":org.apache.geronimo.naming";
+    		}
+    		System.setProperty(javax.naming.Context.URL_PKG_PREFIXES, str);
+    
+    		GBeanMBean serverInfoGBean = new GBeanMBean(ServerInfo.GBEAN_INFO);
+    		serverInfoGBean.setAttribute("baseDirectory", ".");
+    		this.serverInfoObjectName = ObjectName.getInstance(j2eeDomainName + ":type=ServerInfo");
+    		AxisGeronimoUtils.startGBean(serverInfoObjectName, serverInfoGBean,kernel);
+    
+    
+    		GBeanMBean j2eeServerGBean = new GBeanMBean(J2EEServerImpl.GBEAN_INFO);
+    		j2eeServerGBean.setReferencePatterns("ServerInfo", Collections.singleton(serverInfoObjectName));
+    		this.j2eeServerObjectName = ObjectName.getInstance(j2eeDomainName + ":j2eeType=J2EEServer,name=" + j2eeServerName);
+    		AxisGeronimoUtils.startGBean(j2eeServerObjectName, j2eeServerGBean,kernel);
+    
+    		GBeanMBean tmGBean = new GBeanMBean(GeronimoTransactionManager.GBEAN_INFO);
+    		Set patterns = new HashSet();
+    		patterns.add(ObjectName.getInstance("geronimo.server:j2eeType=JCAManagedConnectionFactory,*"));
+    		patterns.add(ObjectName.getInstance("geronimo.server:j2eeType=ActivationSpec,*"));
+    		tmGBean.setReferencePatterns("resourceManagers", patterns);
+    		AxisGeronimoUtils.startGBean(transactionManagerObjectName, tmGBean,kernel);
+    
+    		GBeanMBean connectionTrackerGBean = new GBeanMBean(ConnectionTrackingCoordinator.GBEAN_INFO);
+    		ObjectName connectionTrackerObjectName = ObjectName.getInstance(j2eeDomainName + ":type=ConnectionTracker");
+    		AxisGeronimoUtils.startGBean(connectionTrackerObjectName, connectionTrackerGBean,kernel);
+    
+    //		//load mock resource adapter for mdb
+    //		DeploymentHelper.setUpResourceAdapter(kernel);
+        } catch (Exception e) {
+			throw new DeploymentException(e);
+		}
+	}
+	private void stopJ2EEServer()throws DeploymentException{
+		AxisGeronimoUtils.stopGBean(serverInfoObjectName,kernel);
+		AxisGeronimoUtils.stopGBean(j2eeServerObjectName, kernel);
+		AxisGeronimoUtils.stopGBean(transactionManagerObjectName, kernel);
+		AxisGeronimoUtils.stopGBean(connectionTrackerObjectName, kernel);
+	}
+	
+	private GBeanMBean loadConfig(File unpackedCar) throws Exception {
+		InputStream in = new FileInputStream(new File(unpackedCar, "META-INF/config.ser"));
+		try {
+			ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(in));
+			GBeanInfo gbeanInfo = Configuration.GBEAN_INFO;
+			GBeanMBean config = new GBeanMBean(gbeanInfo);
+			Configuration.loadGMBeanState(config, ois);
+			return config;
+		} finally {
+			in.close();
+		}
+	}
+}
Index: src/java/org/apache/geronimo/axis/GeronimoWsDeployContext.java
===================================================================
RCS file: src/java/org/apache/geronimo/axis/GeronimoWsDeployContext.java
diff -N src/java/org/apache/geronimo/axis/GeronimoWsDeployContext.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/java/org/apache/geronimo/axis/GeronimoWsDeployContext.java	21 Jul 2004 12:10:57 -0000
@@ -0,0 +1,65 @@
+/*
+ * 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.axis;
+
+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;
+
+public class GeronimoWsDeployContext implements Ws4J2eeDeployContext {
+	private PackageModule module;
+	private String moduleLocation;
+	private String outputLocation;
+
+	public GeronimoWsDeployContext(String moduleLocation,String outputLocation){
+		module = PackageModuleFactory.createPackageModule(moduleLocation,true);
+		this.moduleLocation = moduleLocation;
+		this.outputLocation = outputLocation;
+	}
+
+
+    public int getMode() {
+        return Emitter.MODE_ALL;
+    }
+
+    public String getWsdlImplFilename() {
+        return null;
+    }
+
+    public PackageModule getModule() {
+        return module;
+    }
+
+    public String getModuleLocation() {
+        return moduleLocation;
+    }
+
+    public String getContanier() {
+        return GenerationConstants.GERONIMO_CONTAINER;
+    }
+
+    public String getImplStyle() {
+        return GenerationConstants.USE_INTERNALS;
+    }
+
+    public String getOutPutLocation() {
+        return outputLocation;
+    }
+
+}
Index: src/java/org/apache/geronimo/axis/WebServiceContainer.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/axis/src/java/org/apache/geronimo/axis/WebServiceContainer.java,v
retrieving revision 1.3
diff -u -r1.3 WebServiceContainer.java
--- src/java/org/apache/geronimo/axis/WebServiceContainer.java	18 Jul 2004 22:02:01 -0000	1.3
+++ src/java/org/apache/geronimo/axis/WebServiceContainer.java	21 Jul 2004 12:10:58 -0000
@@ -1,12 +1,12 @@
 /*
  * 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.
@@ -16,24 +16,27 @@
 
 package org.apache.geronimo.axis;
 
-import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator;
-import org.apache.geronimo.gbean.jmx.GBeanMBean;
-import org.apache.geronimo.jetty.JettyContainerImpl;
-import org.apache.geronimo.jetty.JettyWebAppContext;
-import org.apache.geronimo.jetty.connector.HTTPConnector;
-import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.transaction.GeronimoTransactionManager;
-import org.apache.geronimo.transaction.UserTransactionImpl;
-import org.apache.geronimo.transaction.context.TransactionContextManager;
-
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
+import java.io.File;
+import java.io.FileInputStream;
+import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URL;
+import java.net.URLClassLoader;
 import java.util.Collections;
-import java.util.HashSet;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Properties;
 import java.util.Set;
+import java.util.Vector;
+
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.apache.geronimo.gbean.jmx.GBeanMBean;
+import org.apache.geronimo.jetty.JettyWebAppContext;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.transaction.UserTransactionImpl;
 
 public class WebServiceContainer {
     private final ObjectName axisGBeanName;
@@ -42,28 +45,27 @@
     private MBeanServer mbServer;
     private Set containerPatterns;
     private ObjectName tmName;
-    private ObjectName tcmName;
     private ObjectName tcaName;
     private ObjectName appName;
     private ObjectName connectorName;
     private String webappsUrl;
     private final boolean startJetty = true;
-    private GBeanMBean tcm;
+    private DependancyEJBManager ejbManager;
 
     public WebServiceContainer(Kernel kernel, ObjectName axisGBeanName) {
         try {
             this.axisGBeanName = axisGBeanName;
-            containerName = new ObjectName("geronimo.jetty:role=Container");
             this.kernel = kernel;
             mbServer = kernel.getMBeanServer();
+			//get refernace to the Jetty web continer artifacts
+			//TODO check they are same names for all the time
+			containerName = new ObjectName(AxisGeronimConstants.WEB_CONTANER_NAME);
             containerPatterns = Collections.singleton(containerName);
-            connectorName = new ObjectName("geronimo.jetty:role=Connector");
-            appName = new ObjectName("geronimo.jetty:app=test");
-            tmName = new ObjectName("geronimo.test:role=TransactionManager");
-            tcmName = new ObjectName("geronimo.test:role=TransactionContextManager");
-            tcaName =
-                    new ObjectName(
-                            "geronimo.test:role=ConnectionTrackingCoordinator");
+            connectorName = new ObjectName(AxisGeronimConstants.WEB_CONNECTOR_NAME);
+            appName = new ObjectName(AxisGeronimConstants.APPLICATION_NAME);
+            tmName = new ObjectName(AxisGeronimConstants.TRANSACTION_MANAGER_NAME);
+            tcaName = 
+            	new ObjectName(AxisGeronimConstants.CONNTECTION_TRACKING_COORDINATOR);
         } catch (MalformedObjectNameException e) {
             e.printStackTrace();
             throw new RuntimeException(e);
@@ -74,57 +76,46 @@
     }
 
     public void doStart() throws Exception {
-        if (startJetty)
-            startJetty();
+		ejbManager = new DependancyEJBManager(kernel);
+		File axisPopertiesfile = new File( new File(AxisGeronimConstants.AXIS_CONFIG_STORE),"axis.properties");
+		Properties axisProperties = new Properties();
+		if(axisPopertiesfile.exists()){
+			axisProperties.load(new FileInputStream(axisPopertiesfile));
+		}else{
+			axisPopertiesfile.getParentFile().mkdirs();
+			axisPopertiesfile.createNewFile();
+		}
+		//TODO deployed webservices should be stored in the local config store
+		//This is a hack till it is found out how to do it
+		ClassLoader myCl = new URLClassLoader(loadDeployedWebservices(axisProperties));
+		//Start the EJB's that depend on the webservices
+		ejbManager.startDependancies(axisProperties);
+		
+		GBeanMBean app = new GBeanMBean(JettyWebAppContext.GBEAN_INFO, myCl);
+
         URL url = Thread.currentThread().getContextClassLoader().getResource(
                 "deployables/axis/");
-        GBeanMBean app = new GBeanMBean(JettyWebAppContext.GBEAN_INFO);
-        app.setAttribute("uri", URI.create(url.toString()));
+        app.setAttribute("URI", URI.create(url.toString()));
         app.setAttribute("contextPath", "/axis");
         app.setAttribute("componentContext", null);
+        
         UserTransactionImpl userTransaction = new UserTransactionImpl();
         app.setAttribute("userTransaction", userTransaction);
         app.setReferencePatterns("Configuration", Collections.EMPTY_SET);
         app.setReferencePatterns("JettyContainer", containerPatterns);
-        app.setReferencePatterns("TransactionContextManager",
-                Collections.singleton(tcmName));
+        app.setReferencePatterns("TransactionManager",
+                Collections.singleton(tmName));
         app.setReferencePatterns("TrackedConnectionAssociator",
                 Collections.singleton(tcaName));
+        //TODO add a dependancy to such that to this service to started the 
+        //jetty must have been started         
         start(appName, app);
     }
 
     public void doStop() throws Exception {
-        stop(tcaName);
-        stop(tcmName);
-        stop(connectorName);
-        stop(containerName);
-    }
-
-    private void startJetty() throws Exception {
-        GBeanMBean connector;
-        GBeanMBean tm;
-        GBeanMBean ctc;
-        GBeanMBean container;
-        container = new GBeanMBean(JettyContainerImpl.GBEAN_INFO);
-        connector = new GBeanMBean(HTTPConnector.GBEAN_INFO);
-        connector.setAttribute("port", new Integer(5678));
-        connector.setReferencePatterns("JettyContainer", containerPatterns);
-        start(containerName, container);
-        start(connectorName, connector);
-        tm = new GBeanMBean(GeronimoTransactionManager.GBEAN_INFO);
-        Set patterns = new HashSet();
-        patterns.add(
-                ObjectName.getInstance(
-                        "geronimo.server:j2eeType=JCAManagedConnectionFactory,*"));
-        tm.setReferencePatterns("ResourceManagers", patterns);
-        start(tmName, tm);
-        tcm = new GBeanMBean(TransactionContextManager.GBEAN_INFO);
-        tcm.setReferencePattern("TransactionManager", tmName);
-        start(tcmName, tcm);
-        ctc = new GBeanMBean(ConnectionTrackingCoordinator.GBEAN_INFO);
-        start(tcaName, ctc);
     }
 
+
     private void start(ObjectName name, Object instance) throws Exception {
         mbServer.registerMBean(instance, name);
         mbServer.invoke(name, "start", null, null);
@@ -133,5 +124,34 @@
     private void stop(ObjectName name) throws Exception {
         mbServer.invoke(name, "stop", null, null);
         mbServer.unregisterMBean(name);
+    }
+    
+    public URL[] loadDeployedWebservices(Hashtable properites) throws MalformedURLException{
+		if(properites == null)
+			return new URL[0];
+		Vector urls = new Vector();
+		Enumeration enu = properites.keys();
+		File configStroe = new File(AxisGeronimConstants.AXIS_CONFIG_STORE);
+		
+		while(enu.hasMoreElements()){
+			File libfile = new File(configStroe,enu.nextElement().toString());
+			if(libfile.exists()){
+				File[] jars = libfile.listFiles();
+				if(jars != null){
+					for(int i = 0;i<jars.length;i++){
+						if(jars[i].getAbsolutePath().endsWith(".jar"))
+							urls.add(jars[i].toURL());
+					}
+				}
+			}
+		}		
+		
+
+		URL[] urlList = new URL[urls.size()];
+		for(int i = 0;i<urls.size();i++){
+			urlList[i]= (URL)urls.get(i);
+			System.out.println(urlList[i]);
+		}
+		return urlList;
     }
 }
Index: src/java/org/apache/geronimo/axis/WebServiceDeployer.java
===================================================================
RCS file: src/java/org/apache/geronimo/axis/WebServiceDeployer.java
diff -N src/java/org/apache/geronimo/axis/WebServiceDeployer.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/java/org/apache/geronimo/axis/WebServiceDeployer.java	21 Jul 2004 12:10:59 -0000
@@ -0,0 +1,302 @@
+/*
+ * 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.axis;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Properties;
+
+import javax.management.ObjectName;
+
+import org.apache.axis.AxisEngine;
+import org.apache.axis.MessageContext;
+import org.apache.axis.deployment.wsdd.WSDDDeployment;
+import org.apache.axis.deployment.wsdd.WSDDDocument;
+import org.apache.axis.encoding.SerializationContextImpl;
+import org.apache.axis.server.AxisServer;
+import org.apache.axis.utils.Admin;
+import org.apache.axis.utils.XMLUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.deployment.DeploymentException;
+import org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2ee;
+import org.apache.geronimo.ews.ws4j2ee.utils.packager.load.PackageModule;
+import org.apache.geronimo.j2ee.deployment.EARConfigBuilder;
+import org.apache.geronimo.j2ee.deployment.ModuleBuilder;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.jmx.JMXUtil;
+import org.apache.geronimo.system.configuration.LocalConfigStore;
+import org.apache.xmlbeans.XmlObject;
+import org.openejb.deployment.OpenEJBModuleBuilder;
+import org.w3c.dom.Document;
+
+public class WebServiceDeployer {
+	protected final Log log = LogFactory.getLog(getClass());
+	
+    private static final String j2eeDomainName =
+        AxisGeronimConstants.J2EE_DOMAIN_NAME;
+    private static final String j2eeServerName =
+        AxisGeronimConstants.J2EE_SERVER_NAME;
+    private static final ObjectName transactionManagerObjectName =
+        JMXUtil.getObjectName(j2eeDomainName + ":type=TransactionManager");
+    private static final ObjectName connectionTrackerObjectName =
+        JMXUtil.getObjectName(j2eeDomainName + ":type=ConnectionTracker");
+
+    private String j2eeApplicationName;
+    private String j2eeModuleName;
+    private String module;
+
+    private final Kernel kernel;
+
+    private Properties axisProperties;
+    private String outDir;
+    private Properties properites;
+    private final File configStore;
+    private String tempOutDir;
+    private boolean hasEJB = true;
+
+    public WebServiceDeployer(String tempOutDir, Kernel kernel) {
+        this.tempOutDir = tempOutDir;
+        this.kernel = kernel;
+        axisProperties = new Properties();
+        properites = new Properties();
+        log.info("start deployer with the "+AxisGeronimConstants.AXIS_CONFIG_STORE+ " as the config store.");
+        configStore = new File(AxisGeronimConstants.AXIS_CONFIG_STORE);
+    }
+
+    public void deploy(
+        String module,
+        String j2eeApplicationName,
+        String j2eeModuleName)
+        throws Exception {
+        this.j2eeApplicationName = j2eeApplicationName;
+        this.j2eeModuleName = j2eeModuleName;
+        this.module = module;
+        
+		log.info("start deploymwnt with the "+this.module+ ".");
+        GeronimoWsDeployContext deployContext =
+            new GeronimoWsDeployContext(module, tempOutDir + "/server");
+            
+        Ws4J2ee ws4j2ee = new Ws4J2ee(deployContext, null);
+        ws4j2ee.generate();
+		log.info("ews code generation done.");
+
+        PackageModule packageModule = deployContext.getModule();
+        if (packageModule.getEjbJarfile() != null) {
+            this.hasEJB = true;
+            System.out.println("the web service is based on a ejb.");
+			log.info("the web service is based on a ejb.");
+        } else if (packageModule.getWebddfile() != null) {
+            this.hasEJB = false;
+			System.out.println("the web service is based on a java class.");
+			log.info("the web service is based on a java class.");
+        } else {
+            throw new DeploymentException("the module must have web.xml or ejb-jar.xml file");
+        }
+        File file = findTheImpl();
+        deployTheWebService(file);
+    }
+
+    public void loadPropertyFiles() throws FileNotFoundException, IOException {
+        File popertiesfile = new File(configStore, "index.properties");
+        int index = 1;
+        if (popertiesfile.exists()) {
+            properites.load(new FileInputStream(popertiesfile));
+            while (properites.containsValue(String.valueOf(index))) {
+                index++;
+            }
+        } else {
+			popertiesfile.getParentFile().mkdirs();
+            popertiesfile.createNewFile();
+        }
+        outDir = String.valueOf(index);
+
+        File axisPopertiesfile = new File(configStore, "axis.properties");
+        if (axisPopertiesfile.exists()) {
+            axisProperties.load(new FileInputStream(axisPopertiesfile));
+        } else {
+            axisPopertiesfile.createNewFile();
+        }
+    }
+
+    public void storeProperties() throws FileNotFoundException, IOException {
+        File popertiesfile = new File(configStore, "index.properties");
+        properites.store(
+            new FileOutputStream(popertiesfile),
+            "ws configuration");
+        File axispopertiesfile = new File(configStore, "axis.properties");
+        axisProperties.store(
+            new FileOutputStream(axispopertiesfile),
+            "ws configuration");
+    }
+
+    public void deployTheWebService(File earFile)
+        throws DeploymentException {
+        File unpackedDir = null;
+        try {
+            loadPropertyFiles();
+            properites.setProperty(j2eeModuleName, outDir);
+            axisProperties.setProperty(outDir, j2eeModuleName);
+
+			unpackedDir = new File(configStore, outDir);
+			unpackedDir.mkdirs();
+			if(hasEJB){
+				deployEJB(earFile,unpackedDir);
+			}else{
+				File out = new File(unpackedDir,earFile.getName());
+				copyTheFile(earFile,out);
+			}
+        } catch (Exception e) {
+            //if something goes wrong make sure nothing leaves in a middle
+            //state
+            if (unpackedDir != null) {
+                AxisGeronimoUtils.delete(unpackedDir);
+            }
+            throw new DeploymentException(e);
+        }
+    }
+    
+    private void deployWsWithAdminClient(File jarFile) throws DeploymentException{
+		InputStream wsddconf = null;
+		InputStream deplydd = null;
+        try {
+            
+            URLClassLoader cl = new  URLClassLoader(new URL[]{jarFile.toURL()});
+            deplydd = cl.getResourceAsStream("deploy.wsdd");
+            
+            File wsddfile = new File(AxisGeronimConstants.AXIS_CONFIG_STORE,"server-config.wsdd");
+            if(wsddfile.exists()){
+            	wsddconf = new FileInputStream(wsddfile);
+            }else{
+            	wsddconf = getClass().getClassLoader().getResourceAsStream("org/apache/axis/server/server-config.wsdd");		
+            }
+            
+            if(wsddconf == null )
+            	throw new DeploymentException("the server-config.wsdd deployment discrypters not found");
+            if(deplydd == null)
+            	throw new DeploymentException("the deploy.wsdd deployment discrypters not found");
+            
+            
+            Admin admin = new Admin();
+            
+            WSDDDocument wsddDoc = new WSDDDocument(XMLUtils.newDocument(wsddconf));
+            WSDDDeployment deployment = wsddDoc.getDeployment();
+            AxisEngine engine = new AxisServer(deployment);
+            engine.setShouldSaveConfig(true);
+            engine.init();
+            MessageContext msgContext = new MessageContext(engine);
+            
+            Document doc = XMLUtils.newDocument(deplydd);
+            Document result = admin.process(msgContext, doc.getDocumentElement());
+            System.out.println(XMLUtils.DocumentToString(result));
+			FileWriter w = new FileWriter(wsddfile);
+            deployment.writeToContext(new SerializationContextImpl(w));
+            w.close();
+        } catch (Exception e) {
+            throw new DeploymentException(e);
+        } 
+    }
+    
+    
+    private void deployEJB(File earFile,File unpackedDir) throws DeploymentException{
+        try {
+            ModuleBuilder moduleBuilder = new OpenEJBModuleBuilder(kernel);
+            
+            ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+            ClassLoader cl =
+            	new URLClassLoader(new URL[] { earFile.toURL()}, oldCl);
+            
+            Thread.currentThread().setContextClassLoader(cl);
+            
+            File carFile = File.createTempFile("OpenEJBTest", ".car");
+            try {
+            		EARConfigBuilder earConfigBuilder =
+            			new EARConfigBuilder(
+            				null,
+            				null,
+            				new ObjectName(
+            					j2eeDomainName
+            						+ ":j2eeType=J2EEServer,name="
+            						+ j2eeServerName),
+            				moduleBuilder,
+            				null,	// web
+            				null, //connector
+            			transactionManagerObjectName, connectionTrackerObjectName);
+            
+            	XmlObject plan =
+            		earConfigBuilder.getDeploymentPlan(earFile.toURL());
+            	earConfigBuilder.buildConfiguration(
+            		carFile,
+            		null,
+            		earFile,
+            		plan);
+            
+            	
+            	LocalConfigStore.unpack(
+            		unpackedDir,
+            		new FileInputStream(carFile));
+            
+            	//store the property IFF all goes well
+            	storeProperties();
+            } finally {
+            	carFile.delete();
+            }
+		} catch (Exception e) {
+			throw new DeploymentException(e);
+		}
+    
+    
+    }
+
+    private File findTheImpl() {
+        File outDir = new File(tempOutDir + "/server");
+        if (outDir.isDirectory()) {
+            File[] files = outDir.listFiles();
+            if (files != null) {
+                for (int i = 0; i < files.length; i++) {
+                    if (files[i].getAbsolutePath().endsWith(".jar")) {
+                        return files[i];
+                    }
+                }
+            }
+        }
+        throw new RuntimeException("implementation jar not found");
+
+    }
+
+    private void copyTheFile(File inFile, File outFile)
+        throws IOException {
+			FileOutputStream out = new FileOutputStream(outFile);
+			FileInputStream in = new FileInputStream(inFile);
+			try{
+				byte[] buf = new byte[1024];
+				int val = in.read(buf);
+				while (val > 0) {
+					out.write(buf, 0, val);
+					val = in.read(buf);
+				}
+			}finally{
+				in.close();
+				out.close();
+			}
+    }
+}
Index: src/java/org/apache/geronimo/axis/WebServiceDeployerGbean.java
===================================================================
RCS file: src/java/org/apache/geronimo/axis/WebServiceDeployerGbean.java
diff -N src/java/org/apache/geronimo/axis/WebServiceDeployerGbean.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/java/org/apache/geronimo/axis/WebServiceDeployerGbean.java	21 Jul 2004 12:10:59 -0000
@@ -0,0 +1,99 @@
+/*
+ * 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.axis;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoFactory;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.WaitingException;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.jmx.JMXUtil;
+
+import javax.management.ObjectName;
+
+public class WebServiceDeployerGbean implements GBeanLifecycle {
+    private final String name;
+    private final Kernel kernel;
+    private static final GBeanInfo GBEAN_INFO;
+    private final ObjectName objectName;
+    
+
+    private WebServiceDeployer wsdeployer;
+
+    static {
+        GBeanInfoFactory infoFactory = new GBeanInfoFactory("WebServiceDeployerGbean",
+                WebServiceDeployerGbean.class);
+        //attributes
+        infoFactory.addAttribute("Name", String.class, true);
+        infoFactory.addAttribute("kernel", Kernel.class, false);
+        infoFactory.addAttribute("objectName", String.class, false);
+        //operations
+        infoFactory.addOperation("deploy", new Class[]{String.class,String.class,String.class});
+        infoFactory.setConstructor(new String[]{"kernel", "Name", "objectName"});
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public WebServiceDeployerGbean(Kernel kernel, String name, String objectName) {
+        this.name = name;
+        this.kernel = kernel;
+        this.objectName = JMXUtil.getObjectName(objectName);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.gbean.GBeanLifecycle#doFail()
+     */
+    public void doFail() {
+        System.out.println("WebServiceDeployerGbean has failed");
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.gbean.GBeanLifecycle#doStart()
+     */
+    public void doStart() throws WaitingException, Exception {
+        System.out.println("WebServiceDeployerGbean has started");
+		wsdeployer = new WebServiceDeployer(AxisGeronimConstants.TEMP_OUTPUT,kernel);
+    }
+
+    private void startDependentEJBs(){
+    	
+    }
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.gbean.GBeanLifecycle#doStop()
+     */
+    public void doStop() throws WaitingException, Exception {
+        System.out.println("WebServiceDeployerGbean has stoped");
+    }
+
+    public void deploy(
+    	String module,
+    	String j2eeApplicationName,
+		String j2eeModuleName) throws Exception {
+			wsdeployer.deploy(module,j2eeApplicationName,j2eeModuleName);
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+    public Kernel getKernel() {
+        return kernel;
+    }
+
+    public String getName() {
+        return name;
+    }
+}
Index: src/test/org/apache/geronimo/axis/AbstractTestCase.java
===================================================================
RCS file: src/test/org/apache/geronimo/axis/AbstractTestCase.java
diff -N src/test/org/apache/geronimo/axis/AbstractTestCase.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/test/org/apache/geronimo/axis/AbstractTestCase.java	21 Jul 2004 12:10:59 -0000
@@ -0,0 +1,69 @@
+/*
+ * 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.axis;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+/**
+ * Abstract base class for test cases.
+ */
+public abstract class AbstractTestCase
+	extends TestCase 
+{
+	protected String testDir = "src/test/";
+	protected String sampleDir = "src/samples/";
+	protected String outDir = "target/generated/samples/";
+	protected String tempDir = "target/generated/temp";
+	/** 
+	 * Basedir for all file I/O. Important when running tests from
+	 * the reactor.
+	 */
+	public String basedir = System.getProperty("basedir");
+    
+	/**
+	 * Constructor.
+	 */
+	public AbstractTestCase(String testName)
+	{
+		super(testName);
+		if(basedir == null){
+			basedir = new File(".").getAbsolutePath();
+			if(!(basedir.endsWith("axis")
+				||basedir.endsWith("axis\\")
+				||basedir.endsWith("axis/"))){
+				basedir = new File("./modules/axis").getAbsolutePath();
+			}
+		}
+		testDir = new File(basedir,testDir).getAbsolutePath();
+		sampleDir = new File(basedir,sampleDir).getAbsolutePath();
+		outDir = new File(basedir,outDir).getAbsolutePath();
+		tempDir = new File(basedir,tempDir).getAbsolutePath();
+	}
+    
+	/**
+	 * Get test input file.
+	 *
+	 * @param path Path to test input file.
+	 */
+	public String getTestFile(String path)
+	{
+		return new File(basedir,path).getAbsolutePath();
+	}
+}
+
Index: src/test/org/apache/geronimo/axis/AdminClientDeploymentTest.java
===================================================================
RCS file: src/test/org/apache/geronimo/axis/AdminClientDeploymentTest.java
diff -N src/test/org/apache/geronimo/axis/AdminClientDeploymentTest.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/test/org/apache/geronimo/axis/AdminClientDeploymentTest.java	21 Jul 2004 12:10:59 -0000
@@ -0,0 +1,118 @@
+/*
+ * 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.axis;
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import javax.management.ObjectName;
+
+import org.apache.axis.AxisEngine;
+import org.apache.axis.MessageContext;
+import org.apache.axis.deployment.wsdd.WSDDDeployment;
+import org.apache.axis.deployment.wsdd.WSDDDocument;
+import org.apache.axis.encoding.SerializationContextImpl;
+import org.apache.axis.server.AxisServer;
+import org.apache.axis.utils.Admin;
+import org.apache.axis.utils.XMLUtils;
+import org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2ee;
+import org.apache.geronimo.gbean.jmx.GBeanMBean;
+import org.apache.geronimo.kernel.Kernel;
+import org.w3c.dom.Document;
+
+public class AdminClientDeploymentTest extends AbstractTestCase {
+    private ObjectName name;
+    private ObjectName name2;
+    private Kernel kernel;
+    private JettyServiceWrapper jettyService;
+
+    /**
+     * @param testName
+     */
+    public AdminClientDeploymentTest(String testName) {
+        super(testName);
+    }
+
+	public void testDeployWithAdminClient() throws Exception{
+		File jarFile =  new File(outDir + "/echo-ewsimpl.jar");
+		if(!jarFile.exists()){
+			GeronimoWsDeployContext deployContext =
+				 new GeronimoWsDeployContext(
+					 getTestFile("target/samples/echo.jar"),
+					 outDir);
+			Ws4J2ee ws4j2ee = new Ws4J2ee(deployContext, null);
+					ws4j2ee.generate();
+		}
+		
+		URLClassLoader cl = new  URLClassLoader(new URL[]{jarFile.toURL()});
+		InputStream deplydd = cl.getResourceAsStream("deploy.wsdd");
+		assertNotNull(deplydd);  
+
+
+//		AdminClient adminClient = new AdminClient();
+//		URL requestUrl = new URL("http://localhost:";
+//			 +AxisGeronimConstants.AXIS_SERVICE_PORT
+//			 +"/axis/services/AdminService");
+//		Call call = adminClient.getCall();
+//		call.setTargetEndpointAddress(requestUrl);
+//		String result = adminClient.process(null,deplydd);
+//		System.out.println(result);
+
+		Admin admin = new Admin();
+		InputStream wsddconf = getClass().getClassLoader().getResourceAsStream("org/apache/axis/server/server-config.wsdd");
+		assertNotNull(wsddconf);
+		WSDDDocument wsddDoc = new WSDDDocument(XMLUtils.newDocument(wsddconf));
+		WSDDDeployment deployment = wsddDoc.getDeployment();
+		AxisEngine engine = new AxisServer(deployment);
+		engine.setShouldSaveConfig(true);
+		engine.init();
+		MessageContext msgContext = new MessageContext(engine);
+
+		Document doc = XMLUtils.newDocument(deplydd);
+		Document result = admin.process(msgContext, doc.getDocumentElement());
+		System.out.println(XMLUtils.DocumentToString(result));
+		PrintWriter w = new PrintWriter(System.out);
+		deployment.writeToContext(new SerializationContextImpl(w));
+		w.close();
+   	}
+
+
+    protected void setUp() throws Exception {
+		new File(outDir).mkdirs();
+        name = new ObjectName("test:name=AxisGBean");
+        name2 = new ObjectName("test:name=AxisGBean2");
+        kernel = new Kernel("test.kernel", "test");
+        kernel.boot();
+		jettyService = new JettyServiceWrapper(kernel);
+		jettyService.doStart();
+		ClassLoader cl = getClass().getClassLoader();
+		ClassLoader myCl = new URLClassLoader(new URL[0], cl);
+		GBeanMBean gbean = new GBeanMBean(AxisGbean.getGBeanInfo(), myCl);
+		gbean.setAttribute("Name", "Test");
+		kernel.loadGBean(name, gbean);
+		kernel.startGBean(name);
+    }
+
+    protected void tearDown() throws Exception {
+		kernel.stopGBean(name);
+		kernel.unloadGBean(name);
+		jettyService.doStop();
+        kernel.shutdown();
+    }
+}
Index: src/test/org/apache/geronimo/axis/AxisGBeanTest.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/axis/src/test/org/apache/geronimo/axis/AxisGBeanTest.java,v
retrieving revision 1.1
diff -u -r1.1 AxisGBeanTest.java
--- src/test/org/apache/geronimo/axis/AxisGBeanTest.java	13 Jul 2004 17:21:55 -0000	1.1
+++ src/test/org/apache/geronimo/axis/AxisGBeanTest.java	21 Jul 2004 12:10:59 -0000
@@ -15,24 +15,32 @@
  */
 package org.apache.geronimo.axis;
 
-import junit.framework.TestCase;
-import org.apache.geronimo.gbean.jmx.GBeanMBean;
-import org.apache.geronimo.kernel.Kernel;
-
-import javax.management.ObjectName;
 import java.io.BufferedReader;
 import java.io.InputStreamReader;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.net.URLClassLoader;
 
-public class AxisGBeanTest extends TestCase {
+import javax.management.ObjectName;
+
+import org.apache.geronimo.gbean.jmx.GBeanMBean;
+import org.apache.geronimo.kernel.Kernel;
+
+public class AxisGBeanTest extends AbstractTestCase {
     private ObjectName name;
     private ObjectName name2;
     private Kernel kernel;
+    private JettyServiceWrapper jettyService;
+
+    /**
+     * @param testName
+     */
+    public AxisGBeanTest(String testName) {
+        super(testName);
+    }
 
     public void testLoad() throws Exception {
-        String textFileurl = "http://localhost:5678/axis/index.html";;
+        String textFileurl = "http://localhost:"+AxisGeronimConstants.AXIS_SERVICE_PORT+"/axis/index.html";;
         ClassLoader cl = getClass().getClassLoader();
         ClassLoader myCl = new URLClassLoader(new URL[0], cl);
         GBeanMBean gbean = new GBeanMBean(AxisGbean.getGBeanInfo(), myCl);
@@ -63,9 +71,12 @@
         name2 = new ObjectName("test:name=AxisGBean2");
         kernel = new Kernel("test.kernel", "test");
         kernel.boot();
+		jettyService = new JettyServiceWrapper(kernel);
+		jettyService.doStart();
     }
 
     protected void tearDown() throws Exception {
+		jettyService.doStop();
         kernel.shutdown();
     }
 }
Index: src/test/org/apache/geronimo/axis/DynamicEJBDeploymentTest.java
===================================================================
RCS file: src/test/org/apache/geronimo/axis/DynamicEJBDeploymentTest.java
diff -N src/test/org/apache/geronimo/axis/DynamicEJBDeploymentTest.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/test/org/apache/geronimo/axis/DynamicEJBDeploymentTest.java	21 Jul 2004 12:11:00 -0000
@@ -0,0 +1,158 @@
+/*
+ * 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.axis;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.management.ObjectName;
+
+import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator;
+import org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2ee;
+import org.apache.geronimo.gbean.jmx.GBeanMBean;
+import org.apache.geronimo.j2ee.deployment.EARConfigBuilder;
+import org.apache.geronimo.j2ee.deployment.ModuleBuilder;
+import org.apache.geronimo.j2ee.management.impl.J2EEServerImpl;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.jmx.JMXUtil;
+import org.apache.geronimo.kernel.management.State;
+import org.apache.geronimo.system.configuration.LocalConfigStore;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
+import org.apache.geronimo.transaction.GeronimoTransactionManager;
+import org.apache.xmlbeans.XmlObject;
+import org.openejb.deployment.OpenEJBModuleBuilder;
+
+public class DynamicEJBDeploymentTest extends AbstractTestCase{
+	private static final String j2eeDomainName = "openejb.server";
+	private static final String j2eeServerName = "TestOpenEJBServer";
+	private static final ObjectName transactionManagerObjectName = JMXUtil.getObjectName(j2eeDomainName + ":type=TransactionManager");
+	private static final ObjectName connectionTrackerObjectName = JMXUtil.getObjectName(j2eeDomainName + ":type=ConnectionTracker");
+	private Kernel kernel;
+
+    /**
+     * @param testName
+     */
+    public DynamicEJBDeploymentTest(String testName) {
+        super(testName);
+    }
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		String str = System.getProperty(javax.naming.Context.URL_PKG_PREFIXES);
+		if (str == null) {
+			str = ":org.apache.geronimo.naming";
+		} else {
+			str = str + ":org.apache.geronimo.naming";
+		}
+		System.setProperty(javax.naming.Context.URL_PKG_PREFIXES, str);
+		kernel = new Kernel("blah");
+		kernel.boot();
+
+		GBeanMBean serverInfoGBean = new GBeanMBean(ServerInfo.GBEAN_INFO);
+		serverInfoGBean.setAttribute("baseDirectory", ".");
+		ObjectName serverInfoObjectName = ObjectName.getInstance(j2eeDomainName + ":type=ServerInfo");
+		kernel.loadGBean(serverInfoObjectName, serverInfoGBean);
+		kernel.startGBean(serverInfoObjectName);
+		assertRunning(kernel, serverInfoObjectName);
+
+		GBeanMBean j2eeServerGBean = new GBeanMBean(J2EEServerImpl.GBEAN_INFO);
+		j2eeServerGBean.setReferencePatterns("ServerInfo", Collections.singleton(serverInfoObjectName));
+		ObjectName j2eeServerObjectName = ObjectName.getInstance(j2eeDomainName + ":j2eeType=J2EEServer,name=" + j2eeServerName);
+		kernel.loadGBean(j2eeServerObjectName, j2eeServerGBean);
+		kernel.startGBean(j2eeServerObjectName);
+		assertRunning(kernel, j2eeServerObjectName);
+
+		GBeanMBean tmGBean = new GBeanMBean(GeronimoTransactionManager.GBEAN_INFO);
+		Set patterns = new HashSet();
+		patterns.add(ObjectName.getInstance("geronimo.server:j2eeType=JCAManagedConnectionFactory,*"));
+		patterns.add(ObjectName.getInstance("geronimo.server:j2eeType=ActivationSpec,*"));
+		tmGBean.setReferencePatterns("resourceManagers", patterns);
+		kernel.loadGBean(transactionManagerObjectName, tmGBean);
+		kernel.startGBean(transactionManagerObjectName);
+		assertRunning(kernel, transactionManagerObjectName);
+
+		GBeanMBean connectionTrackerGBean = new GBeanMBean(ConnectionTrackingCoordinator.GBEAN_INFO);
+		ObjectName connectionTrackerObjectName = ObjectName.getInstance(j2eeDomainName + ":type=ConnectionTracker");
+		kernel.loadGBean(connectionTrackerObjectName, connectionTrackerGBean);
+		kernel.startGBean(connectionTrackerObjectName);
+		assertRunning(kernel, connectionTrackerObjectName);
+
+		//load mock resource adapter for mdb
+//		DeploymentHelper.setUpResourceAdapter(kernel);
+
+	}
+	public void testEJBJarDeploy() throws Exception {
+		String j2eeApplicationName = "null";
+		String j2eeModuleName = "org/openejb/deployment/test";
+	
+		ModuleBuilder moduleBuilder = new OpenEJBModuleBuilder(kernel);
+	
+		File earFile =  new File(outDir + "/echo-ewsimpl.jar");
+		if(!earFile.exists()){
+			GeronimoWsDeployContext deployContext =
+				 new GeronimoWsDeployContext(
+					 getTestFile("target/samples/echo.jar"),
+					 outDir);
+			Ws4J2ee ws4j2ee = new Ws4J2ee(deployContext, null);
+					ws4j2ee.generate();
+		}
+	
+	
+		ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+		ClassLoader cl = new URLClassLoader(new URL[]{earFile.toURL()}, oldCl);
+	
+		Thread.currentThread().setContextClassLoader(cl);
+	
+		File carFile = File.createTempFile("OpenEJBTest", ".car");
+		try {
+			EARConfigBuilder earConfigBuilder = new EARConfigBuilder(null,
+					null,
+					new ObjectName(j2eeDomainName + ":j2eeType=J2EEServer,name=" + j2eeServerName),
+					moduleBuilder,
+					null, // web
+					null, //connector
+					transactionManagerObjectName,
+					connectionTrackerObjectName);
+	
+			XmlObject plan = earConfigBuilder.getDeploymentPlan(earFile.toURL());
+			earConfigBuilder.buildConfiguration(carFile, null, earFile, plan);
+			File unpackedDir = new File(tempDir, "OpenEJBTest-ear-Unpacked");
+			LocalConfigStore.unpack(unpackedDir, new FileInputStream(carFile));
+		} finally {
+			carFile.delete();
+		}
+	}
+
+
+	protected void tearDown() throws Exception {
+//		DeploymentHelper.tearDownAdapter(kernel);
+		kernel.stopGBean(connectionTrackerObjectName);
+		kernel.stopGBean(transactionManagerObjectName);
+		kernel.shutdown();
+	}
+	private void assertRunning(Kernel kernel, ObjectName objectName) throws Exception {
+		int state = ((Integer) kernel.getAttribute(objectName, "state")).intValue();
+		assertEquals(State.RUNNING_INDEX, state);
+	}
+
+
+}
Index: src/test/org/apache/geronimo/axis/EWSTest.java
===================================================================
RCS file: src/test/org/apache/geronimo/axis/EWSTest.java
diff -N src/test/org/apache/geronimo/axis/EWSTest.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/test/org/apache/geronimo/axis/EWSTest.java	21 Jul 2004 12:11:00 -0000
@@ -0,0 +1,47 @@
+/*
+ * 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.axis;
+
+import java.io.File;
+
+import org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2ee;
+
+public class EWSTest extends AbstractTestCase {
+    /**
+     * @param testName
+     */
+    public EWSTest(String testName) {
+        super(testName);
+    }
+
+    public void testEcho() throws Exception {
+        System.out.println(new File(".").getAbsolutePath());
+        GeronimoWsDeployContext deployContext =
+            new GeronimoWsDeployContext(
+                getTestFile("target/samples/echo.jar"),
+                outDir);
+        Ws4J2ee ws4j2ee = new Ws4J2ee(deployContext, null);
+        ws4j2ee.generate();
+    }
+
+    protected void setUp() throws Exception {
+        new File(outDir).mkdirs();
+    }
+
+    protected void tearDown() throws Exception {
+    }
+
+}
Index: src/test/org/apache/geronimo/axis/EchoHeadersTest.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/axis/src/test/org/apache/geronimo/axis/EchoHeadersTest.java,v
retrieving revision 1.1
diff -u -r1.1 EchoHeadersTest.java
--- src/test/org/apache/geronimo/axis/EchoHeadersTest.java	13 Jul 2004 18:52:49 -0000	1.1
+++ src/test/org/apache/geronimo/axis/EchoHeadersTest.java	21 Jul 2004 12:11:01 -0000
@@ -15,21 +15,10 @@
  */
 package org.apache.geronimo.axis;
 
-import junit.framework.TestCase;
-import org.apache.geronimo.gbean.jmx.GBeanMBean;
-import org.apache.geronimo.kernel.Kernel;
-
-import javax.management.ObjectName;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.io.File;
-import java.net.HttpURLConnection;
 import java.net.URL;
 import java.net.URLClassLoader;
-import org.apache.axis.AxisEngine;
-import org.apache.axis.client.Call;
-import org.apache.axis.client.Service;
 
+import javax.management.ObjectName;
 import javax.xml.messaging.URLEndpoint;
 import javax.xml.soap.MessageFactory;
 import javax.xml.soap.Name;
@@ -41,12 +30,26 @@
 import javax.xml.soap.SOAPEnvelope;
 import javax.xml.soap.SOAPMessage;
 
+import org.apache.axis.AxisEngine;
+import org.apache.axis.client.Call;
+import org.apache.axis.client.Service;
+import org.apache.geronimo.gbean.jmx.GBeanMBean;
+import org.apache.geronimo.kernel.Kernel;
 
-public class EchoHeadersTest extends TestCase {
+
+public class EchoHeadersTest extends AbstractTestCase {
     private ObjectName name;
     private ObjectName name2;
     private Kernel kernel;
     private Call call = null;
+    private JettyServiceWrapper jettyService;
+
+    /**
+     * @param testName
+     */
+    public EchoHeadersTest(String testName) {
+        super(testName);
+    }
 
     protected void setUp() throws Exception {
         name = new ObjectName("test:name=AxisGBean");
@@ -54,6 +57,9 @@
         kernel = new Kernel("test.kernel", "test");
         kernel.boot();
 
+		jettyService = new JettyServiceWrapper(kernel);
+		jettyService.doStart();
+
         ClassLoader cl = getClass().getClassLoader();
         ClassLoader myCl = new URLClassLoader(new URL[]{}, cl);
         GBeanMBean gbean = new GBeanMBean(AxisGbean.getGBeanInfo(), myCl);
@@ -146,8 +152,9 @@
     }
     
     protected void tearDown() throws Exception {
-        kernel.stopGBean(name);
+		kernel.stopGBean(name);
         kernel.unloadGBean(name);
+		jettyService.doStop();
         kernel.shutdown();
     }
 }
Index: src/test/org/apache/geronimo/axis/JettyServiceWrapper.java
===================================================================
RCS file: src/test/org/apache/geronimo/axis/JettyServiceWrapper.java
diff -N src/test/org/apache/geronimo/axis/JettyServiceWrapper.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/test/org/apache/geronimo/axis/JettyServiceWrapper.java	21 Jul 2004 12:11:01 -0000
@@ -0,0 +1,99 @@
+/*
+ * 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.axis;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator;
+import org.apache.geronimo.gbean.jmx.GBeanMBean;
+import org.apache.geronimo.jetty.JettyContainerImpl;
+import org.apache.geronimo.jetty.connector.HTTPConnector;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.transaction.GeronimoTransactionManager;
+
+/**
+ * @author [EMAIL PROTECTED]
+ */
+public class JettyServiceWrapper {
+	private ObjectName containerName;
+	private Set containerPatterns;
+	private ObjectName tmName;
+	private ObjectName tcaName;
+	private ObjectName connectorName;
+	
+	private final MBeanServer mbServer;
+	private final Kernel kernel;
+	
+	public JettyServiceWrapper(Kernel kernel)throws MalformedObjectNameException{
+            this.kernel = kernel;
+            this.mbServer = kernel.getMBeanServer();
+            
+            containerName = new ObjectName(AxisGeronimConstants.WEB_CONTANER_NAME);
+            containerPatterns = Collections.singleton(containerName);
+            connectorName = new ObjectName(AxisGeronimConstants.WEB_CONNECTOR_NAME);
+            tmName = new ObjectName(AxisGeronimConstants.TRANSACTION_MANAGER_NAME);
+            tcaName = 
+            	new ObjectName(AxisGeronimConstants.CONNTECTION_TRACKING_COORDINATOR);
+	}
+
+	public void doStart() throws Exception {
+		GBeanMBean connector;
+		GBeanMBean tm;
+		GBeanMBean ctc;
+		GBeanMBean container;
+		container = new GBeanMBean(JettyContainerImpl.GBEAN_INFO);
+		connector = new GBeanMBean(HTTPConnector.GBEAN_INFO);
+		connector.setAttribute("port", new Integer(AxisGeronimConstants.AXIS_SERVICE_PORT));
+		connector.setReferencePatterns("JettyContainer", containerPatterns);
+		start(containerName, container);
+		start(connectorName, connector);
+		tm = new GBeanMBean(GeronimoTransactionManager.GBEAN_INFO);
+		Set patterns = new HashSet();
+		patterns.add(
+				ObjectName.getInstance(
+						"geronimo.server:j2eeType=JCAManagedConnectionFactory,*"));
+		tm.setReferencePatterns("resourceManagers", patterns);
+		start(tmName, tm);
+		ctc = new GBeanMBean(ConnectionTrackingCoordinator.GBEAN_INFO);
+		start(tcaName, ctc);
+	}
+	
+	public void doStop() throws Exception{
+		stop(tcaName);
+		stop(tmName);
+		stop(connectorName);
+		stop(containerName);
+	}
+	
+	
+	private void start(ObjectName name, Object instance) throws Exception {
+		 mbServer.registerMBean(instance, name);
+		 mbServer.invoke(name, "start", null, null);
+	 }
+
+	 private void stop(ObjectName name) throws Exception {
+		 mbServer.invoke(name, "stop", null, null);
+		 mbServer.unregisterMBean(name);
+	 }
+
+}
Index: src/test/org/apache/geronimo/axis/TestServer.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/axis/src/test/org/apache/geronimo/axis/TestServer.java,v
retrieving revision 1.1
diff -u -r1.1 TestServer.java
--- src/test/org/apache/geronimo/axis/TestServer.java	13 Jul 2004 17:21:55 -0000	1.1
+++ src/test/org/apache/geronimo/axis/TestServer.java	21 Jul 2004 12:11:01 -0000
@@ -17,22 +17,27 @@
 
 package org.apache.geronimo.axis;
 
-import org.apache.geronimo.gbean.jmx.GBeanMBean;
-import org.apache.geronimo.kernel.Kernel;
-
-import javax.management.ObjectName;
 import java.net.URL;
 import java.net.URLClassLoader;
 
+import javax.management.ObjectName;
+
+import org.apache.geronimo.gbean.jmx.GBeanMBean;
+import org.apache.geronimo.kernel.Kernel;
+
 public class TestServer {
     private Kernel kernel;
     private ObjectName name;
+	private JettyServiceWrapper jettyService;
 
     public TestServer() throws Exception {
         name = new ObjectName("test:name=AxisGBean");
         kernel = new Kernel("test.kernel", "test");
         kernel.boot();
 
+		jettyService = new JettyServiceWrapper(kernel);
+		jettyService.doStart();
+
         ClassLoader cl = getClass().getClassLoader();
         ClassLoader myCl = new URLClassLoader(new URL[0], cl);
         GBeanMBean gbean = new GBeanMBean(AxisGbean.getGBeanInfo(), myCl);
@@ -43,6 +48,8 @@
         System.out.println("Shutting down the kernel");
         kernel.stopGBean(name);
         kernel.unloadGBean(name);
+        
+		jettyService.doStop();
         kernel.shutdown();
     }
 
Index: src/test/org/apache/geronimo/axis/WebServiceDeploymentTest.java
===================================================================
RCS file: src/test/org/apache/geronimo/axis/WebServiceDeploymentTest.java
diff -N src/test/org/apache/geronimo/axis/WebServiceDeploymentTest.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/test/org/apache/geronimo/axis/WebServiceDeploymentTest.java	21 Jul 2004 12:11:01 -0000
@@ -0,0 +1,54 @@
+/*
+ * 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.axis;
+
+import java.io.File;
+
+import org.apache.geronimo.kernel.Kernel;
+
+/**
+ * @author [EMAIL PROTECTED]
+ */
+public class WebServiceDeploymentTest extends AbstractTestCase{
+	private Kernel kernel;
+	public WebServiceDeploymentTest(String name){
+		super(name);
+	}
+
+	protected void setUp() throws Exception {
+		kernel = new Kernel("test.kernel", "test");
+		kernel.boot();
+		File file = new File(tempDir);
+		file.getParentFile().mkdirs();
+	}
+
+	protected void tearDown() throws Exception {
+		kernel.shutdown();
+		File file = new File(tempDir);
+		AxisGeronimoUtils.delete(file);
+	}
+    
+   
+    
+    public void testDeployEJB() throws Exception{
+		WebServiceDeployer deployer 
+			= new WebServiceDeployer(tempDir,kernel);
+		deployer.deploy(getTestFile("target/samples/echo.jar"),
+				null,
+				"ws/apache/axis/test2");
+    }
+}
Index: src/test/org/apache/geronimo/axis/WebServiceTest.java
===================================================================
RCS file: src/test/org/apache/geronimo/axis/WebServiceTest.java
diff -N src/test/org/apache/geronimo/axis/WebServiceTest.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/test/org/apache/geronimo/axis/WebServiceTest.java	21 Jul 2004 12:11:01 -0000
@@ -0,0 +1,183 @@
+/*
+ * 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.axis;
+
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import javax.management.ObjectName;
+
+import org.apache.geronimo.ews.ws4j2ee.wsutils.GeronimoUtils;
+import org.apache.geronimo.gbean.jmx.GBeanMBean;
+import org.apache.geronimo.kernel.Kernel;
+
+public class WebServiceTest extends AbstractTestCase {
+    private ObjectName axisname;
+    private ObjectName deployGbeanName;
+    private Kernel kernel;
+    private JettyServiceWrapper jettyService;
+
+    /**
+     * @param testName
+     */
+    public WebServiceTest(String testName) {
+        super(testName);
+        // TODO Auto-generated constructor stub
+    }
+
+    public void testLoad() throws Exception {
+        ClassLoader cl = getClass().getClassLoader();
+		ClassLoader myCl = null;
+        
+		URL toolsURL = null;
+        String tools = System.getProperty("java.home");
+			   
+		if (tools != null) {
+		   File f = new File(tools,"./../lib/tools.jar");
+		   System.out.println("tools.jar is "+f.getAbsolutePath());
+		   if (f.exists()) {
+			    toolsURL = f.toURL();
+			    myCl =  new URLClassLoader(new URL[]{toolsURL}, cl);
+		   }
+		}   
+		
+        GBeanMBean deploygbean =
+            new GBeanMBean(WebServiceDeployerGbean.getGBeanInfo(), myCl);
+        kernel.loadGBean(deployGbeanName, deploygbean);
+        kernel.startGBean(deployGbeanName);
+        System.out.println(
+            kernel.getMBeanServer().getAttribute(deployGbeanName, "state"));
+        kernel.getMBeanServer().invoke(
+            deployGbeanName,
+            "deploy",
+            new Object[] {
+                getTestFile("target/samples/echo.jar"),
+                null,
+                "ws/apache/axis/echo" },
+            new String[] {
+                String.class.getName(),
+                String.class.getName(),
+                String.class.getName()});
+        kernel.stopGBean(deployGbeanName);
+        kernel.unloadGBean(deployGbeanName);
+
+        //axis gbean        
+        GBeanMBean axisgbean = new GBeanMBean(AxisGbean.getGBeanInfo(), myCl);
+        kernel.loadGBean(axisname, axisgbean);
+        kernel.startGBean(axisname);
+
+        //invoke the ejb just in the same way it is invoked by the webservice 
+        String msg = "Hi Hello";
+        String result =
+            (String) GeronimoUtils.invokeEJB(
+                "echo",
+                "echoString",
+                new Class[] { String.class },
+                new Object[] { msg });
+        System.out.println(result);
+        assertEquals(msg, result);
+
+        GeronimoUtils.invokeEJB("echo", "echoVoid", new Class[] {
+        }, new Object[] {
+        });
+
+        int valInt = 2345;
+        Integer intObj =
+            (Integer) GeronimoUtils.invokeEJB(
+                "echo",
+                "echoInt",
+                null,
+                new Object[] { new Integer(valInt)});
+        assertEquals(valInt, intObj.intValue());
+
+        double valDouble = 2425.57;
+        Double doubleObj =
+            (Double) GeronimoUtils.invokeEJB(
+                "echo",
+                "echoDouble",
+                null,
+                new Object[] { new Double(valDouble)});
+        assertEquals(valDouble, doubleObj.doubleValue(), 3);
+
+        float valfloat = 2425.57f;
+        Float floatObj =
+            (Float) GeronimoUtils.invokeEJB(
+                "echo",
+                "echoFloat",
+                null,
+                new Object[] { new Float(valfloat)});
+        assertEquals(valDouble, doubleObj.doubleValue(), 3);
+
+        boolean valBoolean = true;
+        Boolean booleanObj =
+            (Boolean) GeronimoUtils.invokeEJB(
+                "echo",
+                "echoBoolean",
+                null,
+                new Object[] { new Boolean(valBoolean)});
+        assertEquals(valBoolean, booleanObj.booleanValue());
+
+        long valLong = 2425573566l;
+        Long longObj =
+            (Long) GeronimoUtils.invokeEJB(
+                "echo",
+                "echoLong",
+                null,
+                new Object[] { new Long(valLong)});
+        assertEquals(valLong, longObj.longValue());
+
+        short valShort = 242;
+        Short shortObj =
+            (Short) GeronimoUtils.invokeEJB(
+                "echo",
+                "echoShort",
+                null,
+                new Object[] { new Short(valShort)});
+        assertEquals(valShort, shortObj.shortValue());
+
+        byte[] byteVal = "Hi Hello".getBytes();
+        byte[] byteValreturn =
+            (byte[]) GeronimoUtils.invokeEJB(
+                "echo",
+                "echoBytes",
+                new Class[] { byte[].class },
+                new Object[] { byteVal });
+
+        kernel.stopGBean(axisname);
+        kernel.unloadGBean(axisname);
+
+    }
+
+    protected void setUp() throws Exception {
+		File file = new File(AxisGeronimConstants.AXIS_CONFIG_STORE);
+        axisname = new ObjectName("test:name=AxisGBean");
+        deployGbeanName = new ObjectName("test:name=WebServiceDeployerGbean");
+        kernel = new Kernel("test.kernel", "test");
+        kernel.boot();
+        jettyService = new JettyServiceWrapper(kernel);
+        jettyService.doStart();
+        file.getParentFile().mkdirs();
+    }
+
+    protected void tearDown() throws Exception {
+        jettyService.doStop();
+        kernel.shutdown();
+        File file = new File(AxisGeronimConstants.AXIS_CONFIG_STORE);
+        AxisGeronimoUtils.delete(file);
+    }
+
+}

Reply via email to