geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r752595 - in /geronimo/sandbox/djencks/framework/modules: geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/ geronimo-kernel/src/test/java/org/apache/geronim...
Date Wed, 11 Mar 2009 19:47:56 GMT
Author: djencks
Date: Wed Mar 11 19:47:56 2009
New Revision: 752595

URL: http://svn.apache.org/viewvc?rev=752595&view=rev
Log:
don't look for geronimo-dependencies.xml for indifidual jar files

Modified:
    geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java
    geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/AbstractRepository.java
    geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Repository.java
    geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockRepository.java
    geronimo/sandbox/djencks/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/GeronimoSourceRepository.java
    geronimo/sandbox/djencks/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java

Modified: geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java?rev=752595&r1=752594&r2=752595&view=diff
==============================================================================
--- geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java
(original)
+++ geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java
Wed Mar 11 19:47:56 2009
@@ -137,14 +137,6 @@
 
             if (!resolvedDependencies.contains(dependency)) {
                 resolvedDependencies.add(dependency);
-
-                List<Dependency> childDependencies = getChildDependencies(dependency);
-                if (!childDependencies.isEmpty()) {
-                    parentStack.push(dependency.getArtifact());
-                    childDependencies = internalResolveTransitiveDependencies(parents, childDependencies,
parentStack);
-                    parentStack.pop();
-                    resolvedDependencies.addAll(childDependencies);
-                }
             }
         }
         return resolvedDependencies;
@@ -176,18 +168,4 @@
         return resolvedDependency;
     }
 
-    private ArrayList<Dependency> getChildDependencies(Dependency dependency) {
-        ArrayList<Dependency> childDependencies = new ArrayList<Dependency>();
-        for (Repository repository : repositories) {
-            if (repository.contains(dependency.getArtifact())) {
-                // get the child artifacts
-                LinkedHashSet<Artifact> childArtifacts = repository.getDependencies(dependency.getArtifact());
-                for (Artifact artifact : childArtifacts) {
-                    // add each child as a classes-only dependency
-                    childDependencies.add(new Dependency(artifact, ImportType.CLASSES));
-                }
-            }
-        }
-        return childDependencies;
-    }
 }

Modified: geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/AbstractRepository.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/AbstractRepository.java?rev=752595&r1=752594&r2=752595&view=diff
==============================================================================
--- geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/AbstractRepository.java
(original)
+++ geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/AbstractRepository.java
Wed Mar 11 19:47:56 2009
@@ -20,12 +20,8 @@
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
 import java.util.Enumeration;
 import java.util.HashMap;
-import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -33,18 +29,8 @@
 import java.util.zip.ZipException;
 import java.util.zip.ZipFile;
 
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.geronimo.kernel.util.XmlUtil;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
 
 /**
  * @version $Rev: 506425 $ $Date: 2007-02-12 22:49:46 +1100 (Mon, 12 Feb 2007) $
@@ -75,82 +61,6 @@
         return location.canRead() && (location.isFile() || new File(location, "META-INF").isDirectory());
     }
 
-    private static final String NAMESPACE = "http://geronimo.apache.org/xml/ns/deployment-1.2";
-    public LinkedHashSet<Artifact> getDependencies(Artifact artifact) {
-        if(!artifact.isResolved()) {
-            throw new IllegalArgumentException("Artifact "+artifact+" is not fully resolved");
-        }
-        LinkedHashSet<Artifact> dependencies = new LinkedHashSet<Artifact>();
-        URL url;
-        try {
-            File location = getLocation(artifact);
-            url = location.toURL();
-        } catch (MalformedURLException e) {
-            throw (IllegalStateException)new IllegalStateException("Unable to get URL for
dependency " + artifact).initCause(e);
-        }
-        ClassLoader depCL = new URLClassLoader(new URL[]{url}, new ClassLoader() {
-            @Override
-            public URL getResource(String name) {
-                return null;
-            }
-        });
-        InputStream is = depCL.getResourceAsStream("META-INF/geronimo-dependency.xml");
-        try {
-            if (is != null) {
-                InputSource in = new InputSource(is);
-                DocumentBuilderFactory dfactory = XmlUtil.newDocumentBuilderFactory();
-                dfactory.setNamespaceAware(true);
-                try {
-                    Document doc = dfactory.newDocumentBuilder().parse(in);
-                    Element root = doc.getDocumentElement();
-                    NodeList configs = root.getElementsByTagNameNS(NAMESPACE, "dependency");
-                    for (int i = 0; i < configs.getLength(); i++) {
-                        Element dependencyElement = (Element) configs.item(i);
-                        String groupId = getString(dependencyElement, "groupId");
-                        String artifactId = getString(dependencyElement, "artifactId");
-                        String version = getString(dependencyElement, "version");
-                        String type = getString(dependencyElement, "type");
-                        if (type == null) {
-                            type = "jar";
-                        }
-                        dependencies.add(new Artifact(groupId, artifactId,  version, type));
-                    }
-                } catch (IOException e) {
-                    throw (IllegalStateException)new IllegalStateException("Unable to parse
geronimo-dependency.xml file in " + url).initCause(e);
-                } catch (ParserConfigurationException e) {
-                    throw (IllegalStateException)new IllegalStateException("Unable to parse
geronimo-dependency.xml file in " + url).initCause(e);
-                } catch (SAXException e) {
-                    throw (IllegalStateException)new IllegalStateException("Unable to parse
geronimo-dependency.xml file in " + url).initCause(e);
-                }
-            }
-        } finally {
-            if (is != null) {
-                try {
-                    is.close();
-                } catch (IOException ignore) {
-                    // ignore
-                }
-            }
-        }
-        return dependencies;
-    }
-
-    private String getString(Element dependencyElement, String childName) {
-        NodeList children = dependencyElement.getElementsByTagNameNS(NAMESPACE, childName);
-        if (children == null || children.getLength() == 0) {
-        return null;
-        }
-        String value = "";
-        NodeList text = children.item(0).getChildNodes();
-        for (int t = 0; t < text.getLength(); t++) {
-            Node n = text.item(t);
-            if (n.getNodeType() == Node.TEXT_NODE) {
-                value += n.getNodeValue();
-            }
-        }
-        return value.trim();
-    }
-
     public void setTypeHandler(String type, ArtifactTypeHandler handler) {
         typeHandlers.put(type, handler);
     }

Modified: geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Repository.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Repository.java?rev=752595&r1=752594&r2=752595&view=diff
==============================================================================
--- geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Repository.java
(original)
+++ geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Repository.java
Wed Mar 11 19:47:56 2009
@@ -44,19 +44,4 @@
      */
     File getLocation(Artifact artifact);
 
-    /**
-     * Loads any dependencies for this artifact declared in
-     * META-INF/geronimo-dependency.xml within the configuration archive.  This
-     * does not do anything special if the artifact is a configuration (which
-     * means it doesn't see dependencies in the ConfigurationData, etc.) so
-     * it's mainly useful for JAR-type artifacts.
-     *
-     * @param artifact A fully-resolved artifact representing the repository
-     *                 entry you're interested in.
-     *
-     * @return a LinkedHashSet (with elements of type Artifact) listing any
-     *         dependencies declared in META-INF/geronimo-dependency.xml for the
-     *         specified artifact.
-     */
-    LinkedHashSet<Artifact> getDependencies(Artifact artifact);
 }

Modified: geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockRepository.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockRepository.java?rev=752595&r1=752594&r2=752595&view=diff
==============================================================================
--- geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockRepository.java
(original)
+++ geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/mock/MockRepository.java
Wed Mar 11 19:47:56 2009
@@ -60,10 +60,6 @@
         return new File(".");
     }
 
-    public LinkedHashSet<Artifact> getDependencies(Artifact artifact) {
-        return new LinkedHashSet<Artifact>();
-    }
-
     public SortedSet<Artifact> list() {
         return new TreeSet<Artifact>(repo);
     }

Modified: geronimo/sandbox/djencks/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/GeronimoSourceRepository.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/GeronimoSourceRepository.java?rev=752595&r1=752594&r2=752595&view=diff
==============================================================================
--- geronimo/sandbox/djencks/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/GeronimoSourceRepository.java
(original)
+++ geronimo/sandbox/djencks/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/GeronimoSourceRepository.java
Wed Mar 11 19:47:56 2009
@@ -187,10 +187,6 @@
             return repo.getLocation(artifact);
         }
 
-        public LinkedHashSet<Artifact> getDependencies(Artifact artifact) {
-            return null;
-        }
-
         public SortedSet<Artifact> list() {
             return null;
         }

Modified: geronimo/sandbox/djencks/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java?rev=752595&r1=752594&r2=752595&view=diff
==============================================================================
--- geronimo/sandbox/djencks/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
(original)
+++ geronimo/sandbox/djencks/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
Wed Mar 11 19:47:56 2009
@@ -1284,11 +1284,12 @@
             }
             if (instance == null) {
                 //no plugin metadata, guess with something else
-                Dependency[] dependencies = data == null ? getDependencies(writeableRepo,
configID) : getDependencies(data);
-                for (Dependency dep : dependencies) {
-                    Artifact artifact = dep.getArtifact();
-                    log.debug("Attempting to download dependency={} for configuration={}",
artifact, configID);
-                    downloadArtifact(artifact, metadata, repos, username, password, monitor,
soFar, parentStack, true, servers, loadOverride);
+                if (data != null) {
+                    for (Dependency dep : getDependencies(data)) {
+                        Artifact artifact = dep.getArtifact();
+                        log.debug("Attempting to download dependency={} for configuration={}",
artifact, configID);
+                        downloadArtifact(artifact, metadata, repos, username, password, monitor,
soFar, parentStack, true, servers, loadOverride);
+                    }
                 }
             } else {
                 //rely on plugin metadata if present.
@@ -1451,24 +1452,6 @@
     }
 
     /**
-     * Used to get dependencies for a JAR
-     *
-     * @param repo     repository containing jar
-     * @param artifact artifact to find dependencies of
-     * @return dependencies of artifact in repository
-     */
-    private static Dependency[] getDependencies(Repository repo, Artifact artifact) {
-        Set<Artifact> set = repo.getDependencies(artifact);
-        Dependency[] results = new Dependency[set.size()];
-        int index = 0;
-        for (Artifact dep : set) {
-            results[index] = new Dependency(dep, ImportType.CLASSES);
-            ++index;
-        }
-        return results;
-    }
-
-    /**
      * Used to get dependencies for a Configuration
      *
      * @param data configuration data



Mime
View raw message