KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > inversoft > savant > MavenInternetProcess


1 /*
2  * Copyright (c) 2002-2004, Inversoft, All Rights Reserved
3  *
4  * This software is distribuable under the GNU Lesser General Public License.
5  * For more information visit gnu.org.
6  */

7 package com.inversoft.savant;
8
9
10 import java.io.File JavaDoc;
11
12
13 /**
14  * <p>
15  * This class is a workflow process that attempts to download
16  * artifacts from the internet using the maven scheme via HTTP.
17  * </p>
18  *
19  * <p>
20  * Maven's URL scheme is
21  * <b>domain</b>/<b>project</b>/jars/<b>name</b>-<b>version</b>.jar
22  * </p>
23  *
24  * <p>
25  * In order to determine the domain in the URL, either a
26  * properties file can be read for group/domain pairs. Or
27  * a standard location can be setup in this class.
28  * </p>
29  *
30  * @author Brian Pontarelli
31  */

32 public class MavenInternetProcess extends InternetProcess {
33
34     private static final URLBuilder builder = new MavenURLBuilder();
35
36
37     /**
38      * <p>
39      * Maven does not support artifact dependencies so this method is a no-op and
40      * always returns false.
41      * </p>
42      */

43     public boolean resolveArtifactDependencies(Artifact artifact,
44             LocalCacheStore localCache)
45     throws SavantException {
46         return false;
47     }
48
49     /**
50      * Using a simple URL connection, this grabs the date of the URL resource and
51      * then attempts to store the stream from the URL to the local cache.
52      *
53      * @param artifact The artifact to store
54      * @param localCache The local cache to store the artifact in
55      * @return The File if downloaded and stored
56      */

57     public File JavaDoc fetch(Artifact artifact, LocalCacheStore localCache)
58     throws SavantException {
59         return findFile(builder, artifact, localCache);
60     }
61
62
63     /**
64      * Returns MavenProcess.
65      */

66     public String JavaDoc getProcessName() {
67         return "MavenProcess";
68     }
69 }
Popular Tags