org.freecompany.redline.payload

Class Contents

public class Contents extends Object

The contents of an RPM archive. These entries define the files and links that the RPM contains as well as headers those files require. Note that the RPM format requires that files in the archive be naturally ordered.
Field Summary
protected HashSet<String>files
protected TreeSet<CpioHeader>headers
protected HashMap<CpioHeader,Object>sources
Method Summary
voidaddDirectory(String path)
Adds a directory entry to the archive with the default permissions of 644.
voidaddDirectory(String path, Directive directive)
Adds a directory entry to the archive with the default permissions of 644.
voidaddDirectory(String path, int permissions)
Adds a directory entry to the archive with the specified permissions.
voidaddDirectory(String path, int permissions, Directive directive, String uname, String gname)
Adds a directory entry to the archive with the specified permissions.
voidaddDirectory(String path, int permissions, Directive directive, String uname, String gname, boolean addParents)
Adds a directory entry to the archive with the specified permissions.
voidaddFile(String path, File source)
Adds a file entry to the archive with the default permissions of 644.
voidaddFile(String path, File source, int permissions)
Adds a file entry to the archive with the specified permissions.
voidaddFile(String path, File source, int permissions, Directive directive)
Adds a file entry to the archive with the specified permissions.
voidaddFile(String path, File source, int permissions, Directive directive, String uname, String gname)
Adds a file entry to the archive with the specified permissions.
voidaddLink(String path, String target)
Adds a directory entry to the archive with the default permissions of 644.
voidaddLink(String path, String target, int permissions)
Adds a directory entry to the archive with the specified permissions.
protected voidaddParents(File file, int permissions, String uname, String gname)
Adds entries for parent directories of this file, so that they may be cleaned up when removing the package.
String[]getBaseNames()
int[]getClasses()
int[]getColors()
String[]getContexts()
int[]getDependsN()
int[]getDependsX()
int[]getDevices()
int[]getDirIndexes()
String[]getDirNames()
int[]getFlags()
String[]getGroups()
int[]getInodes()
String[]getLangs()
String[]getLinkTos()
This could be more efficiently handled during the output phase using a filtering channel, but would require placeholder values in the archive and some state.
String[]getMD5s()
Caclulates an MD5 hash for each file in the archive.
short[]getModes()
int[]getMtimes()
short[]getRdevs()
int[]getSizes()
ObjectgetSource(CpioHeader header)
Retrieves the content for this archive entry, which may be a File if the entry is a regular file or a CharSequence containing the name of the target path if the entry is a link.
intgetTotalSize()
Accumulated size of all files included in the archive.
String[]getUsers()
int[]getVerifyFlags()
Iterable<CpioHeader>headers()
Retrieve the archive headers.
intsize()
Retrieve the size of this archive in number of files.

Field Detail

files

protected final HashSet<String> files

headers

protected final TreeSet<CpioHeader> headers

sources

protected final HashMap<CpioHeader,Object> sources

Method Detail

addDirectory

public void addDirectory(String path)
Adds a directory entry to the archive with the default permissions of 644.

Parameters: path the destination path for the installed file.

addDirectory

public void addDirectory(String path, Directive directive)
Adds a directory entry to the archive with the default permissions of 644.

Parameters: path the destination path for the installed file. directive directive indicating special handling for this directory.

addDirectory

public void addDirectory(String path, int permissions)
Adds a directory entry to the archive with the specified permissions.

Parameters: path the destination path for the installed file. permissions the permissions flags.

addDirectory

public void addDirectory(String path, int permissions, Directive directive, String uname, String gname)
Adds a directory entry to the archive with the specified permissions.

Parameters: path the destination path for the installed file. permissions the permissions flags. directive directive indicating special handling for this directory. uname user owner for the given file gname group owner for the given file

addDirectory

public void addDirectory(String path, int permissions, Directive directive, String uname, String gname, boolean addParents)
Adds a directory entry to the archive with the specified permissions.

Parameters: path the destination path for the installed file. permissions the permissions flags. directive directive indicating special handling for this directory. uname user owner for the given file gname group owner for the given file addParents whether to add parent directories to the rpm

addFile

public void addFile(String path, File source)
Adds a file entry to the archive with the default permissions of 644.

Parameters: path the destination path for the installed file. source the local file to be included in the package.

addFile

public void addFile(String path, File source, int permissions)
Adds a file entry to the archive with the specified permissions.

Parameters: path the destination path for the installed file. source the local file to be included in the package. permissions the permissions flags.

addFile

public void addFile(String path, File source, int permissions, Directive directive)
Adds a file entry to the archive with the specified permissions.

Parameters: path the destination path for the installed file. source the local file to be included in the package. permissions the permissions flags. directive directive indicating special handling for this file.

addFile

public void addFile(String path, File source, int permissions, Directive directive, String uname, String gname)
Adds a file entry to the archive with the specified permissions.

Parameters: path the destination path for the installed file. source the local file to be included in the package. permissions the permissions flags. directive directive indicating special handling for this file. uname user owner for the given file gname group owner for the given file

addLink

public void addLink(String path, String target)
Adds a directory entry to the archive with the default permissions of 644.

Parameters: path the destination path for the installed file.

addLink

public void addLink(String path, String target, int permissions)
Adds a directory entry to the archive with the specified permissions.

Parameters: path the destination path for the installed file. permissions the permissions flags.

addParents

protected void addParents(File file, int permissions, String uname, String gname)
Adds entries for parent directories of this file, so that they may be cleaned up when removing the package.

getBaseNames

public String[] getBaseNames()

getClasses

public int[] getClasses()

getColors

public int[] getColors()

getContexts

public String[] getContexts()

getDependsN

public int[] getDependsN()

getDependsX

public int[] getDependsX()

getDevices

public int[] getDevices()

getDirIndexes

public int[] getDirIndexes()

getDirNames

public String[] getDirNames()

getFlags

public int[] getFlags()

getGroups

public String[] getGroups()

getInodes

public int[] getInodes()

getLangs

public String[] getLangs()

getLinkTos

public String[] getLinkTos()
This could be more efficiently handled during the output phase using a filtering channel, but would require placeholder values in the archive and some state. This is left for a later refactoring.

getMD5s

public String[] getMD5s()
Caclulates an MD5 hash for each file in the archive.

getModes

public short[] getModes()

getMtimes

public int[] getMtimes()

getRdevs

public short[] getRdevs()

getSizes

public int[] getSizes()

getSource

public Object getSource(CpioHeader header)
Retrieves the content for this archive entry, which may be a File if the entry is a regular file or a CharSequence containing the name of the target path if the entry is a link. This is the value to be written to the archive as the body of the entry.

getTotalSize

public int getTotalSize()
Accumulated size of all files included in the archive.

getUsers

public String[] getUsers()

getVerifyFlags

public int[] getVerifyFlags()

headers

public Iterable<CpioHeader> headers()
Retrieve the archive headers. The returned Iterable will iterate in the correct order for the final archive.

size

public int size()
Retrieve the size of this archive in number of files. This count includes both directory entries and soft links.