org.apache.geronimo.client.builder
Class OptionalExplicitDefaultArtifactResolver

java.lang.Object
  extended by org.apache.geronimo.client.builder.OptionalExplicitDefaultArtifactResolver
All Implemented Interfaces:
ArtifactResolver

public class OptionalExplicitDefaultArtifactResolver
extends Object
implements ArtifactResolver

This class is intended to get around some problems using the normal ExplicitDefaultArtifactResolver for client building. We really want it to refer to the server's client_artifact_aliases.properties file, but that isn't available when run from the car-maven-plugin. Also the ServerInfo is missing and the ArtifactManager is not in a parent configuration (the car-maven-plugin starts a configuration that isn't a parent of anything. We might be able to fix that by a use of artifact_aliases.properties itself, but that might be for later).


Field Summary
static GBeanInfo GBEAN_INFO
           
 
Constructor Summary
OptionalExplicitDefaultArtifactResolver(String versionMapLocation, Collection<ArtifactManager> artifactManagers, Collection<ListableRepository> repositories, Collection<ServerInfo> serverInfos, Collection<ArtifactResolver> fallbackResolver)
           
 
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.
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 parentConfigurations)
          Used to search for existing artifacts that match the supplied artifact (which may be partially-populated).
 LinkedHashSet resolveInClassLoader(Collection artifacts)
          Used to search for existing artifacts that match the supplied artifact (which may be partially-populated).
 LinkedHashSet resolveInClassLoader(Collection artifacts, Collection 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

OptionalExplicitDefaultArtifactResolver

public OptionalExplicitDefaultArtifactResolver(String versionMapLocation,
                                               Collection<ArtifactManager> artifactManagers,
                                               Collection<ListableRepository> repositories,
                                               Collection<ServerInfo> serverInfos,
                                               Collection<ArtifactResolver> fallbackResolver)
                                        throws IOException
Throws:
IOException
Method Detail

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.

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 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.

resolveInClassLoader

public LinkedHashSet resolveInClassLoader(Collection 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 resolveInClassLoader(Collection artifacts,
                                          Collection 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.

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

getGBeanInfo

public static GBeanInfo getGBeanInfo()


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