geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1203020 [12/29] - in /geronimo/devtools/eclipse-plugin/branches/3.0-beta-1: eclipse/ plugins/org.apache.geronimo.j2ee.v11.jaxbmodel/ plugins/org.apache.geronimo.j2ee.v11.jaxbmodel/src/test/resources/application/ plugins/org.apache.geronimo...
Date Thu, 17 Nov 2011 02:19:27 GMT
Modified: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/DependencyHelper.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/DependencyHelper.java?rev=1203020&r1=1203019&r2=1203020&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/DependencyHelper.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/DependencyHelper.java Thu Nov 17 02:19:12 2011
@@ -1,743 +1,743 @@
-/*
- * 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.st.v11.core.internal;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.xml.bind.JAXBElement;
-
-import org.apache.geronimo.j2ee.application.ApplicationType;
-import org.apache.geronimo.j2ee.applicationclient.ApplicationClientType;
-import org.apache.geronimo.j2ee.connector.ConnectorType;
-import org.apache.geronimo.j2ee.deployment.ArtifactType;
-import org.apache.geronimo.j2ee.deployment.DependenciesType;
-import org.apache.geronimo.j2ee.deployment.DependencyType;
-import org.apache.geronimo.j2ee.deployment.EnvironmentType;
-import org.apache.geronimo.j2ee.deployment.ObjectFactory;
-import org.apache.geronimo.j2ee.openejb_jar.OpenejbJarType;
-import org.apache.geronimo.j2ee.web.WebAppType;
-import org.apache.geronimo.jaxbmodel.common.operations.JAXBUtils;
-import org.apache.geronimo.st.core.DeploymentUtils;
-import org.apache.geronimo.st.core.GeronimoUtils;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
-
-/**
- * <b>DependencyHelper</b> is a helper class with various methods to aid in the discovery of
- * inter-dependencies between modules being deployed from the GEP to the Geronimo server. It
- * performs the following capabilities:
- * <ol>
- *      <li>Discovery of dependencies between modules<p>
- *      <li>Provides the proper publishing ordering of the modules based on the discovered
- *          dependencies<p>
- *      <li><b>TODO:</b> Query the server searching for missing dependencies
- * </ol>
- * 
- * @version $Rev: 817996 $ $Date: 2009-09-23 16:04:12 +0800 (Wed, 23 Sep 2009) $
- */
-public class DependencyHelper {
-
-    private DependencyManager dm = new DependencyManager();
-    private ObjectFactory deploymentFactory = new ObjectFactory();
-    private List inputModules = new ArrayList();
-    private List inputDeltaKind = new ArrayList();
-    private List reorderedModules = new ArrayList();
-    private List reorderedKinds  = new ArrayList();
-    private List<JAXBElement> inputJAXBElements = new ArrayList();
-    private List<JAXBElement> reorderedJAXBElements = new ArrayList();
-
-    //provide a cache
-    private ConcurrentHashMap<IModule, EnvironmentType> environmentCache = new ConcurrentHashMap<IModule, EnvironmentType>();
-
-    /**
-     * Reorder the publish order of the modules based on any discovered dependencies
-     * 
-     * @param modules   Modules to be published to the Geronimo server
-     * @param deltaKind Publish kind constant for each module
-     * 
-     * @return List of reordered modules and deltaKind (or input if no change)
-     */
-    public List reorderModules(IServer server, List modules, List deltaKind ) {
-        Trace.tracePoint("Entry", "DependencyHelper.reorderModules", modules, deltaKind);
-        
-        //provide a cache
-        ConcurrentHashMap<String,Boolean> verifiedModules = new ConcurrentHashMap<String,Boolean>();
-
-        if (modules.size() == 0) {
-            List reorderedLists = new ArrayList(2);
-            reorderedLists.add(modules);
-            reorderedLists.add(deltaKind);
-            Trace.tracePoint("Exit ", "DependencyHelper.reorderModules", reorderedLists);
-            return reorderedLists;
-        }
-
-        inputModules = modules;
-        inputDeltaKind = deltaKind;
-
-        // 
-        // Iterate through all the modules and register the dependencies
-        // 
-        for (int ii=0; ii<modules.size(); ii++) {
-            IModule[] module = (IModule[]) modules.get(ii);
-            int moduleDeltaKind = ((Integer)deltaKind.get(ii)).intValue();
-            if (moduleDeltaKind != ServerBehaviourDelegate.REMOVED) {
-            	//GERONIMODEVTOOLS-361
-            	for (IModule singleModule:module){
-            		EnvironmentType environment = getEnvironment(singleModule);
-	                if (environment != null) {
-	                    ArtifactType child = environment.getModuleId();
-	                    DependenciesType dependencies = environment.getDependencies();
-	                    if (dependencies != null) {
-	                        List<DependencyType> depList = dependencies.getDependency();
-	                        for ( DependencyType dep : depList) {
-	                            ArtifactType parent = deploymentFactory.createArtifactType();
-	                            parent.setGroupId( dep.getGroupId() );
-	                            parent.setArtifactId( dep.getArtifactId() );
-	                            parent.setVersion( dep.getVersion() );
-	                            parent.setType( dep.getType() );
-	                            
-	                            StringBuilder configId = new StringBuilder();
-	                            if (dep.getGroupId()!=null)
-	                            	configId.append(dep.getGroupId());
-	                            configId.append("/");
-	                            if (dep.getArtifactId()!=null)
-	                            	configId.append(dep.getArtifactId());
-	                            configId.append("/");
-	                            if (dep.getVersion()!=null)
-	                            	configId.append(dep.getVersion());
-	                            configId.append("/");
-	                            if (dep.getType()!=null)
-	                            	configId.append(dep.getType());
-	                            
-	                            //get install flag from the cache
-								Boolean isInstalledModule = verifiedModules
-										.get(configId.toString());
-								if (isInstalledModule == null) {
-									// not in the cache, invoke
-									// isInstalledModule() method
-									isInstalledModule = DeploymentUtils
-											.isInstalledModule(server,
-													configId.toString());
-									// put install flag into the cache for next
-									// retrieve
-									verifiedModules.put(configId.toString(),
-											isInstalledModule);
-								}
-
-								if (!isInstalledModule)
-                                    dm.addDependency( child, parent );
-	                        }
-	                    }
-	                }
-            	}
-            }
-        }
-
-        // 
-        // Iterate through all the modules again and reorder as necessary
-        // 
-        for (int ii=0; ii<modules.size(); ii++) {
-            IModule[] module = (IModule[]) modules.get(ii);
-            int moduleDeltaKind = ((Integer)deltaKind.get(ii)).intValue();
-            if (module!=null && !reorderedModules.contains(module)) {
-                // Not already moved 
-                if (moduleDeltaKind == ServerBehaviourDelegate.REMOVED) {
-                    // Move module if going to be removed 
-                    reorderedModules.add(module);
-                    reorderedKinds.add(moduleDeltaKind);
-                }
-                else {
-                    EnvironmentType environment = getEnvironment(module[0]);
-                    if (environment != null) {
-                        ArtifactType artifact = environment.getModuleId();
-                        if (artifact == null) {
-                            // Move if null (nothing can be done)
-                            if (!reorderedModules.contains(module)) {
-                                reorderedModules.add(module);
-                                reorderedKinds.add(moduleDeltaKind);
-                            }
-                        }
-                        else if (dm.getParents(artifact).contains(artifact) ||  
-                                 dm.getChildren(artifact).contains(artifact)) {
-                            // Move if a tight circular dependency (nothing can be done)
-                            if (!reorderedModules.contains(module)) {
-                                reorderedModules.add(module);
-                                reorderedKinds.add(moduleDeltaKind);
-                            }
-                        }
-                        else if (dm.getParents(artifact).size() == 0) {
-                            // Move if no parents (nothing to do)
-                            if (!reorderedModules.contains(module)) {
-                                reorderedModules.add(module);
-                                reorderedKinds.add(moduleDeltaKind);
-                            }
-                        }
-                        else if (dm.getParents(artifact).size() > 0) {
-                            // Move parents first
-                            processParents(dm.getParents(artifact), artifact);
-                            // Move self 
-                            if (!reorderedModules.contains(module)) {
-                                reorderedModules.add(module);
-                                reorderedKinds.add(moduleDeltaKind);
-                            }
-                        }
-                    }else {
-                    	//no environment defined, do just as no parents
-                        if (!reorderedModules.contains(module)) {
-                            reorderedModules.add(module);
-                            reorderedKinds.add(moduleDeltaKind);
-                        }
-                    }
-                }
-            }
-        }
-
-        // 
-        // Ensure return lists are exactly the same size as the input lists 
-        // 
-        assert reorderedModules.size() == modules.size();
-        assert reorderedKinds.size() == deltaKind.size();
-
-        // 
-        // Return List of lists
-        // 
-        List reorderedLists = new ArrayList(2);
-        reorderedLists.add(reorderedModules);
-        reorderedLists.add(reorderedKinds);
-
-        Trace.tracePoint("Exit ", "DependencyHelper.reorderModules", reorderedLists);
-        return reorderedLists;
-    }
-
-
-    /**
-     * Reorder the list of JAXBElements based on any discovered dependencies
-     * 
-     * @param jaxbElements
-     * 
-     * @return List of JAXBElements (or input if no change)
-     */
-    public List<JAXBElement> reorderJAXBElements( List<JAXBElement> jaxbElements ) {
-        Trace.tracePoint("Entry", "DependencyHelper.reorderModules", jaxbElements);
-
-        if (jaxbElements.size() == 0) {
-            Trace.tracePoint("Exit ", "DependencyHelper.reorderModules", jaxbElements);
-            return jaxbElements;
-        }
-
-        inputJAXBElements = jaxbElements;
-
-        // 
-        // Iterate through all the JAXBElements and register the dependencies
-        // 
-        for (JAXBElement jaxbElement : jaxbElements) {
-            EnvironmentType environment = getEnvironment(jaxbElement);
-            if (environment != null) {
-                ArtifactType child = environment.getModuleId();
-                if (child != null) {
-                    DependenciesType dependencies = environment.getDependencies();
-                    if (dependencies != null) {
-                        List<DependencyType> depList = dependencies.getDependency();
-                        if (depList != null) {
-                            for ( DependencyType dep : depList) {
-                                ArtifactType parent = deploymentFactory.createArtifactType();
-                                parent.setGroupId( dep.getGroupId() );
-                                parent.setArtifactId( dep.getArtifactId() );
-                                parent.setVersion( dep.getVersion() );
-                                parent.setType( dep.getType() );
-                                dm.addDependency( child, parent );
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        // 
-        // Iterate through all the JAXBElements again and reorder as necessary
-        // 
-        for (JAXBElement jaxbElement : jaxbElements) {
-            if (!reorderedJAXBElements.contains(jaxbElement)) {
-                // Not already moved
-                EnvironmentType environment = getEnvironment(jaxbElement);
-                if (environment != null) {
-                    ArtifactType artifact = environment.getModuleId();
-                    if (artifact == null) {
-                        // Move if null (nothing can be done)
-                        if (!reorderedJAXBElements.contains(jaxbElement)) {
-                            reorderedJAXBElements.add(jaxbElement);
-                        }
-                    }
-                    else if (dm.getParents(artifact).contains(artifact) ||  
-                             dm.getChildren(artifact).contains(artifact)) {
-                        // Move if a tight circular dependency (nothing can be done)
-                        if (!reorderedJAXBElements.contains(jaxbElement)) {
-                            reorderedJAXBElements.add(jaxbElement);
-                        }
-                    }
-                    else if (dm.getParents(artifact).size() == 0) {
-                        // Move if no parents (nothing to do)
-                        if (!reorderedJAXBElements.contains(jaxbElement)) {
-                            reorderedJAXBElements.add(jaxbElement);
-                        }
-                    }
-                    else if (dm.getParents(artifact).size() > 0) {
-                        // Move parents first
-                        processJaxbParents(dm.getParents(artifact), artifact);
-                        // Move self 
-                        if (!reorderedJAXBElements.contains(jaxbElement)) {
-                            reorderedJAXBElements.add(jaxbElement);
-                        }
-                    }
-                }
-            }
-        }
-
-        // 
-        // Ensure return list is exactly the same size as the input list 
-        // 
-        assert reorderedJAXBElements.size() == jaxbElements.size();
-
-        // 
-        // Return List of JAXBElements
-        // 
-        Trace.tracePoint("Exit ", "DependencyHelper.reorderModules", reorderedJAXBElements);
-        return reorderedJAXBElements;
-    }
-
-
-    /**
-     *
-     */
-    public void close() {
-        dm.close();
-    }
-
-
-    /*--------------------------------------------------------------------------------------------*\
-    |                                                                                              |
-    |  Private method(s)                                                                           | 
-    |                                                                                              |
-    \*--------------------------------------------------------------------------------------------*/
-
-    /**
-     * Process the parents for a given artifact. The terminatingArtifact parameter will be used as
-     * the terminating condition to ensure there will not be an infinite loop (i.e., if
-     * terminatingArtifact is encountered again there is a circular dependency).
-     * 
-     * @param parents
-     * @param terminatingArtifact
-     */
-    private void processParents(Set parents, ArtifactType terminatingArtifact) {
-        Trace.tracePoint("Enter", "DependencyHelper.processParents", parents, terminatingArtifact );
-
-        if (parents == null) {
-            Trace.tracePoint("Exit ", "DependencyHelper.processParents", null);
-            return;
-        }
-        for (Iterator ii = parents.iterator(); ii.hasNext();) {
-        	ArtifactType artifact = (ArtifactType)ii.next();
-            if (dm.getParents(artifact).size() > 0 && !artifact.equals(terminatingArtifact) &&
-                !dm.getParents(artifact).contains(artifact) && !dm.getChildren(artifact).contains(artifact)) {
-                // Keep processing parents (as long as no circular dependencies)
-                processParents(dm.getParents(artifact), terminatingArtifact);
-                // Move self 
-                IModule[] module = getModule(artifact);
-                int moduleDeltaKind = getDeltaKind(artifact);
-                if (module!=null && !reorderedModules.contains(module)) {
-                    reorderedModules.add(module);
-                    reorderedKinds.add(moduleDeltaKind);
-                }
-            }
-            else {
-                // Move parent
-                IModule[] module = getModule(artifact);
-                int moduleDeltaKind = getDeltaKind(artifact);
-                if (module!=null && !reorderedModules.contains(module)) {
-                    reorderedModules.add(module);
-                    reorderedKinds.add(moduleDeltaKind);
-                }
-            }
-        }
-
-        Trace.tracePoint("Exit ", "DependencyHelper.processParents");
-    }
-
-
-    /**
-     * Returns the Environment for the given IModule
-     * 
-     * @param module IModule to be published
-     * 
-     * @return Environment
-     */
-    private EnvironmentType getEnvironment(IModule module) {
-        Trace.tracePoint("Enter", "DependencyHelper.getEnvironment", module);
-
-        // if module's environment is in the cache, get it from the cache
-        if(environmentCache.containsKey(module)) {
-             return environmentCache.get(module);
-        }
-
-        
-        EnvironmentType environment = null;
-        if (GeronimoUtils.isWebModule(module)) {
-            if (getWebDeploymentPlan(module) != null) {
-                WebAppType plan = getWebDeploymentPlan(module).getValue();
-                if (plan != null)
-                    environment = plan.getEnvironment();
-            }
-        }
-        else if (GeronimoUtils.isEjbJarModule(module)) {
-            if (getOpenEjbDeploymentPlan(module) != null) {
-                OpenejbJarType plan = getOpenEjbDeploymentPlan(module).getValue();
-                if (plan != null)
-                    environment = plan.getEnvironment();
-            }
-        }
-        else if (GeronimoUtils.isEarModule(module)) {
-            if (getApplicationDeploymentPlan(module) != null) {
-                ApplicationType plan = getApplicationDeploymentPlan(module).getValue();
-                if (plan != null)
-                    environment = plan.getEnvironment();
-            }
-        }
-        else if (GeronimoUtils.isRARModule(module)) {
-            if (getConnectorDeploymentPlan(module) != null) {
-                ConnectorType plan = getConnectorDeploymentPlan(module).getValue();
-                if (plan != null)
-                    environment = plan.getEnvironment();
-            }
-        }else if (GeronimoUtils.isAppClientModule(module)) {
-            if (getAppClientDeploymentPlan(module) != null) {
-                ApplicationClientType plan = getAppClientDeploymentPlan(module).getValue();
-                if (plan != null)
-                    environment = plan.getServerEnvironment();
-            }
-        }
-
-        //put module's environment into the cache for next retrieve
-        if (environment != null) {
-            environmentCache.put(module, environment);
-        } 
-        
-        Trace.tracePoint("Exit ", "DependencyHelper.getEnvironment", environment);
-        return environment;
-    }
-
-
-    /**
-     * Return the IModule[] for a given artifact
-     * 
-     * @param artifact
-     * 
-     * @return IModule[]
-     */
-    private IModule[] getModule(ArtifactType artifact) {
-        Trace.tracePoint("Enter", "DependencyHelper.getModule", artifact);
-
-        for (int ii=0; ii<inputModules.size(); ii++) {
-            IModule[] module = (IModule[]) inputModules.get(ii);
-            int moduleDeltaKind = ((Integer)inputDeltaKind.get(ii)).intValue();
-            EnvironmentType environment = getEnvironment(module[0]);
-            if (environment != null) {
-                ArtifactType moduleArtifact = environment.getModuleId();
-                if (artifact.equals(moduleArtifact)) {
-                    Trace.tracePoint("Exit ", "DependencyHelper.getModule", module);
-                    return module;
-                }
-            }
-        }
-
-        Trace.tracePoint("Exit ", "DependencyHelper.getModule", null);
-        return null;
-    }
-
-
-    /**
-     * Return the deltaKind array index for a given artifact
-     * 
-     * @param artifact
-     * 
-     * @return int
-     */
-    private int getDeltaKind(ArtifactType artifact) {
-        Trace.tracePoint("Enter", "DependencyHelper.getDeltaKind", artifact);
-
-        for (int ii=0; ii<inputModules.size(); ii++) {
-            IModule[] module = (IModule[]) inputModules.get(ii);
-            int moduleDeltaKind = ((Integer)inputDeltaKind.get(ii)).intValue();
-            EnvironmentType environment = getEnvironment(module[0]);
-            if (environment != null) {
-                ArtifactType moduleArtifact = environment.getModuleId();
-                if (artifact.equals(moduleArtifact)) {
-                    Trace.tracePoint("Exit ", "DependencyHelper.getDeltaKind", moduleDeltaKind);
-                    return moduleDeltaKind;
-                }
-            }
-        }
-        Trace.tracePoint("Exit ", "DependencyHelper.getDeltaKind", 0);
-        return 0;
-    }
-
-
-    /**
-     * Returns the WebApp for the given IModule
-     * 
-     * @param module IModule to be published
-     * 
-     * @return WebApp
-     */
-    private JAXBElement<WebAppType> getWebDeploymentPlan(IModule module) {
-        Trace.tracePoint("Enter", "DependencyHelper.getWebDeploymentPlan", module);
-
-        IVirtualComponent comp = GeronimoUtils.getVirtualComponent(module);
-        IFile file = GeronimoUtils.getWebDeploymentPlanFile(comp);
-        if (file.getName().equals(GeronimoUtils.WEB_PLAN_NAME) && file.exists()) {
-            try {
-				Trace.tracePoint("Exit ", "DependencyHelper.getWebDeploymentPlan", JAXBUtils.unmarshalFilterDeploymentPlan(file));
-				 return JAXBUtils.unmarshalFilterDeploymentPlan(file);
-			} catch (Exception e) {
-				//ignore it, just indicate error by returning null
-			}
-           
-        }
-
-        Trace.tracePoint("Exit ", "DependencyHelper.getWebDeploymentPlan", null);
-        return null;
-    }
-
-
-    /**
-     * Returns the OpenEjbJar for the given IModule
-     * 
-     * @param module IModule to be published
-     * 
-     * @return OpenEjbJar
-     */
-    private JAXBElement<OpenejbJarType> getOpenEjbDeploymentPlan(IModule module) {
-        Trace.tracePoint("Enter", "DependencyHelper.getOpenEjbDeploymentPlan", module);
-
-        IVirtualComponent comp = GeronimoUtils.getVirtualComponent(module);
-        IFile file = GeronimoUtils.getOpenEjbDeploymentPlanFile(comp);
-        if (file.getName().equals(GeronimoUtils.OPENEJB_PLAN_NAME) && file.exists()) {
-            try {
-				Trace.tracePoint("Exit ", "DependencyHelper.getOpenEjbDeploymentPlan", JAXBUtils.unmarshalFilterDeploymentPlan(file));
-			} catch (Exception e) {
-				//ignore it, just indicate error by returning null
-			}
-            try {
-				return JAXBUtils.unmarshalFilterDeploymentPlan(file);
-			} catch (Exception e) {
-				//ignore it, just indicate error by returning null
-			}
-        }
-
-        Trace.tracePoint("Exit ", "DependencyHelper.getOpenEjbDeploymentPlan", null);
-        return null;
-    }
-
-    /**
-     * Returns the ApplicationClient for the given IModule
-     * 
-     * @param module IModule to be published
-     * 
-     * @return ApplicationClient
-     */
-    private JAXBElement<ApplicationClientType> getAppClientDeploymentPlan(IModule module) {
-        Trace.tracePoint("Enter", "DependencyHelper.getWebDeploymentPlan", module);
-
-        IVirtualComponent comp = GeronimoUtils.getVirtualComponent(module);
-        IFile file = GeronimoUtils.getApplicationClientDeploymentPlanFile(comp);
-        if (file.getName().equals(GeronimoUtils.APP_CLIENT_PLAN_NAME) && file.exists()) {
-            try {
-				Trace.tracePoint("Exit ", "DependencyHelper.getWebDeploymentPlan", JAXBUtils.unmarshalFilterDeploymentPlan(file));
-				 return JAXBUtils.unmarshalFilterDeploymentPlan(file);
-			} catch (Exception e) {
-				//ignore it, just indicate error by returning null
-			}
-           
-        }
-
-        Trace.tracePoint("Exit ", "DependencyHelper.getWebDeploymentPlan", null);
-        return null;
-    }
-    
-    /**
-     * Returns the Application for the given IModule
-     * 
-     * @param module IModule to be published
-     * 
-     * @return Application
-     */
-    private JAXBElement<ApplicationType> getApplicationDeploymentPlan(IModule module) {
-        Trace.tracePoint("Enter", "DependencyHelper.getApplicationDeploymentPlan", module);
-
-        IVirtualComponent comp = GeronimoUtils.getVirtualComponent(module);
-        IFile file = GeronimoUtils.getApplicationDeploymentPlanFile(comp);
-        if (file.getName().equals(GeronimoUtils.APP_PLAN_NAME) && file.exists()) {
-            try {
-				Trace.tracePoint("Exit ", "DependencyHelper.getApplicationDeploymentPlan", JAXBUtils.unmarshalFilterDeploymentPlan(file));
-				  return JAXBUtils.unmarshalFilterDeploymentPlan(file);
-			} catch (Exception e) {
-				//ignore it, just indicate error by returning null
-			}
-          
-        }
-
-        Trace.tracePoint("Exit ", "DependencyHelper.getApplicationDeploymentPlan", null);
-        return null;
-    }
-
-
-    /**
-     * Returns the Connector for the given IModule
-     * 
-     * @param module IModule to be published
-     * 
-     * @return Application
-     */
-    private JAXBElement<ConnectorType> getConnectorDeploymentPlan(IModule module) {
-        Trace.tracePoint("Enter", "DependencyHelper.getConnectorDeploymentPlan", module);
-
-        IVirtualComponent comp = GeronimoUtils.getVirtualComponent(module);
-        IFile file = GeronimoUtils.getConnectorDeploymentPlanFile(comp);
-        if (file.getName().equals(GeronimoUtils.CONNECTOR_PLAN_NAME) && file.exists()) {
-            try {
-				Trace.tracePoint("Exit ", "DependencyHelper.getConnectorDeploymentPlan", JAXBUtils.unmarshalFilterDeploymentPlan(file));
-				 return JAXBUtils.unmarshalFilterDeploymentPlan(file);
-			} catch (Exception e) {
-				//ignore it, just indicate error by returning null
-			}
-           
-        }
-
-        Trace.tracePoint("Exit ", "DependencyHelper.getConnectorDeploymentPlan", null);
-        return null;
-    }
-
-
-    /**
-     * Process the parents for a given artifact. The terminatingArtifact parameter will be used as
-     * the terminating condition to ensure there will not be an infinite loop (i.e., if
-     * terminatingArtifact is encountered again there is a circular dependency).
-     * 
-     * @param parents
-     * @param terminatingArtifact
-     */
-    private void processJaxbParents(Set parents, ArtifactType terminatingArtifact) {
-        Trace.tracePoint("Enter", "DependencyHelper.processJaxbParents", parents, terminatingArtifact );
-
-        if (parents == null) {
-            Trace.tracePoint("Exit ", "DependencyHelper.processJaxbParents", null);
-            return;
-        }
-        for (Iterator ii = parents.iterator(); ii.hasNext();) {
-            ArtifactType artifact = (ArtifactType)ii.next();
-            if (dm.getParents(artifact).size() > 0 && !artifact.equals(terminatingArtifact) &&
-                !dm.getParents(artifact).contains(artifact) && !dm.getChildren(artifact).contains(artifact)) {
-                // Keep processing parents (as long as no circular dependencies)
-                processJaxbParents(dm.getParents(artifact), terminatingArtifact);
-                // Move self 
-                JAXBElement jaxbElement = getJaxbElement(artifact);
-                if (jaxbElement != null) {
-                    if (!reorderedJAXBElements.contains(jaxbElement)) {
-                        reorderedJAXBElements.add(jaxbElement);
-                    }
-                }
-            }
-            else {
-                // Move parent
-                JAXBElement jaxbElement = getJaxbElement(artifact);
-                if (jaxbElement != null) {
-                    if (!reorderedJAXBElements.contains(jaxbElement)) {
-                        reorderedJAXBElements.add(jaxbElement);
-                    }
-                }
-            }
-        }
-
-        Trace.tracePoint("Exit ", "DependencyHelper.processJaxbParents");
-    }
-
-
-    /**
-     * Returns the Environment for the given JAXBElement plan
-     * 
-     * @param jaxbElement JAXBElement plan
-     * 
-     * @return Environment
-     */
-    private EnvironmentType getEnvironment(JAXBElement jaxbElement) {
-        Trace.tracePoint("Enter", "DependencyHelper.getEnvironment", jaxbElement);
-
-        EnvironmentType environment = null;
-        Object plan = jaxbElement.getValue();
-        if (plan != null) {
-            if (WebAppType.class.isInstance(plan)) {
-                environment = ((WebAppType)plan).getEnvironment();
-            }
-            else if (OpenejbJarType.class.isInstance(plan)) {
-                environment = ((OpenejbJarType)plan).getEnvironment();
-            }
-            else if (ApplicationType.class.isInstance(plan)) {
-                environment = ((ApplicationType)plan).getEnvironment();
-            }
-            else if (ConnectorType.class.isInstance(plan)) {
-                environment = ((ConnectorType)plan).getEnvironment();
-            }
-        }
-
-        Trace.tracePoint("Exit ", "DependencyHelper.getEnvironment", environment);
-        return environment;
-    }
-
-
-    /**
-     * Return the JAXBElement for a given artifact
-     * 
-     * @param artifact
-     * 
-     * @return JAXBElement
-     */
-    private JAXBElement getJaxbElement(ArtifactType artifact) {
-        Trace.tracePoint("Enter", "DependencyHelper.getJaxbElement", artifact);
-
-        for (JAXBElement jaxbElement : inputJAXBElements) {
-            EnvironmentType environment = getEnvironment(jaxbElement);
-            if (environment != null) {
-                ArtifactType jaxbArtifact = environment.getModuleId();
-                if (artifact.equals(jaxbArtifact)) {
-                    Trace.tracePoint("Exit ", "DependencyHelper.getJaxbElement", jaxbElement);
-                    return jaxbElement;
-                }
-            }
-        }
-
-        // TODO: Query the server searching for missing dependencies
-        Trace.tracePoint("Exit ", "DependencyHelper.getJaxbElement", null);
-        return null;
-    }
-}
+/*
+ * 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.st.v11.core.internal;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.j2ee.application.ApplicationType;
+import org.apache.geronimo.j2ee.applicationclient.ApplicationClientType;
+import org.apache.geronimo.j2ee.connector.ConnectorType;
+import org.apache.geronimo.j2ee.deployment.ArtifactType;
+import org.apache.geronimo.j2ee.deployment.DependenciesType;
+import org.apache.geronimo.j2ee.deployment.DependencyType;
+import org.apache.geronimo.j2ee.deployment.EnvironmentType;
+import org.apache.geronimo.j2ee.deployment.ObjectFactory;
+import org.apache.geronimo.j2ee.openejb_jar.OpenejbJarType;
+import org.apache.geronimo.j2ee.web.WebAppType;
+import org.apache.geronimo.jaxbmodel.common.operations.JAXBUtils;
+import org.apache.geronimo.st.core.DeploymentUtils;
+import org.apache.geronimo.st.core.GeronimoUtils;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
+
+/**
+ * <b>DependencyHelper</b> is a helper class with various methods to aid in the discovery of
+ * inter-dependencies between modules being deployed from the GEP to the Geronimo server. It
+ * performs the following capabilities:
+ * <ol>
+ *      <li>Discovery of dependencies between modules<p>
+ *      <li>Provides the proper publishing ordering of the modules based on the discovered
+ *          dependencies<p>
+ *      <li><b>TODO:</b> Query the server searching for missing dependencies
+ * </ol>
+ * 
+ * @version $Rev$ $Date$
+ */
+public class DependencyHelper {
+
+    private DependencyManager dm = new DependencyManager();
+    private ObjectFactory deploymentFactory = new ObjectFactory();
+    private List inputModules = new ArrayList();
+    private List inputDeltaKind = new ArrayList();
+    private List reorderedModules = new ArrayList();
+    private List reorderedKinds  = new ArrayList();
+    private List<JAXBElement> inputJAXBElements = new ArrayList();
+    private List<JAXBElement> reorderedJAXBElements = new ArrayList();
+
+    //provide a cache
+    private ConcurrentHashMap<IModule, EnvironmentType> environmentCache = new ConcurrentHashMap<IModule, EnvironmentType>();
+
+    /**
+     * Reorder the publish order of the modules based on any discovered dependencies
+     * 
+     * @param modules   Modules to be published to the Geronimo server
+     * @param deltaKind Publish kind constant for each module
+     * 
+     * @return List of reordered modules and deltaKind (or input if no change)
+     */
+    public List reorderModules(IServer server, List modules, List deltaKind ) {
+        Trace.tracePoint("Entry", "DependencyHelper.reorderModules", modules, deltaKind);
+        
+        //provide a cache
+        ConcurrentHashMap<String,Boolean> verifiedModules = new ConcurrentHashMap<String,Boolean>();
+
+        if (modules.size() == 0) {
+            List reorderedLists = new ArrayList(2);
+            reorderedLists.add(modules);
+            reorderedLists.add(deltaKind);
+            Trace.tracePoint("Exit ", "DependencyHelper.reorderModules", reorderedLists);
+            return reorderedLists;
+        }
+
+        inputModules = modules;
+        inputDeltaKind = deltaKind;
+
+        // 
+        // Iterate through all the modules and register the dependencies
+        // 
+        for (int ii=0; ii<modules.size(); ii++) {
+            IModule[] module = (IModule[]) modules.get(ii);
+            int moduleDeltaKind = ((Integer)deltaKind.get(ii)).intValue();
+            if (moduleDeltaKind != ServerBehaviourDelegate.REMOVED) {
+            	//GERONIMODEVTOOLS-361
+            	for (IModule singleModule:module){
+            		EnvironmentType environment = getEnvironment(singleModule);
+	                if (environment != null) {
+	                    ArtifactType child = environment.getModuleId();
+	                    DependenciesType dependencies = environment.getDependencies();
+	                    if (dependencies != null) {
+	                        List<DependencyType> depList = dependencies.getDependency();
+	                        for ( DependencyType dep : depList) {
+	                            ArtifactType parent = deploymentFactory.createArtifactType();
+	                            parent.setGroupId( dep.getGroupId() );
+	                            parent.setArtifactId( dep.getArtifactId() );
+	                            parent.setVersion( dep.getVersion() );
+	                            parent.setType( dep.getType() );
+	                            
+	                            StringBuilder configId = new StringBuilder();
+	                            if (dep.getGroupId()!=null)
+	                            	configId.append(dep.getGroupId());
+	                            configId.append("/");
+	                            if (dep.getArtifactId()!=null)
+	                            	configId.append(dep.getArtifactId());
+	                            configId.append("/");
+	                            if (dep.getVersion()!=null)
+	                            	configId.append(dep.getVersion());
+	                            configId.append("/");
+	                            if (dep.getType()!=null)
+	                            	configId.append(dep.getType());
+	                            
+	                            //get install flag from the cache
+								Boolean isInstalledModule = verifiedModules
+										.get(configId.toString());
+								if (isInstalledModule == null) {
+									// not in the cache, invoke
+									// isInstalledModule() method
+									isInstalledModule = DeploymentUtils
+											.isInstalledModule(server,
+													configId.toString());
+									// put install flag into the cache for next
+									// retrieve
+									verifiedModules.put(configId.toString(),
+											isInstalledModule);
+								}
+
+								if (!isInstalledModule)
+                                    dm.addDependency( child, parent );
+	                        }
+	                    }
+	                }
+            	}
+            }
+        }
+
+        // 
+        // Iterate through all the modules again and reorder as necessary
+        // 
+        for (int ii=0; ii<modules.size(); ii++) {
+            IModule[] module = (IModule[]) modules.get(ii);
+            int moduleDeltaKind = ((Integer)deltaKind.get(ii)).intValue();
+            if (module!=null && !reorderedModules.contains(module)) {
+                // Not already moved 
+                if (moduleDeltaKind == ServerBehaviourDelegate.REMOVED) {
+                    // Move module if going to be removed 
+                    reorderedModules.add(module);
+                    reorderedKinds.add(moduleDeltaKind);
+                }
+                else {
+                    EnvironmentType environment = getEnvironment(module[0]);
+                    if (environment != null) {
+                        ArtifactType artifact = environment.getModuleId();
+                        if (artifact == null) {
+                            // Move if null (nothing can be done)
+                            if (!reorderedModules.contains(module)) {
+                                reorderedModules.add(module);
+                                reorderedKinds.add(moduleDeltaKind);
+                            }
+                        }
+                        else if (dm.getParents(artifact).contains(artifact) ||  
+                                 dm.getChildren(artifact).contains(artifact)) {
+                            // Move if a tight circular dependency (nothing can be done)
+                            if (!reorderedModules.contains(module)) {
+                                reorderedModules.add(module);
+                                reorderedKinds.add(moduleDeltaKind);
+                            }
+                        }
+                        else if (dm.getParents(artifact).size() == 0) {
+                            // Move if no parents (nothing to do)
+                            if (!reorderedModules.contains(module)) {
+                                reorderedModules.add(module);
+                                reorderedKinds.add(moduleDeltaKind);
+                            }
+                        }
+                        else if (dm.getParents(artifact).size() > 0) {
+                            // Move parents first
+                            processParents(dm.getParents(artifact), artifact);
+                            // Move self 
+                            if (!reorderedModules.contains(module)) {
+                                reorderedModules.add(module);
+                                reorderedKinds.add(moduleDeltaKind);
+                            }
+                        }
+                    }else {
+                    	//no environment defined, do just as no parents
+                        if (!reorderedModules.contains(module)) {
+                            reorderedModules.add(module);
+                            reorderedKinds.add(moduleDeltaKind);
+                        }
+                    }
+                }
+            }
+        }
+
+        // 
+        // Ensure return lists are exactly the same size as the input lists 
+        // 
+        assert reorderedModules.size() == modules.size();
+        assert reorderedKinds.size() == deltaKind.size();
+
+        // 
+        // Return List of lists
+        // 
+        List reorderedLists = new ArrayList(2);
+        reorderedLists.add(reorderedModules);
+        reorderedLists.add(reorderedKinds);
+
+        Trace.tracePoint("Exit ", "DependencyHelper.reorderModules", reorderedLists);
+        return reorderedLists;
+    }
+
+
+    /**
+     * Reorder the list of JAXBElements based on any discovered dependencies
+     * 
+     * @param jaxbElements
+     * 
+     * @return List of JAXBElements (or input if no change)
+     */
+    public List<JAXBElement> reorderJAXBElements( List<JAXBElement> jaxbElements ) {
+        Trace.tracePoint("Entry", "DependencyHelper.reorderModules", jaxbElements);
+
+        if (jaxbElements.size() == 0) {
+            Trace.tracePoint("Exit ", "DependencyHelper.reorderModules", jaxbElements);
+            return jaxbElements;
+        }
+
+        inputJAXBElements = jaxbElements;
+
+        // 
+        // Iterate through all the JAXBElements and register the dependencies
+        // 
+        for (JAXBElement jaxbElement : jaxbElements) {
+            EnvironmentType environment = getEnvironment(jaxbElement);
+            if (environment != null) {
+                ArtifactType child = environment.getModuleId();
+                if (child != null) {
+                    DependenciesType dependencies = environment.getDependencies();
+                    if (dependencies != null) {
+                        List<DependencyType> depList = dependencies.getDependency();
+                        if (depList != null) {
+                            for ( DependencyType dep : depList) {
+                                ArtifactType parent = deploymentFactory.createArtifactType();
+                                parent.setGroupId( dep.getGroupId() );
+                                parent.setArtifactId( dep.getArtifactId() );
+                                parent.setVersion( dep.getVersion() );
+                                parent.setType( dep.getType() );
+                                dm.addDependency( child, parent );
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        // 
+        // Iterate through all the JAXBElements again and reorder as necessary
+        // 
+        for (JAXBElement jaxbElement : jaxbElements) {
+            if (!reorderedJAXBElements.contains(jaxbElement)) {
+                // Not already moved
+                EnvironmentType environment = getEnvironment(jaxbElement);
+                if (environment != null) {
+                    ArtifactType artifact = environment.getModuleId();
+                    if (artifact == null) {
+                        // Move if null (nothing can be done)
+                        if (!reorderedJAXBElements.contains(jaxbElement)) {
+                            reorderedJAXBElements.add(jaxbElement);
+                        }
+                    }
+                    else if (dm.getParents(artifact).contains(artifact) ||  
+                             dm.getChildren(artifact).contains(artifact)) {
+                        // Move if a tight circular dependency (nothing can be done)
+                        if (!reorderedJAXBElements.contains(jaxbElement)) {
+                            reorderedJAXBElements.add(jaxbElement);
+                        }
+                    }
+                    else if (dm.getParents(artifact).size() == 0) {
+                        // Move if no parents (nothing to do)
+                        if (!reorderedJAXBElements.contains(jaxbElement)) {
+                            reorderedJAXBElements.add(jaxbElement);
+                        }
+                    }
+                    else if (dm.getParents(artifact).size() > 0) {
+                        // Move parents first
+                        processJaxbParents(dm.getParents(artifact), artifact);
+                        // Move self 
+                        if (!reorderedJAXBElements.contains(jaxbElement)) {
+                            reorderedJAXBElements.add(jaxbElement);
+                        }
+                    }
+                }
+            }
+        }
+
+        // 
+        // Ensure return list is exactly the same size as the input list 
+        // 
+        assert reorderedJAXBElements.size() == jaxbElements.size();
+
+        // 
+        // Return List of JAXBElements
+        // 
+        Trace.tracePoint("Exit ", "DependencyHelper.reorderModules", reorderedJAXBElements);
+        return reorderedJAXBElements;
+    }
+
+
+    /**
+     *
+     */
+    public void close() {
+        dm.close();
+    }
+
+
+    /*--------------------------------------------------------------------------------------------*\
+    |                                                                                              |
+    |  Private method(s)                                                                           | 
+    |                                                                                              |
+    \*--------------------------------------------------------------------------------------------*/
+
+    /**
+     * Process the parents for a given artifact. The terminatingArtifact parameter will be used as
+     * the terminating condition to ensure there will not be an infinite loop (i.e., if
+     * terminatingArtifact is encountered again there is a circular dependency).
+     * 
+     * @param parents
+     * @param terminatingArtifact
+     */
+    private void processParents(Set parents, ArtifactType terminatingArtifact) {
+        Trace.tracePoint("Enter", "DependencyHelper.processParents", parents, terminatingArtifact );
+
+        if (parents == null) {
+            Trace.tracePoint("Exit ", "DependencyHelper.processParents", null);
+            return;
+        }
+        for (Iterator ii = parents.iterator(); ii.hasNext();) {
+        	ArtifactType artifact = (ArtifactType)ii.next();
+            if (dm.getParents(artifact).size() > 0 && !artifact.equals(terminatingArtifact) &&
+                !dm.getParents(artifact).contains(artifact) && !dm.getChildren(artifact).contains(artifact)) {
+                // Keep processing parents (as long as no circular dependencies)
+                processParents(dm.getParents(artifact), terminatingArtifact);
+                // Move self 
+                IModule[] module = getModule(artifact);
+                int moduleDeltaKind = getDeltaKind(artifact);
+                if (module!=null && !reorderedModules.contains(module)) {
+                    reorderedModules.add(module);
+                    reorderedKinds.add(moduleDeltaKind);
+                }
+            }
+            else {
+                // Move parent
+                IModule[] module = getModule(artifact);
+                int moduleDeltaKind = getDeltaKind(artifact);
+                if (module!=null && !reorderedModules.contains(module)) {
+                    reorderedModules.add(module);
+                    reorderedKinds.add(moduleDeltaKind);
+                }
+            }
+        }
+
+        Trace.tracePoint("Exit ", "DependencyHelper.processParents");
+    }
+
+
+    /**
+     * Returns the Environment for the given IModule
+     * 
+     * @param module IModule to be published
+     * 
+     * @return Environment
+     */
+    private EnvironmentType getEnvironment(IModule module) {
+        Trace.tracePoint("Enter", "DependencyHelper.getEnvironment", module);
+
+        // if module's environment is in the cache, get it from the cache
+        if(environmentCache.containsKey(module)) {
+             return environmentCache.get(module);
+        }
+
+        
+        EnvironmentType environment = null;
+        if (GeronimoUtils.isWebModule(module)) {
+            if (getWebDeploymentPlan(module) != null) {
+                WebAppType plan = getWebDeploymentPlan(module).getValue();
+                if (plan != null)
+                    environment = plan.getEnvironment();
+            }
+        }
+        else if (GeronimoUtils.isEjbJarModule(module)) {
+            if (getOpenEjbDeploymentPlan(module) != null) {
+                OpenejbJarType plan = getOpenEjbDeploymentPlan(module).getValue();
+                if (plan != null)
+                    environment = plan.getEnvironment();
+            }
+        }
+        else if (GeronimoUtils.isEarModule(module)) {
+            if (getApplicationDeploymentPlan(module) != null) {
+                ApplicationType plan = getApplicationDeploymentPlan(module).getValue();
+                if (plan != null)
+                    environment = plan.getEnvironment();
+            }
+        }
+        else if (GeronimoUtils.isRARModule(module)) {
+            if (getConnectorDeploymentPlan(module) != null) {
+                ConnectorType plan = getConnectorDeploymentPlan(module).getValue();
+                if (plan != null)
+                    environment = plan.getEnvironment();
+            }
+        }else if (GeronimoUtils.isAppClientModule(module)) {
+            if (getAppClientDeploymentPlan(module) != null) {
+                ApplicationClientType plan = getAppClientDeploymentPlan(module).getValue();
+                if (plan != null)
+                    environment = plan.getServerEnvironment();
+            }
+        }
+
+        //put module's environment into the cache for next retrieve
+        if (environment != null) {
+            environmentCache.put(module, environment);
+        } 
+        
+        Trace.tracePoint("Exit ", "DependencyHelper.getEnvironment", environment);
+        return environment;
+    }
+
+
+    /**
+     * Return the IModule[] for a given artifact
+     * 
+     * @param artifact
+     * 
+     * @return IModule[]
+     */
+    private IModule[] getModule(ArtifactType artifact) {
+        Trace.tracePoint("Enter", "DependencyHelper.getModule", artifact);
+
+        for (int ii=0; ii<inputModules.size(); ii++) {
+            IModule[] module = (IModule[]) inputModules.get(ii);
+            int moduleDeltaKind = ((Integer)inputDeltaKind.get(ii)).intValue();
+            EnvironmentType environment = getEnvironment(module[0]);
+            if (environment != null) {
+                ArtifactType moduleArtifact = environment.getModuleId();
+                if (artifact.equals(moduleArtifact)) {
+                    Trace.tracePoint("Exit ", "DependencyHelper.getModule", module);
+                    return module;
+                }
+            }
+        }
+
+        Trace.tracePoint("Exit ", "DependencyHelper.getModule", null);
+        return null;
+    }
+
+
+    /**
+     * Return the deltaKind array index for a given artifact
+     * 
+     * @param artifact
+     * 
+     * @return int
+     */
+    private int getDeltaKind(ArtifactType artifact) {
+        Trace.tracePoint("Enter", "DependencyHelper.getDeltaKind", artifact);
+
+        for (int ii=0; ii<inputModules.size(); ii++) {
+            IModule[] module = (IModule[]) inputModules.get(ii);
+            int moduleDeltaKind = ((Integer)inputDeltaKind.get(ii)).intValue();
+            EnvironmentType environment = getEnvironment(module[0]);
+            if (environment != null) {
+                ArtifactType moduleArtifact = environment.getModuleId();
+                if (artifact.equals(moduleArtifact)) {
+                    Trace.tracePoint("Exit ", "DependencyHelper.getDeltaKind", moduleDeltaKind);
+                    return moduleDeltaKind;
+                }
+            }
+        }
+        Trace.tracePoint("Exit ", "DependencyHelper.getDeltaKind", 0);
+        return 0;
+    }
+
+
+    /**
+     * Returns the WebApp for the given IModule
+     * 
+     * @param module IModule to be published
+     * 
+     * @return WebApp
+     */
+    private JAXBElement<WebAppType> getWebDeploymentPlan(IModule module) {
+        Trace.tracePoint("Enter", "DependencyHelper.getWebDeploymentPlan", module);
+
+        IVirtualComponent comp = GeronimoUtils.getVirtualComponent(module);
+        IFile file = GeronimoUtils.getWebDeploymentPlanFile(comp);
+        if (file.getName().equals(GeronimoUtils.WEB_PLAN_NAME) && file.exists()) {
+            try {
+				Trace.tracePoint("Exit ", "DependencyHelper.getWebDeploymentPlan", JAXBUtils.unmarshalFilterDeploymentPlan(file));
+				 return JAXBUtils.unmarshalFilterDeploymentPlan(file);
+			} catch (Exception e) {
+				//ignore it, just indicate error by returning null
+			}
+           
+        }
+
+        Trace.tracePoint("Exit ", "DependencyHelper.getWebDeploymentPlan", null);
+        return null;
+    }
+
+
+    /**
+     * Returns the OpenEjbJar for the given IModule
+     * 
+     * @param module IModule to be published
+     * 
+     * @return OpenEjbJar
+     */
+    private JAXBElement<OpenejbJarType> getOpenEjbDeploymentPlan(IModule module) {
+        Trace.tracePoint("Enter", "DependencyHelper.getOpenEjbDeploymentPlan", module);
+
+        IVirtualComponent comp = GeronimoUtils.getVirtualComponent(module);
+        IFile file = GeronimoUtils.getOpenEjbDeploymentPlanFile(comp);
+        if (file.getName().equals(GeronimoUtils.OPENEJB_PLAN_NAME) && file.exists()) {
+            try {
+				Trace.tracePoint("Exit ", "DependencyHelper.getOpenEjbDeploymentPlan", JAXBUtils.unmarshalFilterDeploymentPlan(file));
+			} catch (Exception e) {
+				//ignore it, just indicate error by returning null
+			}
+            try {
+				return JAXBUtils.unmarshalFilterDeploymentPlan(file);
+			} catch (Exception e) {
+				//ignore it, just indicate error by returning null
+			}
+        }
+
+        Trace.tracePoint("Exit ", "DependencyHelper.getOpenEjbDeploymentPlan", null);
+        return null;
+    }
+
+    /**
+     * Returns the ApplicationClient for the given IModule
+     * 
+     * @param module IModule to be published
+     * 
+     * @return ApplicationClient
+     */
+    private JAXBElement<ApplicationClientType> getAppClientDeploymentPlan(IModule module) {
+        Trace.tracePoint("Enter", "DependencyHelper.getWebDeploymentPlan", module);
+
+        IVirtualComponent comp = GeronimoUtils.getVirtualComponent(module);
+        IFile file = GeronimoUtils.getApplicationClientDeploymentPlanFile(comp);
+        if (file.getName().equals(GeronimoUtils.APP_CLIENT_PLAN_NAME) && file.exists()) {
+            try {
+				Trace.tracePoint("Exit ", "DependencyHelper.getWebDeploymentPlan", JAXBUtils.unmarshalFilterDeploymentPlan(file));
+				 return JAXBUtils.unmarshalFilterDeploymentPlan(file);
+			} catch (Exception e) {
+				//ignore it, just indicate error by returning null
+			}
+           
+        }
+
+        Trace.tracePoint("Exit ", "DependencyHelper.getWebDeploymentPlan", null);
+        return null;
+    }
+    
+    /**
+     * Returns the Application for the given IModule
+     * 
+     * @param module IModule to be published
+     * 
+     * @return Application
+     */
+    private JAXBElement<ApplicationType> getApplicationDeploymentPlan(IModule module) {
+        Trace.tracePoint("Enter", "DependencyHelper.getApplicationDeploymentPlan", module);
+
+        IVirtualComponent comp = GeronimoUtils.getVirtualComponent(module);
+        IFile file = GeronimoUtils.getApplicationDeploymentPlanFile(comp);
+        if (file.getName().equals(GeronimoUtils.APP_PLAN_NAME) && file.exists()) {
+            try {
+				Trace.tracePoint("Exit ", "DependencyHelper.getApplicationDeploymentPlan", JAXBUtils.unmarshalFilterDeploymentPlan(file));
+				  return JAXBUtils.unmarshalFilterDeploymentPlan(file);
+			} catch (Exception e) {
+				//ignore it, just indicate error by returning null
+			}
+          
+        }
+
+        Trace.tracePoint("Exit ", "DependencyHelper.getApplicationDeploymentPlan", null);
+        return null;
+    }
+
+
+    /**
+     * Returns the Connector for the given IModule
+     * 
+     * @param module IModule to be published
+     * 
+     * @return Application
+     */
+    private JAXBElement<ConnectorType> getConnectorDeploymentPlan(IModule module) {
+        Trace.tracePoint("Enter", "DependencyHelper.getConnectorDeploymentPlan", module);
+
+        IVirtualComponent comp = GeronimoUtils.getVirtualComponent(module);
+        IFile file = GeronimoUtils.getConnectorDeploymentPlanFile(comp);
+        if (file.getName().equals(GeronimoUtils.CONNECTOR_PLAN_NAME) && file.exists()) {
+            try {
+				Trace.tracePoint("Exit ", "DependencyHelper.getConnectorDeploymentPlan", JAXBUtils.unmarshalFilterDeploymentPlan(file));
+				 return JAXBUtils.unmarshalFilterDeploymentPlan(file);
+			} catch (Exception e) {
+				//ignore it, just indicate error by returning null
+			}
+           
+        }
+
+        Trace.tracePoint("Exit ", "DependencyHelper.getConnectorDeploymentPlan", null);
+        return null;
+    }
+
+
+    /**
+     * Process the parents for a given artifact. The terminatingArtifact parameter will be used as
+     * the terminating condition to ensure there will not be an infinite loop (i.e., if
+     * terminatingArtifact is encountered again there is a circular dependency).
+     * 
+     * @param parents
+     * @param terminatingArtifact
+     */
+    private void processJaxbParents(Set parents, ArtifactType terminatingArtifact) {
+        Trace.tracePoint("Enter", "DependencyHelper.processJaxbParents", parents, terminatingArtifact );
+
+        if (parents == null) {
+            Trace.tracePoint("Exit ", "DependencyHelper.processJaxbParents", null);
+            return;
+        }
+        for (Iterator ii = parents.iterator(); ii.hasNext();) {
+            ArtifactType artifact = (ArtifactType)ii.next();
+            if (dm.getParents(artifact).size() > 0 && !artifact.equals(terminatingArtifact) &&
+                !dm.getParents(artifact).contains(artifact) && !dm.getChildren(artifact).contains(artifact)) {
+                // Keep processing parents (as long as no circular dependencies)
+                processJaxbParents(dm.getParents(artifact), terminatingArtifact);
+                // Move self 
+                JAXBElement jaxbElement = getJaxbElement(artifact);
+                if (jaxbElement != null) {
+                    if (!reorderedJAXBElements.contains(jaxbElement)) {
+                        reorderedJAXBElements.add(jaxbElement);
+                    }
+                }
+            }
+            else {
+                // Move parent
+                JAXBElement jaxbElement = getJaxbElement(artifact);
+                if (jaxbElement != null) {
+                    if (!reorderedJAXBElements.contains(jaxbElement)) {
+                        reorderedJAXBElements.add(jaxbElement);
+                    }
+                }
+            }
+        }
+
+        Trace.tracePoint("Exit ", "DependencyHelper.processJaxbParents");
+    }
+
+
+    /**
+     * Returns the Environment for the given JAXBElement plan
+     * 
+     * @param jaxbElement JAXBElement plan
+     * 
+     * @return Environment
+     */
+    private EnvironmentType getEnvironment(JAXBElement jaxbElement) {
+        Trace.tracePoint("Enter", "DependencyHelper.getEnvironment", jaxbElement);
+
+        EnvironmentType environment = null;
+        Object plan = jaxbElement.getValue();
+        if (plan != null) {
+            if (WebAppType.class.isInstance(plan)) {
+                environment = ((WebAppType)plan).getEnvironment();
+            }
+            else if (OpenejbJarType.class.isInstance(plan)) {
+                environment = ((OpenejbJarType)plan).getEnvironment();
+            }
+            else if (ApplicationType.class.isInstance(plan)) {
+                environment = ((ApplicationType)plan).getEnvironment();
+            }
+            else if (ConnectorType.class.isInstance(plan)) {
+                environment = ((ConnectorType)plan).getEnvironment();
+            }
+        }
+
+        Trace.tracePoint("Exit ", "DependencyHelper.getEnvironment", environment);
+        return environment;
+    }
+
+
+    /**
+     * Return the JAXBElement for a given artifact
+     * 
+     * @param artifact
+     * 
+     * @return JAXBElement
+     */
+    private JAXBElement getJaxbElement(ArtifactType artifact) {
+        Trace.tracePoint("Enter", "DependencyHelper.getJaxbElement", artifact);
+
+        for (JAXBElement jaxbElement : inputJAXBElements) {
+            EnvironmentType environment = getEnvironment(jaxbElement);
+            if (environment != null) {
+                ArtifactType jaxbArtifact = environment.getModuleId();
+                if (artifact.equals(jaxbArtifact)) {
+                    Trace.tracePoint("Exit ", "DependencyHelper.getJaxbElement", jaxbElement);
+                    return jaxbElement;
+                }
+            }
+        }
+
+        // TODO: Query the server searching for missing dependencies
+        Trace.tracePoint("Exit ", "DependencyHelper.getJaxbElement", null);
+        return null;
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/DependencyHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/DependencyHelper.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/DependencyHelper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/DependencyManager.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/DependencyManager.java?rev=1203020&r1=1203019&r2=1203020&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/DependencyManager.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/DependencyManager.java Thu Nov 17 02:19:12 2011
@@ -1,214 +1,214 @@
-/*
- * 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.st.v11.core.internal;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.geronimo.j2ee.deployment.ArtifactType;
-
-
-/**
- * <b>DependencyManager</b> is very closely-based on the similar class in the Geronimo server.
- * DependencyManager is the record keeper of the dependencies in the Geronimo Eclipse Plugin. The
- * DependencyManager does not enforce any dependencies, it is simply a place where components can
- * register their intent to be dependent on another component, and where other components can query
- * those dependencies.
- * 
- * <p>Like the DependencyManager in the Geronimo server, it uses the nomenclature of parent-child
- * where a child is dependent on a parent. The names parent and child have no other meaning are just
- * a convenience to make the code readable.
- * 
- * <p>The initial usage of this DependencyManager in the GEP is somewhat limited but other usages 
- * are possible<p>
- * 
- * @version $Rev: 680897 $ $Date: 2008-07-30 09:18:42 +0800 (Wed, 30 Jul 2008) $
- */
-public class DependencyManager {
-
-    //
-    // Map from child to a list of parents
-    //
-    private final Map childToParentMap = new HashMap();
-
-    //
-    // Map from parent back to a list of its children
-    //
-    private final Map parentToChildMap = new HashMap();
-
-
-    /**
-     *
-     */
-    public void close() {
-        childToParentMap.clear();
-        parentToChildMap.clear();
-    }
-
-
-    /**
-     * Declares a dependency from a child to a parent.
-     *
-     * @param child the dependent component
-     * @param parent the component the child is depending on
-     */
-    public void addDependency(ArtifactType child, ArtifactType parent) {
-        Trace.tracePoint("Entry", "DependencyManager.addDependency", child, parent);
-
-        Set parents = (Set) childToParentMap.get(child);
-        if (parents == null) {
-            parents = new LinkedHashSet();
-            childToParentMap.put(child, parents);
-        }
-        parents.add(parent);
-
-        Set children = (Set) parentToChildMap.get(parent);
-        if (children == null) {
-            children = new LinkedHashSet();
-            parentToChildMap.put(parent, children);
-        }
-        children.add(child);
-
-        Trace.tracePoint("Exit ", "DependencyManager.addDependency", childToParentMap.size() );
-        Trace.tracePoint("Exit ", "DependencyManager.addDependency", parentToChildMap.size() );
-    }
-
-
-    /**
-     * Removes a dependency from a child to a parent
-     *
-     * @param child the dependnet component
-     * @param parent the component that the child wil no longer depend on
-     */
-    public void removeDependency(ArtifactType child, ArtifactType parent) {
-        Trace.tracePoint("Entry", "DependencyManager.removeDependency", child, parent);
-
-        Set parents = (Set) childToParentMap.get(child);
-        if (parents != null) {
-            parents.remove(parent);
-        }
-
-        Set children = (Set) parentToChildMap.get(parent);
-        if (children != null) {
-            children.remove(child);
-        }
-
-        Trace.tracePoint("Exit ", "DependencyManager.addDependency");
-    }
-
-
-    /**
-     * Removes all dependencies for a child
-     *
-     * @param child the component that will no longer depend on anything
-     */
-    public void removeAllDependencies(ArtifactType child) {
-        Trace.tracePoint("Entry", "DependencyManager.removeAllDependencies", child);
-
-        Set parents = (Set) childToParentMap.remove(child);
-        if (parents == null) {
-            return;
-        }
-
-        for (Iterator iterator = parents.iterator(); iterator.hasNext();) {
-        	ArtifactType parent = (ArtifactType) iterator.next();
-            Set children = (Set) parentToChildMap.get(parent);
-            if (children != null) {
-                children.remove(child);
-            }
-        }
-
-        Trace.tracePoint("Exit ", "DependencyManager.removeAllDependencies");
-    }
-
-
-    /**
-     * Adds dependencies from the child to every parent in the parents set
-     *
-     * @param child the dependent component
-     * @param parents the set of components the child is depending on
-     */
-    public void addDependencies(ArtifactType child, Set parents) {
-        Trace.tracePoint("Entry", "DependencyManager.addDependencies", child, parents);
-
-        Set existingParents = (Set) childToParentMap.get(child);
-        if (existingParents == null) {
-            existingParents = new LinkedHashSet(parents);
-            childToParentMap.put(child, existingParents);
-        }
-        else {
-            existingParents.addAll(parents);
-        }
-
-        for (Iterator i = parents.iterator(); i.hasNext();) {
-            Object startParent = i.next();
-            Set children = (Set) parentToChildMap.get(startParent);
-            if (children == null) {
-                children = new LinkedHashSet();
-                parentToChildMap.put(startParent, children);
-            }
-            children.add(child);
-        }
-
-        Trace.tracePoint("Exit ", "DependencyManager.addDependencies");
-    }
-
-
-    /**
-     * Gets the set of parents that the child is depending on
-     *
-     * @param child the dependent component
-     * @return a collection containing all of the components the child depends on; will never be null
-     */
-    public Set getParents(ArtifactType child) {
-        Trace.tracePoint("Entry", "DependencyManager.getParents", child);
-
-        Set parents = (Set) childToParentMap.get(child);
-        if (parents == null) {
-            Trace.tracePoint("Exit", "DependencyManager.getParents", 0);
-            return Collections.EMPTY_SET;
-        }
-
-        Trace.tracePoint("Exit", "DependencyManager.getParents", parents.size() );
-        return new LinkedHashSet(parents);
-    }
-
-
-    /**
-     * Gets all of the children that have a dependency on the specified parent.
-     *
-     * @param parent the component the returned childen set depend on
-     * @return a collection containing all of the components that depend on the parent; will never be null
-     */
-    public Set getChildren(ArtifactType parent) {
-        Trace.tracePoint("Entry", "DependencyManager.getChildren", parent);
-
-        Set children = (Set) parentToChildMap.get(parent);
-        if (children == null) {
-            Trace.tracePoint("Exit ", "DependencyManager.getChildren", 0);
-            return Collections.EMPTY_SET;
-        }
-
-        Trace.tracePoint("Exit ", "DependencyManager.getChildren", children.size() );
-        return new LinkedHashSet(children);
-    }
-}
+/*
+ * 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.st.v11.core.internal;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.geronimo.j2ee.deployment.ArtifactType;
+
+
+/**
+ * <b>DependencyManager</b> is very closely-based on the similar class in the Geronimo server.
+ * DependencyManager is the record keeper of the dependencies in the Geronimo Eclipse Plugin. The
+ * DependencyManager does not enforce any dependencies, it is simply a place where components can
+ * register their intent to be dependent on another component, and where other components can query
+ * those dependencies.
+ * 
+ * <p>Like the DependencyManager in the Geronimo server, it uses the nomenclature of parent-child
+ * where a child is dependent on a parent. The names parent and child have no other meaning are just
+ * a convenience to make the code readable.
+ * 
+ * <p>The initial usage of this DependencyManager in the GEP is somewhat limited but other usages 
+ * are possible<p>
+ * 
+ * @version $Rev$ $Date$
+ */
+public class DependencyManager {
+
+    //
+    // Map from child to a list of parents
+    //
+    private final Map childToParentMap = new HashMap();
+
+    //
+    // Map from parent back to a list of its children
+    //
+    private final Map parentToChildMap = new HashMap();
+
+
+    /**
+     *
+     */
+    public void close() {
+        childToParentMap.clear();
+        parentToChildMap.clear();
+    }
+
+
+    /**
+     * Declares a dependency from a child to a parent.
+     *
+     * @param child the dependent component
+     * @param parent the component the child is depending on
+     */
+    public void addDependency(ArtifactType child, ArtifactType parent) {
+        Trace.tracePoint("Entry", "DependencyManager.addDependency", child, parent);
+
+        Set parents = (Set) childToParentMap.get(child);
+        if (parents == null) {
+            parents = new LinkedHashSet();
+            childToParentMap.put(child, parents);
+        }
+        parents.add(parent);
+
+        Set children = (Set) parentToChildMap.get(parent);
+        if (children == null) {
+            children = new LinkedHashSet();
+            parentToChildMap.put(parent, children);
+        }
+        children.add(child);
+
+        Trace.tracePoint("Exit ", "DependencyManager.addDependency", childToParentMap.size() );
+        Trace.tracePoint("Exit ", "DependencyManager.addDependency", parentToChildMap.size() );
+    }
+
+
+    /**
+     * Removes a dependency from a child to a parent
+     *
+     * @param child the dependnet component
+     * @param parent the component that the child wil no longer depend on
+     */
+    public void removeDependency(ArtifactType child, ArtifactType parent) {
+        Trace.tracePoint("Entry", "DependencyManager.removeDependency", child, parent);
+
+        Set parents = (Set) childToParentMap.get(child);
+        if (parents != null) {
+            parents.remove(parent);
+        }
+
+        Set children = (Set) parentToChildMap.get(parent);
+        if (children != null) {
+            children.remove(child);
+        }
+
+        Trace.tracePoint("Exit ", "DependencyManager.addDependency");
+    }
+
+
+    /**
+     * Removes all dependencies for a child
+     *
+     * @param child the component that will no longer depend on anything
+     */
+    public void removeAllDependencies(ArtifactType child) {
+        Trace.tracePoint("Entry", "DependencyManager.removeAllDependencies", child);
+
+        Set parents = (Set) childToParentMap.remove(child);
+        if (parents == null) {
+            return;
+        }
+
+        for (Iterator iterator = parents.iterator(); iterator.hasNext();) {
+        	ArtifactType parent = (ArtifactType) iterator.next();
+            Set children = (Set) parentToChildMap.get(parent);
+            if (children != null) {
+                children.remove(child);
+            }
+        }
+
+        Trace.tracePoint("Exit ", "DependencyManager.removeAllDependencies");
+    }
+
+
+    /**
+     * Adds dependencies from the child to every parent in the parents set
+     *
+     * @param child the dependent component
+     * @param parents the set of components the child is depending on
+     */
+    public void addDependencies(ArtifactType child, Set parents) {
+        Trace.tracePoint("Entry", "DependencyManager.addDependencies", child, parents);
+
+        Set existingParents = (Set) childToParentMap.get(child);
+        if (existingParents == null) {
+            existingParents = new LinkedHashSet(parents);
+            childToParentMap.put(child, existingParents);
+        }
+        else {
+            existingParents.addAll(parents);
+        }
+
+        for (Iterator i = parents.iterator(); i.hasNext();) {
+            Object startParent = i.next();
+            Set children = (Set) parentToChildMap.get(startParent);
+            if (children == null) {
+                children = new LinkedHashSet();
+                parentToChildMap.put(startParent, children);
+            }
+            children.add(child);
+        }
+
+        Trace.tracePoint("Exit ", "DependencyManager.addDependencies");
+    }
+
+
+    /**
+     * Gets the set of parents that the child is depending on
+     *
+     * @param child the dependent component
+     * @return a collection containing all of the components the child depends on; will never be null
+     */
+    public Set getParents(ArtifactType child) {
+        Trace.tracePoint("Entry", "DependencyManager.getParents", child);
+
+        Set parents = (Set) childToParentMap.get(child);
+        if (parents == null) {
+            Trace.tracePoint("Exit", "DependencyManager.getParents", 0);
+            return Collections.EMPTY_SET;
+        }
+
+        Trace.tracePoint("Exit", "DependencyManager.getParents", parents.size() );
+        return new LinkedHashSet(parents);
+    }
+
+
+    /**
+     * Gets all of the children that have a dependency on the specified parent.
+     *
+     * @param parent the component the returned childen set depend on
+     * @return a collection containing all of the components that depend on the parent; will never be null
+     */
+    public Set getChildren(ArtifactType parent) {
+        Trace.tracePoint("Entry", "DependencyManager.getChildren", parent);
+
+        Set children = (Set) parentToChildMap.get(parent);
+        if (children == null) {
+            Trace.tracePoint("Exit ", "DependencyManager.getChildren", 0);
+            return Collections.EMPTY_SET;
+        }
+
+        Trace.tracePoint("Exit ", "DependencyManager.getChildren", children.size() );
+        return new LinkedHashSet(children);
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/DependencyManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/DependencyManager.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/DependencyManager.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/Trace.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/Trace.java?rev=1203020&r1=1203019&r2=1203020&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/Trace.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/Trace.java Thu Nov 17 02:19:12 2011
@@ -21,7 +21,7 @@ import org.apache.geronimo.st.v11.core.A
 /**
  * Helper class to route trace output.
  *
- * @version $Rev: 471551 $ $Date: 2006-11-05 17:47:11 -0500 (Sun, 05 Nov 2006) $
+ * @version $Rev$ $Date$
  */
 public class Trace {
 

Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/Trace.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/Trace.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/Trace.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/operations/GeronimoV11FacetInstallDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/operations/GeronimoV11FacetInstallDelegate.java?rev=1203020&r1=1203019&r2=1203020&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/operations/GeronimoV11FacetInstallDelegate.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/operations/GeronimoV11FacetInstallDelegate.java Thu Nov 17 02:19:12 2011
@@ -26,7 +26,7 @@ import org.eclipse.wst.common.frameworks
 import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
 
 /**
- * @version $Rev: 471551 $ $Date: 2006-11-05 17:47:11 -0500 (Sun, 05 Nov 2006) $
+ * @version $Rev$ $Date$
  */
 public class GeronimoV11FacetInstallDelegate extends GeronimoFacetInstallDelegate {
 

Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/operations/GeronimoV11FacetInstallDelegate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/operations/GeronimoV11FacetInstallDelegate.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/operations/GeronimoV11FacetInstallDelegate.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/operations/V11DeploymentPlanCreationOperation.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/operations/V11DeploymentPlanCreationOperation.java?rev=1203020&r1=1203019&r2=1203020&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/operations/V11DeploymentPlanCreationOperation.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/operations/V11DeploymentPlanCreationOperation.java Thu Nov 17 02:19:12 2011
@@ -37,7 +37,7 @@ import org.eclipse.core.resources.IFile;
 import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
 
 /**
- * @version $Rev: 509704 $ $Date: 2007-02-20 13:42:24 -0500 (Tue, 20 Feb 2007) $
+ * @version $Rev$ $Date$
  */
 public class V11DeploymentPlanCreationOperation extends DeploymentPlanCreationOperation {
 

Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/operations/V11DeploymentPlanCreationOperation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/operations/V11DeploymentPlanCreationOperation.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/operations/V11DeploymentPlanCreationOperation.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message