geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r657378 - in /geronimo/gshell/trunk/gshell-support/gshell-artifact: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/geronimo/ src/main/java/org/apache/geronimo/gshell/ src/main/java/org...
Date Sat, 17 May 2008 15:43:24 GMT
Author: jdillon
Date: Sat May 17 08:43:24 2008
New Revision: 657378

URL: http://svn.apache.org/viewvc?rev=657378&view=rev
Log:
Some initial work to deal with maven artifacts and repositories

Added:
    geronimo/gshell/trunk/gshell-support/gshell-artifact/
    geronimo/gshell/trunk/gshell-support/gshell-artifact/pom.xml   (with props)
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManager.java
  (with props)
    geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactManager.java
  (with props)

Added: 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=657378&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/pom.xml (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/pom.xml Sat May 17 08:43:24 2008
@@ -0,0 +1,83 @@
+<?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$ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    
+    <modelVersion>4.0.0</modelVersion>
+    
+    <parent>
+        <groupId>org.apache.geronimo.gshell.support</groupId>
+        <artifactId>gshell-support</artifactId>
+        <version>1.0-alpha-2-SNAPSHOT</version>
+    </parent>
+    
+    <artifactId>gshell-artifact</artifactId>
+    <name>GShell Support :: Artifact</name>
+    
+    <description>
+        Provides support for working with artifacts and repositories.
+    </description>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.gshell.support</groupId>
+            <artifactId>gshell-plexus</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.maven.artifact</groupId>
+            <artifactId>maven-artifact</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-project</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.maven.wagon</groupId>
+            <artifactId>wagon-provider-api</artifactId>
+        </dependency>
+
+        <!--
+        TODO: Move this out of here...
+        -->
+        
+        <dependency>
+            <groupId>org.apache.maven.wagon</groupId>
+            <artifactId>wagon-http-lightweight</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+    </dependencies>
+
+</project>
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-support/gshell-artifact/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 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/ArtifactManager.java?rev=657378&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManager.java
(added)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/ArtifactManager.java
Sat May 17 08:43:24 2008
@@ -0,0 +1,56 @@
+/*
+ * 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;
+
+import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.InvalidRepositoryException;
+import org.apache.maven.artifact.UnknownRepositoryLayoutException;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+
+import java.util.List;
+import java.io.File;
+import java.net.URL;
+import java.net.MalformedURLException;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ArtifactManager
+{
+    ArtifactRepository getLocalRepository();
+
+    void setLocalRepository(ArtifactRepository repository);
+
+    void setLocalRepository(File dir) throws MalformedURLException, InvalidRepositoryException;
+
+    List<ArtifactRepository> getRemoteRepositories();
+
+    void addRemoteRepository(ArtifactRepository repository);
+
+    void addRemoteRepository(String id, URL url) throws UnknownRepositoryLayoutException;
+
+    ArtifactFactory getArtifactFactory();
+
+    ArtifactResolutionResult resolve(ArtifactResolutionRequest request);
+}
\ No newline at end of file

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

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

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

Added: geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactManager.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactManager.java?rev=657378&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactManager.java
(added)
+++ geronimo/gshell/trunk/gshell-support/gshell-artifact/src/main/java/org/apache/geronimo/gshell/artifact/DefaultArtifactManager.java
Sat May 17 08:43:24 2008
@@ -0,0 +1,142 @@
+/*
+ * 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;
+
+import org.apache.maven.artifact.InvalidRepositoryException;
+import org.apache.maven.artifact.UnknownRepositoryLayoutException;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.manager.WagonManager;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
+import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+@Component(role=ArtifactManager.class)
+public class DefaultArtifactManager
+    implements ArtifactManager
+{
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    @Requirement
+    private ArtifactFactory artifactFactory;
+
+    @Requirement
+    private ArtifactRepositoryFactory repositoryFactory;
+
+    @Requirement
+    private ArtifactResolver artifactResolver;
+
+    @Requirement
+    private ArtifactMetadataSource artifactMetadataSource;
+
+    @Requirement
+    private WagonManager wagonManager;
+
+    private ArtifactRepository localRepository;
+
+    private List<ArtifactRepository> remoteRepositories = new ArrayList<ArtifactRepository>();
+
+    public ArtifactRepository getLocalRepository() {
+        return localRepository;
+    }
+
+    public void setLocalRepository(final ArtifactRepository repository) {
+        assert repository != null;
+
+        localRepository = repository;
+    }
+
+    public void setLocalRepository(final File dir) throws InvalidRepositoryException {
+        assert dir != null;
+
+        localRepository = repositoryFactory.createLocalRepository(dir);
+    }
+
+    public List<ArtifactRepository> getRemoteRepositories() {
+        return remoteRepositories;
+    }
+
+    public void addRemoteRepository(final ArtifactRepository repository) {
+        assert repository != null;
+
+        remoteRepositories.add(repository);
+    }
+
+    public void addRemoteRepository(final String id, final URL url) throws UnknownRepositoryLayoutException
{
+        assert id != null;
+        assert url != null;
+
+        ArtifactRepository repo = repositoryFactory.createArtifactRepository(
+            id,
+            url.toExternalForm(),
+            ArtifactRepositoryFactory.DEFAULT_LAYOUT_ID,
+            new ArtifactRepositoryPolicy(),  // snapshots
+            new ArtifactRepositoryPolicy()); // releases
+        
+        remoteRepositories.add(repo);
+    }
+
+    public ArtifactFactory getArtifactFactory() {
+        return artifactFactory;
+    }
+
+    public ArtifactResolutionResult resolve(final ArtifactResolutionRequest request) {
+        assert request != null;
+
+        // Automatically fill in some missing bits
+
+        if (request.getLocalRepository() == null) {
+            request.setLocalRepository(localRepository);
+        }
+
+        if (request.getRemoteRepostories() == null) {
+            request.setRemoteRepostories(remoteRepositories);
+        }
+
+        if (request.getMetadataSource() == null) {
+            request.setMetadataSource(artifactMetadataSource);
+        }
+
+        log.debug("Resolving request: {}", request);
+
+        ArtifactResolutionResult result = artifactResolver.resolve(request);
+
+        log.debug("Resolution result: {}", result);
+
+        return result;
+    }
+}
\ No newline at end of file

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

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

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



Mime
View raw message