geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r720801 - in /geronimo/gshell/trunk: gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/ gshell-support/gshell-artifact-maven/src/main/java/org/apache/geronimo/gshell/artifact/maven/ gshell-wisdom/gshel...
Date Wed, 26 Nov 2008 10:55:39 GMT
Author: jdillon
Date: Wed Nov 26 02:55:38 2008
New Revision: 720801

URL: http://svn.apache.org/viewvc?rev=720801&view=rev
Log:
Moved filtering of gshell-artifact specific impl artifacts to gshell-artifact impl modules

Added:
    geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/AndArtifactFilter.java
  (with props)
    geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/IvyDependenciesFilter.java
  (with props)
    geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/java/org/apache/geronimo/gshell/artifact/maven/MavenArtifactDependenciesFilter.java
  (with props)
Modified:
    geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/ArtifactResolverImpl.java
    geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/java/org/apache/geronimo/gshell/artifact/maven/ArtifactResolverImpl.java
    geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationArtifactFilter.java

Added: geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/AndArtifactFilter.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/AndArtifactFilter.java?rev=720801&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/AndArtifactFilter.java
(added)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/AndArtifactFilter.java
Wed Nov 26 02:55:38 2008
@@ -0,0 +1,60 @@
+/*
+ * 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.gshell.artifact.ivy;
+
+import org.apache.ivy.core.module.descriptor.Artifact;
+import org.apache.ivy.util.filter.Filter;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * AND artifact filter.
+ *
+ * @version $Rev$ $Date$
+ */
+public class AndArtifactFilter
+    implements Filter
+{
+    private final List<Filter> filters = new ArrayList<Filter>();
+
+    public boolean accept(final Object obj) {
+        if (obj instanceof Artifact) {
+            return include((Artifact)obj);
+        }
+        return false;
+    }
+
+    public boolean include(final Artifact artifact) {
+        boolean include = true;
+        for (Iterator<Filter> i = filters.iterator(); i.hasNext() && include;)
{
+            Filter filter = i.next();
+            if (!filter.accept(artifact)) {
+                include = false;
+            }
+        }
+        return include;
+    }
+
+    public void add(final Filter filter) {
+        filters.add(filter);
+    }
+}
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/AndArtifactFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/AndArtifactFilter.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/AndArtifactFilter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/ArtifactResolverImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/ArtifactResolverImpl.java?rev=720801&r1=720800&r2=720801&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/ArtifactResolverImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/ArtifactResolverImpl.java
Wed Nov 26 02:55:38 2008
@@ -61,8 +61,16 @@
         options.setOutputReport(true);
         options.setTransitive(true);
 
+        AndArtifactFilter filter = new AndArtifactFilter();
+        options.setArtifactFilter(filter);
+
+        // Filter deps needed for use of apache-ivy
+        filter.add(new IvyDependenciesFilter());
+
         if (request.filter != null) {
-            options.setArtifactFilter(new Filter() {
+            log.debug("Filter: {}", request.filter);
+
+            filter.add(new Filter() {
                 public boolean accept(final Object obj) {
                     if (!(obj instanceof org.apache.ivy.core.module.descriptor.Artifact))
{
                         return false;
@@ -80,13 +88,17 @@
 
         try {
             ResolveReport resolveReport = ivy.resolve(md, options);
-
             result.artifacts = new LinkedHashSet<Artifact>();
 
+            log.debug("Resolved:");
+
             for (ArtifactDownloadReport downloadReport : resolveReport.getAllArtifactsReports())
{
-                Artifact resolved = createArtifact(downloadReport.getArtifact());
-                resolved.setFile(downloadReport.getLocalFile());
-                result.artifacts.add(resolved);
+                Artifact artifact = createArtifact(downloadReport.getArtifact());
+                artifact.setFile(downloadReport.getLocalFile());
+
+                log.debug("    {}", artifact);
+
+                result.artifacts.add(artifact);
             }
         }
         catch (Exception e) {
@@ -113,13 +125,19 @@
     private ModuleDescriptor createModuleDescriptor(final Request request) {
         assert request != null;
 
+        log.debug("Artifact: {}", request.artifact);
+
         ModuleRevisionId id = ModuleRevisionId.newInstance(request.artifact.getGroup(), request.artifact.getName(),
request.artifact.getVersion());
         DefaultModuleDescriptor md = new DefaultModuleDescriptor(id, "integration", null,
true);
         md.addConfiguration(new Configuration("default"));
         md.setLastModified(System.currentTimeMillis());
 
         if (request.artifacts != null) {
+            log.debug("Dependencies:");
+
             for (Artifact artifact : request.artifacts) {
+                log.debug("    {}", artifact);
+
                 ModuleRevisionId depId = ModuleRevisionId.newInstance(artifact.getGroup(),
artifact.getName(), artifact.getVersion());
                 DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md, depId,
false, false, true);
                 dd.addDependencyConfiguration("default", "default");

Added: geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/IvyDependenciesFilter.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/IvyDependenciesFilter.java?rev=720801&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/IvyDependenciesFilter.java
(added)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/IvyDependenciesFilter.java
Wed Nov 26 02:55:38 2008
@@ -0,0 +1,58 @@
+/*
+ * 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.gshell.artifact.ivy;
+
+import org.apache.ivy.core.module.descriptor.Artifact;
+import org.apache.ivy.util.filter.Filter;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Filters artifacts required for using Apache Ivy for resolution of artifacts.
+ *
+ * @version $Rev$ $Date$
+ */
+public class IvyDependenciesFilter
+    implements Filter
+{
+    private static final String[] EXCLUDES = {
+        "gshell-artifact-ivy",
+        "ivy",
+    };
+
+    private final Set<String> excludes = new HashSet<String>();
+
+    public IvyDependenciesFilter() {
+        excludes.addAll(Arrays.asList(EXCLUDES));
+    }
+
+    public boolean accept(final Object obj) {
+        if (!(obj instanceof Artifact)) {
+            return false;
+        }
+
+        Artifact artifact = (Artifact)obj;
+        String name = artifact.getName();
+
+        return !excludes.contains(name);
+    }
+}
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/IvyDependenciesFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/IvyDependenciesFilter.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-ivy/src/main/java/org/apache/geronimo/gshell/artifact/ivy/IvyDependenciesFilter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/java/org/apache/geronimo/gshell/artifact/maven/ArtifactResolverImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/java/org/apache/geronimo/gshell/artifact/maven/ArtifactResolverImpl.java?rev=720801&r1=720800&r2=720801&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/java/org/apache/geronimo/gshell/artifact/maven/ArtifactResolverImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/java/org/apache/geronimo/gshell/artifact/maven/ArtifactResolverImpl.java
Wed Nov 26 02:55:38 2008
@@ -75,11 +75,15 @@
             _request.setArtifactDependencies(artifacts);
         }
 
-        // Always filter for runtime scope
         AndArtifactFilter filter = new AndArtifactFilter();
         _request.setFilter(filter);
+
+        // Always filter for runtime scope
         filter.add(new ScopeArtifactFilter(org.apache.maven.artifact.Artifact.SCOPE_RUNTIME));
 
+        // Filter deps needed for use of maven-artifact
+        filter.add(new MavenArtifactDependenciesFilter());
+
         if (request.filter != null) {
             log.debug("Filter: {}", request.filter);
             

Added: geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/java/org/apache/geronimo/gshell/artifact/maven/MavenArtifactDependenciesFilter.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/java/org/apache/geronimo/gshell/artifact/maven/MavenArtifactDependenciesFilter.java?rev=720801&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/java/org/apache/geronimo/gshell/artifact/maven/MavenArtifactDependenciesFilter.java
(added)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/java/org/apache/geronimo/gshell/artifact/maven/MavenArtifactDependenciesFilter.java
Wed Nov 26 02:55:38 2008
@@ -0,0 +1,75 @@
+/*
+ * 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.gshell.artifact.maven;
+
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.Artifact;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Arrays;
+
+/**
+ * Filters artifacts required for using Maven Artifact for resolution of artifacts.
+ *
+ * @version $Rev$ $Date$
+ */
+public class MavenArtifactDependenciesFilter
+    implements ArtifactFilter
+{
+    private static final String[] EXCLUDES = {
+        "gshell-artifact-maven",
+        "gshell-plexus",
+        "aspectjrt",
+        "maven-artivact",
+        "maven-model",
+        "maven-plugin-registry",
+        "maven-profile",
+        "maven-project",
+        "maven-settings",
+        "plexus-classworlds",
+        "plexus-component-annotations",
+        "plexus-container-default",
+        "plexus-interpolation",
+        "plexus-utils",
+        "wagon-file",
+        "wagon-http-lightweight",
+        "wagon-http-shared",
+        "wagon-provider-api",
+        "xbean-reflect",
+        "xercesMinimal",
+        "nekohtml",
+
+    };
+
+    private final Set<String> excludes = new HashSet<String>();
+
+    public MavenArtifactDependenciesFilter() {
+        excludes.addAll(Arrays.asList(EXCLUDES));
+    }
+
+    public boolean include(final Artifact artifact) {
+        assert artifact != null;
+
+        String name = artifact.getArtifactId();
+
+        return !excludes.contains(name);
+    }
+}
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/java/org/apache/geronimo/gshell/artifact/maven/MavenArtifactDependenciesFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/java/org/apache/geronimo/gshell/artifact/maven/MavenArtifactDependenciesFilter.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact-maven/src/main/java/org/apache/geronimo/gshell/artifact/maven/MavenArtifactDependenciesFilter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationArtifactFilter.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationArtifactFilter.java?rev=720801&r1=720800&r2=720801&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationArtifactFilter.java
(original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationArtifactFilter.java
Wed Nov 26 02:55:38 2008
@@ -56,53 +56,18 @@
         "slf4j-api",
         "slf4j-log4j12",
         "spring-core",
-        "spring-beans",
-
-        //
-        // FIXME: Need to hook this filtering up in the ArtifactResolverImpls
-        //
-        
-        // gshell-artifact-ivy
-        "gshell-artifact-ivy",
-        "ivy",
-
-        // gshell-artifact-maven
-        "gshell-artifact-maven",
-        "gshell-plexus",
-        "aspectjrt",
-        "maven-artivact",
-        "maven-model",
-        "maven-plugin-registry",
-        "maven-profile",
-        "maven-project",
-        "maven-settings",
-        "plexus-classworlds",
-        "plexus-component-annotations",
-        "plexus-container-default",
-        "plexus-interpolation",
-        "plexus-utils",
-        "wagon-file",
-        "wagon-http-lightweight",
-        "wagon-http-shared",
-        "wagon-provider-api",
-        "xbean-reflect",
-        "xercesMinimal",
-        "nekohtml",
-
+        "spring-beans"
     };
 
     private final Set<String> excludes = new HashSet<String>();
 
     public ApplicationArtifactFilter() {
         excludes.addAll(Arrays.asList(EXCLUDES));
-
     }
 
     public boolean accept(final Artifact artifact) {
         assert artifact != null;
 
-        String name = artifact.getName();
-
-        return !excludes.contains(name);
+        return !excludes.contains(artifact.getName());
     }
 }



Mime
View raw message