Class FileSourceProvider
java.lang.Object
org.apache.torque.generator.source.SourceProvider
org.apache.torque.generator.source.stream.FileSourceProvider
Contains sources which are read from files in the file system.
$Id: FileSourceProvider.java 1917241 2024-04-21 13:29:41Z tv $
-
Constructor Summary
ConstructorsConstructorDescriptionFileSourceProvider(StreamSourceFormat sourceFormat, Fileset sourceFileset, Boolean combineFiles) Constructor. -
Method Summary
Modifier and TypeMethodDescriptioncopy()Returns a copy of this source provider in its initial state.voidcopyNotSetSettingsFrom(SourceProvider sourceProvider) Copies settings which are not set in this source provider from another source provider.Returns whether source files are combined into one source tree.getPaths()Returns all paths in the source Fileset.Returns the fileset which determines the source files to read.Returns the source format for this provider.booleanhasNext()protected voidinitInternal(ConfigurationHandlers configurationHandlers, ControllerState controllerState) Determines the files which match the source fileset.next()voidremove()voidresetInternal(ConfigurationHandlers configurationHandlers, ControllerState controllerState) Resets the sources provided by this SourceProvider.voidsetSourceFileset(Fileset sourceFileset) Sets the fileset which determines the source files to read.toString()Methods inherited from class org.apache.torque.generator.source.SourceProvider
init, isInit, resetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
FileSourceProvider
public FileSourceProvider(StreamSourceFormat sourceFormat, Fileset sourceFileset, Boolean combineFiles) throws ConfigurationException Constructor.- Parameters:
sourceFormat- the source format, or null if the source format should be determined from the file extension.sourceFileset- the fileset defining the source files, not null.combineFiles- whether all files should be combined into one source tree.- Throws:
IllegalArgumentException- if the source type is unknown.NullPointerException- if path is null.ConfigurationException- if the source filter cannot be instantiated.
-
-
Method Details
-
initInternal
protected void initInternal(ConfigurationHandlers configurationHandlers, ControllerState controllerState) throws ConfigurationException Determines the files which match the source fileset.- Specified by:
initInternalin classSourceProvider- Parameters:
configurationHandlers- the configuration handlers, not null.controllerState- the current controller state, not null.- Throws:
ConfigurationException- if the sourceFileset has no basedir or if the files cannot be determined.
-
resetInternal
public void resetInternal(ConfigurationHandlers configurationHandlers, ControllerState controllerState) Description copied from class:SourceProviderResets the sources provided by this SourceProvider.- Specified by:
resetInternalin classSourceProvider- Parameters:
configurationHandlers- the configuration handlers, not null.controllerState- the current controller state, not null.
-
hasNext
public boolean hasNext() -
next
-
remove
public void remove() -
toString
-
getSourceFormat
Returns the source format for this provider.- Returns:
- the source format, or null if the format is determined from file extensions.
-
getSourceFileset
Returns the fileset which determines the source files to read.- Returns:
- the fileset which determines the source files to read.
-
setSourceFileset
Sets the fileset which determines the source files to read.- Parameters:
sourceFileset- the new source fileset, not null.- Throws:
NullPointerException- if sourceFileset is null.IllegalStateException- if init() was called before.
-
getPaths
Returns all paths in the source Fileset. The method init() must be called beforehand.- Returns:
- all Paths in the source fileset, not null.
- Throws:
IllegalStateException- if the init method was not yet called.
-
getCombineFiles
Returns whether source files are combined into one source tree.- Returns:
- true if the source files are combined into one source tree, false otherwise, null to allow overriding this property (but will count as false if not overridden).
-
copy
Returns a copy of this source provider in its initial state. This means theSourceProvider.init(ConfigurationHandlers, ControllerState)method of the new source provider must be called before it can be used.- Specified by:
copyin classSourceProvider- Returns:
- the SourceProvider
- Throws:
ConfigurationException- if the new SourceProvider cannot be initialized.
-
copyNotSetSettingsFrom
Copies settings which are not set in this source provider from another source provider. This only works if the type of the other source provider is known to this source provider. Only a subset of all properties are typically used for overwriting. No Properties which are already set are overwritten.- Specified by:
copyNotSetSettingsFromin classSourceProvider- Parameters:
sourceProvider- the source provoder to copy the settings from.
-