public class ArtifactStubFactory
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private org.codehaus.plexus.archiver.manager.ArchiverManager |
archiverManager |
private boolean |
createFiles |
private boolean |
createUnpackableFile |
private java.io.File |
srcFile |
private java.io.File |
workingDir |
Constructor and Description |
---|
ArtifactStubFactory()
Default constructor.
|
ArtifactStubFactory(java.io.File workingDir,
boolean createFiles)
This constructor is to be used if files are needed and to set a working dir
|
Modifier and Type | Method and Description |
---|---|
org.apache.maven.artifact.Artifact |
createArtifact(java.lang.String groupId,
java.lang.String artifactId,
java.lang.String version) |
org.apache.maven.artifact.Artifact |
createArtifact(java.lang.String groupId,
java.lang.String artifactId,
java.lang.String version,
java.lang.String scope) |
org.apache.maven.artifact.Artifact |
createArtifact(java.lang.String groupId,
java.lang.String artifactId,
java.lang.String version,
java.lang.String scope,
java.lang.String type,
java.lang.String classifier) |
org.apache.maven.artifact.Artifact |
createArtifact(java.lang.String groupId,
java.lang.String artifactId,
org.apache.maven.artifact.versioning.VersionRange versionRange,
java.lang.String scope,
java.lang.String type,
java.lang.String classifier,
boolean optional) |
void |
createUnpackableFile(org.apache.maven.artifact.Artifact artifact,
java.io.File destFile) |
java.util.Set<org.apache.maven.artifact.Artifact> |
getArtifactArtifacts() |
java.util.Set<org.apache.maven.artifact.Artifact> |
getClassifiedArtifacts() |
static java.lang.String |
getFormattedFileName(org.apache.maven.artifact.Artifact artifact,
boolean removeVersion)
Builds the file name.
|
java.util.Set<org.apache.maven.artifact.Artifact> |
getGroupIdArtifacts() |
java.util.Set<org.apache.maven.artifact.Artifact> |
getMixedArtifacts() |
java.util.Set<org.apache.maven.artifact.Artifact> |
getReleaseAndSnapshotArtifacts() |
org.apache.maven.artifact.Artifact |
getReleaseArtifact() |
java.util.Set<org.apache.maven.artifact.Artifact> |
getScopedArtifacts() |
org.apache.maven.artifact.Artifact |
getSnapshotArtifact() |
java.io.File |
getSrcFile() |
java.util.Set<org.apache.maven.artifact.Artifact> |
getTypedArchiveArtifacts() |
java.util.Set<org.apache.maven.artifact.Artifact> |
getTypedArtifacts() |
static java.lang.String |
getUnpackableFileName(org.apache.maven.artifact.Artifact artifact) |
java.io.File |
getWorkingDir() |
boolean |
isCreateFiles() |
void |
setArtifactFile(org.apache.maven.artifact.Artifact artifact,
java.io.File workingDir)
Creates a new empty file and attaches it to the artifact.
|
void |
setArtifactFile(org.apache.maven.artifact.Artifact artifact,
java.io.File workingDir,
java.io.File srcFile)
Copyies the srcFile to the workingDir and then attaches it to the artifact.
|
private void |
setArtifactFile(org.apache.maven.artifact.Artifact artifact,
java.io.File workingDir,
java.io.File srcFile,
boolean createUnpackableFile)
Creates a file that can be copied or unpacked based on the passed in artifact
|
void |
setCreateFiles(boolean createFiles) |
void |
setSrcFile(java.io.File srcFile) |
void |
setUnpackableArtifactFile(org.apache.maven.artifact.Artifact artifact,
java.io.File workingDir)
Creates an unpackable file (zip,jar etc) containing an empty file.
|
void |
setUnpackableArtifactFile(org.apache.maven.artifact.Artifact artifact,
java.io.File workingDir,
java.io.File srcFile)
Creates an unpackable file (zip,jar etc) containing the srcFile.
|
void |
setUnpackableFile(org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager)
If set, the file will be created as a zip/jar/war with a file inside that can be checked to exist after
unpacking.
|
static void |
setVariableValueToObject(java.lang.Object object,
java.lang.String variable,
java.lang.Object value)
Convenience method to set values to variables in objects that don't have setters
|
void |
setWorkingDir(java.io.File workingDir) |
private java.io.File workingDir
private boolean createFiles
private java.io.File srcFile
private boolean createUnpackableFile
private org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager
public ArtifactStubFactory()
public ArtifactStubFactory(java.io.File workingDir, boolean createFiles)
workingDir
- createFiles
- public void setUnpackableFile(org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager)
archiverManager
- public org.apache.maven.artifact.Artifact createArtifact(java.lang.String groupId, java.lang.String artifactId, java.lang.String version) throws java.io.IOException
groupId
- artifactId
- version
- DefaultArtifact
instance for the given parametersjava.io.IOException
- if anycreateArtifact(String, String, String, String, String, String)
public org.apache.maven.artifact.Artifact createArtifact(java.lang.String groupId, java.lang.String artifactId, java.lang.String version, java.lang.String scope) throws java.io.IOException
groupId
- artifactId
- version
- scope
- DefaultArtifact
instance for the given parametersjava.io.IOException
- if anycreateArtifact(String, String, String, String, String, String)
public org.apache.maven.artifact.Artifact createArtifact(java.lang.String groupId, java.lang.String artifactId, java.lang.String version, java.lang.String scope, java.lang.String type, java.lang.String classifier) throws java.io.IOException
groupId
- artifactId
- version
- scope
- type
- classifier
- DefaultArtifact
instance for the given parametersjava.io.IOException
- if anycreateArtifact(String, String, VersionRange, String, String, String, boolean)
public org.apache.maven.artifact.Artifact createArtifact(java.lang.String groupId, java.lang.String artifactId, org.apache.maven.artifact.versioning.VersionRange versionRange, java.lang.String scope, java.lang.String type, java.lang.String classifier, boolean optional) throws java.io.IOException
groupId
- not nullartifactId
- not nullversionRange
- not nullscope
- not nulltype
- not nullclassifier
- optional
- not nullDefaultArtifact
instancejava.io.IOException
- if anypublic void setArtifactFile(org.apache.maven.artifact.Artifact artifact, java.io.File workingDir) throws java.io.IOException
artifact
- to attach the file to.workingDir
- where to locate the new filejava.io.IOException
public void setArtifactFile(org.apache.maven.artifact.Artifact artifact, java.io.File workingDir, java.io.File srcFile) throws java.io.IOException
artifact
- to attachworkingDir
- where to copy the srcFile.srcFile
- file to be attached.java.io.IOException
public void setUnpackableArtifactFile(org.apache.maven.artifact.Artifact artifact, java.io.File workingDir) throws java.io.IOException
artifact
- to attachworkingDir
- where to create the file.java.io.IOException
public void setUnpackableArtifactFile(org.apache.maven.artifact.Artifact artifact, java.io.File workingDir, java.io.File srcFile) throws java.io.IOException
artifact
- to attachworkingDir
- where to create the file.srcFile
- java.io.IOException
- if anyprivate void setArtifactFile(org.apache.maven.artifact.Artifact artifact, java.io.File workingDir, java.io.File srcFile, boolean createUnpackableFile) throws java.io.IOException
artifact
- workingDir
- srcFile
- createUnpackableFile
- java.io.IOException
- if anypublic static java.lang.String getUnpackableFileName(org.apache.maven.artifact.Artifact artifact)
artifact
- public void createUnpackableFile(org.apache.maven.artifact.Artifact artifact, java.io.File destFile) throws org.codehaus.plexus.archiver.manager.NoSuchArchiverException, org.codehaus.plexus.archiver.ArchiverException, java.io.IOException
artifact
- destFile
- org.codehaus.plexus.archiver.manager.NoSuchArchiverException
org.codehaus.plexus.archiver.ArchiverException
- if anyjava.io.IOException
- if anypublic org.apache.maven.artifact.Artifact getReleaseArtifact() throws java.io.IOException
DefaultArtifact
instance for testGroupId:release:jar:1.0
java.io.IOException
- if anypublic org.apache.maven.artifact.Artifact getSnapshotArtifact() throws java.io.IOException
DefaultArtifact
instance for testGroupId:snapshot:jar:2.0-SNAPSHOT
java.io.IOException
- if anypublic java.util.Set<org.apache.maven.artifact.Artifact> getReleaseAndSnapshotArtifacts() throws java.io.IOException
DefaultArtifact
, i.e.:
testGroupId:snapshot:jar:2.0-SNAPSHOT, testGroupId:release:jar:1.0
java.io.IOException
- if anygetReleaseArtifact()
,
getSnapshotArtifact()
public java.util.Set<org.apache.maven.artifact.Artifact> getScopedArtifacts() throws java.io.IOException
DefaultArtifact
, i.e.:
g:provided:jar:1.0, g:compile:jar:1.0, g:system:jar:1.0, g:test:jar:1.0, g:runtime:jar:1.0
java.io.IOException
- if anypublic java.util.Set<org.apache.maven.artifact.Artifact> getTypedArtifacts() throws java.io.IOException
DefaultArtifact
, i.e.:
g:d:zip:1.0, g:a:war:1.0, g:b:jar:1.0, g:c:sources:1.0, g:e:rar:1.0
java.io.IOException
- if anypublic java.util.Set<org.apache.maven.artifact.Artifact> getClassifiedArtifacts() throws java.io.IOException
DefaultArtifact
, i.e.:
g:c:jar:three:1.0, g:b:jar:two:1.0, g:d:jar:four:1.0, g:a:jar:one:1.0
java.io.IOException
- if anypublic java.util.Set<org.apache.maven.artifact.Artifact> getTypedArchiveArtifacts() throws java.io.IOException
DefaultArtifact
, i.e.:
g:d:zip:1.0, g:a:war:1.0, g:b:jar:1.0, g:e:rar:1.0
java.io.IOException
- if anypublic java.util.Set<org.apache.maven.artifact.Artifact> getArtifactArtifacts() throws java.io.IOException
DefaultArtifact
, i.e.:
g:one:jar:a:1.0, g:two:jar:a:1.0, g:four:jar:a:1.0, g:three:jar:a:1.0
java.io.IOException
- if anypublic java.util.Set<org.apache.maven.artifact.Artifact> getGroupIdArtifacts() throws java.io.IOException
DefaultArtifact
, i.e.:
one:group-one:jar:a:1.0, three:group-three:jar:a:1.0, four:group-four:jar:a:1.0,
two:group-two:jar:a:1.0
java.io.IOException
- if anypublic java.util.Set<org.apache.maven.artifact.Artifact> getMixedArtifacts() throws java.io.IOException
DefaultArtifact
java.io.IOException
- if anygetTypedArtifacts()
,
getScopedArtifacts()
,
getReleaseAndSnapshotArtifacts()
public boolean isCreateFiles()
public void setCreateFiles(boolean createFiles)
createFiles
- The createFiles to set.public java.io.File getWorkingDir()
public void setWorkingDir(java.io.File workingDir)
workingDir
- The workingDir to set.public java.io.File getSrcFile()
public void setSrcFile(java.io.File srcFile)
srcFile
- The srcFile to set.public static void setVariableValueToObject(java.lang.Object object, java.lang.String variable, java.lang.Object value) throws java.lang.IllegalAccessException
object
- variable
- value
- java.lang.IllegalAccessException
public static java.lang.String getFormattedFileName(org.apache.maven.artifact.Artifact artifact, boolean removeVersion)
artifact
- File to be formatted.removeVersion
- Specifies if the version should be removed from the file name.