Package org.codehaus.mojo.rpm
Class Mapping
- java.lang.Object
-
- org.codehaus.mojo.rpm.Mapping
-
public class Mapping extends Object
A description of a file or directory to be installed. It includes the properties to be assigned and the location(s) where the file(s) can be found for packaging.
-
-
Constructor Summary
Constructors Constructor Description Mapping()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ArtifactMap
getArtifact()
Retrieve the artifact specification.String
getAttrString(String defaultFileMode, String defaultGrp, String defaultUsr)
Deprecated.UsegetAttrString(String, String, String, String)
instead (additionally includes defaultDirMode)String
getAttrString(String defaultFileMode, String defaultDirMode, String defaultGrp, String defaultUsr)
Assemble the RPM SPEC file attributes for a mapping.String
getConfiguration()
Retrieves the configuration value.Dependency
getDependency()
Retrieve the dependency specification.String
getDerivedDirAttrString(String defaultDirMode, String defaultGrp, String defaultUsr)
Assemble RPM SPEC directory attributes for a mapping.String
getDestination()
Return the destination directory name.String
getDirectory()
Retrieve the destination during package installation.String
getFilemode()
Retrieve the UNIX file permissions.String
getGroupname()
Retrieve the UNIX group name to own the installed files.List<Source>
getSources()
Retrieve the list of source file specifications.String
getUsername()
Retrieve the UNIX user name to own the installed files.boolean
isDirectoryIncluded()
Returns if thegetDirectory()
should be used for theattribute string
(if and only ifsources
make up everything that gets copied to the directory).
By default, this returnstrue
.boolean
isDirOnly()
Return directory-only status.boolean
isDocumentation()
Retrieve the documentation status.boolean
isRecurseDirectories()
Indicates if sub-directories contained in thegetSources()
should be explicitly listed in%files
.boolean
isSoftLinkOnly()
Return directory-only status.boolean
isSourceDirsOnly()
Return source with directories only status.void
setArtifact(ArtifactMap am)
Set the artifact specification.void
setConfiguration(String cfg)
Set the configuration status.void
setDependency(Dependency am)
Set the dependency specification.void
setDirectory(String dir)
Set the destination during package installation.void
setDirectoryIncluded(boolean directoryIncluded)
Sets if thegetDirectory()
should be used for theattribute string
(if and only ifsources
make up everything that gets copied to the directory).
By default, this istrue
.void
setDocumentation(boolean isDoc)
Set the documentation status.void
setFilemode(String fmode)
Set the UNIX file permissions.void
setGroupname(String grpname)
Set the UNIX group name to own the installed files.void
setRecurseDirectories(boolean recurseDirectories)
Indicates if sub-directories contained in thegetSources()
should be explicitly listed in%files
.void
setSources(List<Source> srclist)
Set the list of source file specifications.void
setUsername(String uname)
Set the UNIX user name to own the installed files.String
toString()
-
-
-
Method Detail
-
getDirectory
public String getDirectory()
Retrieve the destination during package installation.- Returns:
- The destination during package installation.
-
setDirectory
public void setDirectory(String dir)
Set the destination during package installation.- Parameters:
dir
- The new destination during package installation.
-
isDirectoryIncluded
public boolean isDirectoryIncluded()
Returns if thegetDirectory()
should be used for theattribute string
(if and only ifsources
make up everything that gets copied to the directory).
By default, this returnstrue
.- Returns:
- Whether the
getDirectory()
should be used for theattribute string
.
-
setDirectoryIncluded
public void setDirectoryIncluded(boolean directoryIncluded)
Sets if thegetDirectory()
should be used for theattribute string
(if and only ifsources
make up everything that gets copied to the directory).
By default, this istrue
.- Parameters:
directoryIncluded
- ThedirectoryIncluded
to set.
-
getConfiguration
public String getConfiguration()
Retrieves the configuration value. This may be just a string representation ofgetConfiguration()
. However, modifications to the %config declaration (such as noreplace) are allowed.- Returns:
- The configuration value.
-
setConfiguration
public void setConfiguration(String cfg)
Set the configuration status. This value istrue
if the file(s) in this mapping are configuration files. Any value other thantrue
orfalse
will be considered a modifier of the %config declaration in the spec file.- Parameters:
cfg
- The new configuration value.
-
isDocumentation
public boolean isDocumentation()
Retrieve the documentation status. This value istrue
if the file(s) in this mapping are documentation files.- Returns:
- The documentation status.
-
setDocumentation
public void setDocumentation(boolean isDoc)
Set the documentation status. This value istrue
if the file(s) in this mapping are documentation files.- Parameters:
isDoc
- The new documentation status.
-
getFilemode
public String getFilemode()
Retrieve the UNIX file permissions. This is a three-digit octal number which specifies the permissions to be applied to each file in the mapping when it is installed.- Returns:
- The UNIX file permissions.
-
setFilemode
public void setFilemode(String fmode)
Set the UNIX file permissions. This is a three-digit octal number which specifies the permissions to be applied to each file in the mapping when it is installed.- Parameters:
fmode
- The new UNIX file permissions.
-
getUsername
public String getUsername()
Retrieve the UNIX user name to own the installed files. Note that this must be a name, not a numeric user ID.- Returns:
- The UNIX user name to own the installed files.
-
setUsername
public void setUsername(String uname)
Set the UNIX user name to own the installed files. Note that this must be a name, not a numeric user ID.- Parameters:
uname
- The new UNIX user name to own the installed files.
-
getGroupname
public String getGroupname()
Retrieve the UNIX group name to own the installed files. Note that this must be a name, not a numeric group ID.- Returns:
- The UNIX group name to own the installed files.
-
setGroupname
public void setGroupname(String grpname)
Set the UNIX group name to own the installed files. Note that this must be a name, not a numeric group ID. Indicates if sub-directories contained in thegetSources()
should be explicitly listed in%files
.- Parameters:
grpname
- The new UNIX group name to own the installed files.
-
getSources
public List<Source> getSources()
Retrieve the list of source file specifications.- Returns:
- The list of source file specifications.
-
setSources
public void setSources(List<Source> srclist)
Set the list of source file specifications.- Parameters:
srclist
- The new list of source file specifications.
-
getArtifact
public ArtifactMap getArtifact()
Retrieve the artifact specification.- Returns:
- The artifact specification.
-
setArtifact
public void setArtifact(ArtifactMap am)
Set the artifact specification.- Parameters:
am
- The new artifact specification.
-
getDependency
public Dependency getDependency()
Retrieve the dependency specification.- Returns:
- The dependency specification.
-
setDependency
public void setDependency(Dependency am)
Set the dependency specification.- Parameters:
am
- The new dependency specification.
-
isRecurseDirectories
public final boolean isRecurseDirectories()
Indicates if sub-directories contained in thegetSources()
should be explicitly listed in%files
. This includes listing thegetDestination()
, ifisDirectoryIncluded()
istrue
.- Returns:
- Returns the
recurseDirectories
. - Since:
- 2.1-alpha-1
-
setRecurseDirectories
public final void setRecurseDirectories(boolean recurseDirectories)
Indicates if sub-directories contained in thegetSources()
should be explicitly listed in%files
. This includes listing thegetDestination()
, ifisDirectoryIncluded()
istrue
.- Parameters:
recurseDirectories
- TherecurseDirectories
to set.- Since:
- 2.1-alpha-1
-
getAttrString
@Deprecated public String getAttrString(String defaultFileMode, String defaultGrp, String defaultUsr)
Deprecated.UsegetAttrString(String, String, String, String)
instead (additionally includes defaultDirMode)Assemble the RPM SPEC file attributes for a mapping.- Parameters:
defaultFileMode
- Default file mode to use if not set for this mapping.defaultGrp
- Default group to use if not set for this mapping.defaultUsr
- Default user to use if not set for this mapping.- Returns:
- The attribute string for the SPEC file.
-
getAttrString
public String getAttrString(String defaultFileMode, String defaultDirMode, String defaultGrp, String defaultUsr)
Assemble the RPM SPEC file attributes for a mapping.- Parameters:
defaultFileMode
- Default file mode to use if not set for this mapping.defaultDirMode
- Default directory mode to use if not set for this mapping.defaultGrp
- Default group to use if not set for this mapping.defaultUsr
- Default user to use if not set for this mapping.- Returns:
- The attribute string for the SPEC file. Includes
%dir
for directory-only entries.
-
getDerivedDirAttrString
public String getDerivedDirAttrString(String defaultDirMode, String defaultGrp, String defaultUsr)
Assemble RPM SPEC directory attributes for a mapping. Used if a mapping results in both directory and file SPEC entries.- Parameters:
defaultDirMode
- Default directory mode if not set for this mapping.defaultGrp
- Default group to use if not set for this mapping.defaultUsr
- Default user to use if not set for this mapping.- Returns:
- The attribute string for the SPEC file. Includes
%dir
-
getDestination
public String getDestination()
Return the destination directory name.- Returns:
- The name of the destination directory.
-
isDirOnly
public boolean isDirOnly()
Return directory-only status.- Returns:
true
if no sources were specified in the mapping
-
isSourceDirsOnly
public boolean isSourceDirsOnly()
Return source with directories only status.- Returns:
true
if no sources were specified in the mapping
-
isSoftLinkOnly
public boolean isSoftLinkOnly()
Return directory-only status.- Returns:
true
if no sources were specified in the mapping
-
-