org.apache.geronimo.kernel.repository
Class DefaultArtifactResolver

java.lang.Object
  extended by org.apache.geronimo.kernel.repository.DefaultArtifactResolver
All Implemented Interfaces:
ArtifactResolver
Direct Known Subclasses:
ExplicitDefaultArtifactResolver

public class DefaultArtifactResolver
extends Object
implements ArtifactResolver


Field Summary
static GBeanInfo GBEAN_INFO
           
 
Constructor Summary
DefaultArtifactResolver(ArtifactManager artifactManager, Collection<? extends ListableRepository> repositories, Map<Artifact,Artifact> explicitResolution)
           
DefaultArtifactResolver(ArtifactManager artifactManager, ListableRepository repository)
           
 
Method Summary
 Artifact generateArtifact(Artifact source, String defaultType)
          Used to generate a fully-populated Artifact from a partially-populated Artifact when you're about to deploy/save a new artifact.
protected  Map<Artifact,Artifact> getExplicitResolution()
           
static GBeanInfo getGBeanInfo()
           
 Artifact queryArtifact(Artifact artifact)
          Used to search for existing artifacts in the server that match the supplied artifact (which may be partially-populated).
 Artifact[] queryArtifacts(Artifact artifact)
          Used to search for existing artifacts in the server that match the supplied artifact (which may be partially-populated).
 Artifact resolveInClassLoader(Artifact source)
          Used to search for existing artifacts that match the supplied artifact (which may be partially-populated).
 Artifact resolveInClassLoader(Artifact source, Collection<Configuration> parentConfigurations)
          Used to search for existing artifacts that match the supplied artifact (which may be partially-populated).
 LinkedHashSet<Artifact> resolveInClassLoader(Collection<Artifact> artifacts)
          Used to search for existing artifacts that match the supplied artifact (which may be partially-populated).
 LinkedHashSet<Artifact> resolveInClassLoader(Collection<Artifact> artifacts, Collection<Configuration> parentConfigurations)
          Used to search for existing artifacts that match the supplied artifact (which may be partially-populated).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GBEAN_INFO

public static final GBeanInfo GBEAN_INFO
Constructor Detail

DefaultArtifactResolver

public DefaultArtifactResolver(ArtifactManager artifactManager,
                               ListableRepository repository)

DefaultArtifactResolver

public DefaultArtifactResolver(ArtifactManager artifactManager,
                               Collection<? extends ListableRepository> repositories,
                               Map<Artifact,Artifact> explicitResolution)
Method Detail

getExplicitResolution

protected Map<Artifact,Artifact> getExplicitResolution()

generateArtifact

public Artifact generateArtifact(Artifact source,
                                 String defaultType)
Description copied from interface: ArtifactResolver
Used to generate a fully-populated Artifact from a partially-populated Artifact when you're about to deploy/save a new artifact. That is, this method comes up with reasonable default values that hopefully do not conflict with anything that's already deployed.

Specified by:
generateArtifact in interface ArtifactResolver
Parameters:
source - The artifact to complete (normally partially-resolved)
defaultType - The type to use for the resulting artifact if the source artifact doesn't have a type set
Returns:
If the source artifact is fully resolved (e.g. artifact.isResolved() == true) then it will be returned. Otherwise a new fully-resolved artifact is returned.

queryArtifact

public Artifact queryArtifact(Artifact artifact)
                       throws MultipleMatchesException
Description copied from interface: ArtifactResolver
Used to search for existing artifacts in the server that match the supplied artifact (which may be partially-populated). This method expects either no results or one result (multiple matches is an error).

Specified by:
queryArtifact in interface ArtifactResolver
Parameters:
artifact - incompletely resolved artifact to match
Returns:
A matching artifact, or null of there were no matches
Throws:
MultipleMatchesException - if there is more than one match

queryArtifacts

public Artifact[] queryArtifacts(Artifact artifact)
Description copied from interface: ArtifactResolver
Used to search for existing artifacts in the server that match the supplied artifact (which may be partially-populated).

TODO: The artifacts should be sorted ascending by type then group then artifact then version

Specified by:
queryArtifacts in interface ArtifactResolver
Parameters:
artifact - the Artifact to match.
Returns:
The matching artifacts, which may be 0, 1, or many

resolveInClassLoader

public LinkedHashSet<Artifact> resolveInClassLoader(Collection<Artifact> artifacts)
                                             throws MissingDependencyException
Description copied from interface: ArtifactResolver
Used to search for existing artifacts that match the supplied artifact (which may be partially-populated). Preference is given to artifacts that are already loaded, to reduce duplication. If nothing can be found that's an error, because something depends on this.

Specified by:
resolveInClassLoader in interface ArtifactResolver
Parameters:
artifacts - incompletely resolved Artifact
Returns:
A sorted set ordered in the same way the input was ordered, with entries of type Artifact
Throws:
MissingDependencyException - if no matching Artifact can be found.

resolveInClassLoader

public LinkedHashSet<Artifact> resolveInClassLoader(Collection<Artifact> artifacts,
                                                    Collection<Configuration> parentConfigurations)
                                             throws MissingDependencyException
Description copied from interface: ArtifactResolver
Used to search for existing artifacts that match the supplied artifact (which may be partially-populated). Preference is given to artifacts that are already loaded, or that exist in the parent configurations, to reduce duplication. If nothing can be found that's an error, because something depends on this.

Specified by:
resolveInClassLoader in interface ArtifactResolver
Parameters:
artifacts - incompletely resolved Artifacts to match
parentConfigurations - Configurations to search in
Returns:
A sorted set ordered in the same way the input was ordered, with entries of type Artifact
Throws:
MissingDependencyException - if no matching Artifact can be found.

resolveInClassLoader

public Artifact resolveInClassLoader(Artifact source)
                              throws MissingDependencyException
Description copied from interface: ArtifactResolver
Used to search for existing artifacts that match the supplied artifact (which may be partially-populated). Preference is given to artifacts that are already loaded, to reduce duplication. If nothing can be found that's an error, because something depends on this.

Specified by:
resolveInClassLoader in interface ArtifactResolver
Parameters:
source - incompletely resolved Artifact
Returns:
completely resolved Artifact matching the source
Throws:
MissingDependencyException - if no matching Artifact can be found.

resolveInClassLoader

public Artifact resolveInClassLoader(Artifact source,
                                     Collection<Configuration> parentConfigurations)
                              throws MissingDependencyException
Description copied from interface: ArtifactResolver
Used to search for existing artifacts that match the supplied artifact (which may be partially-populated). Preference is given to artifacts that are already loaded, or that exist in the parent configurations, to reduce duplication. If nothing can be found that's an error, because something depends on this.

Specified by:
resolveInClassLoader in interface ArtifactResolver
Parameters:
source - incompletely resolved Artifact
parentConfigurations - A Collection with entries of type Configuration
Returns:
completely resolved Artifact matching the source
Throws:
MissingDependencyException - if no matching Artifact can be found.

getGBeanInfo

public static GBeanInfo getGBeanInfo()


Copyright © 2003-2008 The Apache Geronimo development community. All Rights Reserved.