KickJava   Java API By Example, From Geeks To Geeks.

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


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 Savant scheme via HTTP.
17  * </p>
18  *
19  * <p>
20  * Savant's URL scheme is
21  * <b>domain</b>/<b>group</b>/<b>project</b>/<b>name</b>-<b>version</b>.<b>type</b>
22  * </p>
23  *
24  * <p>
25  * Savant's scheme allows a local repository to be setup and
26  * still contain artifacts from 3rd party groups.
27  * </p>
28  *
29  * <p>
30  * In order to determine the domain in the URL, either a
31  * properties file can be read for group/domain pairs. Or
32  * a standard location can be setup in this class.
33  * </p>
34  *
35  * @author Brian Pontarelli
36  */

37 public class SavantInternetProcess extends InternetProcess {
38
39     private static final URLBuilder builder = new SavantURLBuilder();
40
41
42     /**
43      * <p>
44      * Using a simple URL connection, this attempts to download the artifact
45      * dependency XML file, parse it and update the given artifacts internal
46      * list of dependencies. This is done using standard Savant URLs. If the
47      * artifact dependencies are found, they are cached locally using the
48      * LocalCacheStore.
49      * </p>
50      *
51      * @param artifact The artifact to update with the resolved dependencies.
52      * @return True if the artifact was updated, false otherwise.
53      */

54     public boolean resolveArtifactDependencies(Artifact artifact,
55             LocalCacheStore localCache)
56     throws SavantException {
57         return resolveArtifactDependencies(builder, artifact, localCache);
58     }
59
60     /**
61      * Using a simple URL connection, this grabs the date of the URL resource and
62      * then attempts to store the stream from the URL to the local cache.
63      *
64      * @param artifact The artifact to store
65      * @param localCache The local cache to store the artifact in
66      * @return The File if downloaded and stored
67      */

68     public File JavaDoc fetch(Artifact artifact, LocalCacheStore localCache)
69     throws SavantException {
70         return findFile(builder, artifact, localCache);
71     }
72
73     /**
74      * Returns SavantProcess.
75      */

76     public String JavaDoc getProcessName() {
77         return "SavantProcess";
78     }
79 }
Popular Tags