Bug 20474 - New Selector and improved documentation
Summary: New Selector and improved documentation
Status: RESOLVED FIXED
Alias: None
Product: Ant
Classification: Unclassified
Component: Core (show other bugs)
Version: nightly
Hardware: Other other
: P3 enhancement (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-06-04 11:27 UTC by Jan Mat
Modified: 2008-02-22 12:18 UTC (History)
0 users



Attachments
Zip containing diffs and complete files (85.62 KB, application/octet-stream)
2003-06-04 11:29 UTC, Jan Mat
Details
the forgotten diff (919 bytes, patch)
2003-06-04 11:37 UTC, Jan Mat
Details | Diff
Add support for CacheSelector (without this, many classes can (821 bytes, patch)
2003-06-05 09:05 UTC, Jan Mat
Details | Diff
Complete refactored implemenation and updated documentation (104.79 KB, application/octet-stream)
2003-06-06 14:05 UTC, Jan Mat
Details
MD5Algorithm uses MessageDigest for computing the value (7.87 KB, text/plain)
2003-06-06 16:37 UTC, Jan Mat
Details
Added test for MD5Algorithm (15.51 KB, text/plain)
2003-06-06 16:37 UTC, Jan Mat
Details
Added MD5Algorithm (contains the other modifications) (7.20 KB, patch)
2003-06-06 16:37 UTC, Jan Mat
Details | Diff
ZIP containing refactored CacheSelector and docs (139.93 KB, application/octet-stream)
2003-07-02 06:53 UTC, Jan Mat
Details
Scenario CacheSelector in conjunction with Apache Forrest (1.11 KB, application/octet-stream)
2003-07-02 07:39 UTC, Jan Mat
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Mat 2003-06-04 11:27:59 UTC
I wrote a Selector which can:
- compute a value of a file
- compare this value with one stored in a cache
- decide whether to select

The "compute" algorithm and the cache is configurable. Current implementations:
HashvalueAlgorithm: reads the file´s content into a String and uses its 
hashValue(), 
therefore only files are selected whichs CONTENT has changed
PropertyfileCache: use java.util.Properties for storing the key-value-pairs.

While writing the selector and its testcase I realized that the doco needs some 
improvents in that area. So I have done that, too.
Comment 1 Jan Mat 2003-06-04 11:29:16 UTC
Created attachment 6622 [details]
Zip containing diffs and complete files
Comment 2 Jan Mat 2003-06-04 11:36:17 UTC
The zip contains:

docs\manual\CoreTypes\*.html - the improved/updated doco (complete files)
docs\manual\CoreTypes\*.diff -    "  diff-file
docs\manual\CoreTypes\*.png  - graphics used in the doco

**\cacheselector\*.java - new files for the selector (complete files)

CacheSelectorTest.java - JUnit testcase for the new selector

AbstractFileSet, SelectorContainer - adding support for the new selector

BaseExtendSelector - my fault :-(  no changes done



I have forgotten the BaseSelectorContainer for the support for the new selector.
Next attachement.
Comment 3 Jan Mat 2003-06-04 11:37:00 UTC
Created attachment 6623 [details]
the forgotten diff
Comment 4 Jan Mat 2003-06-05 09:05:36 UTC
Created attachment 6642 [details]
Add support for CacheSelector (without this, many classes can
Comment 5 Jan Mat 2003-06-06 14:05:23 UTC
Created attachment 6671 [details]
Complete refactored implemenation and updated documentation
Comment 6 Jan Mat 2003-06-06 14:06:58 UTC
The attachement 6671 contains the full new sources (complete and diff´s), so 
the other are out of date.
Comment 7 Magesh Umasankar 2003-06-06 14:41:56 UTC
I like the idea behind the cache selector.  But I am not comfortable with the
HashValueAlgorithm where you convert a byte array into a character string 
object before computing the hashvalue for it.  Instead of converting from bytes
to string, use MessageDigest along with the MD5 algorithm to calculate the MD5
hashvalue for each file (See the code for the checksum task for an example).
This is purely stream based and not string based.
Comment 8 Jan Mat 2003-06-06 15:02:00 UTC
I know why I implement the CacheSelector against the Algorithm _interface_ :-)

I will try an implementation as MD5Algorithm.
Comment 9 Jan Mat 2003-06-06 16:37:04 UTC
Created attachment 6675 [details]
MD5Algorithm uses MessageDigest for computing the value
Comment 10 Jan Mat 2003-06-06 16:37:06 UTC
Created attachment 6676 [details]
Added test for MD5Algorithm
Comment 11 Jan Mat 2003-06-06 16:37:08 UTC
Created attachment 6677 [details]
Added MD5Algorithm (contains the other modifications)
Comment 12 Jan Mat 2003-07-02 06:53:36 UTC
After a while a refactorisation this would be the final version.

Features:
- CacheSelector uses a third interface java.util.Comparator for comparing
  the new and the cached value
- smaller Algorithm interface
- configuration of Algorithm and Cache is done via IntrospectionHelper
- MD5Algorithm is changed to DigestAlgorithm and supports SHA
- default values for easier use

Now I need comments. 
Then I can try my first change to the cvs tree :-)
Comment 13 Jan Mat 2003-07-02 06:53:45 UTC
Created attachment 7049 [details]
ZIP containing refactored CacheSelector and docs
Comment 14 Jan Mat 2003-07-02 07:39:25 UTC
In conjunction with forrest I created a test scenario.
I attache a zip file containing the two files for running the scenario on 
windows.

Needed:
- Ant distribution containing the cacheselector
- Ant-Contrib

Install + Run:
- unzip forrests fresh-site.zip into %forrest_home%\fresh-site
- unzip the attached cacheselector+forrest.zip into %forrest_home%\fresh-site
- open a cmd.exe in %forrest_home%\fresh-site
- type #suite.bat

Scenario:
- deletes all generated files (so you can run this multiple times)
- generate the site
- copy to dist-1: should contain all files
- copy to dist-2: should contain no files, because nothing has changed
- generate the site
- copy to dist-3: should contain no files, because no CONTENT has changed
- modify two sources (using notepad)
- generate the site
- copy to dist-4: should contain only the derived files (faq.html, faq.pdf, 
test1.html)

Comment 15 Jan Mat 2003-07-02 07:39:29 UTC
Created attachment 7050 [details]
Scenario CacheSelector in conjunction with Apache Forrest
Comment 16 Jeff Turner 2003-07-05 14:32:47 UTC
Seems a useful addition, and a nicely done patch.

One comment: when I see <cache/>, it's not immediately obvious what the selector
does. I think the fact that a cache is used is more an implementation detail,
than anything of relevance to the user.  Perhaps <modified/> would be better?


--Jeff
Comment 17 Jan Mat 2003-09-13 17:17:03 UTC
commited as <modified> selector

Jan