Class JobEntryZipFile
- java.lang.Object
-
- org.pentaho.di.job.entry.JobEntryBase
-
- org.pentaho.di.job.entries.zipfile.JobEntryZipFile
-
- All Implemented Interfaces:
Cloneable,org.pentaho.di.core.AttributesInterface,org.pentaho.di.core.CheckResultSourceInterface,org.pentaho.di.core.ExtensionDataInterface,org.pentaho.di.core.logging.LoggingObjectInterface,org.pentaho.di.core.logging.LoggingObjectLifecycleInterface,org.pentaho.di.core.variables.VariableSpace,JobEntryInterface,ResourceHolderInterface
public class JobEntryZipFile extends JobEntryBase implements Cloneable, JobEntryInterface
This defines a 'zip file' job entry. Its main use would be to zip files in a directory and process zipped files (deleted or move).- Since:
- 27-02-2007
- Author:
- Samatar Hassan
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJobEntryZipFile.ZipJobEntryPatternFileSelectorHelper class providing pattern restrictions for file names to be zipped
-
Field Summary
Fields Modifier and Type Field Description intafterZipintcompressionRateintifZipFileExists-
Fields inherited from class org.pentaho.di.job.entry.JobEntryBase
attributesMap, containerObjectId, entryStepSetVariablesMap, extensionDataMap, log, metaStore, parentJob, parentJobMeta, rep, variables
-
-
Constructor Summary
Constructors Constructor Description JobEntryZipFile()JobEntryZipFile(String n)Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheck(List<org.pentaho.di.core.CheckResultInterface> remarks, JobMeta jobMeta, org.pentaho.di.core.variables.VariableSpace space, Repository repository, org.pentaho.metastore.api.IMetaStore metaStore)Allows JobEntry objects to check themselves for consistencyObjectclone()This method is called when a job entry is duplicated in Spoon.booleanevaluates()This method must return true if the job entry supports the true/false outgoing hops.org.pentaho.di.core.Resultexecute(org.pentaho.di.core.Result previousResult, int nr)Execute the job entry.booleangetcreateparentfolder()booleangetDatafromprevious()StringgetDateTimeFormat()StringgetFullFilename(String filename, boolean addDate, boolean addTime, boolean specifyFormat, String datetimeFormat)StringgetMoveToDirectory()StringgetSourceDirectory()StringgetStoredSourcePathDepth()StringgetWildcard()StringgetWildcardExclude()StringgetXML()This method is called by PDI whenever a job entry needs to serialize its settings to XML.StringgetZipFilename()booleanisAddFileToResult()booleanisCreateMoveToDirectory()booleanisDateInFilename()booleanisIncludingSubFolders()booleanisSpecifyFormat()booleanisTimeInFilename()voidloadRep(Repository rep, org.pentaho.metastore.api.IMetaStore metaStore, org.pentaho.di.repository.ObjectId id_jobentry, List<org.pentaho.di.core.database.DatabaseMeta> databases, List<SlaveServer> slaveServers)This method is called by PDI whenever a job entry needs to read its configuration from a PDI repository.voidloadXML(Node entrynode, List<org.pentaho.di.core.database.DatabaseMeta> databases, List<SlaveServer> slaveServers, Repository rep, org.pentaho.metastore.api.IMetaStore metaStore)This method is called by PDI whenever a job entry needs to read its settings from XML.booleanmoveFilesToDestinationFolder(org.apache.commons.vfs2.FileObject sourceFileOrFolder, org.apache.commons.vfs2.FileObject fileObjectd, String realMovetodirectory, boolean isSourceDirectory, org.apache.commons.vfs2.FileObject zippedFile)booleanprocessRowFile(Job parentJob, org.pentaho.di.core.Result result, String realZipfilename, String realWildcard, String realWildcardExclude, String realSourceDirectoryOrFile, String realMovetodirectory, boolean createparentfolder)voidsaveRep(Repository rep, org.pentaho.metastore.api.IMetaStore metaStore, org.pentaho.di.repository.ObjectId id_job)This method is called by PDI whenever a job entry needs to save its settings to a PDI repository.voidsetAddFileToResult(boolean addfiletoresultin)voidsetCreateMoveToDirectory(boolean createMoveToDirectory)voidsetcreateparentfolder(boolean createparentfolder)voidsetDatafromprevious(boolean isfromprevious)voidsetDateInFilename(boolean adddate)voidsetDateTimeFormat(String date_time_format)voidsetIncludingSubFolders(boolean includesSubFolders)voidsetMoveToDirectory(String movetodirectory)voidsetSourceDirectory(String sourcedirectory)voidsetSpecifyFormat(boolean SpecifyFormat)voidsetStoredSourcePathDepth(String storedSourcePathDepth)voidsetTimeInFilename(boolean addtime)voidsetWildcard(String wildcard)voidsetWildcardExclude(String wildcardexclude)voidsetZipFilename(String zipFilename)-
Methods inherited from class org.pentaho.di.job.entry.JobEntryBase
addDatetimeToFilename, check, clear, copyVariablesFrom, environmentSubstitute, environmentSubstitute, equals, exportResources, exportResources, fieldSubstitute, getAttribute, getAttributes, getAttributesMap, getBooleanValueOfVariable, getContainerObjectId, getDescription, getDialogClassName, getEntryStepSetVariable, getEntryStepSetVariablesMap, getExtensionDataMap, getFilename, getHolderType, getLogChannel, getLogChannelId, getLogLevel, getMetaStore, getName, getObjectCopy, getObjectId, getObjectName, getObjectRevision, getObjectType, getParent, getParentJob, getParentJobMeta, getParentVariableSpace, getPluginId, getRealFilename, getReferencedObjectDescriptions, getRegistrationDate, getRepository, getRepositoryDirectory, getResourceDependencies, getSQLStatements, getSQLStatements, getSQLStatements, getTypeDesc, getTypeId, getUsedDatabaseConnections, getVariable, getVariable, getVariables, hasChanged, hashCode, hasRepositoryReferences, initializeVariablesFrom, injectVariables, isBasic, isDebug, isDetailed, isDummy, isEvaluation, isForcingSeparateLogging, isFTP, isGatheringMetrics, isHTTP, isJob, isMail, isReferencedObjectEnabled, isRowlevel, isSFTP, isShell, isSpecial, isStart, isTransformation, isUnconditional, listVariables, loadReferencedObject, loadReferencedObject, loadRep, loadXML, loadXML, logBasic, logBasic, logDebug, logDebug, logDetailed, logDetailed, logError, logError, logError, logMinimal, logMinimal, logRowlevel, logRowlevel, lookupRepositoryReferences, parseRepositoryObjects, resetErrorsBeforeExecution, saveRep, setAttribute, setAttributes, setAttributesMap, setChanged, setChanged, setContainerObjectId, setDescription, setEntryStepSetVariable, setForcingSeparateLogging, setGatheringMetrics, setID, setLogLevel, setMetaStore, setName, setObjectId, setParentJob, setParentJobMeta, setParentVariableSpace, setPluginId, setRepository, setTypeId, setVariable, shareVariablesWith, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.pentaho.di.job.entry.JobEntryInterface
check, clear, exportResources, exportResources, getDescription, getDialogClassName, getFilename, getLogChannel, getName, getObjectId, getParentJob, getParentJobMeta, getPluginId, getRealFilename, getReferencedObjectDescriptions, getResourceDependencies, getSQLStatements, getSQLStatements, getSQLStatements, getTypeId, getUsedDatabaseConnections, hasChanged, hasRepositoryReferences, isDummy, isEvaluation, isJob, isMail, isReferencedObjectEnabled, isShell, isSpecial, isStart, isTransformation, isUnconditional, loadReferencedObject, loadReferencedObject, loadRep, loadXML, lookupRepositoryReferences, resetErrorsBeforeExecution, saveRep, setChanged, setChanged, setDescription, setMetaStore, setName, setObjectId, setParentJob, setParentJobMeta, setPluginId, setRepository
-
-
-
-
Constructor Detail
-
JobEntryZipFile
public JobEntryZipFile(String n)
Default constructor.
-
JobEntryZipFile
public JobEntryZipFile()
-
-
Method Detail
-
clone
public Object clone()
Description copied from class:JobEntryBaseThis method is called when a job entry is duplicated in Spoon. It needs to return a deep copy of this job entry object. It is essential that the implementing class creates proper deep copies if the job entry configuration is stored in modifiable objects, such as lists or custom helper objects.- Specified by:
clonein interfaceJobEntryInterface- Overrides:
clonein classJobEntryBase- Returns:
- a clone of the object
-
getXML
public String getXML()
Description copied from class:JobEntryBaseThis method is called by PDI whenever a job entry needs to serialize its settings to XML. It is called when saving a job in Spoon. The method returns an XML string, containing the serialized settings. The string contains a series of XML tags, typically one tag per setting. The helper class org.pentaho.di.core.xml.XMLHandler is typically used to construct the XML string.- Specified by:
getXMLin interfaceJobEntryInterface- Overrides:
getXMLin classJobEntryBase- Returns:
- the xml representation of the job entry
-
loadXML
public void loadXML(Node entrynode, List<org.pentaho.di.core.database.DatabaseMeta> databases, List<SlaveServer> slaveServers, Repository rep, org.pentaho.metastore.api.IMetaStore metaStore) throws org.pentaho.di.core.exception.KettleXMLException
Description copied from interface:JobEntryInterfaceThis method is called by PDI whenever a job entry needs to read its settings from XML. The XML node containing the job entry's settings is passed in as an argument. Again, the helper class org.pentaho.di.core.xml.XMLHandler is typically used to conveniently read the settings from the XML node.- Specified by:
loadXMLin interfaceJobEntryInterface- Overrides:
loadXMLin classJobEntryBase- Parameters:
entrynode- the top-level XML nodedatabases- the list of databasesslaveServers- the list of slave serversrep- the repository objectmetaStore- The metaStore to optionally load from.- Throws:
org.pentaho.di.core.exception.KettleXMLException- if any errors occur during the loading of the XML
-
loadRep
public void loadRep(Repository rep, org.pentaho.metastore.api.IMetaStore metaStore, org.pentaho.di.repository.ObjectId id_jobentry, List<org.pentaho.di.core.database.DatabaseMeta> databases, List<SlaveServer> slaveServers) throws org.pentaho.di.core.exception.KettleException
Description copied from interface:JobEntryInterfaceThis method is called by PDI whenever a job entry needs to read its configuration from a PDI repository. The job entry id given in the arguments should be used as the identifier when using the repository's serialization methods.- Specified by:
loadRepin interfaceJobEntryInterface- Overrides:
loadRepin classJobEntryBase- Parameters:
rep- the repository objectmetaStore- the MetaStore to useid_jobentry- the id of the job entrydatabases- the list of databasesslaveServers- the list of slave servers- Throws:
org.pentaho.di.core.exception.KettleException- if any errors occur during the load
-
saveRep
public void saveRep(Repository rep, org.pentaho.metastore.api.IMetaStore metaStore, org.pentaho.di.repository.ObjectId id_job) throws org.pentaho.di.core.exception.KettleException
Description copied from interface:JobEntryInterfaceThis method is called by PDI whenever a job entry needs to save its settings to a PDI repository. The repository object passed in as the first argument provides a convenient set of methods for serializing job entry settings. When calling repository serialization methods, job id and job entry id are required. The job id is passed in to saveRep() as an argument, and the job entry id can be obtained by a call to getObjectId() inherited from the base class.- Specified by:
saveRepin interfaceJobEntryInterface- Overrides:
saveRepin classJobEntryBase- Parameters:
rep- the repositorymetaStore- the MetaStore to useid_job- the id_job- Throws:
org.pentaho.di.core.exception.KettleException- if any errors occur during the save
-
processRowFile
public boolean processRowFile(Job parentJob, org.pentaho.di.core.Result result, String realZipfilename, String realWildcard, String realWildcardExclude, String realSourceDirectoryOrFile, String realMovetodirectory, boolean createparentfolder)
-
execute
public org.pentaho.di.core.Result execute(org.pentaho.di.core.Result previousResult, int nr)Description copied from interface:JobEntryInterfaceExecute the job entry. The previous result and number of rows are provided to the method for the purpose of chaining job entries, transformations, etc.- Specified by:
executein interfaceJobEntryInterface- Parameters:
previousResult- the previous resultnr- the number of rows- Returns:
- the Result object from execution of this job entry
-
getFullFilename
public String getFullFilename(String filename, boolean addDate, boolean addTime, boolean specifyFormat, String datetimeFormat)
-
evaluates
public boolean evaluates()
Description copied from class:JobEntryBaseThis method must return true if the job entry supports the true/false outgoing hops. For JobEntryBase, this method always returns false- Specified by:
evaluatesin interfaceJobEntryInterface- Overrides:
evaluatesin classJobEntryBase- Returns:
- false
-
setZipFilename
public void setZipFilename(String zipFilename)
-
setWildcard
public void setWildcard(String wildcard)
-
setWildcardExclude
public void setWildcardExclude(String wildcardexclude)
-
setSourceDirectory
public void setSourceDirectory(String sourcedirectory)
-
setMoveToDirectory
public void setMoveToDirectory(String movetodirectory)
-
getSourceDirectory
public String getSourceDirectory()
-
getMoveToDirectory
public String getMoveToDirectory()
-
getZipFilename
public String getZipFilename()
-
isCreateMoveToDirectory
public boolean isCreateMoveToDirectory()
-
setCreateMoveToDirectory
public void setCreateMoveToDirectory(boolean createMoveToDirectory)
-
getWildcard
public String getWildcard()
-
getWildcardExclude
public String getWildcardExclude()
-
setAddFileToResult
public void setAddFileToResult(boolean addfiletoresultin)
-
isAddFileToResult
public boolean isAddFileToResult()
-
setcreateparentfolder
public void setcreateparentfolder(boolean createparentfolder)
-
setDateInFilename
public void setDateInFilename(boolean adddate)
-
isDateInFilename
public boolean isDateInFilename()
-
setTimeInFilename
public void setTimeInFilename(boolean addtime)
-
isTimeInFilename
public boolean isTimeInFilename()
-
isSpecifyFormat
public boolean isSpecifyFormat()
-
setSpecifyFormat
public void setSpecifyFormat(boolean SpecifyFormat)
-
getDateTimeFormat
public String getDateTimeFormat()
-
setDateTimeFormat
public void setDateTimeFormat(String date_time_format)
-
getcreateparentfolder
public boolean getcreateparentfolder()
-
setDatafromprevious
public void setDatafromprevious(boolean isfromprevious)
-
getDatafromprevious
public boolean getDatafromprevious()
-
check
public void check(List<org.pentaho.di.core.CheckResultInterface> remarks, JobMeta jobMeta, org.pentaho.di.core.variables.VariableSpace space, Repository repository, org.pentaho.metastore.api.IMetaStore metaStore)
Description copied from class:JobEntryBaseAllows JobEntry objects to check themselves for consistency- Specified by:
checkin interfaceJobEntryInterface- Overrides:
checkin classJobEntryBase- Parameters:
remarks- List of CheckResult objects indicating consistency statusjobMeta- the metadata object for the job entryspace- the variable space to resolve string expressions with variables withrepository- the repository to load Kettle objects frommetaStore- the MetaStore to load common elements from
-
isIncludingSubFolders
public boolean isIncludingSubFolders()
- Returns:
- true if the search for files to zip in a folder include sub-folders
-
setIncludingSubFolders
public void setIncludingSubFolders(boolean includesSubFolders)
- Parameters:
includesSubFolders- Set to true if the search for files to zip in a folder needs to include sub-folders
-
getStoredSourcePathDepth
public String getStoredSourcePathDepth()
-
setStoredSourcePathDepth
public void setStoredSourcePathDepth(String storedSourcePathDepth)
-
moveFilesToDestinationFolder
public boolean moveFilesToDestinationFolder(org.apache.commons.vfs2.FileObject sourceFileOrFolder, org.apache.commons.vfs2.FileObject fileObjectd, String realMovetodirectory, boolean isSourceDirectory, org.apache.commons.vfs2.FileObject zippedFile)
-
-