KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > kernel > repository > ArtifactResolver


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.geronimo.kernel.repository;
18
19 import java.util.Collection JavaDoc;
20 import java.util.LinkedHashSet JavaDoc;
21
22 /**
23  * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
24  */

25 public interface ArtifactResolver {
26
27     /**
28      * Used to generate a fully-populated Artifact from a partially-populated Artifact
29      * when you're about to deploy/save a new artifact. That is, this method comes up
30      * with reasonable default values that hopefully do not conflict with anything
31      * that's already deployed.
32      *
33      * @param source The artifact to complete (normally partially-populated)
34      * @param defaultType The type to use for the resulting artifact if the source
35      * artifact doesn't have a type set
36      *
37      * @return If the source artifact is fully populated (e.g. artifact.isResolved()
38      * == true) then it will be returned. Otherwise a new fully-populated
39      * artifact is returned.
40      */

41     Artifact generateArtifact(Artifact source, String JavaDoc defaultType);
42
43     /**
44      * Used to search for existing artifacts that match the supplied artifact (which
45      * may be partially-populated). Preference is given to artifacts that are already
46      * loaded, to reduce duplication. If nothing can be found that's an error,
47      * because something depends on this.
48      */

49     Artifact resolveInClassLoader(Artifact source) throws MissingDependencyException;
50
51     /**
52      * Used to search for existing artifacts that match the supplied artifact (which
53      * may be partially-populated). Preference is given to artifacts that are already
54      * loaded, or that exist in the parent configurations, to reduce duplication. If
55      * nothing can be found that's an error, because something depends on this.
56      *
57      * @param parentConfigurations A Collection with entries of type Configuration
58      */

59     Artifact resolveInClassLoader(Artifact source, Collection JavaDoc parentConfigurations) throws MissingDependencyException;
60
61     /**
62      * Used to search for existing artifacts that match the supplied artifact (which
63      * may be partially-populated). Preference is given to artifacts that are already
64      * loaded, to reduce duplication. If nothing can be found that's an error,
65      * because something depends on this.
66      *
67      * @return A sorted set ordered in the same way the input was ordered, with
68      * entries of type Artifact
69      */

70     LinkedHashSet JavaDoc resolveInClassLoader(Collection JavaDoc artifacts) throws MissingDependencyException;
71
72     /**
73      * Used to search for existing artifacts that match the supplied artifact (which
74      * may be partially-populated). Preference is given to artifacts that are already
75      * loaded, or that exist in the parent configurations, to reduce duplication. If
76      * nothing can be found that's an error, because something depends on this.
77      *
78      * @param parentConfigurations A Collection with entries of type Configuration
79      *
80      * @return A sorted set ordered in the same way the input was ordered, with
81      * entries of type Artifact
82      */

83     LinkedHashSet JavaDoc resolveInClassLoader(Collection JavaDoc artifacts, Collection JavaDoc parentConfigurations) throws MissingDependencyException;
84
85     /**
86      * Used to search for existing artifacts in the server that match the supplied
87      * artifact (which may be partially-populated). This method expects either no
88      * results or one result (multiple matches is an error).
89      *
90      * @return A matching artifact, or null of there were no matches
91      */

92     Artifact queryArtifact(Artifact artifact) throws MultipleMatchesException;
93
94     /**
95      * Used to search for existing artifacts in the server that match the supplied
96      * artifact (which may be partially-populated).
97      *
98      * TODO: The artifacts should be sorted ascending by type then group then artifact then version
99      *
100      * @return The matching artifacts, which may be 0, 1, or many
101      */

102     Artifact[] queryArtifacts(Artifact artifact);
103 }
104
Popular Tags