geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r447436 - in /geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support: ./ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/geronimo/ src/main/java/org/apache/geronimo/deployment/
Date Mon, 18 Sep 2006 15:25:34 GMT
Author: sppatel
Date: Mon Sep 18 08:25:33 2006
New Revision: 447436

URL: http://svn.apache.org/viewvc?view=rev&rev=447436
Log:
add dependency to geronimo-deployment which will contain DeployableModule interface, add initial
Eclipse impl of DeployableModule

Added:
    geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/java/org/
    geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/java/org/apache/
    geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/java/org/apache/geronimo/
    geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/java/org/apache/geronimo/deployment/
    geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/java/org/apache/geronimo/deployment/EclipseDeployableModule.java
  (with props)
Modified:
    geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/pom.xml

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=447436&r1=447435&r2=447436
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/pom.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/pom.xml Mon Sep 18 08:25:33
2006
@@ -7,6 +7,11 @@
 	<name>Geronimo Eclipse Plugin :: Eclipse Deployment Support</name>
 	<dependencies>
 		<dependency>
+			<groupId>org.apache.geronimo.modules</groupId>
+			<artifactId>geronimo-deployment</artifactId>
+			<version>1.2-SNAPSHOT</version>
+		</dependency>
+		<dependency>
 			<groupId>xmlbeans</groupId>
 			<artifactId>xbean</artifactId>
 			<version>2.0.0</version>

Added: 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=auto&rev=447436
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/java/org/apache/geronimo/deployment/EclipseDeployableModule.java
(added)
+++ geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/java/org/apache/geronimo/deployment/EclipseDeployableModule.java
Mon Sep 18 08:25:33 2006
@@ -0,0 +1,211 @@
+/**
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ *  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.deployment;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+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
+ */
+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 boolean archived = false;
+	
+	public EclipseDeployableModule(File config) {
+		try {
+			module = ModuleDocument.Factory.parse(config).getModule();
+			init();
+		} catch (XmlException e) {
+			e.printStackTrace();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * @param module
+	 */
+	private EclipseDeployableModule(Module module) {
+		this.module = module;
+		init();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.deployment.DeployableModule#cleanup()
+	 */
+	public void cleanup() {
+		// TODO Auto-generated method stub
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.deployment.DeployableModule#getClassesFolders()
+	 */
+	public File[] getClassesFolders() {
+		if (classesFolders != null) {
+			return classesFolders;
+		}
+
+		Classes[] classes = module.getClassesArray();
+		classesFolders = new File[classes.length];
+		for (int i = 0; i < classesFolders.length; i++) {
+			File file = new File(classes[i].getPath());
+			if (file.exists()) {
+				classesFolders[i] = file;
+			} else {
+
+			}
+		}
+		return classesFolders;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.deployment.DeployableModule#getModuleContextResources()
+	 */
+	public File[] getModuleContextResources() {
+		if (resourcesFolders != null) {
+			return resourcesFolders;
+		}
+
+		Resources[] resources = module.getResourcesArray();
+		resourcesFolders = new File[resources.length];
+		for (int i = 0; i < classesFolders.length; i++) {
+			File file = new File(resources[i].getPath());
+			if (file.exists()) {
+				resourcesFolders[i] = file;
+			} else {
+
+			}
+		}
+
+		return resourcesFolders;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.deployment.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);
+		}
+
+		return children;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.deployment.DeployableModule#getRoot()
+	 */
+	public File getRoot() {
+		if (root != null) {
+			return root;
+		}
+		root = new File(module.getPath());
+		return root;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.deployment.DeployableModule#getURI()
+	 */
+	public String getURI() {
+		if(uri != null) {
+			return uri;
+		}
+		uri = module.getName();
+		return uri;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.deployment.DeployableModule#isArchived()
+	 */
+	public boolean isArchived() {
+		return archived;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.deployment.DeployableModule#resolve(java.lang.String)
+	 */
+	public URL resolve(String path) throws IOException {
+		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()) 
+				return file.toURL();
+		}
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.geronimo.deployment.DeployableModule#resolveModule(java.lang.String)
+	 */
+	public DeployableModule resolveModule(String uri) throws IOException {
+		DeployableModule[] children = getModules();
+		for(int i = 0; i < children.length; i++) {
+			if(children[i].getURI().equals(uri)) {
+				return children[i];
+			}
+		}
+		return null;
+	}
+	
+	private void init() {
+		archived = getRoot().isFile();
+	}
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/java/org/apache/geronimo/deployment/EclipseDeployableModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/java/org/apache/geronimo/deployment/EclipseDeployableModule.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev

Propchange: geronimo/devtools/eclipse-plugin/trunk/modules/eclipse-support/src/main/java/org/apache/geronimo/deployment/EclipseDeployableModule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message