geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r441511 - in /geronimo/devtools/eclipse-plugin/trunk: modules/ modules/eclipse-support/ modules/eclipse-support/src/ modules/eclipse-support/src/main/ modules/eclipse-support/src/main/java/ modules/eclipse-support/src/main/schema/ plugins/o...
Date Fri, 08 Sep 2006 14:23:46 GMT
Author: sppatel
Date: Fri Sep  8 07:23:45 2006
New Revision: 441511

URL: http://svn.apache.org/viewvc?view=rev&rev=441511
Log:
create schema for representing deployable wtp projects and generate config during deployment

Added:
    geronimo/devtools/eclipse-plugin/trunk/modules/
    geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/
    geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/pom.xml   (with props)
    geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/
    geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/
    geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/java/
    geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/schema/
    geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/schema/eclipse-deployable-1.0.xsd
  (with props)
    geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/schema/xmlconfig.xml
  (with props)
Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/.classpath
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/META-INF/MANIFEST.MF
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/build.properties
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/pom.xml
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java

Added: 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=auto&rev=441511
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/pom.xml (added)
+++ geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/pom.xml Fri Sep  8 07:23:45
2006
@@ -0,0 +1,57 @@
+<project>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.apache.geronimo.devtools</groupId>
+	<artifactId>eclipse-support</artifactId>
+	<packaging>jar</packaging>
+	<version>1.0-SNAPSHOT</version>
+	<name>Geronimo Eclipse Plugin :: Eclipse Deployment Support</name>
+	<dependencies>
+		<dependency>
+			<groupId>xmlbeans</groupId>
+			<artifactId>xbean</artifactId>
+			<version>2.0.0</version>
+		</dependency>
+		<dependency>
+			<groupId>stax</groupId>
+			<artifactId>stax-api</artifactId>
+			<version>1.0</version>
+			<exclusions>
+				<exclusion>
+					<groupId>xmlbeans</groupId>
+					<artifactId>xmlbeans-jsr173-api</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+	</dependencies>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.codehaus.mojo</groupId>
+				<artifactId>xmlbeans-maven-plugin</artifactId>
+				<version>2.0.1-SNAPSHOT</version>
+				<executions>
+					<execution>
+						<goals>
+							<goal>xmlbeans</goal>
+						</goals>
+					</execution>
+				</executions>
+				<configuration>
+					<sourceSchemas>
+						eclipse-deployable-1.0.xsd
+					</sourceSchemas>
+					<schemaDirectory>
+						${pom.basedir}/src/main/schema
+					</schemaDirectory>
+					<xmlConfigs>
+						<xmlConfig implementation="java.io.File">
+							${pom.basedir}/src/main/schema/xmlconfig.xml
+						</xmlConfig>
+					</xmlConfigs>
+					<download>true</download>
+					<quiet>false</quiet>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+</project>

Propchange: geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Rev

Propchange: geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/schema/eclipse-deployable-1.0.xsd
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/schema/eclipse-deployable-1.0.xsd?view=auto&rev=441511
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/schema/eclipse-deployable-1.0.xsd
(added)
+++ geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/schema/eclipse-deployable-1.0.xsd
Fri Sep  8 07:23:45 2006
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+    <xs:element name="module">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element ref="resources" minOccurs="0" maxOccurs="unbounded" />
+                <xs:element ref="classes" minOccurs="0" maxOccurs="unbounded" />
+                <xs:element ref="children" minOccurs="0" />
+            </xs:sequence>
+            <xs:attribute name="path" type="xs:string" use="required" />
+            <xs:attribute name="name" type="xs:string" use="required" />
+        </xs:complexType>
+    </xs:element>
+
+    <xs:element name="resources">
+        <xs:complexType>
+            <xs:attribute name="path" type="xs:string" use="required" />
+        </xs:complexType>
+    </xs:element>
+
+    <xs:element name="classes">
+        <xs:complexType>
+            <xs:attribute name="path" type="xs:string" use="required" />
+        </xs:complexType>
+    </xs:element>
+
+    <xs:element name="children">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element ref="module" maxOccurs="unbounded" />
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+
+</xs:schema>
\ No newline at end of file

Propchange: geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/schema/eclipse-deployable-1.0.xsd
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/schema/eclipse-deployable-1.0.xsd
------------------------------------------------------------------------------
    svn:keywords = Date Rev

Propchange: geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/schema/eclipse-deployable-1.0.xsd
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/schema/xmlconfig.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/schema/xmlconfig.xml?view=auto&rev=441511
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/schema/xmlconfig.xml
(added)
+++ geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/schema/xmlconfig.xml
Fri Sep  8 07:23:45 2006
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright 2006 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.
+-->
+<xb:config xmlns:xb="http://www.bea.com/2002/09/xbean/config">
+    <xb:namespace>
+        <xb:package>org.apache.geronimo.xbeans.eclipse.deployment</xb:package>
+    </xb:namespace>
+</xb:config>

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

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

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

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/.classpath
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/.classpath?view=diff&rev=441511&r1=441510&r2=441511
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/.classpath
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/.classpath
Fri Sep  8 07:23:45 2006
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
 	<classpathentry kind="src" path="src"/>
+	<classpathentry exported="true" kind="lib" path="lib/eclipse-support-1.0-SNAPSHOT.jar"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 	<classpathentry kind="output" path="target/classes"/>

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/META-INF/MANIFEST.MF?view=diff&rev=441511&r1=441510&r2=441511
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/META-INF/MANIFEST.MF
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/META-INF/MANIFEST.MF
Fri Sep  8 07:23:45 2006
@@ -35,3 +35,5 @@
  org.apache.geronimo.st.core.commands,
  org.apache.geronimo.st.core.internal,
  org.apache.geronimo.st.core.operations
+Bundle-ClassPath: lib/eclipse-support-1.0-SNAPSHOT.jar,
+ .

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/build.properties
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/build.properties?view=diff&rev=441511&r1=441510&r2=441511
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/build.properties
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/build.properties
Fri Sep  8 07:23:45 2006
@@ -2,4 +2,5 @@
 output.. = bin/
 bin.includes = META-INF/,\
                .,\
-               plugin.xml
+               plugin.xml,\
+               lib/eclipse-support-1.0-SNAPSHOT.jar

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/pom.xml?view=diff&rev=441511&r1=441510&r2=441511
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/pom.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/pom.xml Fri
Sep  8 07:23:45 2006
@@ -60,9 +60,9 @@
                         <configuration>
                             <artifactItems>
                                 <artifactItem>
-                                    <groupId>org.apache.geronimo.specs</groupId>
-                                    <artifactId>geronimo-j2ee-deployment_1.1_spec</artifactId>
-                                    <version>${geronimo_spec_version}</version>
 
+                                    <groupId>org.apache.geronimo.devtools</groupId>
+                                    <artifactId>eclipse-support</artifactId>
+                                    <version>1.0-SNAPSHOT</version>  
                                 </artifactItem>
                             </artifactItems>
                             <outputDirectory>lib</outputDirectory>
@@ -101,6 +101,11 @@
             <groupId>xmlbeans</groupId>
             <artifactId>xbean</artifactId>
             <version>2.0.0</version>     
+        </dependency>
+        <dependency>
+        	<groupId>org.apache.geronimo.devtools</groupId>
+            <artifactId>eclipse-support</artifactId>
+            <version>1.0-SNAPSHOT</version>
         </dependency>
     </dependencies>
 </project>

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=441511&r1=441510&r2=441511
==============================================================================
--- 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
Fri Sep  8 07:23:45 2006
@@ -15,6 +15,8 @@
  */
 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;
@@ -39,6 +41,11 @@
 import org.apache.geronimo.st.core.commands.TargetModuleIdNotFoundException;
 import org.apache.geronimo.st.core.internal.Messages;
 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.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -56,6 +63,11 @@
 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.server.core.IModule;
 import org.eclipse.wst.server.core.IServer;
 import org.eclipse.wst.server.core.IServerListener;
@@ -277,6 +289,8 @@
 	}
 
 	protected void invokeCommand(int deltaKind, IModule module) throws CoreException {
+		generateRunFromWorkspaceConfig(module);
+		
 		ClassLoader old = Thread.currentThread().getContextClassLoader();
 		try {
 			ClassLoader cl = getContextClassLoader();
@@ -304,6 +318,73 @@
 			e.printStackTrace();
 		} 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();
+		System.out.println(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());
+			}
 		}
 	}
 



Mime
View raw message