|
|||||||||
| Home >> All >> org >> josql >> [ contrib overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.josql.contrib
Class JoSQLAntFileSelector

java.lang.Objectorg.josql.Query
org.josql.contrib.JoSQLAntFileSelector
- All Implemented Interfaces:
- org.apache.tools.ant.types.selectors.ExtendFileSelector, org.apache.tools.ant.types.selectors.FileSelector, org.apache.tools.ant.types.Parameterizable
- public class JoSQLAntFileSelector
- extends org.josql.Query
- implements org.apache.tools.ant.types.selectors.ExtendFileSelector
- extends org.josql.Query
A custom file selector for use with Ant.
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) 55 .
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.
- where - multiple where params are supported, the value of each param is concatenated with the others to form the full WHERE clause. It is up to you to decide how you split up your where clause.
- debug - when set to on (case-insensitive) debug information about the WHERE clause
actually used and for each file passed to
isSelected(File,String,File)55 what the WHERE clause evaluated to, eithertrueorfalse.
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.
| Field Summary | |
private boolean |
configured
|
private boolean |
debug
|
static java.lang.String |
DEBUG
|
private java.lang.Exception |
parseExp
|
private boolean |
shownWhere
|
private static java.lang.String |
sqlPrefix
|
private java.lang.String |
where
|
static java.lang.String |
WHERE
|
| Fields inherited from class org.josql.Query |
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 Summary | |
JoSQLAntFileSelector()
|
|
| Method Summary | |
boolean |
isSelected(java.io.File basedir,
java.lang.String filename,
java.io.File file)
Method that each selector will implement to create their selection behaviour. |
void |
setParameters(org.apache.tools.ant.types.Parameter[] parms)
Set the parameters |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
sqlPrefix
private static java.lang.String sqlPrefix
WHERE
public static final java.lang.String WHERE
- See Also:
- Constant Field Values
DEBUG
public static final java.lang.String DEBUG
- See Also:
- Constant Field Values
parseExp
private java.lang.Exception parseExp
configured
private boolean configured
where
private java.lang.String where
debug
private boolean debug
shownWhere
private boolean shownWhere
| Constructor Detail |
JoSQLAntFileSelector
public JoSQLAntFileSelector()
| Method Detail |
setParameters
public void setParameters(org.apache.tools.ant.types.Parameter[] parms)
- Description copied from interface:
org.apache.tools.ant.types.Parameterizable - Set the parameters
- Specified by:
setParametersin interfaceorg.apache.tools.ant.types.Parameterizable
isSelected
public boolean isSelected(java.io.File basedir, java.lang.String filename, java.io.File file) throws org.apache.tools.ant.BuildException
- Description copied from interface:
org.apache.tools.ant.types.selectors.FileSelector - Method that each selector will implement to create their
selection behaviour. If there is a problem with the setup
of a selector, it can throw a BuildException to indicate
the problem.
- Specified by:
isSelectedin interfaceorg.apache.tools.ant.types.selectors.FileSelector
|
|||||||||
| Home >> All >> org >> josql >> [ contrib overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC