public class JoSQLAntFileSelector extends Query
See: Custom Ant Selectors for more details.
Allows a JoSQL WHERE clause
to be applied to each file passed to the selector isSelected(File,String,File)
.
An obvious question to ask here is "why do I need this when Ant has lots of custom file selectors". Well, in short, you don't "need" this selector, but I've found that trying to remember all the custom elements and their attributes can be painful and doesn't give me all the power needed to select the files I want. This custom selector however does.
The selector supports the following "param"s.
isSelected(File,String,File)
what the
WHERE clause evaluated to, either true
or false
.Usage:
A typical usage may be:
<fileset dir="myDir" includes="**"> <custom classpath="[PATH_TO_JOSQL]/JoSQL-1.0.jar:[PATH_TO_JOSQL]/3rd-party-jars/gentlyWEB-utils-1.1.jar" classname="org.josql.contrib.JoSQLAntFileSelector"> <param name="debug" value="on" /> <param name="where" value="toDate (lastModified) > toDate ('22/Sep/2005')" /> <param name="where" value="AND length > 10000" /> </custom> </fileset>
This will create a file set containing all the files modified after 22/Sep/2005 and have a length greater than 10000 bytes.
Compare this to how it would be "normally" be done with standard Ant fileset selectors:
<fileset dir="myDir" includes="**"> <date datetime="22/Sep/2005" pattern="dd/MMM/yyyy" when="after" /> <size value="10000" when="more" /> </fileset>
Of course it is perfectly possible to mix and match this selector and other custom selectors or the built-in selectors.
Modifier and Type | Field and Description |
---|---|
static String |
DEBUG |
static String |
WHERE |
ALL, ALL_OBJS_VAR_NAME, CURR_OBJ_VAR_NAME, GROUP_BY_RESULTS, GRPBY_OBJ_VAR_NAME, GRPBY_OBJ_VAR_NAME_SYNONYM, HAVING_RESULTS, INT_BIND_VAR_PREFIX, nullQueryList, ORDER_BY_ASC, ORDER_BY_DESC, PARENT_BIND_VAR_NAME, QUERY_BIND_VAR_NAME, RESULTS, WHERE_RESULTS
Constructor and Description |
---|
JoSQLAntFileSelector() |
Modifier and Type | Method and Description |
---|---|
boolean |
isSelected(File basedir,
String filename,
File file) |
void |
setParameters(Parameter[] parms) |
addBindVariableChangedListener, addFunctionHandler, addSaveValueChangedListener, addTiming, doExecuteOn, execute, execute, execute, fireBindVariableChangedEvent, fireSaveValueChangedEvent, getAliases, getAllObjects, getAnonymousBindVariableName, getClassLoader, getColumns, getCurrentObject, getDefaultFunctionHandlers, getExecuteOnFunctions, getFrom, getFromObjectClass, getFunctionHandler, getFunctionHandlers, getGroupByColumns, getGroupBySaveValue, getGroupBySaveValues, getGroupByVariable, getHavingClause, getLimit, getObjectComparator, getOrderByColumns, getOrderByComparator, getParent, getQuery, getQueryResults, getSaveValue, getTopLevelQuery, getVariable, getVariable, getVariableClass, getVariables, getWhereClause, getWildcardCharacter, init, initOrderByComparator, isWantObjects, isWhereTrue, loadClass, parse, parseAndExec, parsed, removeBindVariableChangedListener, removeSaveValueChangedListener, reorder, reorder, setAllObjects, setClassLoader, setClassName, setColumns, setCurrentGroupByObjects, setCurrentObject, setExecuteOnFunctions, setFrom, setFromObjectClass, setGroupByColumns, setGroupByLimit, setGroupByOrderColumns, setHaving, setLimit, setObjectComparator, setOrderByColumns, setParent, setSaveValue, setSaveValues, setVariable, setVariable, setVariables, setWantDistinctResults, setWantObjects, setWantTimings, setWhere, setWildcardCharacter, toString
public static final String WHERE
public static final String DEBUG