geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r615381 - in /geronimo/server/trunk: buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/
Date Fri, 25 Jan 2008 22:36:59 GMT
Author: djencks
Date: Fri Jan 25 14:36:57 2008
New Revision: 615381

URL: http://svn.apache.org/viewvc?rev=615381&view=rev
Log:
GERONIMO-3779 make sure pom versions determine what goes into assembled server

Modified:
    geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java
    geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/InstallModulesMojo.java
    geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/Maven2RepositoryAdapter.java
    geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/LocalOpenResult.java

Modified: geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java?rev=615381&r1=615380&r2=615381&view=diff
==============================================================================
--- geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java
(original)
+++ geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractCarMojo.java
Fri Jan 25 14:36:57 2008
@@ -252,9 +252,9 @@
         implements Maven2RepositoryAdapter.ArtifactLookup
     {
 
-        private final Map resolvedArtifacts;
+        private final Map<org.apache.geronimo.kernel.repository.Artifact, Artifact>
resolvedArtifacts;
 
-        public ArtifactLookupImpl(Map resolvedArtifacts) {
+        public ArtifactLookupImpl(Map<org.apache.geronimo.kernel.repository.Artifact,
Artifact> resolvedArtifacts) {
             this.resolvedArtifacts = resolvedArtifacts;
         }
 
@@ -275,7 +275,7 @@
 
             boolean debug = log.isDebugEnabled();
 
-            Artifact mavenArtifact = (Artifact)resolvedArtifacts.get(artifact);
+            Artifact mavenArtifact = resolvedArtifacts.get(artifact);
 
             // If not cached, then make a new artifact
             if (mavenArtifact == null) {

Modified: geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/InstallModulesMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/InstallModulesMojo.java?rev=615381&r1=615380&r2=615381&view=diff
==============================================================================
--- geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/InstallModulesMojo.java
(original)
+++ geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/InstallModulesMojo.java
Fri Jan 25 14:36:57 2008
@@ -28,10 +28,10 @@
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.basic.BasicKernel;
 import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.WritableListableRepository;
 import org.apache.geronimo.system.configuration.RepositoryConfigurationStore;
 import org.apache.geronimo.system.plugin.DownloadResults;
 import org.apache.geronimo.system.plugin.PluginInstallerGBean;
+import org.apache.geronimo.system.plugin.SourceRepository;
 import org.apache.geronimo.system.plugin.model.ArtifactType;
 import org.apache.geronimo.system.plugin.model.PluginArtifactType;
 import org.apache.geronimo.system.plugin.model.PluginListType;
@@ -114,12 +114,6 @@
      */
     private AliasedArtifactResolver geronimoArtifactResolver;
 
-//    private WritableListableRepository targetRepo;
-
-//    private RepositoryConfigurationStore targetStore;
-
-    private WritableListableRepository sourceRepo;
-
     private RepositoryConfigurationStore sourceStore;
 
     /**
@@ -129,15 +123,8 @@
 
     protected void doExecute() throws Exception {
         DependencyTree dependencies = dependencyHelper.getDependencies(project);
-
-        //
-        // TODO: Check if we need to use the Maven2RepositoryAdapter here or not...
-        //
-
-        Maven2RepositoryAdapter.ArtifactLookup lookup = new ArtifactLookupImpl(new HashMap());
-        sourceRepo = new Maven2RepositoryAdapter(dependencies, lookup);
-        // sourceRepo = new Maven2RepositoryAdapter(new File(sourceRepository.getBasedir()));
-        sourceStore = new RepositoryConfigurationStore(sourceRepo);
+        Maven2RepositoryAdapter.ArtifactLookup lookup = new ArtifactLookupImpl(new HashMap<Artifact,
org.apache.maven.artifact.Artifact>());
+        SourceRepository sourceRepo = new Maven2RepositoryAdapter(dependencies, lookup);
         PluginListType pluginList = new PluginListType();
         String localRepo = sourceRepository.getUrl();
         if ("file".equals(sourceRepository.getProtocol())) {
@@ -160,7 +147,7 @@
         Kernel kernel = new BasicKernel("Assembly");
         try {
             PluginInstallerGBean installer = new PluginInstallerGBean(targetRepositoryPath,
targetServerPath, servers, kernel, getClass().getClassLoader());
-            installer.install(pluginList, localRepo, true, null, null, downloadPoller);
+            installer.install(pluginList, sourceRepo, true, null, null, downloadPoller);
         } finally {
             kernel.shutdown();
         }

Modified: geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/Maven2RepositoryAdapter.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/Maven2RepositoryAdapter.java?rev=615381&r1=615380&r2=615381&view=diff
==============================================================================
--- geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/Maven2RepositoryAdapter.java
(original)
+++ geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/Maven2RepositoryAdapter.java
Fri Jan 25 14:36:57 2008
@@ -20,16 +20,23 @@
 package org.apache.geronimo.mavenplugins.car;
 
 import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
 import java.util.SortedSet;
 import java.util.TreeSet;
-import java.util.Iterator;
 
-import org.apache.geronimo.system.repository.Maven2Repository;
-import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.Version;
+import javax.security.auth.login.FailedLoginException;
+
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
-
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.FileWriteMonitor;
+import org.apache.geronimo.kernel.repository.Version;
+import org.apache.geronimo.system.plugin.LocalOpenResult;
+import org.apache.geronimo.system.plugin.OpenResult;
+import org.apache.geronimo.system.plugin.SourceRepository;
+import org.apache.geronimo.system.plugin.model.PluginListType;
+import org.apache.geronimo.system.repository.Maven2Repository;
 import org.codehaus.mojo.pluginsupport.dependency.DependencyTree;
 
 /**
@@ -37,9 +44,7 @@
  *
  * @version $Rev$ $Date$
  */
-public class Maven2RepositoryAdapter
-    extends Maven2Repository
-{
+public class Maven2RepositoryAdapter extends Maven2Repository implements SourceRepository
{
     private ArtifactLookup lookup;
 
     private DependencyTree dependencyTree;
@@ -57,18 +62,18 @@
     }
 
     public SortedSet list() {
-        TreeSet list = new TreeSet();
+        TreeSet<Artifact> list = new TreeSet<Artifact>();
         listInternal(list, dependencyTree.getRootNode(), null, null, null, null);
         return list;
     }
 
     public SortedSet list(Artifact query) {
-        TreeSet list = new TreeSet();
+        TreeSet<Artifact> list = new TreeSet<Artifact>();
         listInternal(list, dependencyTree.getRootNode(), query.getGroupId(), query.getArtifactId(),
query.getVersion(), query.getType());
         return list;
     }
 
-    private void listInternal(TreeSet list, DependencyTree.Node node, String groupId, String
artifactId, Version version, String type) {
+    private void listInternal(TreeSet<Artifact> list, DependencyTree.Node node, String
groupId, String artifactId, Version version, String type) {
         if (matches(node.getArtifact(), groupId, artifactId, version, type)) {
             list.add(mavenToGeronimoArtifact(node.getArtifact()));
         }
@@ -91,12 +96,28 @@
         return new org.apache.geronimo.kernel.repository.Artifact(artifact.getGroupId(),
artifact.getArtifactId(), artifact.getVersion(), artifact.getType());
     }
 
+    public PluginListType getPluginList() {
+        throw new RuntimeException("Not implemented");
+    }
+
+    public OpenResult open(Artifact artifact, FileWriteMonitor fileWriteMonitor) throws IOException,
FailedLoginException {
+        if (!artifact.isResolved()) {
+            SortedSet<Artifact> list = list(artifact);
+            if (list.isEmpty()) {
+                throw new IOException("Could not resolve artifact " + artifact + " in repo
" + rootFile);
+            }
+            artifact = list.first();
+        }
+        File location = getLocation(artifact);
+        return new LocalOpenResult(artifact, location);
+
+    }
+
     //
     // ArtifactLookup
     //
 
-    public static interface ArtifactLookup
-    {
+    public static interface ArtifactLookup {
         File getLocation(Artifact artifact);
 
         File getBasedir();
@@ -112,7 +133,7 @@
         GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(Maven2RepositoryAdapter.class,
"Repository");
         infoFactory.addAttribute("lookup", ArtifactLookup.class, true);
         infoFactory.addAttribute("dependencies", DependencyTree.class, true);
-        infoFactory.setConstructor(new String[]{"dependencies", "lookup" });
+        infoFactory.setConstructor(new String[]{"dependencies", "lookup"});
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 

Modified: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/LocalOpenResult.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/LocalOpenResult.java?rev=615381&r1=615380&r2=615381&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/LocalOpenResult.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/LocalOpenResult.java
Fri Jan 25 14:36:57 2008
@@ -30,11 +30,11 @@
 /**
  * @version $Rev$ $Date$
  */
-class LocalOpenResult implements OpenResult {
+public class LocalOpenResult implements OpenResult {
     private final Artifact artifact;
     private final File file;
 
-    LocalOpenResult(Artifact artifact, File file) {
+    public LocalOpenResult(Artifact artifact, File file) {
         this.artifact = artifact;
         this.file = file;
     }



Mime
View raw message