You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2008/09/10 11:09:47 UTC

svn commit: r693749 - in /geronimo/gshell/trunk/gshell-support/gshell-artifact: pom.xml src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactory.java src/main/resources/META-INF/spring/ src/main/resources/META-INF/spring/components.xml

Author: jdillon
Date: Wed Sep 10 02:09:46 2008
New Revision: 693749

URL: http://svn.apache.org/viewvc?rev=693749&view=rev
Log:
Add a spring factory bean to create the ArtifactManager

Added:
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactory.java   (contents, props changed)
      - copied, changed from r680934, geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManager.java
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/resources/META-INF/spring/
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/resources/META-INF/spring/components.xml   (with props)
Modified:
    geronimo/gshell/trunk/gshell-support/gshell-artifact/pom.xml

Modified: geronimo/gshell/trunk/gshell-support/gshell-artifact/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/pom.xml?rev=693749&r1=693748&r2=693749&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/pom.xml Wed Sep 10 02:09:46 2008
@@ -55,6 +55,11 @@
         </dependency>
 
         <dependency>
+            <groupId>org.apache.geronimo.gshell.support</groupId>
+            <artifactId>gshell-spring</artifactId>
+        </dependency>
+
+        <dependency>
             <groupId>org.codehaus.plexus</groupId>
             <artifactId>plexus-container-default</artifactId>
         </dependency>
@@ -85,4 +90,43 @@
         </dependency>
     </dependencies>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.plexus</groupId>
+                <artifactId>plexus-maven-plugin</artifactId>
+                <configuration>
+                    <extractors>
+                        <classComponentDescriptorExtractor>
+                            <gleaner implementation="org.codehaus.plexus.cdc.gleaner.AnnotationComponentGleaner"/>
+                        </classComponentDescriptorExtractor>
+                    </extractors>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>process-classes</id>
+                        <phase>process-classes</phase>
+                        <goals>
+                            <goal>descriptor</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>process-test-classes</id>
+                        <phase>process-test-classes</phase>
+                        <goals>
+                            <goal>test-descriptor</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.codehaus.plexus</groupId>
+                        <artifactId>plexus-cdc-anno</artifactId>
+                        <version>1.0-alpha-1</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
+        </plugins>
+    </build>
+
 </project>
\ No newline at end of file

Copied: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactory.java (from r680934, geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManager.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactory.java?p2=geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactory.java&p1=geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManager.java&r1=680934&r2=693749&rev=693749&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManager.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactory.java Wed Sep 10 02:09:46 2008
@@ -19,23 +19,50 @@
 
 package org.apache.geronimo.gshell.artifact;
 
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
-import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
-import org.apache.maven.wagon.events.TransferListener;
+import org.springframework.beans.factory.FactoryBean;
+import org.codehaus.plexus.DefaultPlexusContainer;
+import org.codehaus.plexus.PlexusContainer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.annotation.PostConstruct;
 
 /**
- * Provides a facade over the artifact + repository subsystem.
+ * Creates {@link ArtifactManager} beans.
  *
  * @version $Rev$ $Date$
  */
-public interface ArtifactManager
+public class ArtifactManagerFactory
+    implements FactoryBean
 {
-    ArtifactRepositoryManager getRepositoryManager();
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    private PlexusContainer container;
+
+    @PostConstruct
+    public void init() throws Exception {
+        container = new DefaultPlexusContainer();
+
+        log.debug("Constructed Plexus container: {}", container);
+    }
+    
+    public Object getObject() throws Exception {
+        if (container == null) {
+            container = new DefaultPlexusContainer();
+        }
+
+        Object target = container.lookup(ArtifactManager.class);
+
+        log.debug("Using ArtifactManager: {}", target);
 
-    ArtifactFactory getArtifactFactory();
+        return target;
+    }
 
-    void setDownloadMonitor(TransferListener listener);
+    public Class getObjectType() {
+        return ArtifactManager.class;
+    }
 
-    ArtifactResolutionResult resolve(ArtifactResolutionRequest request) throws ResolutionException;
+    public boolean isSingleton() {
+        return true;
+    }
 }
\ No newline at end of file

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

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

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManagerFactory.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

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

Added: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/resources/META-INF/spring/components.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/resources/META-INF/spring/components.xml?rev=693749&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/resources/META-INF/spring/components.xml (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/resources/META-INF/spring/components.xml Wed Sep 10 02:09:46 2008
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+
+<!-- $Rev$ $Date$ -->
+        
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xsi:schemaLocation="
+            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+            http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
+            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
+
+    <context:annotation-config/>
+
+    <bean id="artifactManager" class="org.apache.geronimo.gshell.artifact.ArtifactManagerFactory"/>
+    
+</beans>
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/resources/META-INF/spring/components.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/resources/META-INF/spring/components.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/resources/META-INF/spring/components.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/resources/META-INF/spring/components.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml