Package Torello.Java.Build
Class JarInclude
- java.lang.Object
-
- Torello.Java.Build.JarInclude
-
public class JarInclude extends java.lang.Object
Hi-Lited Source-Code:- View Here: Torello/Java/Build/JarInclude.java
- Open New Browser-Tab: Torello/Java/Build/JarInclude.java
File Size: 8,068 Bytes Line Count: 184 '\n' Characters Found
-
-
Constructor Summary
Constructors Constructor Description JarInclude()
Build an instance of this class
-
Method Summary
Request that a Directory or Directory-Tree be added to the '.jar' Modifier and Type Method JarInclude
add(String workingDirectory, String subDirectory, boolean traverseTree, FileNodeFilter fileFilter, FileNodeFilter dirFilter)
JarInclude
add(String workingDirectory, String subDirectory, FileNodeFilter fileFilter)
-
-
-
Constructor Detail
-
JarInclude
public JarInclude()
Build an instance of this class
-
-
Method Detail
-
add
public JarInclude add(java.lang.String workingDirectory, java.lang.String subDirectory, FileNodeFilter fileFilter)
Convenience Method
Adds a Jar-Include Directive that DOES NOT recurse the directory-tree
Invokes:add(String, String, boolean, FileNodeFilter, FileNodeFilter)
-
add
public JarInclude add(java.lang.String workingDirectory, java.lang.String subDirectory, boolean traverseTree, FileNodeFilter fileFilter, FileNodeFilter dirFilter)
Inserts a request for files to be included in the Tar-Jar Build Stage (Stage 4).- Parameters:
workingDirectory
- When files are added to a'.jar'
-File, the "Working Directory" part of the File-System Path is not included in the name of the files that are inserted.subDirectory
- The "Sub-Directory" part of the File-System Path is included into the names of any and all files that are inserted in the'.jar'
.traverseTree
- Indicates whether the theString
-Parameter'subDirectory'
should be interpreted as a directory-name - or as an entire tree branch whose own sub-directories should be traversed by the file-scanner.fileFilter
- A filter / "chooser" / specifier for deciding which files residing on the File-System inside'subDirectory'
(or'subDirectory'
, and its own sub-directories - in the case that'traverseTree'
was passedTRUE
), are to be included in the'.jar'
.
This filter must returnTRUE
if a file this filter is testing should be inserted into the'.jar'
, andFALSE
, if the file should not be.
This parameter may be passed null, and if it is it will be quietly ignored. When this filter is null, all files that reside within'subDirectory'
will be inserted into the'.jar'
-File.
If this parameter were passed null, and'traverseTree'
were passedTRUE
, then all files inside of'subDirectory'
would be inserted into the'.jar'
- and furthermore, all files in all sub-directories of'subDirectory'
would also be inserted.dirFilter
- This filter can only be employed if'traverseTree'
has been passedTRUE
.
When'traverseTree'
isTRUE
as the directory tree rooted atworkingDirectory/subDirectory/
is traversed, each sub-directory that is encountered will be passed to this filter. When this test is performed, the filter should returnTRUE
to indicate that it would like a particular sub-directory searched, andFALSE
to indicate that it must be skipped.
This parameter may be passed null, and if it is it will be silently ignored. If this parameter is null, and'traverseTree'
isTRUE
, all sub-directories ofworkingDirectory/subDirectory/
will be entered / traversed.
NOTE: If this parameter is passed a non-null filter, but'traverseTree'
has been passedFALSE
, then anIllegalArgumentException
will throw. Parameter'dirFilter'
has no use or application if the named directory-tree is not going to be traversed!- Returns:
'this'
instance, for convenience and invocation-chaining.- Throws:
java.lang.NullPointerException
- If either'workingDirectory'
or'subDirectory'
is passed null.java.lang.IllegalArgumentException
- If either'workingDirectory'
or'subDirectory'
do not name real directories that actually exist on the File-System.
This exception will also throw if'traverseTree'
is passedFALSE
but'dirFilter'
is non-null.- Code:
- Exact Method Body:
File f; Objects.requireNonNull(workingDirectory, M1 + "workingDirectory" + M2); Objects.requireNonNull(subDirectory, M1 + "subDirectory" + M2); if (workingDirectory.length() > 0) { f = new File(workingDirectory); if (! f.exists()) throw new IllegalArgumentException( "The directory-name provided to parameter 'workingDirectory' does not exist on " + "the File-System:\n[" + workingDirectory + ']' ); if (! f.isDirectory()) throw new IllegalArgumentException( "The directory-name provided to parameter 'workingDirectory' is not the name of " + "an actual File-System directory:\n[" + workingDirectory + ']' ); } if (! workingDirectory.endsWith(File.separator)) if (workingDirectory.length() > 0) workingDirectory = workingDirectory + File.separator; String subDir = workingDirectory + subDirectory; if (subDir.length() > 0) { f = new File(subDir); if ((! f.exists()) || (! f.isDirectory())) throw new IllegalArgumentException( "The directory-name provided to parameter 'subDirectory' does not exist on the " + "File-System as a Sub-Directory of 'workingDirectory':\n" + "[" + subDirectory + ']' ); } if (! subDirectory.endsWith(File.separator)) if (subDirectory.length() > 0) subDirectory = subDirectory + File.separator; if ((! traverseTree) && (dirFilter != null)) throw new IllegalArgumentException( "You have passed FALSE to 'traverseTree', but a non-null filter to parameter " + "'dirFilter'. This is not allowed." ); this.descriptors.add (new Descriptor(workingDirectory, subDirectory, traverseTree, fileFilter, dirFilter)); return this;
-
-