ShrinkWrap Resolver Maven Implementation 2.0.0-alpha-3

org.jboss.shrinkwrap.resolver.impl.maven
Class MavenWorkingSessionImpl

java.lang.Object
  extended by org.jboss.shrinkwrap.resolver.impl.maven.MavenWorkingSessionImpl
All Implemented Interfaces:
MavenWorkingSession

public class MavenWorkingSessionImpl
extends Object
implements MavenWorkingSession

Implementation of a MavenWorkingSession, encapsulating Maven/Aether backend

Author:
Karel Piwko

Constructor Summary
MavenWorkingSessionImpl()
           
 
Method Summary
 void disableClassPathWorkspaceReader()
          Disables the classpath workspace reader which may be used to resolve from dependencies on the ClassPath
 void disableMavenCentral()
          Disables use of the Maven Central Repository
 Collection<org.sonatype.aether.resolution.ArtifactResult> execute(org.sonatype.aether.collection.CollectRequest request, MavenResolutionFilter[] filters)
          
 MavenWorkingSession execute(org.apache.maven.model.building.ModelBuildingRequest request)
          Loads an effective POM file and updates session settings accordingly.
 MavenWorkingSession execute(org.apache.maven.settings.building.SettingsBuildingRequest request)
          Loads Maven configuration and updates session settings accordingly.
 org.sonatype.aether.artifact.ArtifactTypeRegistry getArtifactTypeRegistry()
          Gets registry of the known artifact types based on underlying session
 Set<MavenDependency> getDeclaredDependencies()
          Metadata for all defined elements
 List<MavenDependency> getDependenciesForResolution()
          Gets the Set of dependencies to be resolved for this session
 Set<MavenDependency> getDependencyManagement()
          Gets a set af dependency declarations stored in version management.
 org.apache.maven.model.Model getModel()
          Returns underlying Maven model for parsed POM file.
 List<org.sonatype.aether.repository.RemoteRepository> getRemoteRepositories()
          Returns a list of remote repositories enabled from Maven settings.
 List<org.apache.maven.model.Profile> getSettingsDefinedProfiles()
          Gets a list of profiles defined in settings.xml.
 MavenWorkingSession goOffline(boolean value)
           
 MavenWorkingSession regenerateSession()
          Refreshes underlying Aether session in order to contain newly acquired information, such as new settings.xml content
 void setOffline(boolean offline)
          Whether or not to set this session in "offline" mode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MavenWorkingSessionImpl

public MavenWorkingSessionImpl()
Method Detail

getDependencyManagement

public Set<MavenDependency> getDependencyManagement()
Description copied from interface: MavenWorkingSession
Gets a set af dependency declarations stored in version management. These dependency declarations are used to get versions if none are specified in MavenDependency#getAddress() address and also affect transitive dependency resolutions.

Specified by:
getDependencyManagement in interface MavenWorkingSession
Returns:
Set of defined MavenDependencys

getDependenciesForResolution

public List<MavenDependency> getDependenciesForResolution()
Description copied from interface: MavenWorkingSession
Gets the Set of dependencies to be resolved for this session

Specified by:
getDependenciesForResolution in interface MavenWorkingSession
Returns:
MavenDependencys to be resolved as part of the request to the backend; may be a subset of MavenWorkingSession.getDeclaredDependencies() after pre-request filtering has been done

getDeclaredDependencies

public Set<MavenDependency> getDeclaredDependencies()
Metadata for all defined elements

Specified by:
getDeclaredDependencies in interface MavenWorkingSession
Returns:
See Also:
MavenWorkingSession.getDeclaredDependencies()

execute

public MavenWorkingSession execute(org.apache.maven.model.building.ModelBuildingRequest request)
                            throws org.jboss.shrinkwrap.resolver.api.InvalidConfigurationFileException
Description copied from interface: MavenWorkingSession
Loads an effective POM file and updates session settings accordingly.

Specified by:
execute in interface MavenWorkingSession
Parameters:
request - Request to load the effective POM file
Returns:
Modified session instance
Throws:
org.jboss.shrinkwrap.resolver.api.InvalidConfigurationFileException

execute

public MavenWorkingSession execute(org.apache.maven.settings.building.SettingsBuildingRequest request)
                            throws org.jboss.shrinkwrap.resolver.api.InvalidConfigurationFileException
Description copied from interface: MavenWorkingSession
Loads Maven configuration and updates session settings accordingly.

Specified by:
execute in interface MavenWorkingSession
Parameters:
request - Request to load settings.xml file
Returns:
Modified session instance
Throws:
org.jboss.shrinkwrap.resolver.api.InvalidConfigurationFileException

execute

public Collection<org.sonatype.aether.resolution.ArtifactResult> execute(org.sonatype.aether.collection.CollectRequest request,
                                                                         MavenResolutionFilter[] filters)
                                                                  throws org.sonatype.aether.resolution.DependencyResolutionException

Specified by:
execute in interface MavenWorkingSession
Throws:
org.sonatype.aether.resolution.DependencyResolutionException
See Also:
MavenWorkingSession.execute(org.sonatype.aether.collection.CollectRequest, org.jboss.shrinkwrap.resolver.api.maven.filter.MavenResolutionFilter[])

goOffline

public MavenWorkingSession goOffline(boolean value)

getRemoteRepositories

public List<org.sonatype.aether.repository.RemoteRepository> getRemoteRepositories()
                                                                            throws IllegalStateException
Description copied from interface: MavenWorkingSession
Returns a list of remote repositories enabled from Maven settings. If an effective pom was loaded, and it actually contains any repositories, these are added as well.

Specified by:
getRemoteRepositories in interface MavenWorkingSession
Returns:
List of currently active repositories
Throws:
IllegalStateException - If currently active repositories cannot be resolved

getModel

public org.apache.maven.model.Model getModel()
Description copied from interface: MavenWorkingSession
Returns underlying Maven model for parsed POM file. This is useful when you need to extract additional information from the model.

Specified by:
getModel in interface MavenWorkingSession
Returns:
Maven model for parsed POM file.

regenerateSession

public MavenWorkingSession regenerateSession()
Description copied from interface: MavenWorkingSession
Refreshes underlying Aether session in order to contain newly acquired information, such as new settings.xml content

Specified by:
regenerateSession in interface MavenWorkingSession
Returns:
Modified session instance

getSettingsDefinedProfiles

public List<org.apache.maven.model.Profile> getSettingsDefinedProfiles()
Description copied from interface: MavenWorkingSession
Gets a list of profiles defined in settings.xml.

Specified by:
getSettingsDefinedProfiles in interface MavenWorkingSession
Returns:
List of defined profiles

getArtifactTypeRegistry

public org.sonatype.aether.artifact.ArtifactTypeRegistry getArtifactTypeRegistry()
Description copied from interface: MavenWorkingSession
Gets registry of the known artifact types based on underlying session

Specified by:
getArtifactTypeRegistry in interface MavenWorkingSession
Returns:
the registry

setOffline

public void setOffline(boolean offline)
Description copied from interface: MavenWorkingSession
Whether or not to set this session in "offline" mode

Specified by:
setOffline in interface MavenWorkingSession

disableClassPathWorkspaceReader

public void disableClassPathWorkspaceReader()
Disables the classpath workspace reader which may be used to resolve from dependencies on the ClassPath

Specified by:
disableClassPathWorkspaceReader in interface MavenWorkingSession
See Also:
MavenWorkingSession.disableClassPathWorkspaceReader()

disableMavenCentral

public void disableMavenCentral()
Disables use of the Maven Central Repository

Specified by:
disableMavenCentral in interface MavenWorkingSession
See Also:
MavenWorkingSession.disableMavenCentral()

ShrinkWrap Resolver Maven Implementation 2.0.0-alpha-3

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.