geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r485779 - in /geronimo/devtools/eclipse-plugin/trunk: ./ modules/eclipse-support/ modules/eclipse-support/src/main/java/org/apache/geronimo/deployment/ modules/eclipse-support/src/main/resources/ plugins/org.apache.geronimo.st.core/src/org/...
Date Mon, 11 Dec 2006 17:59:08 GMT
Author: sppatel
Date: Mon Dec 11 09:59:07 2006
New Revision: 485779

URL: http://svn.apache.org/viewvc?view=rev&rev=485779
Log:
 r3165@sppatel-009027040242:  sppatel | 2006-12-05 12:31:45 -0500
 G1526 local branch
 r3166@sppatel-009027040242:  sppatel | 2006-12-05 12:49:05 -0500
 update EclipseDeployable to new interface
 r3167@sppatel-009027040242:  sppatel | 2006-12-05 12:51:52 -0500
 throw DeploymentException on constructor
 r3168@sppatel-009027040242:  sppatel | 2006-12-05 13:27:17 -0500
 make EclipseDeployable a gbean and create plan
 r3194@sppatel-009027040242:  sppatel | 2006-12-06 13:54:53 -0500
 need empty constructor
 r3214@sppatel-009027040242:  sppatel | 2006-12-07 13:15:06 -0500
 add dependency
 r3215@sppatel-009027040242:  sppatel | 2006-12-07 13:17:18 -0500
 enable run resource from workspace
 r3216@sppatel-009027040242:  sppatel | 2006-12-07 13:18:30 -0500
 move config gen to command
 r3217@sppatel-009027040242:  sppatel | 2006-12-07 13:19:27 -0500
 remove moved methods
 r3218@sppatel-009027040242:  sppatel | 2006-12-07 14:11:10 -0500
 need to make dependency on configuration due to class cast
 r3224@sppatel-009027040242:  sppatel | 2006-12-07 15:29:29 -0500
 fix resolve and getModuleContextResource methods
 r3233@sppatel-009027040242:  sppatel | 2006-12-07 16:51:26 -0500
 fix NPE
 r3237@sppatel-009027040242:  sppatel | 2006-12-07 18:11:47 -0500
 utility method to get deployment plan file
 r3238@sppatel-009027040242:  sppatel | 2006-12-07 18:12:34 -0500
 pass in deployment plan for redeploy

Added:
    geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/resources/
    geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/resources/geronimo-service.xml
  (with props)
Modified:
    geronimo/devtools/eclipse-plugin/trunk/   (props changed)
    geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/pom.xml
    geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/java/org/apache/geronimo/deployment/EclipseDeployableModule.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoUtils.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/commands/DeployCommand.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/commands/RedeployCommand.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/sections/ServerEditorTestEnvSection.java

Propchange: geronimo/devtools/eclipse-plugin/trunk/
------------------------------------------------------------------------------
    svk:merge = 47d51c14-9805-4038-8224-40f2b3020a56:/local/G1526-eclipse:3238

Modified: geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/pom.xml?view=diff&rev=485779&r1=485778&r2=485779
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/pom.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/pom.xml Mon Dec 11 09:59:07
2006
@@ -42,11 +42,11 @@
 	<version>1.0-SNAPSHOT</version>
 	<name>Geronimo Eclipse Plugin :: Eclipse Deployment Support</name>
 	<dependencies>
-		<!--<dependency>
+		<dependency>
 			<groupId>org.apache.geronimo.modules</groupId>
 			<artifactId>geronimo-deployment</artifactId>
 			<version>1.2-SNAPSHOT</version>
-		</dependency>-->
+		</dependency>
 		<dependency>
 			<groupId>xmlbeans</groupId>
 			<artifactId>xbean</artifactId>

Modified: geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/java/org/apache/geronimo/deployment/EclipseDeployableModule.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/java/org/apache/geronimo/deployment/EclipseDeployableModule.java?view=diff&rev=485779&r1=485778&r2=485779
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/java/org/apache/geronimo/deployment/EclipseDeployableModule.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/java/org/apache/geronimo/deployment/EclipseDeployableModule.java
Mon Dec 11 09:59:07 2006
@@ -14,62 +14,49 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
 package org.apache.geronimo.deployment;
 
 import java.io.File;
 import java.io.IOException;
 import java.net.URL;
+import java.util.jar.JarFile;
 
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.xbeans.eclipse.deployment.ModuleDocument;
 import org.apache.geronimo.xbeans.eclipse.deployment.ClassesDocument.Classes;
 import org.apache.geronimo.xbeans.eclipse.deployment.ModuleDocument.Module;
 import org.apache.geronimo.xbeans.eclipse.deployment.ResourcesDocument.Resources;
-import org.apache.xmlbeans.XmlException;
 
 /**
  * @version $Rev$ $Date$
  */
-public class EclipseDeployableModule /*implements DeployableModule*/ {
+public class EclipseDeployableModule implements DeployableModule {
 
 	private Module module = null;
 
 	private File root;
-	
+
 	private String uri;
 
 	private File[] classesFolders = null;
 
 	private File[] resourcesFolders = null;
 
-	//private DeployableModule[] children = null;
-	
+	private DeployableModule[] children = null;
+
 	private boolean archived = false;
-	
-	public EclipseDeployableModule(File config) {
+
+	public EclipseDeployableModule() {
+	}
+
+	public EclipseDeployableModule(File config) throws DeploymentException {
 		try {
 			module = ModuleDocument.Factory.parse(config).getModule();
 			init();
-		} catch (XmlException e) {
-			e.printStackTrace();
-		} catch (IOException e) {
-			e.printStackTrace();
+		} catch (Exception e) {
+			throw new DeploymentException(e);
 		}
 	}
 
@@ -125,13 +112,9 @@
 
 		Resources[] resources = module.getResourcesArray();
 		resourcesFolders = new File[resources.length];
-		for (int i = 0; i < classesFolders.length; i++) {
+		for (int i = 0; i < resourcesFolders.length; i++) {
 			File file = new File(resources[i].getPath());
-			if (file.exists()) {
-				resourcesFolders[i] = file;
-			} else {
-
-			}
+			resourcesFolders[i] = file;
 		}
 
 		return resourcesFolders;
@@ -142,20 +125,24 @@
 	 * 
 	 * @see org.apache.geronimo.deployment.DeployableModule#getModules()
 	 */
-	/*public DeployableModule[] getModules() {
+	public DeployableModule[] getModules() {
 		if (children != null) {
 			return children;
 		}
 
-		Module[] childModules = module.getChildren().getModuleArray();
-		children = new DeployableModule[childModules.length];
-		for (int i = 0; i < childModules.length; i++) {
-			Module child = childModules[i];
-			children[i] = new EclipseDeployableModule(child);
+		if (module.getChildren() != null) {
+			Module[] childModules = module.getChildren().getModuleArray();
+			children = new DeployableModule[childModules.length];
+			for (int i = 0; i < childModules.length; i++) {
+				Module child = childModules[i];
+				children[i] = new EclipseDeployableModule(child);
+			}
+		} else {
+			children = new EclipseDeployableModule[]{};
 		}
 
 		return children;
-	}*/
+	}
 
 	/*
 	 * (non-Javadoc)
@@ -166,7 +153,11 @@
 		if (root != null) {
 			return root;
 		}
-		root = new File(module.getPath());
+		if (module.getPath() != null) {
+			root = new File(module.getPath());
+		} else {
+			root = new File(module.getResourcesArray(0).getPath());
+		}
 		return root;
 	}
 
@@ -176,7 +167,7 @@
 	 * @see org.apache.geronimo.deployment.DeployableModule#getURI()
 	 */
 	public String getURI() {
-		if(uri != null) {
+		if (uri != null) {
 			return uri;
 		}
 		uri = module.getName();
@@ -198,12 +189,14 @@
 	 * @see org.apache.geronimo.deployment.DeployableModule#resolve(java.lang.String)
 	 */
 	public URL resolve(String path) throws IOException {
+		System.out.println("Resolving: " + path);
 		File[] search = getModuleContextResources();
-		for(int i = 0; i <  search.length; i++) {
-			String findPath = search[i].getAbsolutePath().concat(path);
-			File file = new File(findPath);
-			if(file.exists()) 
+		for (int i = 0; i < search.length; i++) {
+			File file = new File(search[i].getAbsolutePath(), path);
+			if (file.exists()) {
+				System.out.println("Resolved to: " + file);
 				return file.toURL();
+			}
 		}
 		return null;
 	}
@@ -213,17 +206,40 @@
 	 * 
 	 * @see org.apache.geronimo.deployment.DeployableModule#resolveModule(java.lang.String)
 	 */
-/*	public DeployableModule resolveModule(String uri) throws IOException {
+	public DeployableModule resolveModule(String uri) throws IOException {
 		DeployableModule[] children = getModules();
-		for(int i = 0; i < children.length; i++) {
-			if(children[i].getURI().equals(uri)) {
+		for (int i = 0; i < children.length; i++) {
+			if (children[i].getURI().equals(uri)) {
 				return children[i];
 			}
 		}
 		return null;
-	}*/
-	
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.deployment.DeployableModule#getArchive()
+	 */
+	public JarFile getArchive() {
+		return null;
+	}
+
 	private void init() {
 		archived = getRoot().isFile();
 	}
+
+	public static final GBeanInfo GBEAN_INFO;
+
+	static {
+		GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(
+				EclipseDeployableModule.class, "DeployableModule");
+		infoBuilder.addInterface(DeployableModule.class);
+		GBEAN_INFO = infoBuilder.getBeanInfo();
+	}
+
+	public static GBeanInfo getGBeanInfo() {
+		return GBEAN_INFO;
+	}
+
 }

Added: geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/resources/geronimo-service.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/resources/geronimo-service.xml?view=auto&rev=485779
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/resources/geronimo-service.xml
(added)
+++ geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/resources/geronimo-service.xml
Mon Dec 11 09:59:07 2006
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+	Licensed to the Apache Software Foundation (ASF) under one or more
+	contributor license agreements.  See the NOTICE file distributed with
+	this work for additional information regarding copyright ownership.
+	The ASF licenses this file to You under the Apache License, Version 2.0
+	(the "License"); you may not use this file except in compliance with
+	the License.  You may obtain a copy of the License at
+	
+	http://www.apache.org/licenses/LICENSE-2.0
+	
+	Unless required by applicable law or agreed to in writing, software
+	distributed under the License is distributed on an "AS IS" BASIS,
+	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	See the License for the specific language governing permissions and
+	limitations under the License.
+-->
+<module xmlns="http://geronimo.apache.org/xml/ns/deployment-1.1">
+	<environment>
+		<moduleId>
+			<groupId>org.apache.geronimo.eclipse.deployment</groupId>
+			<artifactId>eclipse-deployment-support</artifactId>
+			<version>1.0-SNAPSHOT</version>
+			<type>car</type>
+		</moduleId>
+		<dependencies>
+			<dependency>
+				<groupId>org.apache.geronimo.configs</groupId>
+      			<artifactId>geronimo-gbean-deployer</artifactId>
+      			<version>1.2-SNAPSHOT</version>
+      			<type>car</type>
+			</dependency>
+			<dependency>
+				<groupId>xmlbeans</groupId>
+				<artifactId>xbean</artifactId>
+				<version>2.0.0</version>
+				<type>jar</type>
+				<import>classes</import>
+			</dependency>
+			 <dependency>
+                <groupId>stax</groupId>
+                <artifactId>stax-api</artifactId>
+                <version>1.0</version>
+                <type>jar</type>
+            </dependency>
+		</dependencies>
+	</environment>
+	<gbean name="EclipseDeployable" class="org.apache.geronimo.deployment.EclipseDeployableModule"
/>
+</module>
\ No newline at end of file

Propchange: geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/resources/geronimo-service.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/resources/geronimo-service.xml
------------------------------------------------------------------------------
    svn:keywords = Date Rev

Propchange: geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/resources/geronimo-service.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java?view=diff&rev=485779&r1=485778&r2=485779
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java
Mon Dec 11 09:59:07 2006
@@ -16,8 +16,6 @@
  */
 package org.apache.geronimo.st.core;
 
-import java.io.File;
-import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
@@ -43,12 +41,7 @@
 import org.apache.geronimo.st.core.operations.ISharedLibEntryCreationDataModelProperties;
 import org.apache.geronimo.st.core.operations.SharedLibEntryCreationOperation;
 import org.apache.geronimo.st.core.operations.SharedLibEntryDataModelProvider;
-import org.apache.geronimo.xbeans.eclipse.deployment.ModuleDocument;
-import org.apache.geronimo.xbeans.eclipse.deployment.ChildrenDocument.Children;
-import org.apache.geronimo.xbeans.eclipse.deployment.ModuleDocument.Module;
-import org.apache.xmlbeans.XmlOptions;
 import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IContainer;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -67,11 +60,6 @@
 import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
 import org.eclipse.jdt.launching.IVMInstall;
 import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.jst.j2ee.internal.deployables.J2EEFlexProjDeployable;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
 import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
 import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
 import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
@@ -364,7 +352,6 @@
 	}
 
 	protected void invokeCommand(int deltaKind, IModule module) throws CoreException {
-		generateRunFromWorkspaceConfig(module);
 		
 		ClassLoader old = Thread.currentThread().getContextClassLoader();
 		try {
@@ -398,72 +385,7 @@
 		} finally {
 			Thread.currentThread().setContextClassLoader(old);
 		}
-	}
-	
-	private void generateRunFromWorkspaceConfig(IModule module) {
-		if (getGeronimoServer().isRunFromWorkspace()) {
-			IPath configDir = Activator.getDefault().getStateLocation().append("looseconfig").append("server_"
+ getServer().getId());
-			configDir.toFile().mkdirs();
-
-			ModuleDocument doc = ModuleDocument.Factory.newInstance();
-			Module deployable = doc.addNewModule();
-			processModuleConfig(deployable, module);
-
-			XmlOptions options = new XmlOptions();
-			options.setSavePrettyPrint();
-			File file = configDir.append(module.getName()).addFileExtension("xml").toFile();
-			Trace.trace(Trace.INFO,doc.xmlText(options));
-			try {
-				doc.save(file, options);
-			} catch (IOException e) {
-				e.printStackTrace();
-			}
-		}
-	}
-
-	private void processModuleConfig(Module deployable, IModule serverModule) {
-		
-		deployable.setName(serverModule.getName());
-		
-		J2EEFlexProjDeployable j2eeModule = (J2EEFlexProjDeployable) serverModule.loadAdapter(J2EEFlexProjDeployable.class,
null);
-		if (j2eeModule != null) {
-			
-			if(j2eeModule.isBinary()) {
-				deployable.setPath(serverModule.getName());
-				return;
-			}
-			
-			IContainer[] containers = j2eeModule.getResourceFolders();
-			for (int i = 0; i < containers.length; i++) {
-				deployable.addNewResources().setPath(containers[i].getLocation().toOSString());
-			}
-			containers = j2eeModule.getJavaOutputFolders();
-			for (int i = 0; i < containers.length; i++) {
-				deployable.addNewClasses().setPath(containers[i].getLocation().toOSString());
-			}
-		}
-
-		IModule[] children = j2eeModule.getChildModules();		
-		if (children.length > 0) {
-			Children modChild = deployable.addNewChildren();
-			for (int i = 0; i < children.length; i++) {
-				processModuleConfig(modChild.addNewModule(), children[i]);
-			}
-		}
-		
-		IVirtualComponent vc = ComponentCore.createComponent(serverModule.getProject());
-		IVirtualReference[] refs = vc.getReferences();
-		for(int i = 0; i< refs.length; i++) {
-			IVirtualComponent refComp = refs[i].getReferencedComponent();
-			if(refComp.isBinary()) {
-				Children modChild = deployable.getChildren() == null ? deployable.addNewChildren() :
deployable.getChildren();
-				Module binaryModule = modChild.addNewModule();
-				VirtualArchiveComponent archiveComp = (VirtualArchiveComponent) refComp;
-				binaryModule.setName(archiveComp.getUnderlyingDiskFile().getName());
-				binaryModule.setPath(archiveComp.getUnderlyingDiskFile().getAbsolutePath());
-			}
-		}
-	}
+	}	
 
 	/**
 	 * @param module

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoUtils.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoUtils.java?view=diff&rev=485779&r1=485778&r2=485779
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoUtils.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoUtils.java
Mon Dec 11 09:59:07 2006
@@ -23,6 +23,7 @@
 
 import org.apache.geronimo.st.core.internal.Trace;
 import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.emf.common.util.URI;
@@ -31,9 +32,11 @@
 import org.eclipse.emf.ecore.resource.ResourceSet;
 import org.eclipse.emf.ecore.xmi.XMIResource;
 import org.eclipse.jst.j2ee.internal.deployables.J2EEFlexProjDeployable;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
 import org.eclipse.jst.server.core.IWebModule;
 import org.eclipse.wst.common.componentcore.ArtifactEdit;
 import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
 import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
 import org.eclipse.wst.server.core.IModule;
 
@@ -85,6 +88,24 @@
 			Trace.trace(Trace.SEVERE, "getJSR88ModuleType = null");
 			return null;
 		}
+	}
+	
+	public static IFile getDeploymentPlanFile(IModule module) {
+		IProject project = module.getProject();
+		IVirtualComponent comp = ComponentCore.createComponent(project);
+		String type = J2EEProjectUtilities.getJ2EEProjectType(project);
+		if (IModuleConstants.JST_WEB_MODULE.equals(type)) {
+			return getWebDeploymentPlanFile(comp);
+		} else if (IModuleConstants.JST_EJB_MODULE.equals(type)) {
+			return getOpenEjbDeploymentPlanFile(comp);
+		} else if (IModuleConstants.JST_EAR_MODULE.equals(type)) {
+			return getApplicationDeploymentPlanFile(comp);
+		} else if (IModuleConstants.JST_CONNECTOR_MODULE.equals(type)) {
+			return getConnectorDeploymentPlanFile(comp);
+		} else if (IModuleConstants.JST_UTILITY_MODULE.equals(type)) {
+			return getServiceDeploymentPlanFile(comp);
+		}
+		return null;
 	}
 
 	public static IFile getWebDeploymentPlanFile(IVirtualComponent comp) {

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/commands/DeployCommand.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/commands/DeployCommand.java?view=diff&rev=485779&r1=485778&r2=485779
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/commands/DeployCommand.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/commands/DeployCommand.java
Mon Dec 11 09:59:07 2006
@@ -17,15 +17,23 @@
 package org.apache.geronimo.st.core.commands;
 
 import java.io.File;
+import java.io.IOException;
 
+import org.apache.geronimo.st.core.Activator;
 import org.apache.geronimo.st.core.DeploymentUtils;
-import org.apache.geronimo.st.core.GeronimoUtils;
 import org.apache.geronimo.st.core.IGeronimoServer;
 import org.apache.geronimo.st.core.internal.Trace;
+import org.apache.geronimo.xbeans.eclipse.deployment.ModuleDocument;
+import org.apache.geronimo.xbeans.eclipse.deployment.ChildrenDocument.Children;
+import org.apache.geronimo.xbeans.eclipse.deployment.ModuleDocument.Module;
+import org.apache.xmlbeans.XmlOptions;
+import org.eclipse.core.resources.IContainer;
 import org.eclipse.core.runtime.IPath;
-import org.eclipse.wst.common.componentcore.internal.StructureEdit;
-import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
-import org.eclipse.wst.common.componentcore.internal.impl.WorkbenchComponentImpl;
+import org.eclipse.jst.j2ee.internal.deployables.J2EEFlexProjDeployable;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
 import org.eclipse.wst.server.core.IModule;
 import org.eclipse.wst.server.core.IServer;
 
@@ -45,25 +53,78 @@
 	public File getTargetFile() {
 		File file = null;
 		IGeronimoServer gs = getGeronimoServer();
-		if (gs.isRunFromWorkspace() && !GeronimoUtils.isEarModule(getModule())) {
-			StructureEdit moduleCore = StructureEdit.getStructureEditForRead(getModule().getProject());
-			try {
-				WorkbenchComponent component = moduleCore.getComponent();
-				IPath loc = ((WorkbenchComponentImpl) component).getDefaultSourceRoot();
-				file = getModule().getProject().findMember(loc).getLocation().toFile();
-			} finally {
-				if (moduleCore != null)
-					moduleCore.dispose();
-			}
+		if (gs.isRunFromWorkspace()) {
+			file = generateRunFromWorkspaceConfig(getModule());
 		} else {
 			IPath outputDir = DeploymentUtils.STATE_LOC.append("server_" + getServer().getId());
 			outputDir.toFile().mkdirs();
 			file = DeploymentUtils.createJarFile(getModule(), outputDir);
 		}
-		
 		Trace.trace(Trace.INFO, "File: " + file.getAbsolutePath());
-		
 		return file;
+	}
+
+	protected File generateRunFromWorkspaceConfig(IModule module) {
+		IPath configDir = Activator.getDefault().getStateLocation().append("looseconfig").append("server_"
+ getServer().getId());
+		configDir.toFile().mkdirs();
+
+		ModuleDocument doc = ModuleDocument.Factory.newInstance();
+		Module deployable = doc.addNewModule();
+		processModuleConfig(deployable, module);
+
+		XmlOptions options = new XmlOptions();
+		options.setSavePrettyPrint();
+		File file = configDir.append(module.getName()).addFileExtension("xml").toFile();
+		Trace.trace(Trace.INFO,doc.xmlText(options));
+		try {
+			doc.save(file, options);
+			return file;
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+	private void processModuleConfig(Module deployable, IModule serverModule) {
+		deployable.setName(serverModule.getName());
+		J2EEFlexProjDeployable j2eeModule = (J2EEFlexProjDeployable) serverModule.loadAdapter(J2EEFlexProjDeployable.class,
null);
+		if (j2eeModule != null) {
+
+			if(j2eeModule.isBinary()) {
+				deployable.setPath(serverModule.getName());
+				return;
+			}
+
+			IContainer[] containers = j2eeModule.getResourceFolders();
+			for (int i = 0; i < containers.length; i++) {
+				deployable.addNewResources().setPath(containers[i].getLocation().toOSString());
+			}
+			containers = j2eeModule.getJavaOutputFolders();
+			for (int i = 0; i < containers.length; i++) {
+				deployable.addNewClasses().setPath(containers[i].getLocation().toOSString());
+			}
+		}
+
+		IModule[] children = j2eeModule.getChildModules();		
+		if (children.length > 0) {
+			Children modChild = deployable.addNewChildren();
+			for (int i = 0; i < children.length; i++) {
+				processModuleConfig(modChild.addNewModule(), children[i]);
+			}
+		}
+
+		IVirtualComponent vc = ComponentCore.createComponent(serverModule.getProject());
+		IVirtualReference[] refs = vc.getReferences();
+		for(int i = 0; i< refs.length; i++) {
+			IVirtualComponent refComp = refs[i].getReferencedComponent();
+			if(refComp.isBinary()) {
+				Children modChild = deployable.getChildren() == null ? deployable.addNewChildren() :
deployable.getChildren();
+				Module binaryModule = modChild.addNewModule();
+				VirtualArchiveComponent archiveComp = (VirtualArchiveComponent) refComp;
+				binaryModule.setName(archiveComp.getUnderlyingDiskFile().getName());
+				binaryModule.setPath(archiveComp.getUnderlyingDiskFile().getAbsolutePath());
+			}
+		}
 	}
 
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/commands/RedeployCommand.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/commands/RedeployCommand.java?view=diff&rev=485779&r1=485778&r2=485779
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/commands/RedeployCommand.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/commands/RedeployCommand.java
Mon Dec 11 09:59:07 2006
@@ -20,6 +20,7 @@
 import javax.enterprise.deploy.spi.TargetModuleID;
 
 import org.apache.geronimo.st.core.DeploymentUtils;
+import org.apache.geronimo.st.core.GeronimoUtils;
 import org.apache.geronimo.st.core.IGeronimoServer;
 import org.apache.geronimo.st.core.ModuleArtifactMapper;
 import org.eclipse.core.runtime.CoreException;
@@ -57,7 +58,7 @@
 			ids = new TargetModuleID[] {id};
 		}
 		
-		return new DeploymentCmdStatus(Status.OK_STATUS, getDeploymentManager().redeploy(ids, getTargetFile(),
null));
+		return new DeploymentCmdStatus(Status.OK_STATUS, getDeploymentManager().redeploy(ids, getTargetFile(),
GeronimoUtils.getDeploymentPlanFile(getModule()).getLocation().toFile()));
 	}
 
 	/*

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/sections/ServerEditorTestEnvSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/sections/ServerEditorTestEnvSection.java?view=diff&rev=485779&r1=485778&r2=485779
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/sections/ServerEditorTestEnvSection.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.ui/src/org/apache/geronimo/st/v11/ui/sections/ServerEditorTestEnvSection.java
Mon Dec 11 09:59:07 2006
@@ -87,12 +87,11 @@
 		runFromWorkspace = toolkit.createButton(composite, Messages.editorSectionRunFromWorkspace,
SWT.CHECK);
 		runFromWorkspace.setSelection(gs.isRunFromWorkspace());
 		// TODO temporarily disable support until new implementation
-		runFromWorkspace.setEnabled(false);
+		//runFromWorkspace.setEnabled(false);
 		runFromWorkspace.addSelectionListener(new SelectionListener() {
 
 			public void widgetSelected(SelectionEvent e) {
-				execute(new SetRunFromWorkspaceCommand(server, runFromWorkspace
-						.getSelection()));
+				execute(new SetRunFromWorkspaceCommand(server, runFromWorkspace.getSelection()));
 			}
 
 			public void widgetDefaultSelected(SelectionEvent e) {



Mime
View raw message