public class ArtifactStubFactory extends Object
Constructor and Description |
---|
ArtifactStubFactory()
Default constructor.
|
ArtifactStubFactory(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 |
---|---|
Artifact |
createArtifact(String groupId,
String artifactId,
String version) |
Artifact |
createArtifact(String groupId,
String artifactId,
String version,
String scope) |
Artifact |
createArtifact(String groupId,
String artifactId,
String version,
String scope,
String type,
String classifier) |
Artifact |
createArtifact(String groupId,
String artifactId,
VersionRange versionRange,
String scope,
String type,
String classifier,
boolean optional) |
void |
createUnpackableFile(Artifact artifact,
File destFile) |
Set<Artifact> |
getArtifactArtifacts() |
Set<Artifact> |
getClassifiedArtifacts() |
static String |
getFormattedFileName(Artifact artifact,
boolean removeVersion)
Builds the file name.
|
Set<Artifact> |
getGroupIdArtifacts() |
Set<Artifact> |
getMixedArtifacts() |
Set<Artifact> |
getReleaseAndSnapshotArtifacts() |
Artifact |
getReleaseArtifact() |
Set<Artifact> |
getScopedArtifacts() |
Artifact |
getSnapshotArtifact() |
File |
getSrcFile() |
Set<Artifact> |
getTypedArchiveArtifacts() |
Set<Artifact> |
getTypedArtifacts() |
static String |
getUnpackableFileName(Artifact artifact) |
File |
getWorkingDir() |
boolean |
isCreateFiles() |
void |
setArtifactFile(Artifact artifact,
File workingDir)
Creates a new empty file and attaches it to the artifact.
|
void |
setArtifactFile(Artifact artifact,
File workingDir,
File srcFile)
Copyies the srcFile to the workingDir and then attaches it to the artifact.
|
void |
setCreateFiles(boolean createFiles) |
void |
setSrcFile(File srcFile) |
void |
setUnpackableArtifactFile(Artifact artifact,
File workingDir)
Creates an unpackable file (zip,jar etc) containing an empty file.
|
void |
setUnpackableArtifactFile(Artifact artifact,
File workingDir,
File srcFile)
Creates an unpackable file (zip,jar etc) containing the srcFile.
|
void |
setUnpackableFile(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(Object object,
String variable,
Object value)
Convenience method to set values to variables in objects that don't have setters
|
void |
setWorkingDir(File workingDir) |
public ArtifactStubFactory()
public ArtifactStubFactory(File workingDir, boolean createFiles)
workingDir
- createFiles
- public void setUnpackableFile(ArchiverManager archiverManager)
archiverManager
- public Artifact createArtifact(String groupId, String artifactId, String version) throws IOException
groupId
- artifactId
- version
- DefaultArtifact
instance for the given parametersIOException
- if anycreateArtifact(String, String, String, String, String, String)
public Artifact createArtifact(String groupId, String artifactId, String version, String scope) throws IOException
groupId
- artifactId
- version
- scope
- DefaultArtifact
instance for the given parametersIOException
- if anycreateArtifact(String, String, String, String, String, String)
public Artifact createArtifact(String groupId, String artifactId, String version, String scope, String type, String classifier) throws IOException
groupId
- artifactId
- version
- scope
- type
- classifier
- DefaultArtifact
instance for the given parametersIOException
- if anycreateArtifact(String, String, VersionRange, String, String, String, boolean)
public Artifact createArtifact(String groupId, String artifactId, VersionRange versionRange, String scope, String type, String classifier, boolean optional) throws IOException
groupId
- not nullartifactId
- not nullversionRange
- not nullscope
- not nulltype
- not nullclassifier
- optional
- not nullDefaultArtifact
instanceIOException
- if anypublic void setArtifactFile(Artifact artifact, File workingDir) throws IOException
artifact
- to attach the file to.workingDir
- where to locate the new fileIOException
public void setArtifactFile(Artifact artifact, File workingDir, File srcFile) throws IOException
artifact
- to attachworkingDir
- where to copy the srcFile.srcFile
- file to be attached.IOException
public void setUnpackableArtifactFile(Artifact artifact, File workingDir) throws IOException
artifact
- to attachworkingDir
- where to create the file.IOException
public void setUnpackableArtifactFile(Artifact artifact, File workingDir, File srcFile) throws IOException
artifact
- to attachworkingDir
- where to create the file.srcFile
- IOException
- if anypublic static String getUnpackableFileName(Artifact artifact)
artifact
- public void createUnpackableFile(Artifact artifact, File destFile) throws NoSuchArchiverException, ArchiverException, IOException
artifact
- destFile
- NoSuchArchiverException
ArchiverException
- if anyIOException
- if anypublic Artifact getReleaseArtifact() throws IOException
DefaultArtifact
instance for testGroupId:release:jar:1.0
IOException
- if anypublic Artifact getSnapshotArtifact() throws IOException
DefaultArtifact
instance for testGroupId:snapshot:jar:2.0-SNAPSHOT
IOException
- if anypublic Set<Artifact> getReleaseAndSnapshotArtifacts() throws IOException
DefaultArtifact
, i.e.:
testGroupId:snapshot:jar:2.0-SNAPSHOT, testGroupId:release:jar:1.0
IOException
- if anygetReleaseArtifact()
,
getSnapshotArtifact()
public Set<Artifact> getScopedArtifacts() throws 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
IOException
- if anypublic Set<Artifact> getTypedArtifacts() throws 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
IOException
- if anypublic Set<Artifact> getClassifiedArtifacts() throws 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
IOException
- if anypublic Set<Artifact> getTypedArchiveArtifacts() throws IOException
DefaultArtifact
, i.e.:
g:d:zip:1.0, g:a:war:1.0, g:b:jar:1.0, g:e:rar:1.0
IOException
- if anypublic Set<Artifact> getArtifactArtifacts() throws 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
IOException
- if anypublic Set<Artifact> getGroupIdArtifacts() throws 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
IOException
- if anypublic Set<Artifact> getMixedArtifacts() throws IOException
DefaultArtifact
IOException
- if anygetTypedArtifacts()
,
getScopedArtifacts()
,
getReleaseAndSnapshotArtifacts()
public boolean isCreateFiles()
public void setCreateFiles(boolean createFiles)
createFiles
- The createFiles to set.public File getWorkingDir()
public void setWorkingDir(File workingDir)
workingDir
- The workingDir to set.public File getSrcFile()
public void setSrcFile(File srcFile)
srcFile
- The srcFile to set.public static void setVariableValueToObject(Object object, String variable, Object value) throws IllegalAccessException
object
- variable
- value
- IllegalAccessException
public static String getFormattedFileName(Artifact artifact, boolean removeVersion)
artifact
- File to be formatted.removeVersion
- Specifies if the version should be removed from the file name.Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.