Package com.axway.ats.action.objects
Class FilePackage
- java.lang.Object
-
- com.axway.ats.action.objects.FilePackage
-
- All Implemented Interfaces:
Package
public class FilePackage extends Object implements Package
FIXME We should consider re-factoring this piece of code TheFilePackage
class implements thePackage
interface focusing on file operations. In reality aFilePackage
is either a file or a folder on a specific machine.
-
-
Field Summary
Fields Modifier and Type Field Description static Long
ATTRIBUTE_NOT_SUPPORTED
-
Constructor Summary
Constructors Constructor Description FilePackage(String absolutePath)
Constructor.FilePackage(String absolutePath, OperatingSystemType osType)
ConstructorFilePackage(String atsAgent, String absolutePath)
Constructor.FilePackage(String atsAgent, String absolutePath, OperatingSystemType osType)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAbsolutePath()
List<PackageHeader>
getAllHeaders()
List<InputStream>
getAllStreams()
String
getAtsAgent()
String
getDescription()
long
getGid()
String
getGroupName()
Get the name of the group of the entity.String[]
getHeaderValues(String headerName)
String
getMd5sum()
String
getMd5sum(boolean binaryMode)
long
getModTime()
String
getName()
String
getOwnerName()
Get the name of the owner of the entity.long
getPermissions()
long
getSize()
String
getSubject()
String
getTag()
long
getUid()
String
getUniqueIdentifier()
InputStream
getWholePackage()
String[]
grep(String expression, boolean isRegExp)
Returns the line of theFilePackage
containing the specified expression.boolean
isFile()
void
tag()
String
toString()
-
-
-
Field Detail
-
ATTRIBUTE_NOT_SUPPORTED
public static final Long ATTRIBUTE_NOT_SUPPORTED
-
-
Constructor Detail
-
FilePackage
public FilePackage(String absolutePath) throws PackageException
Constructor. Extracts the operation system by itself.- Parameters:
absolutePath
- the absolute path and name of the entity, e.g. /root/file.ext- Throws:
PackageException
-
FilePackage
public FilePackage(String absolutePath, OperatingSystemType osType)
Constructor- Parameters:
absolutePath
- the absolute path and name of the entity, e.g. /root/file.extosType
- the operating system of the machine
-
FilePackage
public FilePackage(String atsAgent, String absolutePath) throws PackageException
Constructor. Extracts the operation system by itself.- Parameters:
atsAgent
- the address of the remote ATS agent where the entity is located onabsolutePath
- the absolute path and name of the entity, e.g. /root/file.ext- Throws:
PackageException
-
FilePackage
public FilePackage(String atsAgent, String absolutePath, OperatingSystemType osType)
Constructor- Parameters:
atsAgent
- the address of the remote ATS agent where the entity is located onabsolutePath
- the absolute path and name of the entity, e.g. /root/file.extosType
- the operating system of the machine
-
-
Method Detail
-
getAllHeaders
public List<PackageHeader> getAllHeaders() throws PackageException
- Specified by:
getAllHeaders
in interfacePackage
- Throws:
PackageException
-
getAllStreams
public List<InputStream> getAllStreams() throws PackageException
- Specified by:
getAllStreams
in interfacePackage
- Throws:
PackageException
-
getDescription
public String getDescription() throws PackageException
- Specified by:
getDescription
in interfacePackage
- Throws:
PackageException
-
getHeaderValues
public String[] getHeaderValues(String headerName) throws PackageException
- Specified by:
getHeaderValues
in interfacePackage
- Throws:
PackageException
-
getSubject
public String getSubject() throws PackageException
- Specified by:
getSubject
in interfacePackage
- Throws:
PackageException
-
getTag
public String getTag() throws ActionException
- Throws:
ActionException
-
getWholePackage
public InputStream getWholePackage() throws PackageException
- Specified by:
getWholePackage
in interfacePackage
- Throws:
PackageException
-
tag
public void tag() throws ActionException
- Throws:
ActionException
-
getName
public String getName()
-
getOwnerName
public String getOwnerName() throws PackageException
Get the name of the owner of the entity.
Note: It returns null on Windows.- Returns:
- Throws:
PackageException
-
getGroupName
public String getGroupName() throws PackageException
Get the name of the group of the entity.
Note: It returns null on Windows.- Returns:
- Throws:
PackageException
-
getGid
public long getGid() throws PackageException
- Throws:
PackageException
-
getUid
public long getUid() throws PackageException
- Throws:
PackageException
-
grep
public String[] grep(String expression, boolean isRegExp) throws PackageException
Returns the line of theFilePackage
containing the specified expression.- Parameters:
expression
- the expression to search forisRegExp
- true if the expression provided is a regular expression- Returns:
- the lines, containing the expression
- Throws:
PackageException
-
isFile
public boolean isFile() throws PackageException
- Returns:
- true if the entity represented by this package is a file and false if the entity is a folder
- Throws:
PackageException
-
getPermissions
public long getPermissions() throws PackageException
- Throws:
PackageException
-
getModTime
public long getModTime() throws PackageException
- Throws:
PackageException
-
getUniqueIdentifier
public String getUniqueIdentifier() throws PackageException
- Throws:
PackageException
-
getSize
public long getSize() throws PackageException
- Throws:
PackageException
-
getMd5sum
public String getMd5sum() throws PackageException
- Throws:
PackageException
-
getMd5sum
public String getMd5sum(boolean binaryMode) throws PackageException
- Throws:
PackageException
-
getAbsolutePath
public String getAbsolutePath()
- Returns:
- the absolute path of the
FilePackage
-
getAtsAgent
public String getAtsAgent()
- Returns:
- the address of the remote ATS agent
-
-