geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From de...@apache.org
Subject svn commit: r811324 - in /geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core: DeploymentUtils.java internal/DependencyHelper.java
Date Fri, 04 Sep 2009 09:37:59 GMT
Author: delos
Date: Fri Sep  4 09:37:58 2009
New Revision: 811324

URL: http://svn.apache.org/viewvc?rev=811324&view=rev
Log:
GERONIMODEVTOOLS-362  GEP DependencyHelper not interrogating server for already-deployed dependencies

Modified:
    geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/DeploymentUtils.java
    geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/internal/DependencyHelper.java

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/DeploymentUtils.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/DeploymentUtils.java?rev=811324&r1=811323&r2=811324&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/DeploymentUtils.java
(original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/DeploymentUtils.java
Fri Sep  4 09:37:58 2009
@@ -180,19 +180,14 @@
 	public static TargetModuleID getTargetModuleID(DeploymentManager dm, String configId) throws
TargetModuleIdNotFoundException {
 
 		try {
-			TargetModuleID ids[] = dm.getAvailableModules(null, dm.getTargets());
-			if (ids != null) {
-				for (int i = 0; i < ids.length; i++) {
-					if (ids[i].getModuleID().equals(configId)) {
-						Trace.trace(Trace.INFO, "Found configuration " + configId +  " on server.");
-						return ids[i];
-					}
-				}
-			}
+			TargetModuleID id = isInstalledModule(dm,configId);
+			if (id!=null) return id;
 		} catch (IllegalStateException e) {
 			e.printStackTrace();
 		} catch (TargetException e) {
 			e.printStackTrace();
+		} catch (CoreException e) {
+			e.printStackTrace();
 		}
 
 		throw new TargetModuleIdNotFoundException("Could not find TargetModuleID with configId
" + configId);
@@ -263,4 +258,39 @@
 
         return fileList;
     }
+
+	public static boolean isInstalledModule(IServer server, String configId) {
+		DeploymentManager dm;
+		try {
+			dm = DeploymentCommandFactory.getDeploymentManager(server);
+			TargetModuleID id=isInstalledModule(dm,configId);
+			if (id==null) return false;
+			else return true;
+		} catch (CoreException e) {
+			e.printStackTrace();
+			return false;
+		} catch (IllegalStateException e) {
+			e.printStackTrace();
+			return false;
+		} catch (TargetException e) {
+			e.printStackTrace();
+			return false;
+		}
+		
+	}
+	
+	private static TargetModuleID isInstalledModule(DeploymentManager dm, String configId) throws
CoreException, IllegalStateException, TargetException{
+		
+		TargetModuleID[] ids = dm.getAvailableModules(null, dm.getTargets());
+		if(ids == null) return null;
+		if (ids != null) {
+			for (int i = 0; i < ids.length; i++) {
+				if (ids[i].getModuleID().equals(configId)) {
+					Trace.trace(Trace.INFO, "Found configuration " + configId +  " on server.");
+					return ids[i];
+				}
+			}
+		}
+		return null;
+	}
 }

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/internal/DependencyHelper.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/internal/DependencyHelper.java?rev=811324&r1=811323&r2=811324&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/internal/DependencyHelper.java
(original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.5/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/internal/DependencyHelper.java
Fri Sep  4 09:37:58 2009
@@ -34,6 +34,7 @@
 import org.apache.geronimo.jee.deployment.ObjectFactory;
 import org.apache.geronimo.jee.openejb.OpenejbJar;
 import org.apache.geronimo.jee.web.WebApp;
+import org.apache.geronimo.st.core.DeploymentUtils;
 import org.apache.geronimo.st.core.GeronimoUtils;
 import org.apache.geronimo.st.core.jaxb.JAXBUtils;
 import org.eclipse.core.resources.IFile;
@@ -111,7 +112,13 @@
 	                            parent.setVersion( dep.getVersion() );
 	                            parent.setType( dep.getType() );
 	                           
-	                            dm.addDependency( child, parent );
+	                            String configId = dep.getGroupId().concat("/")
+	              				  .concat(dep.getArtifactId()).concat("/")
+	              				  .concat(dep.getVersion()).concat("/")
+	              				  .concat(dep.getType());
+              
+					            if (!DeploymentUtils.isInstalledModule(server,configId))
+					                 	dm.addDependency( child, parent );
 	                        }
 	                    }
 	                }



Mime
View raw message