summaryrefslogtreecommitdiffstats
path: root/.metadata/.plugins/org.eclipse.core.resources
diff options
context:
space:
mode:
Diffstat (limited to '.metadata/.plugins/org.eclipse.core.resources')
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/0/20cfb79fd7cc001b1cb5d1e6b2b8577e8
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/0/a05a6788c5cc001b1cb5d1e6b2b8577e401
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/0/e0026384e5cc001b1cb5d1e6b2b8577e88
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/1/106f9d2cdfcc001b1cb5d1e6b2b8577e203
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/1/30c081b2e0cc001b1cb5d1e6b2b8577e7
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/11/80d6246dd6cc001b1cb5d1e6b2b8577e6
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/13/3008d510e7cc001b1cb5d1e6b2b8577e84
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/15/b04c21fcd6cc001b1cb5d1e6b2b8577e6
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/15/e0103604e9cc001b1cb5d1e6b2b8577e30
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/18/60a6f070e8cc001b1cb5d1e6b2b8577e83
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/18/c047d42de7cc001b1cb5d1e6b2b8577e75
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/19/20950cccc2cc001b1cb5d1e6b2b8577e464
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/19/50418faadfcc001b1cb5d1e6b2b8577e56
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/19/d08185fedecc001b1cb5d1e6b2b8577e50
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/1b/d0ae4066dfcc001b1cb5d1e6b2b8577e751
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/1f/f08e6a88c5cc001b1cb5d1e6b2b8577e401
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/20/701d27e5e3cc001b1cb5d1e6b2b8577e121
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/22/5008a93bd7cc001b1cb5d1e6b2b8577e6
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/23/1018ad0fe9cc001b1cb5d1e6b2b8577e213
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/28/2068aab0e0cc001b1cb5d1e6b2b8577e3
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/29/d05b2f38e0cc001b1cb5d1e6b2b8577e114
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/2b/b0a325dfe3cc001b1cb5d1e6b2b8577e124
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/2d/60cebe1ce7cc001b1cb5d1e6b2b8577e88
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/3/20302377c5cc001b1cb5d1e6b2b8577e466
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/3/6012a90ee5cc001b1cb5d1e6b2b8577e85
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/3/d00f403ce5cc001b1cb5d1e6b2b8577e88
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/31/30b24831e0cc001b1cb5d1e6b2b8577e102
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/33/a0869d8ae8cc001b1cb5d1e6b2b8577e46
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/34/00c3242ce7cc001b1cb5d1e6b2b8577e81
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/36/f0c7c8fadecc001b1cb5d1e6b2b8577e207
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/37/e0aa462ee2cc001b1cb5d1e6b2b8577e43
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/3a/c04412f6decc001b1cb5d1e6b2b8577e51
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/3a/e0bc1035c3cc001b1cb5d1e6b2b8577e465
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/3b/40e69c52dbcc001b1cb5d1e6b2b8577e221
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/3c/a09ea1dce8cc001b1cb5d1e6b2b8577e199
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/3e/b074f67ac4cc001b1cb5d1e6b2b8577e439
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/3f/a05c7330e7cc001b1cb5d1e6b2b8577e391
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/4/707d014ee1cc001b1cb5d1e6b2b8577e14
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/40/d068f945e2cc001b1cb5d1e6b2b8577e47
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/41/60c9c248dfcc001b1cb5d1e6b2b8577e443
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/44/b010d665e0cc001b1cb5d1e6b2b8577e352
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/44/c05d37dadacc001b1cb5d1e6b2b8577e466
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/45/00f8bf83d8cc001b1cb5d1e6b2b8577e6
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/46/3022b241e2cc001b1cb5d1e6b2b8577e98
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/46/3054e63ce0cc001b1cb5d1e6b2b8577e109
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/48/1007d258c3cc001b1cb5d1e6b2b8577e470
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/48/20fe8a19e8cc001b1cb5d1e6b2b8577e58
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/49/404e9e48dbcc001b1cb5d1e6b2b8577e123
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/4a/a0d35eb7dfcc001b1cb5d1e6b2b8577e37
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/4b/506700ece8cc001b1cb5d1e6b2b8577e0
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/4e/50b9433ce5cc001b1cb5d1e6b2b8577e85
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/50/90cd5938e8cc001b1cb5d1e6b2b8577e73
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/50/d0de8453e7cc001b1cb5d1e6b2b8577e120
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/52/701c9e8de8cc001b1cb5d1e6b2b8577e46
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/53/30a6352cd7cc001b1cb5d1e6b2b8577e4
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/54/b0cdc3bbdacc001b1cb5d1e6b2b8577e6
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/54/f0b1a95be0cc001b1cb5d1e6b2b8577e294
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/55/10bc84d5e3cc001b1cb5d1e6b2b8577e86
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/55/b0f9ab54e7cc001b1cb5d1e6b2b8577e119
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/56/105bfb09e0cc001b1cb5d1e6b2b8577e167
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/57/905d2c8fe8cc001b1cb5d1e6b2b8577e47
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/59/c0c8c246e1cc001b1cb5d1e6b2b8577e9
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/5a/e048ee04dfcc001b1cb5d1e6b2b8577e285
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/5c/50e5b4e7c4cc001b1cb5d1e6b2b8577e400
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/5c/a021a44ae1cc001b1cb5d1e6b2b8577e14
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/5c/d03e8612e0cc001b1cb5d1e6b2b8577e62
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/5d/a0a1d5d2e3cc001b1cb5d1e6b2b8577e45
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/5e/80ae3dd5c3cc001b1cb5d1e6b2b8577e439
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/5e/d02bec52e8cc001b1cb5d1e6b2b8577e82
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/5e/e01425c7d8cc001b1cb5d1e6b2b8577e466
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/6/c021d3dfe3cc001b1cb5d1e6b2b8577e125
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/60/60e21d0cdfcc001b1cb5d1e6b2b8577e283
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/60/90dcfaefdfcc001b1cb5d1e6b2b8577e92
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/61/d02ece32e2cc001b1cb5d1e6b2b8577e35
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/62/50fa868fe0cc001b1cb5d1e6b2b8577e5
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/67/c08995d7dacc001b1cb5d1e6b2b8577e401
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/6a/40eb8a34e8cc001b1cb5d1e6b2b8577e74
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/6b/007f3805e4cc001b1cb5d1e6b2b8577e124
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/6b/1011a45fe0cc001b1cb5d1e6b2b8577e94
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/6c/90f93031e2cc001b1cb5d1e6b2b8577e129
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/6c/a0290b92dfcc001b1cb5d1e6b2b8577e230
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/6d/30d2495fd7cc001b1cb5d1e6b2b8577e6
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/6e/308c2f77c5cc001b1cb5d1e6b2b8577e466
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/6e/502dc37ce3cc001b1cb5d1e6b2b8577e124
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/70/708fbdccdfcc001b1cb5d1e6b2b8577e41
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/70/a01386bcd7cc001b1cb5d1e6b2b8577e9
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/71/00e5f755c3cc001b1cb5d1e6b2b8577e466
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/74/b077f08adfcc001b1cb5d1e6b2b8577e29
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/74/d047cc4fe0cc001b1cb5d1e6b2b8577e199
-rwxr-xr-x.metadata/.plugins/org.eclipse.core.resources/.history/75/108dd14fe2cc001b1cb5d1e6b2b8577e279
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/7a/1074c631e8cc001b1cb5d1e6b2b8577e68
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/7b/2094b897d8cc001b1cb5d1e6b2b8577e6
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/7b/20a45331dfcc001b1cb5d1e6b2b8577e204
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/7b/e032ae79e8cc001b1cb5d1e6b2b8577e83
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/7c/105e8944e2cc001b1cb5d1e6b2b8577e236
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/7c/9015cd20e5cc001b1cb5d1e6b2b8577e391
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/8/20ed8defe3cc001b1cb5d1e6b2b8577e121
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/8/f086f421d7cc001b1cb5d1e6b2b8577e4
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/81/b0d15befc4cc001b1cb5d1e6b2b8577e465
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/82/b0f5a443dbcc001b1cb5d1e6b2b8577e84
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/86/d09a3ad8c3cc001b1cb5d1e6b2b8577e439
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/89/30cf4029e2cc001b1cb5d1e6b2b8577e53
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/8b/40660d86dfcc001b1cb5d1e6b2b8577e29
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/8f/e05d218fe4cc001b1cb5d1e6b2b8577e87
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/9/60f57655e8cc001b1cb5d1e6b2b8577e82
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/9/901db4bedfcc001b1cb5d1e6b2b8577e123
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/92/00c4f154e1cc001b1cb5d1e6b2b8577e14
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/92/50f83343c3cc001b1cb5d1e6b2b8577e465
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/92/f04c650dd3cc001b1cb5d1e6b2b8577e0
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/94/30b2bc9cc4cc001b1cb5d1e6b2b8577e404
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/99/b0e80514dacc001b1cb5d1e6b2b8577e7
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/9a/407293fee3cc001b1cb5d1e6b2b8577e118
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/9a/90187f4fe8cc001b1cb5d1e6b2b8577e73
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/9a/a06fb94ae7cc001b1cb5d1e6b2b8577e71
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/9a/d09cdadfd8cc001b1cb5d1e6b2b8577e7
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/9d/709e9f11d7cc001b1cb5d1e6b2b8577e6
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/9d/a07c2f9ce0cc001b1cb5d1e6b2b8577e3
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/9d/f0639cc5d6cc001b1cb5d1e6b2b8577e6
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/9e/e0501e5edfcc001b1cb5d1e6b2b8577e133
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/a1/000553f6e3cc001b1cb5d1e6b2b8577e119
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/a2/c0064e18e7cc001b1cb5d1e6b2b8577e77
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/a5/00556abad6cc001b1cb5d1e6b2b8577e6
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/a5/80d03704e7cc001b1cb5d1e6b2b8577e85
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/a7/40794dccc3cc001b1cb5d1e6b2b8577e471
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/a8/9022136ee0cc001b1cb5d1e6b2b8577e369
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/a8/b0147438dacc001b1cb5d1e6b2b8577e5
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/aa/7002898bc4cc001b1cb5d1e6b2b8577e441
-rwxr-xr-x.metadata/.plugins/org.eclipse.core.resources/.history/ab/40aeeabbe8cc001b1cb5d1e6b2b8577e280
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/ad/402e511bdfcc001b1cb5d1e6b2b8577e419
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/ad/40812526e9cc001b1cb5d1e6b2b8577e108
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/ae/b03a1b42d6cc001b1cb5d1e6b2b8577e6
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/af/c0c4421ce0cc001b1cb5d1e6b2b8577e402
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/b/4027c958e0cc001b1cb5d1e6b2b8577e293
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/b5/60ab1beed6cc001b1cb5d1e6b2b8577e4
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/b8/009f59b6e7cc001b1cb5d1e6b2b8577e57
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/bc/b09d9f15e9cc001b1cb5d1e6b2b8577e236
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/c/c023cfa3e5cc001b1cb5d1e6b2b8577e391
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/c1/c035d4cdc2cc001b1cb5d1e6b2b8577e464
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/c1/c05e77e0e8cc001b1cb5d1e6b2b8577e215
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/c5/300d02a5dfcc001b1cb5d1e6b2b8577e47
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/c6/704f923fe2cc001b1cb5d1e6b2b8577e89
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/c6/b0b31853e0cc001b1cb5d1e6b2b8577e200
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/c7/101c4325dfcc001b1cb5d1e6b2b8577e420
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/c8/30026b2be2cc001b1cb5d1e6b2b8577e62
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/c8/d0e9e056e1cc001b1cb5d1e6b2b8577e13
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/c9/3099f3d7e3cc001b1cb5d1e6b2b8577e86
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/c9/b0ded3a3e5cc001b1cb5d1e6b2b8577e88
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/cb/b0eba5fde8cc001b1cb5d1e6b2b8577e5
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/cc/301f065fe7cc001b1cb5d1e6b2b8577e330
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/cd/90676c0fd3cc001b1cb5d1e6b2b8577e3
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/ce/30bc82b1dfcc001b1cb5d1e6b2b8577e28
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/cf/b00ecd4ddbcc001b1cb5d1e6b2b8577e423
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/d0/702716e6dacc001b1cb5d1e6b2b8577e6
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/d5/50fb2525d8cc001b1cb5d1e6b2b8577e9
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/d5/a03a78ebdfcc001b1cb5d1e6b2b8577e84
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/d7/60548624e2cc001b1cb5d1e6b2b8577e13
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/d8/4023cfd0e3cc001b1cb5d1e6b2b8577e45
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/d9/80af19f1decc001b1cb5d1e6b2b8577e97
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/da/70dbc32ce2cc001b1cb5d1e6b2b8577e34
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/da/a0bcaaecdecc001b1cb5d1e6b2b8577e680
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/de/a0586196c4cc001b1cb5d1e6b2b8577e440
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/e/70db95b7dacc001b1cb5d1e6b2b8577e7
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/e/c0a5f93ae8cc001b1cb5d1e6b2b8577e73
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/e6/a061da8cc4cc001b1cb5d1e6b2b8577e439
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/e7/4049f8f4decc001b1cb5d1e6b2b8577e50
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/e7/8035943de2cc001b1cb5d1e6b2b8577e35
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/e8/10892647e0cc001b1cb5d1e6b2b8577e142
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/e8/1094a711dfcc001b1cb5d1e6b2b8577e242
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/e8/607592f9dfcc001b1cb5d1e6b2b8577e100
-rwxr-xr-x.metadata/.plugins/org.eclipse.core.resources/.history/e9/202e0baae8cc001b1cb5d1e6b2b8577e280
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/eb/10ee020ce4cc001b1cb5d1e6b2b8577e118
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/ec/00c9fb38dfcc001b1cb5d1e6b2b8577e68
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/ec/3014ff87cbcc001b1cb5d1e6b2b8577e464
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/ed/003408ede0cc001b1cb5d1e6b2b8577e7
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/ed/50e6b142dfcc001b1cb5d1e6b2b8577e72
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/ed/80752b18e5cc001b1cb5d1e6b2b8577e85
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/ee/40e8b13ee7cc001b1cb5d1e6b2b8577e73
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/ee/c01f073edbcc001b1cb5d1e6b2b8577e87
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/ee/e0cb4c28dacc001b1cb5d1e6b2b8577e4
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/f/50480a4ee7cc001b1cb5d1e6b2b8577e124
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/f0/003fa905e0cc001b1cb5d1e6b2b8577e72
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/f0/4062814be1cc001b1cb5d1e6b2b8577e14
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/f2/8090c670e5cc001b1cb5d1e6b2b8577e391
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/f3/70c6cd90c5cc001b1cb5d1e6b2b8577e401
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/f4/60dff0e1e8cc001b1cb5d1e6b2b8577e215
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/f5/30f02c92e4cc001b1cb5d1e6b2b8577e87
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/f6/20dbe86ad4cc001b1cb5d1e6b2b8577e3
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/f6/b00cc017e9cc001b1cb5d1e6b2b8577e238
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/f8/50d897cbd8cc001b1cb5d1e6b2b8577e7
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/f9/e035d9a3e5cc001b1cb5d1e6b2b8577e85
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/fa/a056b67fd8cc001b1cb5d1e6b2b8577e466
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/fb/5069911ed8cc001b1cb5d1e6b2b8577e466
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/fc/a0122896e4cc001b1cb5d1e6b2b8577e46
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.history/fc/a0fccaade5cc001b1cb5d1e6b2b8577e88
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/16/35/history.indexbin0 -> 117 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/16/bd/history.indexbin0 -> 93 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/2/history.indexbin0 -> 124 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/2b/history.indexbin0 -> 730 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/42/history.indexbin0 -> 159 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/49/history.indexbin0 -> 113 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/5e/e5/history.indexbin0 -> 846 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/5e/history.indexbin0 -> 1459 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/60/history.indexbin0 -> 85 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/73/history.indexbin0 -> 168 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/8/history.indexbin0 -> 79 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/91/history.indexbin0 -> 158 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/9d/53/history.indexbin0 -> 1490 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/9d/history.indexbin0 -> 180 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/e9/history.indexbin0 -> 167 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.markers.snapbin0 -> 249564 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.syncinfo.snapbin0 -> 361046 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.indexes/e4/22/9d/53/2e/5e/4c/history.indexbin0 -> 897 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.indexes/e4/22/9d/53/2e/5e/history.indexbin0 -> 127 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.indexes/e4/22/9d/53/cc/9d/4c/history.indexbin0 -> 112 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.locationbin0 -> 46 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.markers.snapbin0 -> 15224 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.syncinfo.snapbin0 -> 45621 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.7/.indexes/e4/22/9d/53/2e/5e/4d/history.indexbin0 -> 890 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.7/.indexes/e4/22/9d/53/2e/5e/history.indexbin0 -> 415 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.7/.locationbin0 -> 46 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.7/.markers.snapbin0 -> 14362 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.7/.syncinfo.snapbin0 -> 33489 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/etc/.indexes/history.indexbin0 -> 2500 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/etc/.markers.snapbin0 -> 384 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/etc/.syncinfo.snapbin0 -> 3259 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/lib/.markers.snapbin0 -> 32 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.projects/lib/.syncinfo.snapbin0 -> 40141 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.indexbin0 -> 1214 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.root/.markers.snapbin0 -> 560 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resourcesbin0 -> 3955 bytes
-rw-r--r--.metadata/.plugins/org.eclipse.core.resources/.snapbin0 -> 201915 bytes
231 files changed, 31030 insertions, 0 deletions
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/0/20cfb79fd7cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/0/20cfb79fd7cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..7df7473
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/0/20cfb79fd7cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,8 @@
+<XDtClass:forAllClasses>
+<XDtClass:forAllTags>
+</XDtClass:forAllTags>
+<XDtClass:ifHasClassTag tagName="ant:task" paramName="name">
+<XDtClass:classTagValue tagName="ant:task" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag>
+</XDtClass:forAllClasses>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/0/a05a6788c5cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/0/a05a6788c5cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..0fd258c
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/0/a05a6788c5cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,401 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.Resource;
+import org.apache.tools.ant.types.ResourceCollection;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ * @author Matt Inger
+ * @ant.task name=for
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+ private List resourceCollections = new ArrayList();
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ public void add(ResourceCollection resourceCollection) {
+ this.resourceCollections.add(resourceCollection);
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && resourceCollections.isEmpty() && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or resources or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ Iterator it = resourceCollections.iterator();
+ while (it.hasNext()) {
+ ResourceCollection c = (ResourceCollection) it.next();
+ Iterator rit = c.iterator();
+ while (rit.hasNext()) {
+ Resource r = (Resource) rit.next();
+ doToken(r.toString());
+ }
+ }
+
+ it = hasIterators.iterator();
+ while (it.hasNext()) {
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/0/e0026384e5cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/0/e0026384e5cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..26e5610
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/0/e0026384e5cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.ant17;
+
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.CallTarget;
+import org.apache.tools.ant.taskdefs.Property;
+
+/**
+ * Subclass of Ant which allows us to fetch
+ * properties which are set in the scope of the called
+ * target, and set them in the scope of the calling target.
+ * Normally, these properties are thrown away as soon as the
+ * called target completes execution.
+ *
+ * @author inger
+ * @author Dale Anson, [email protected]
+ * @ant.task name="antcallback"
+ */
+public class AntCallBack extends CallTarget {
+
+ /** the name of the property to fetch from the new project */
+ private String returnName = null;
+
+ private ProjectDelegate fakeProject = null;
+
+ public void setProject(Project realProject) {
+ fakeProject = new ProjectDelegate(realProject);
+ super.setProject(fakeProject);
+ }
+
+ /**
+ * Do the execution.
+ *
+ * @exception BuildException Description of the Exception
+ */
+ public void execute() throws BuildException {
+ super.execute();
+
+ // copy back the props if possible
+ if ( returnName != null ) {
+ StringTokenizer st = new StringTokenizer( returnName, "," );
+ while ( st.hasMoreTokens() ) {
+ String name = st.nextToken().trim();
+ String value = fakeProject.getSubproject().getUserProperty( name );
+ if ( value != null ) {
+ getProject().setUserProperty( name, value );
+ }
+ else {
+ value = fakeProject.getSubproject().getProperty( name );
+ if ( value != null ) {
+ getProject().setProperty( name, value );
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Set the property or properties that are set in the new project to be
+ * transfered back to the original project. As with all properties, if the
+ * property already exists in the original project, it will not be overridden
+ * by a different value from the new project.
+ *
+ * @param r the name of a property in the new project to set in the original
+ * project. This may be a comma separate list of properties.
+ */
+ public void setReturn( String r ) {
+ returnName = r;
+ }
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1/106f9d2cdfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/1/106f9d2cdfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..34236f0
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/1/106f9d2cdfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ package net.sf.antcontrib.antserver.client;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Vector;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import net.sf.antcontrib.antserver.Command;
+import net.sf.antcontrib.antserver.Response;
+import net.sf.antcontrib.antserver.commands.RunAntCommand;
+import net.sf.antcontrib.antserver.commands.RunTargetCommand;
+import net.sf.antcontrib.antserver.commands.SendFileCommand;
+import net.sf.antcontrib.antserver.commands.ShutdownCommand;
+
+/****************************************************************************
+ * Place class description here.
+ *
+ * @author <a href='mailto:[email protected]'>Matthew Inger</a>
+ * @author <additional author>
+ *
+ * @since
+ *
+ ****************************************************************************/
+
+
+public class ClientTask
+ extends Task
+{
+ private String machine = "localhost";
+ private int port = 17000;
+ private Vector commands;
+ private boolean persistant = false;
+ private boolean failOnError = true;
+
+ public ClientTask()
+ {
+ super();
+ this.commands = new Vector();
+ }
+
+
+ public void setMachine(String machine)
+ {
+ this.machine = machine;
+ }
+
+
+ public void setPort(int port)
+ {
+ this.port = port;
+ }
+
+
+ public void setPersistant(boolean persistant)
+ {
+ this.persistant = persistant;
+ }
+
+
+ public void setFailOnError(boolean failOnError)
+ {
+ this.failOnError = failOnError;
+ }
+
+
+ public void addConfiguredShutdown(ShutdownCommand cmd)
+ {
+ commands.add(cmd);
+ }
+
+ public void addConfiguredRunTarget(RunTargetCommand cmd)
+ {
+ commands.add(cmd);
+ }
+
+ public void addConfiguredRunAnt(RunAntCommand cmd)
+ {
+ commands.add(cmd);
+ }
+
+ public void addConfiguredSendFile(SendFileCommand cmd)
+ {
+ commands.add(cmd);
+ }
+
+
+ public void execute()
+ {
+ Enumeration e = commands.elements();
+ Command c = null;
+ while (e.hasMoreElements())
+ {
+ c = (Command)e.nextElement();
+ c.validate(getProject());
+ }
+
+ Client client = new Client(getProject(), machine, port);
+
+ try
+ {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+
+ try
+ {
+ int failCount = 0;
+
+ client.connect();
+
+ e = commands.elements();
+ c = null;
+ Response r = null;
+ Document d = null;
+ boolean keepGoing = true;
+ while (e.hasMoreElements() && keepGoing)
+ {
+ c = (Command)e.nextElement();
+ r = client.sendCommand(c);
+ if (! r.isSucceeded())
+ {
+ failCount++;
+ log("Command caused a build failure:" + c,
+ Project.MSG_ERR);
+ log(r.getErrorMessage(),
+ Project.MSG_ERR);
+ log(r.getErrorStackTrace(),
+ Project.MSG_DEBUG);
+ if (! persistant)
+ keepGoing = false;
+ }
+
+ try
+ {
+ ByteArrayInputStream bais =
+ new ByteArrayInputStream(r.getResultsXml().getBytes());
+ d = db.parse(bais);
+ NodeList nl = d.getElementsByTagName("target");
+ int len = nl.getLength();
+ Element element = null;
+ for (int i=0;i<len;i++)
+ {
+ element = (Element)nl.item(i);
+ getProject().log("[" + element.getAttribute("name") + "]",
+ Project.MSG_INFO);
+ }
+ }
+ catch (SAXException se)
+ {
+
+ }
+
+ if (c instanceof ShutdownCommand)
+ {
+ keepGoing = false;
+ client.shutdown();
+ }
+ }
+
+ if (failCount > 0 && failOnError)
+ throw new BuildException("One or more commands failed.");
+ }
+ finally
+ {
+ if (client != null)
+ client.disconnect();
+ }
+ }
+ catch (ParserConfigurationException ex)
+ {
+ throw new BuildException(ex);
+ }
+ catch (IOException ex)
+ {
+ throw new BuildException(ex);
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1/30c081b2e0cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/1/30c081b2e0cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..134c2ce
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/1/30c081b2e0cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,7 @@
+<XDtClass:forAllClasses><XDtClass:ifHasClassTag tagName="ant:task"
+><XDtClass:classTagValue tagName="ant:task" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag
+><XDtClass:ifHasClassTag tagName="ant:type"
+><XDtClass:classTagValue tagName="ant:task" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag
+></XDtClass:forAllClasses> \ No newline at end of file
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/11/80d6246dd6cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/11/80d6246dd6cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..f17efb7
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/11/80d6246dd6cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,6 @@
+<XDtClass:forAllClasses>
+ <XDtClass:ifHasClassTag tagName="ant:task" paramName="name">
+ <XDtClass:classTagValue tagName="ant:task" paramName="name"/>=<XDtClass:classOf><XDtJavaBean:beanClass/></XDtClass>
+ </XDtClass:ifHasClassTag>
+</XDtClass:forAllClasses>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/13/3008d510e7cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/13/3008d510e7cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..07cd5de
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/13/3008d510e7cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Ant;
+
+/**
+ * Subclass of CallTarget which allows us to fetch
+ * properties which are set in the scope of the called
+ * target, and set them in the scope of the calling target.
+ * Normally, these properties are thrown away as soon as the
+ * called target completes execution.
+ *
+ * @author inger
+ * @author Dale Anson, [email protected]
+ * @ant.task name="antfetch"
+ */
+public class AntFetch extends Ant {
+ /** the name of the property to fetch from the new project */
+ private String returnName = null;
+
+ private ProjectDelegate fakeProject = null;
+
+ public void setProject(Project realProject) {
+ fakeProject = new ProjectDelegate(realProject);
+ super.setProject(fakeProject);
+ }
+
+ /**
+ * Do the execution.
+ *
+ * @exception BuildException Description of the Exception
+ */
+ public void execute() throws BuildException {
+ super.execute();
+ // copy back the props if possible
+ if ( returnName != null ) {
+ StringTokenizer st = new StringTokenizer( returnName, "," );
+ while ( st.hasMoreTokens() ) {
+ String name = st.nextToken().trim();
+ String value = super.getProject().getProperty(returnName);
+ if ( value != null ) {
+ getProject().setUserProperty( name, value );
+ }
+ else {
+ value = fakeProject.getSubproject().getProperty( name );
+ if ( value != null ) {
+ getProject().setProperty( name, value );
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Set the property or properties that are set in the new project to be
+ * transfered back to the original project. As with all properties, if the
+ * property already exists in the original project, it will not be overridden
+ * by a different value from the new project.
+ *
+ * @param r the name of a property in the new project to set in the original
+ * project. This may be a comma separate list of properties.
+ */
+ public void setReturn( String r ) {
+ returnName = r;
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/15/b04c21fcd6cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/15/b04c21fcd6cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..c7f3e07
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/15/b04c21fcd6cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,6 @@
+<XDtClass:forAllClasses>
+ <XDtClass:ifHasClassTag tagName="ant.task" paramName="name">
+ <XDtClass:classTagValue tagName="ant.task" paramName="name"/>=<XDtClass:fullClassName />
+ </XDtClass:ifHasClassTag>
+</XDtClass:forAllClasses>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/15/e0103604e9cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/15/e0103604e9cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..7246acc
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/15/e0103604e9cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,30 @@
+package net.sf.antcontrib.util;
+
+import java.io.IOException;
+
+public class Utils {
+
+ public static void close(InputStream is) {
+ try {
+ if (is != null) {
+ is.close();
+ }
+ }
+ catch (IOException e) {
+ ;
+ }
+
+ }
+
+ public static void close(OutputStream is) {
+ try {
+ if (is != null) {
+ is.close();
+ }
+ }
+ catch (IOException e) {
+ ;
+ }
+
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/18/60a6f070e8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/18/60a6f070e8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..6b9a7b0
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/18/60a6f070e8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.condition;
+
+import java.lang.reflect.Field;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.condition.ConditionBase;
+
+/**
+ * Extends ConditionBase so I can get access to the condition count and the
+ * first condition. This is the class that the BooleanConditionTask is proxy
+ * for.
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ *
+ * @author Dale Anson, [email protected]
+ */
+public class BooleanConditionBase extends ConditionBase {
+
+ private Vector conditions;
+
+ public BooleanConditionBase() {
+ this.conditions = getParentConditions();
+ }
+
+ private Vector getParentConditions() {
+ try {
+ Field f = ConditionBase.class.getDeclaredField("conditions");
+ f.setAccessible(true);
+ Vector v = (Vector) f.get(this);
+ return v;
+ }
+ catch (NoSuchFieldException e) {
+ throw new BuildException(e);
+ }
+ catch (IllegalAccessException e) {
+ throw new BuildException(e);
+ }
+ }
+
+ /**
+ * Adds a feature to the IsPropertyTrue attribute of the BooleanConditionBase
+ * object
+ *
+ * @param i The feature to be added to the IsPropertyTrue attribute
+ */
+ public void addIsPropertyTrue( IsPropertyTrue i ) {
+ getConditions().add( i );
+ }
+
+ /**
+ * Adds a feature to the IsPropertyFalse attribute of the
+ * BooleanConditionBase object
+ *
+ * @param i The feature to be added to the IsPropertyFalse attribute
+ */
+ public void addIsPropertyFalse( IsPropertyFalse i ) {
+ getConditions().add( i );
+ }
+
+ public void addIsGreaterThan( IsGreaterThan i) {
+ getConditions().add(i);
+ }
+
+ public void addIsLessThan( IsLessThan i) {
+ getConditions().add(i);
+ }
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/18/c047d42de7cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/18/c047d42de7cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..45dc251
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/18/c047d42de7cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.CallTarget;
+import org.apache.tools.ant.taskdefs.Property;
+
+/**
+ * Subclass of Ant which allows us to fetch
+ * properties which are set in the scope of the called
+ * target, and set them in the scope of the calling target.
+ * Normally, these properties are thrown away as soon as the
+ * called target completes execution.
+ *
+ * @author inger
+ * @author Dale Anson, [email protected]
+ * @ant.task name="antcallback"
+ */
+public class AntCallBack extends CallTarget {
+
+ /** the name of the property to fetch from the new project */
+ private String returnName = null;
+
+ /**
+ * Do the execution.
+ *
+ * @exception BuildException Description of the Exception
+ */
+ public void execute() throws BuildException {
+ super.execute();
+
+ // copy back the props if possible
+ if ( returnName != null ) {
+ StringTokenizer st = new StringTokenizer( returnName, "," );
+ while ( st.hasMoreTokens() ) {
+ String name = st.nextToken().trim();
+ String value = super.getProject().getProperty(returnName);
+ if ( value != null ) {
+ getProject().setUserProperty( name, value );
+ }
+ }
+ }
+ }
+
+ /**
+ * Set the property or properties that are set in the new project to be
+ * transfered back to the original project. As with all properties, if the
+ * property already exists in the original project, it will not be overridden
+ * by a different value from the new project.
+ *
+ * @param r the name of a property in the new project to set in the original
+ * project. This may be a comma separate list of properties.
+ */
+ public void setReturn( String r ) {
+ returnName = r;
+ }
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/19/20950cccc2cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/19/20950cccc2cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..4290c19
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/19/20950cccc2cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,464 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private Path currPath;
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ private Path getOrCreatePath() {
+ if (currPath == null) {
+ currPath = new Path(getProject());
+ }
+ return currPath;
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfigured(Path path) {
+ getOrCreatePath().append(path);
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfiguredPath(Path path) {
+ addConfigured(path);
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && currPath == null && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or path or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ // Take Care of the path element
+ String[] pathElements = new String[0];
+ if (currPath != null) {
+ pathElements = currPath.list();
+ }
+ for (int i = 0; i < pathElements.length; i++) {
+ File nextFile = new File(pathElements[i]);
+ doToken(nextFile.getAbsolutePath());
+ }
+
+ // Take care of iterators
+ for (Iterator i = hasIterators.iterator(); i.hasNext();) {
+ Iterator it = ((HasIterator) i.next()).iterator();
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void add(FileSet fileset) {
+ getOrCreatePath().addFileset(fileset);
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void addFileSet(FileSet fileset) {
+ add(fileset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void add(DirSet dirset) {
+ getOrCreatePath().addDirset(dirset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void addDirSet(DirSet dirset) {
+ add(dirset);
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/19/50418faadfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/19/50418faadfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..91ae9f2
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/19/50418faadfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.tools.ant.BuildException;
+
+public class AddCredentialsTask
+ extends AbstractHttpStateTypeTask {
+
+ private List credentials = new ArrayList();
+ private List proxyCredentials = new ArrayList();
+
+ public void addConfiguredCredentials(Credentials credentials) {
+ this.credentials.add(credentials);
+ }
+
+ public void addConfiguredProxyCredentials(Credentials credentials) {
+ this.proxyCredentials.add(credentials);
+ }
+
+ protected void execute(HttpStateType stateType) throws BuildException {
+ if (credentials.isEmpty() && proxyCredentials.isEmpty()) {
+ throw new BuildException("Either regular or proxy credentials" +
+ " must be supplied.");
+ }
+
+ Iterator it = credentials.iterator();
+ while (it.hasNext()) {
+ Credentials c = (Credentials)it.next();
+ stateType.addConfiguredCredentials(c);
+ }
+
+ it = proxyCredentials.iterator();
+ while (it.hasNext()) {
+ Credentials c = (Credentials)it.next();
+ stateType.addConfiguredProxyCredentials(c);
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/19/d08185fedecc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/19/d08185fedecc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..552de46
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/19/d08185fedecc001b1cb5d1e6b2b8577e
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.Exit;
+import org.apache.tools.ant.types.Reference;
+
+/**
+ * Extension of <code>&lt;fail&gt;</code> that can throw an exception
+ * that is a reference in the project.
+ *
+ * <p>This may be useful inside the <code>&lt;catch&gt;</code> block
+ * of a <code>&lt;trycatch&gt;</code> task if you want to rethrow the
+ * exception just caught.</p>
+ */
+public class Throw extends Exit {
+
+ private Reference ref;
+
+ /**
+ * The reference that points to a BuildException.
+ */
+ public void setRefid(Reference ref) {
+ this.ref = ref;
+ }
+
+ public void execute() throws BuildException {
+ Object reffed = ref != null
+ ? ref.getReferencedObject(getProject())
+ : null;
+ if (reffed != null && reffed instanceof BuildException) {
+ throw (BuildException) reffed;
+ }
+ super.execute();
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1b/d0ae4066dfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/1b/d0ae4066dfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..4f1d5b0
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/1b/d0ae4066dfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,751 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net;
+
+import java.io.BufferedReader;
+import java.io.DataOutputStream;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.HttpURLConnection;
+
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+
+import java.rmi.server.UID;
+
+import java.util.*;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.ProjectHelper;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.TaskContainer;
+
+/**
+ * This task does an http post. Name/value pairs for the post can be set in
+ * either or both of two ways, by nested Prop elements and/or by a file
+ * containing properties. Nested Prop elements are automatically configured by
+ * Ant. Properties from a file are configured by code borrowed from Property so
+ * all Ant property constructs (like ${somename}) are resolved prior to the
+ * post. This means that a file can be set up in advance of running the build
+ * and the appropriate property values will be filled in at run time.
+ *
+ * @author Dale Anson, [email protected]
+ * @version $Revision: 1.11 $
+ */
+public class PostTask extends Task {
+
+ /** Storage for name/value pairs to send. */
+ private Hashtable props = new Hashtable();
+ /** URL to send the name/value pairs to. */
+ private URL to = null;
+ /** File to read name/value pairs from. */
+ private File propsFile = null;
+ /** storage for Ant properties */
+ private String textProps = null;
+ /** encoding to use for the name/value pairs */
+ private String encoding = "UTF-8";
+ /** where to store the server response */
+ private File log = null;
+ /** append to the log? */
+ private boolean append = true;
+ /** verbose? */
+ private boolean verbose = true;
+ /** want to keep the server response? */
+ private boolean wantResponse = true;
+ /** store output in a property */
+ private String property = null;
+
+ /** how long to wait for a response from the server */
+ private long maxwait = 180000; // units for maxwait is milliseconds
+ /** fail on error? */
+ private boolean failOnError = false;
+
+ // storage for cookies
+ private static Hashtable cookieStorage = new Hashtable();
+
+ /** connection to the server */
+ private URLConnection connection = null;
+ /** for thread handling */
+ private Thread currentRunner = null;
+
+
+
+ /**
+ * Set the url to post to. Required.
+ *
+ * @param name the url to post to.
+ */
+ public void setTo( URL name ) {
+ to = name;
+ }
+
+
+ /**
+ * Set the name of a file to read a set of properties from.
+ *
+ * @param f the file
+ */
+ public void setFile( File f ) {
+ propsFile = f;
+ }
+
+
+ /**
+ * Set the name of a file to save the response to. Optional. Ignored if
+ * "want response" is false.
+ *
+ * @param f the file
+ */
+ public void setLogfile( File f ) {
+ log = f;
+ }
+
+
+ /**
+ * Should the log file be appended to or overwritten? Default is true,
+ * append to the file.
+ *
+ * @param b append or not
+ */
+ public void setAppend( boolean b ) {
+ append = b;
+ }
+
+
+ /**
+ * If true, progress messages and returned data from the post will be
+ * displayed. Default is true.
+ *
+ * @param b true = verbose
+ */
+ public void setVerbose( boolean b ) {
+ verbose = b;
+ }
+
+
+ /**
+ * Default is true, get the response from the post. Can be set to false for
+ * "fire and forget" messages.
+ *
+ * @param b print/log server response
+ */
+ public void setWantresponse( boolean b ) {
+ wantResponse = b;
+ }
+
+ /**
+ * Set the name of a property to save the response to. Optional. Ignored if
+ * "wantResponse" is false.
+ * @param name the name to use for the property
+ */
+ public void setProperty( String name ) {
+ property = name;
+ }
+
+ /**
+ * Sets the encoding of the outgoing properties, default is UTF-8.
+ *
+ * @param encoding The new encoding value
+ */
+ public void setEncoding( String encoding ) {
+ this.encoding = encoding;
+ }
+
+
+ /**
+ * How long to wait on the remote server. As a post is generally a two part
+ * process (sending and receiving), maxwait is applied separately to each
+ * part, that is, if 180 is passed as the wait parameter, this task will
+ * spend at most 3 minutes to connect to the remote server and at most
+ * another 3 minutes waiting on a response after the post has been sent.
+ * This means that the wait period could total as much as 6 minutes (or 360
+ * seconds). <p>
+ *
+ * The default wait period is 3 minutes (180 seconds).
+ *
+ * @param wait time to wait in seconds, set to 0 to wait forever.
+ */
+ public void setMaxwait( int wait ) {
+ maxwait = wait * 1000;
+ }
+
+
+ /**
+ * Should the build fail if the post fails?
+ *
+ * @param fail true = fail the build, default is false
+ */
+ public void setFailonerror( boolean fail ) {
+ failOnError = fail;
+ }
+
+ /**
+ * Adds a name/value pair to post. Optional.
+ *
+ * @param p A property pair to send as part of the post.
+ * @exception BuildException When name and/or value are missing.
+ */
+ public void addConfiguredProp( Prop p ) throws BuildException {
+ String name = p.getName();
+ if ( name == null ) {
+ throw new BuildException( "name is null", getLocation() );
+ }
+ String value = p.getValue();
+ if ( value == null ) {
+ value = getProject().getProperty( name );
+ }
+ if ( value == null ) {
+ throw new BuildException( "value is null", getLocation() );
+ }
+ props.put( name, value );
+ }
+
+
+ /**
+ * Adds a feature to the Text attribute of the PostTask object
+ *
+ * @param text The feature to be added to the Text attribute
+ */
+ public void addText( String text ) {
+ textProps = text;
+ }
+
+
+ /**
+ * Do the post.
+ *
+ * @exception BuildException On any error.
+ */
+ public void execute() throws BuildException {
+ if ( to == null ) {
+ throw new BuildException( "'to' attribute is required", getLocation() );
+ }
+ final String content = getContent();
+ try {
+ if ( verbose )
+ log( "Opening connection for post to " + to.toString() + "..." );
+
+ // do the POST
+ Thread runner =
+ new Thread() {
+ public void run() {
+ DataOutputStream out = null;
+ try {
+ // set the url connection properties
+ connection = to.openConnection();
+ connection.setDoInput( true );
+ connection.setDoOutput( true );
+ connection.setUseCaches( false );
+ connection.setRequestProperty(
+ "Content-Type",
+ "application/x-www-form-urlencoded" );
+
+ // check if there are cookies to be included
+ for ( Iterator it = cookieStorage.keySet().iterator(); it.hasNext(); ) {
+ StringBuffer sb = new StringBuffer();
+ Object name = it.next();
+ if ( name != null ) {
+ String key = name.toString();
+ Cookie cookie = ( Cookie ) cookieStorage.get( name );
+ if ( to.getPath().startsWith( cookie.getPath() ) ) {
+ connection.addRequestProperty( "Cookie", cookie.toString() );
+ }
+ }
+ }
+
+ // do the post
+ if ( verbose ) {
+ log( "Connected, sending data..." );
+ }
+ out = new DataOutputStream( connection.getOutputStream() );
+ if ( verbose ) {
+ log( content );
+ }
+ out.writeBytes( content );
+ out.flush();
+ if ( verbose ) {
+ log( "Data sent." );
+ }
+ }
+ catch ( Exception e ) {
+ if ( failOnError ) {
+ throw new BuildException( e, getLocation() );
+ }
+ }
+ finally {
+ try {
+ out.close();
+ }
+ catch ( Exception e ) {
+ // ignored
+ }
+ }
+ }
+ }
+ ;
+ runner.start();
+ runner.join( maxwait );
+ if ( runner.isAlive() ) {
+ runner.interrupt();
+ if ( failOnError ) {
+ throw new BuildException( "maxwait exceeded, unable to send data", getLocation() );
+ }
+ return ;
+ }
+
+ // read the response, if any, optionally writing it to a file
+ if ( wantResponse ) {
+ if ( verbose ) {
+ log( "Waiting for response..." );
+ }
+ runner =
+ new Thread() {
+ public void run() {
+ PrintWriter fw = null;
+ StringWriter sw = null;
+ PrintWriter pw = null;
+ BufferedReader in = null;
+ try {
+ if ( connection instanceof HttpURLConnection ) {
+ // read and store cookies
+ Map map = ( ( HttpURLConnection ) connection ).getHeaderFields();
+ for ( Iterator it = map.keySet().iterator(); it.hasNext(); ) {
+ String name = ( String ) it.next();
+ if ( name != null && name.equals( "Set-Cookie" ) ) {
+ List cookies = ( List ) map.get( name );
+ for ( Iterator c = cookies.iterator(); c.hasNext(); ) {
+ String raw = ( String ) c.next();
+ Cookie cookie = new Cookie( raw );
+ cookieStorage.put( cookie.getId(), cookie );
+ }
+ }
+ }
+
+ // maybe log response headers
+ if ( verbose ) {
+ log( String.valueOf( ( ( HttpURLConnection ) connection ).getResponseCode() ) );
+ log( ( ( HttpURLConnection ) connection ).getResponseMessage() );
+ StringBuffer sb = new StringBuffer();
+ map = ( ( HttpURLConnection ) connection ).getHeaderFields();
+ for ( Iterator it = map.keySet().iterator(); it.hasNext(); ) {
+ String name = ( String ) it.next();
+ sb.append( name ).append( "=" );
+ List values = ( List ) map.get( name );
+ if ( values != null ) {
+ if ( values.size() == 1 )
+ sb.append( values.get( 0 ) );
+ else if ( values.size() > 1 ) {
+ sb.append( "[" );
+ for ( Iterator v = values.iterator(); v.hasNext(); ) {
+ sb.append( v.next() ).append( "," );
+ }
+ sb.append( "]" );
+ }
+ }
+ sb.append( "\n" );
+ log( sb.toString() );
+ }
+ }
+ }
+ in = new BufferedReader(
+ new InputStreamReader( connection.getInputStream() ) );
+ if ( log != null ) {
+ // user wants output stored to a file
+ fw = new PrintWriter( new FileWriter( log, append ) );
+ }
+ if ( property != null ) {
+ // user wants output stored in a property
+ sw = new StringWriter();
+ pw = new PrintWriter( sw );
+ }
+ String line;
+ while ( null != ( ( line = in.readLine() ) ) ) {
+ if ( currentRunner != this ) {
+ break;
+ }
+ if ( verbose ) {
+ log( line );
+ }
+ if ( fw != null ) {
+ // write response to a file
+ fw.println( line );
+ }
+ if ( pw != null ) {
+ // write response to a property
+ pw.println( line );
+ }
+ }
+ }
+ catch ( Exception e ) {
+ //e.printStackTrace();
+ if ( failOnError ) {
+ throw new BuildException( e, getLocation() );
+ }
+ }
+ finally {
+ try {
+ in.close();
+ }
+ catch ( Exception e ) {
+ // ignored
+ }
+ try {
+ if ( fw != null ) {
+ fw.flush();
+ fw.close();
+ }
+ }
+ catch ( Exception e ) {
+ // ignored
+ }
+ }
+ if ( property != null && sw != null ) {
+ // save property
+ getProject().setProperty( property, sw.toString() );
+ }
+ }
+ };
+ currentRunner = runner;
+ runner.start();
+ runner.join( maxwait );
+ if ( runner.isAlive() ) {
+ currentRunner = null;
+ runner.interrupt();
+ if ( failOnError ) {
+ throw new BuildException( "maxwait exceeded, unable to receive data", getLocation() );
+ }
+ }
+ }
+ if ( verbose )
+ log( "Post complete." );
+ }
+ catch ( Exception e ) {
+ if ( failOnError ) {
+ throw new BuildException( e );
+ }
+ }
+ }
+
+
+ /**
+ * Borrowed from Property -- load variables from a file
+ *
+ * @param file file to load
+ * @exception BuildException Description of the Exception
+ */
+ private void loadFile( File file ) throws BuildException {
+ Properties fileprops = new Properties();
+ try {
+ if ( file.exists() ) {
+ FileInputStream fis = new FileInputStream( file );
+ try {
+ fileprops.load( fis );
+ }
+ finally {
+ if ( fis != null ) {
+ fis.close();
+ }
+ }
+ addProperties( fileprops );
+ }
+ else {
+ log( "Unable to find property file: " + file.getAbsolutePath(),
+ Project.MSG_VERBOSE );
+ }
+ log( "Post complete." );
+ }
+ catch ( Exception e ) {
+ if ( failOnError ) {
+ throw new BuildException( e );
+ }
+ }
+ }
+
+
+ /**
+ * Builds and formats the message to send to the server. Message is UTF-8
+ * encoded unless encoding has been explicitly set.
+ *
+ * @return the message to send to the server.
+ */
+ private String getContent() {
+ if ( propsFile != null ) {
+ loadFile( propsFile );
+ }
+
+ if ( textProps != null ) {
+ loadTextProps( textProps );
+ }
+
+ StringBuffer content = new StringBuffer();
+ try {
+ Enumeration en = props.keys();
+ while ( en.hasMoreElements() ) {
+ String name = ( String ) en.nextElement();
+ String value = ( String ) props.get( name );
+ content.append( URLEncoder.encode( name, encoding ) );
+ content.append( "=" );
+ content.append( URLEncoder.encode( value, encoding ) );
+ if ( en.hasMoreElements() ) {
+ content.append( "&" );
+ }
+ }
+ }
+ catch ( IOException ex ) {
+ if ( failOnError ) {
+ throw new BuildException( ex, getLocation() );
+ }
+ }
+ return content.toString();
+ }
+
+
+ /**
+ * Description of the Method
+ *
+ * @param tp
+ */
+ private void loadTextProps( String tp ) {
+ Properties p = new Properties();
+ Project project = getProject();
+ StringTokenizer st = new StringTokenizer( tp, "$" );
+ while ( st.hasMoreTokens() ) {
+ String token = st.nextToken();
+ int start = token.indexOf( "{" );
+ int end = token.indexOf( "}" );
+ if ( start > -1 && end > -1 && end > start ) {
+ String name = token.substring( start + 1, end - start );
+ String value = project.getProperty( name );
+ if ( value != null )
+ p.setProperty( name, value );
+ }
+ }
+ addProperties( p );
+ }
+
+
+ /**
+ * Borrowed from Property -- iterate through a set of properties, resolve
+ * them, then assign them
+ *
+ * @param fileprops The feature to be added to the Properties attribute
+ */
+ private void addProperties( Properties fileprops ) {
+ resolveAllProperties( fileprops );
+ Enumeration e = fileprops.keys();
+ while ( e.hasMoreElements() ) {
+ String name = ( String ) e.nextElement();
+ String value = fileprops.getProperty( name );
+ props.put( name, value );
+ }
+ }
+
+
+ /**
+ * Borrowed from Property -- resolve properties inside a properties
+ * hashtable
+ *
+ * @param fileprops Description of the Parameter
+ * @exception BuildException Description of the Exception
+ */
+ private void resolveAllProperties( Properties fileprops ) throws BuildException {
+ for ( Enumeration e = fileprops.keys(); e.hasMoreElements(); ) {
+ String name = ( String ) e.nextElement();
+ String value = fileprops.getProperty( name );
+
+ boolean resolved = false;
+ while ( !resolved ) {
+ Vector fragments = new Vector();
+ Vector propertyRefs = new Vector();
+ /// this is the Ant 1.5 way of doing it. The Ant 1.6 PropertyHelper
+ /// should be used -- eventually.
+ ProjectHelper.parsePropertyString( value, fragments,
+ propertyRefs );
+
+ resolved = true;
+ if ( propertyRefs.size() != 0 ) {
+ StringBuffer sb = new StringBuffer();
+ Enumeration i = fragments.elements();
+ Enumeration j = propertyRefs.elements();
+ while ( i.hasMoreElements() ) {
+ String fragment = ( String ) i.nextElement();
+ if ( fragment == null ) {
+ String propertyName = ( String ) j.nextElement();
+ if ( propertyName.equals( name ) ) {
+ throw new BuildException( "Property " + name
+ + " was circularly "
+ + "defined." );
+ }
+ fragment = getProject().getProperty( propertyName );
+ if ( fragment == null ) {
+ if ( fileprops.containsKey( propertyName ) ) {
+ fragment = fileprops.getProperty( propertyName );
+ resolved = false;
+ }
+ else {
+ fragment = "${" + propertyName + "}";
+ }
+ }
+ }
+ sb.append( fragment );
+ }
+ value = sb.toString();
+ fileprops.put( name, value );
+ }
+ }
+ }
+ }
+
+ /**
+ * Represents a cookie. See RFC 2109 and 2965.
+ */
+ public class Cookie {
+ private String name;
+ private String value;
+ private String domain;
+ private String path = "/";
+ private String id;
+
+ /**
+ * @param raw the raw string abstracted from the header of an http response
+ * for a single cookie.
+ */
+ public Cookie( String raw ) {
+ String[] args = raw.split( "[;]" );
+ for ( int i = 0; i < args.length; i++ ) {
+ String part = args[ i ];
+ int eq_index = part.indexOf("=");
+ if (eq_index == -1)
+ continue;
+ String first_part = part.substring(0, eq_index).trim();
+ String second_part = part.substring(eq_index + 1);
+ if ( i == 0 ) {
+ name = first_part;
+ value = second_part;
+ }
+ else if ( first_part.equalsIgnoreCase( "Path" ) )
+ path = second_part;
+ else if ( first_part.equalsIgnoreCase( "Domain" ) )
+ domain = second_part;
+ }
+ if (name == null)
+ throw new IllegalArgumentException("Raw cookie does not contain a cookie name.");
+ if (path == null)
+ path = "/";
+ setId(path, name);
+ }
+
+ /**
+ * @param name name of the cookie
+ * @param value the value of the cookie
+ */
+ public Cookie( String name, String value ) {
+ if (name == null)
+ throw new IllegalArgumentException("Cookie name may not be null.");
+
+ this.name = name;
+ this.value = value;
+ setId(name);
+ }
+
+ /**
+ * @return the id of the cookie, used internally by Post to store the cookie
+ * in a hashtable.
+ */
+ public String getId() {
+ if (id == null)
+ setId(path, name);
+ return id.toString();
+ }
+
+ private void setId(String name) {
+ setId(path, name);
+ }
+
+ private void setId(String path, String name) {
+ if (name == null)
+ name = "";
+ id = path + name;
+ }
+
+ /**
+ * @return the name of the cookie
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return the value of the cookie
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * @param domain the domain of the cookie
+ */
+ public void setDomain( String domain ) {
+ this.domain = domain;
+ }
+
+ /**
+ * @return the domain of the cookie
+ */
+ public String getDomain() {
+ return domain;
+ }
+
+ /**
+ * @param path the path of the cookie
+ */
+ public void setPath( String path ) {
+ this.path = path;
+ }
+
+ /**
+ * @return the path of the cookie
+ */
+ public String getPath() {
+ return path;
+ }
+
+ /**
+ * @return a Cookie formatted as a Cookie Version 1 string. The returned
+ * string is suitable for including with an http request.
+ */
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append( name ).append( "=" ).append( value ).append( ";" );
+ if ( domain != null )
+ sb.append( "Domain=" ).append( domain ).append( ";" );
+ if ( path != null )
+ sb.append( "Path=" ).append( path ).append( ";" );
+ sb.append( "Version=\"1\";" );
+ return sb.toString();
+ }
+ }
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1f/f08e6a88c5cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/1f/f08e6a88c5cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..0fd258c
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/1f/f08e6a88c5cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,401 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.Resource;
+import org.apache.tools.ant.types.ResourceCollection;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ * @author Matt Inger
+ * @ant.task name=for
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+ private List resourceCollections = new ArrayList();
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ public void add(ResourceCollection resourceCollection) {
+ this.resourceCollections.add(resourceCollection);
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && resourceCollections.isEmpty() && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or resources or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ Iterator it = resourceCollections.iterator();
+ while (it.hasNext()) {
+ ResourceCollection c = (ResourceCollection) it.next();
+ Iterator rit = c.iterator();
+ while (rit.hasNext()) {
+ Resource r = (Resource) rit.next();
+ doToken(r.toString());
+ }
+ }
+
+ it = hasIterators.iterator();
+ while (it.hasNext()) {
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/20/701d27e5e3cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/20/701d27e5e3cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..67c6f76
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/20/701d27e5e3cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.ant16;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import net.sf.antcontrib.logic.condition.BooleanConditionBase;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Exit;
+import org.apache.tools.ant.taskdefs.Sequential;
+import org.apache.tools.ant.taskdefs.condition.Condition;
+import org.apache.tools.ant.taskdefs.condition.ConditionBase;
+import org.apache.tools.ant.taskdefs.condition.Equals;
+
+
+/**
+ *
+ * @ant.task name="assert"
+ */
+public class Assert
+ extends ConditionBase {
+
+ private List tasks = new ArrayList();
+ private String message;
+ private boolean failOnError = true;
+ private boolean execute = true;
+ private Sequential sequential;
+ private String name;
+ private String value;
+
+ public Sequential createSequential() {
+ this.sequential = (Sequential) getProject().createTask("sequential");
+ return this.sequential;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public BooleanConditionBase createBool() {
+ return this;
+ }
+
+ public void setExecute(boolean execute) {
+ this.execute = execute;
+ }
+
+ public void setFailOnError(boolean failOnError) {
+ this.failOnError = failOnError;
+ }
+
+ public void execute() {
+ String value = getProject().getProperty("ant.enable.asserts");
+ boolean assertsEnabled = Project.toBoolean(value);
+
+ if (assertsEnabled) {
+ if (name != null) {
+ if (value == null) {
+ throw new BuildException("The 'value' attribute must accompany the 'name' attribute.");
+ }
+ String propVal = getProject().replaceProperties("${" + name + "}");
+ Equals e = new Equals();
+ e.setArg1(propVal);
+ e.setArg2(value);
+ addEquals(e);
+ }
+
+ if (countConditions() == 0) {
+ throw new BuildException("There is no condition specified.");
+ }
+ else if (countConditions() > 1) {
+ throw new BuildException("There must be exactly one condition specified.");
+ }
+
+ Condition c = (Condition) getConditions().nextElement();
+ if (! c.eval()) {
+ if (failOnError) {
+ Exit fail = (Exit) getProject().createTask("fail");
+ fail.setMessage(message);
+ fail.execute();
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/22/5008a93bd7cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/22/5008a93bd7cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..d8a15a1
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/22/5008a93bd7cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,6 @@
+<XDtClass:forAllClasses>
+ <XDtClass:ifHasClassTag tagName="ant:task" paramName="name">
+ <XDtClass:classTagValue tagName="ant:task" paramName="name"/>=<XDtClass:fullClassName />
+ </XDtClass:ifHasClassTag>
+</XDtClass:forAllClasses>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/23/1018ad0fe9cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/23/1018ad0fe9cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..d6c4b44
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/23/1018ad0fe9cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,213 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.URI;
+import org.apache.commons.httpclient.URIException;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.Property;
+import org.apache.tools.ant.util.FileUtils;
+
+public abstract class AbstractMethodTask
+ extends Task {
+
+ private HttpMethodBase method;
+ private File responseDataFile;
+ private String responseDataProperty;
+ private String statusCodeProperty;
+ private HttpClient httpClient;
+ private List responseHeaders = new ArrayList();
+
+ public static class ResponseHeader {
+ private String name;
+ private String property;
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getProperty() {
+ return property;
+ }
+ public void setProperty(String property) {
+ this.property = property;
+ }
+ }
+
+ protected abstract HttpMethodBase createNewMethod();
+ protected void configureMethod(HttpMethodBase method) {
+ }
+ protected void cleanupResources(HttpMethodBase method) {
+ }
+
+ public void addConfiguredResponseHeader(ResponseHeader responseHeader) {
+ this.responseHeaders.add(responseHeader);
+ }
+
+ public void addConfiguredHttpClient(HttpClientType httpClientType) {
+ this.httpClient = httpClientType.getClient();
+ }
+
+ protected HttpMethodBase createMethodIfNecessary() {
+ if (method == null) {
+ method = createNewMethod();
+ }
+ return method;
+ }
+
+ public void setResponseDataFile(File responseDataFile) {
+ this.responseDataFile = responseDataFile;
+ }
+
+ public void setResponseDataProperty(String responseDataProperty) {
+ this.responseDataProperty = responseDataProperty;
+ }
+
+ public void setStatusCodeProperty(String statusCodeProperty) {
+ this.statusCodeProperty = statusCodeProperty;
+ }
+
+ public void setClientRefId(String clientRefId) {
+ Object clientRef = getProject().getReference(clientRefId);
+ if (clientRef == null) {
+ throw new BuildException("Reference '" + clientRefId + "' does not exist.");
+ }
+ if (! (clientRef instanceof HttpClientType)) {
+ throw new BuildException("Reference '" + clientRefId + "' is of the wrong type.");
+ }
+ httpClient = ((HttpClientType) clientRef).getClient();
+ }
+
+ public void setDoAuthentication(boolean doAuthentication) {
+ createMethodIfNecessary().setDoAuthentication(doAuthentication);
+ }
+
+ public void setFollowRedirects(boolean doFollowRedirects) {
+ createMethodIfNecessary().setFollowRedirects(doFollowRedirects);
+ }
+
+ public void addConfiguredParams(MethodParams params) {
+ createMethodIfNecessary().setParams(params);
+ }
+
+ public void setPath(String path) {
+ createMethodIfNecessary().setPath(path);
+ }
+
+ public void setURL(String url) {
+ try {
+ createMethodIfNecessary().setURI(new URI(url, false));
+ }
+ catch (URIException e) {
+ throw new BuildException(e);
+ }
+ }
+
+ public void setQueryString(String queryString) {
+ createMethodIfNecessary().setQueryString(queryString);
+ }
+
+ public void addConfiguredHeader(Header header) {
+ createMethodIfNecessary().setRequestHeader(header);
+ }
+
+ public void execute() throws BuildException {
+ if (httpClient == null) {
+ httpClient = new HttpClient();
+ }
+
+ HttpMethodBase method = createMethodIfNecessary();
+ configureMethod(method);
+ try {
+ int statusCode = httpClient.executeMethod(method);
+ if (statusCodeProperty != null) {
+ Property p = (Property)getProject().createTask("property");
+ p.setName(statusCodeProperty);
+ p.setValue(String.valueOf(statusCode));
+ p.perform();
+ }
+
+ Iterator it = responseHeaders.iterator();
+ while (it.hasNext()) {
+ ResponseHeader header = (ResponseHeader)it.next();
+ Property p = (Property)getProject().createTask("property");
+ p.setName(header.getProperty());
+ Header h = method.getResponseHeader(header.getName());
+ if (h != null && h.getValue() != null) {
+ p.setValue(h.getValue());
+ p.perform();
+ }
+
+ }
+ if (responseDataProperty != null) {
+ Property p = (Property)getProject().createTask("property");
+ p.setName(responseDataProperty);
+ p.setValue(method.getResponseBodyAsString());
+ p.perform();
+ }
+ else if (responseDataFile != null) {
+ FileOutputStream fos = null;
+ InputStream is = null;
+ try {
+ is = method.getResponseBodyAsStream();
+ fos = new FileOutputStream(responseDataFile);
+ byte buf[] = new byte[10*1024];
+ int read = 0;
+ while ((read = is.read(buf, 0, 10*1024)) != -1) {
+ fos.write(buf, 0, read);
+ }
+ }
+ finally {
+ try {
+ if (fos != null) {
+ fos.close();
+ }
+ }
+ catch (IOException e) {
+ ;
+ }
+ try {
+ if (is != null) {
+ is.close();
+ }
+ }
+ catch (IOException e) {
+ ;
+ }
+ }
+ }
+ }
+ catch (IOException e) {
+ throw new BuildException(e);
+ }
+ finally {
+ cleanupResources(method);
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/28/2068aab0e0cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/28/2068aab0e0cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..e1d59e9
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/28/2068aab0e0cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,3 @@
+<XDtClass:forAllClasses><XDtClass:ifHasClassTag tagName="ant:task"
+><XDtClass:classTagValue tagName="ant:task" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag></XDtClass:forAllClasses> \ No newline at end of file
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/29/d05b2f38e0cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/29/d05b2f38e0cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..d1231af
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/29/d05b2f38e0cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.property;
+
+import java.io.File;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.util.FileUtils;
+
+public class PathToFileSet
+ extends Task
+{
+ private File dir;
+ private String name;
+ private String pathRefId;
+ private boolean ignoreNonRelative = false;
+
+ private static FileUtils fileUtils = FileUtils.newFileUtils();
+
+ public void setDir(File dir) {
+ this.dir = dir;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setPathRefId(String pathRefId) {
+ this.pathRefId = pathRefId;
+ }
+
+ public void setIgnoreNonRelative(boolean ignoreNonRelative) {
+ this.ignoreNonRelative = ignoreNonRelative;
+ }
+
+ public void execute() {
+ if (dir == null)
+ throw new BuildException("missing dir");
+ if (name == null)
+ throw new BuildException("missing name");
+ if (pathRefId == null)
+ throw new BuildException("missing pathrefid");
+
+ if (! dir.isDirectory())
+ throw new BuildException(
+ dir.toString() + " is not a directory");
+
+ Object path = getProject().getReference(pathRefId);
+ if (path == null)
+ throw new BuildException("Unknown reference " + pathRefId);
+ if (! (path instanceof Path))
+ throw new BuildException(pathRefId + " is not a path");
+
+
+ String[] sources = ((Path) path).list();
+
+ FileSet fileSet = new FileSet();
+ fileSet.setProject(getProject());
+ fileSet.setDir(dir);
+ String dirNormal =
+ fileUtils.normalize(dir.getAbsolutePath()).getAbsolutePath();
+ if (! dirNormal.endsWith(File.separator)) {
+ dirNormal += File.separator;
+ }
+
+
+ boolean atLeastOne = false;
+ for (int i = 0; i < sources.length; ++i) {
+ File sourceFile = new File(sources[i]);
+ if (! sourceFile.exists())
+ continue;
+ String relativeName = getRelativeName(dirNormal, sourceFile);
+ if (relativeName == null && !ignoreNonRelative) {
+ throw new BuildException(
+ sources[i] + " is not relative to " + dir.getAbsolutePath());
+ }
+ if (relativeName == null)
+ continue;
+ fileSet.createInclude().setName(relativeName);
+ atLeastOne = true;
+ }
+
+ if (! atLeastOne) {
+ // need to make an empty fileset
+ fileSet.createInclude().setName("a:b:c:d//THis si &&& not a file !!! ");
+ }
+ getProject().addReference(name, fileSet);
+ }
+
+ private String getRelativeName(String dirNormal, File file) {
+ String fileNormal =
+ fileUtils.normalize(file.getAbsolutePath()).getAbsolutePath();
+ if (! fileNormal.startsWith(dirNormal))
+ return null;
+ return fileNormal.substring(dirNormal.length());
+ }
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2b/b0a325dfe3cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/2b/b0a325dfe3cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..3e126d4
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/2b/b0a325dfe3cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.ant16;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import net.sf.antcontrib.logic.condition.BooleanConditionBase;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.ProjectHelper;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.TaskContainer;
+import org.apache.tools.ant.taskdefs.Exit;
+import org.apache.tools.ant.taskdefs.Sequential;
+import org.apache.tools.ant.taskdefs.condition.Condition;
+import org.apache.tools.ant.taskdefs.condition.Equals;
+
+
+/**
+ *
+ * @ant.task name="assert"
+ */
+public class Assert
+ extends BooleanConditionBase {
+
+ private List tasks = new ArrayList();
+ private String message;
+ private boolean failOnError = true;
+ private boolean execute = true;
+ private Sequential sequential;
+ private String name;
+ private String value;
+
+ public Sequential createSequential() {
+ this.sequential = (Sequential) getProject().createTask("sequential");
+ return this.sequential;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public BooleanConditionBase createBool() {
+ return this;
+ }
+
+ public void setExecute(boolean execute) {
+ this.execute = execute;
+ }
+
+ public void setFailOnError(boolean failOnError) {
+ this.failOnError = failOnError;
+ }
+
+ public void execute() {
+ String value = getProject().getProperty("ant.enable.asserts");
+ boolean assertsEnabled = Project.toBoolean(value);
+
+ if (assertsEnabled) {
+ if (name != null) {
+ if (value == null) {
+ throw new BuildException("The 'value' attribute must accompany the 'name' attribute.");
+ }
+ String propVal = getProject().replaceProperties("${" + name + "}");
+ Equals e = new Equals();
+ e.setArg1(propVal);
+ e.setArg2(value);
+ addEquals(e);
+ }
+
+ if (countConditions() == 0) {
+ throw new BuildException("There is no condition specified.");
+ }
+ else if (countConditions() > 1) {
+ throw new BuildException("There must be exactly one condition specified.");
+ }
+
+ Condition c = (Condition) getConditions().nextElement();
+ if (! c.eval()) {
+ if (failOnError) {
+ Exit fail = (Exit) getProject().createTask("fail");
+ fail.setMessage(message);
+ fail.execute();
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2d/60cebe1ce7cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/2d/60cebe1ce7cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..434f202
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/2d/60cebe1ce7cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.CallTarget;
+import org.apache.tools.ant.taskdefs.Property;
+
+/**
+ * Subclass of Ant which allows us to fetch
+ * properties which are set in the scope of the called
+ * target, and set them in the scope of the calling target.
+ * Normally, these properties are thrown away as soon as the
+ * called target completes execution.
+ *
+ * @author inger
+ * @author Dale Anson, [email protected]
+ * @ant.task name="antcallback"
+ */
+public class AntCallBack extends CallTarget {
+
+ /** the name of the property to fetch from the new project */
+ private String returnName = null;
+
+ private ProjectDelegate fakeProject = null;
+
+ public void setProject(Project realProject) {
+ fakeProject = new ProjectDelegate(realProject);
+ super.setProject(fakeProject);
+ }
+
+ /**
+ * Do the execution.
+ *
+ * @exception BuildException Description of the Exception
+ */
+ public void execute() throws BuildException {
+ super.execute();
+
+ // copy back the props if possible
+ if ( returnName != null ) {
+ StringTokenizer st = new StringTokenizer( returnName, "," );
+ while ( st.hasMoreTokens() ) {
+ String name = st.nextToken().trim();
+ String value = fakeProject.getSubproject().getUserProperty( name );
+ if ( value != null ) {
+ getProject().setUserProperty( name, value );
+ }
+ else {
+ value = fakeProject.getSubproject().getProperty( name );
+ if ( value != null ) {
+ getProject().setProperty( name, value );
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Set the property or properties that are set in the new project to be
+ * transfered back to the original project. As with all properties, if the
+ * property already exists in the original project, it will not be overridden
+ * by a different value from the new project.
+ *
+ * @param r the name of a property in the new project to set in the original
+ * project. This may be a comma separate list of properties.
+ */
+ public void setReturn( String r ) {
+ returnName = r;
+ }
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3/20302377c5cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/3/20302377c5cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..35e5c63
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/3/20302377c5cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,466 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ * @author Matt Inger
+ * @ant.task name=for
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private Path currPath;
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ private Path getOrCreatePath() {
+ if (currPath == null) {
+ currPath = new Path(getProject());
+ }
+ return currPath;
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfigured(Path path) {
+ getOrCreatePath().append(path);
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfiguredPath(Path path) {
+ addConfigured(path);
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && currPath == null && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or path or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ // Take Care of the path element
+ String[] pathElements = new String[0];
+ if (currPath != null) {
+ pathElements = currPath.list();
+ }
+ for (int i = 0; i < pathElements.length; i++) {
+ File nextFile = new File(pathElements[i]);
+ doToken(nextFile.getAbsolutePath());
+ }
+
+ // Take care of iterators
+ for (Iterator i = hasIterators.iterator(); i.hasNext();) {
+ Iterator it = ((HasIterator) i.next()).iterator();
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void add(FileSet fileset) {
+ getOrCreatePath().addFileset(fileset);
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void addFileSet(FileSet fileset) {
+ add(fileset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void add(DirSet dirset) {
+ getOrCreatePath().addDirset(dirset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void addDirSet(DirSet dirset) {
+ add(dirset);
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3/6012a90ee5cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/3/6012a90ee5cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..e51c5f5
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/3/6012a90ee5cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Ant;
+
+/**
+ * Subclass of CallTarget which allows us to fetch
+ * properties which are set in the scope of the called
+ * target, and set them in the scope of the calling target.
+ * Normally, these properties are thrown away as soon as the
+ * called target completes execution.
+ *
+ * @author inger
+ * @author Dale Anson, [email protected]
+ * @ant.task name="antfetch"
+ */
+public class AntFetch extends Ant {
+ /** the name of the property to fetch from the new project */
+ private String returnName = null;
+
+ private ProjectDelegate fakeProject = null;
+
+ public void setProject(Project realProject) {
+ fakeProject = new ProjectDelegate(realProject);
+ super.setProject(fakeProject);
+ }
+
+ /**
+ * Do the execution.
+ *
+ * @exception BuildException Description of the Exception
+ */
+ public void execute() throws BuildException {
+ super.execute();
+
+ // copy back the props if possible
+ if ( returnName != null ) {
+ StringTokenizer st = new StringTokenizer( returnName, "," );
+ while ( st.hasMoreTokens() ) {
+ String name = st.nextToken().trim();
+ String value = fakeProject.getSubproject().getUserProperty( name );
+ if ( value != null ) {
+ getProject().setUserProperty( name, value );
+ }
+ else {
+ value = fakeProject.getSubproject().getProperty( name );
+ if ( value != null ) {
+ getProject().setProperty( name, value );
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Set the property or properties that are set in the new project to be
+ * transfered back to the original project. As with all properties, if the
+ * property already exists in the original project, it will not be overridden
+ * by a different value from the new project.
+ *
+ * @param r the name of a property in the new project to set in the original
+ * project. This may be a comma separate list of properties.
+ */
+ public void setReturn( String r ) {
+ returnName = r;
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3/d00f403ce5cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/3/d00f403ce5cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..434f202
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/3/d00f403ce5cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.CallTarget;
+import org.apache.tools.ant.taskdefs.Property;
+
+/**
+ * Subclass of Ant which allows us to fetch
+ * properties which are set in the scope of the called
+ * target, and set them in the scope of the calling target.
+ * Normally, these properties are thrown away as soon as the
+ * called target completes execution.
+ *
+ * @author inger
+ * @author Dale Anson, [email protected]
+ * @ant.task name="antcallback"
+ */
+public class AntCallBack extends CallTarget {
+
+ /** the name of the property to fetch from the new project */
+ private String returnName = null;
+
+ private ProjectDelegate fakeProject = null;
+
+ public void setProject(Project realProject) {
+ fakeProject = new ProjectDelegate(realProject);
+ super.setProject(fakeProject);
+ }
+
+ /**
+ * Do the execution.
+ *
+ * @exception BuildException Description of the Exception
+ */
+ public void execute() throws BuildException {
+ super.execute();
+
+ // copy back the props if possible
+ if ( returnName != null ) {
+ StringTokenizer st = new StringTokenizer( returnName, "," );
+ while ( st.hasMoreTokens() ) {
+ String name = st.nextToken().trim();
+ String value = fakeProject.getSubproject().getUserProperty( name );
+ if ( value != null ) {
+ getProject().setUserProperty( name, value );
+ }
+ else {
+ value = fakeProject.getSubproject().getProperty( name );
+ if ( value != null ) {
+ getProject().setProperty( name, value );
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Set the property or properties that are set in the new project to be
+ * transfered back to the original project. As with all properties, if the
+ * property already exists in the original project, it will not be overridden
+ * by a different value from the new project.
+ *
+ * @param r the name of a property in the new project to set in the original
+ * project. This may be a comma separate list of properties.
+ */
+ public void setReturn( String r ) {
+ returnName = r;
+ }
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/31/30b24831e0cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/31/30b24831e0cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..9547923
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/31/30b24831e0cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.property;
+
+import java.io.File;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileList;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.selectors.OrSelector;
+
+public class PathFilterTask
+ extends Task {
+
+ private OrSelector select;
+ private Path path;
+ private String pathid;
+
+
+ public void setPathId(String pathid) {
+ this.pathid = pathid;
+ }
+
+ public OrSelector createSelect() {
+ select = new OrSelector();
+ return select;
+ }
+
+ public void addConfiguredFileSet(FileSet fileset) {
+ if (this.path == null) {
+ this.path = (Path)getProject().createDataType("path");
+ }
+ this.path.addFileset(fileset);
+ }
+
+ public void addConfiguredDirSet(DirSet dirset) {
+ if (this.path == null) {
+ this.path = (Path)getProject().createDataType("path");
+ }
+ this.path.addDirset(dirset);
+ }
+
+ public void addConfiguredFileList(FileList filelist) {
+ if (this.path == null) {
+ this.path = (Path)getProject().createDataType("path");
+ }
+ this.path.addFilelist(filelist);
+ }
+
+ public void addConfiguredPath(Path path) {
+ if (this.path == null) {
+ this.path = (Path)getProject().createDataType("path");
+ }
+ this.path.add(path);
+ }
+
+
+ public void execute() throws BuildException {
+ if (select == null) {
+ throw new BuildException("A <select> element must be specified.");
+ }
+
+ if (pathid == null) {
+ throw new BuildException("A 'pathid' attribute must be specified.");
+ }
+
+ Path selectedFiles = (Path)getProject().createDataType("path");
+
+ if (this.path != null) {
+ String files[] = this.path.list();
+ for (int i=0;i<files.length;i++) {
+ File file = new File(files[i]);
+ if (select.isSelected(file.getParentFile(),
+ file.getName(),
+ file)) {
+ selectedFiles.createPathElement().setLocation(file);
+ }
+ }
+
+ getProject().addReference(pathid, selectedFiles);
+ }
+ }
+
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/33/a0869d8ae8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/33/a0869d8ae8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..82f3e08
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/33/a0869d8ae8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.condition;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.condition.IsFalse;
+
+/**
+ * Extends IsFalse condition to check the value of a specified property.
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ *
+ * @author Dale Anson, [email protected]
+ * @version $Revision: 1.3 $
+ * @ant.type name="ispropertyfalse"
+ */
+public class IsPropertyFalse extends IsFalse {
+
+ private String name = null;
+
+ public void setProperty(String name) {
+ this.name = name;
+ }
+
+ public boolean eval() throws BuildException {
+ if (name == null)
+ throw new BuildException("Property name must be set.");
+ String value = getProject().getProperty(name);
+ if (value == null)
+ return true;
+ return !getProject().toBoolean(value);
+ }
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/34/00c3242ce7cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/34/00c3242ce7cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..dedd277
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/34/00c3242ce7cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.CallTarget;
+import org.apache.tools.ant.taskdefs.Property;
+
+/**
+ * Subclass of Ant which allows us to fetch
+ * properties which are set in the scope of the called
+ * target, and set them in the scope of the calling target.
+ * Normally, these properties are thrown away as soon as the
+ * called target completes execution.
+ *
+ * @author inger
+ * @author Dale Anson, [email protected]
+ * @ant.task name="antcallback"
+ */
+public class AntCallBack extends CallTarget {
+
+ /** the name of the property to fetch from the new project */
+ private String returnName = null;
+
+ /**
+ * Do the execution.
+ *
+ * @exception BuildException Description of the Exception
+ */
+ public void execute() throws BuildException {
+ super.execute();
+
+ // copy back the props if possible
+ if ( returnName != null ) {
+ StringTokenizer st = new StringTokenizer( returnName, "," );
+ while ( st.hasMoreTokens() ) {
+ String name = st.nextToken().trim();
+ String value = fakeProject.getSubproject().getUserProperty( name );
+ if ( value != null ) {
+ getProject().setUserProperty( name, value );
+ }
+ else {
+ value = fakeProject.getSubproject().getProperty( name );
+ if ( value != null ) {
+ getProject().setProperty( name, value );
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Set the property or properties that are set in the new project to be
+ * transfered back to the original project. As with all properties, if the
+ * property already exists in the original project, it will not be overridden
+ * by a different value from the new project.
+ *
+ * @param r the name of a property in the new project to set in the original
+ * project. This may be a comma separate list of properties.
+ */
+ public void setReturn( String r ) {
+ returnName = r;
+ }
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/36/f0c7c8fadecc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/36/f0c7c8fadecc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..14f31ec
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/36/f0c7c8fadecc001b1cb5d1e6b2b8577e
@@ -0,0 +1,207 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.Sequential;
+
+/***
+ * Task definition for the ANT task to switch on a particular value.
+ *
+ * <pre>
+ *
+ * Usage:
+ *
+ * Task declaration in the project:
+ * <code>
+ * &lt;taskdef name="switch" classname="net.sf.antcontrib.logic.Switch" /&gt;
+ * </code>
+ *
+ * Task calling syntax:
+ * <code>
+ * &lt;switch value="value" [caseinsensitive="true|false"] &gt;
+ * &lt;case value="val"&gt;
+ * &lt;property name="propname" value="propvalue" /&gt; |
+ * &lt;antcall target="targetname" /&gt; |
+ * any other tasks
+ * &lt;/case&gt;
+ * [
+ * &lt;default&gt;
+ * &lt;property name="propname" value="propvalue" /&gt; |
+ * &lt;antcall target="targetname" /&gt; |
+ * any other tasks
+ * &lt;/default&gt;
+ * ]
+ * &lt;/switch&gt;
+ * </code>
+ *
+ *
+ * Attributes:
+ * value -&gt; The value to switch on
+ * caseinsensitive -&gt; Should we do case insensitive comparisons?
+ * (default is false)
+ *
+ * Subitems:
+ * case --&gt; An individual case to consider, if the value that
+ * is being switched on matches to value attribute of
+ * the case, then the nested tasks will be executed.
+ * default --&gt; The default case for when no match is found.
+ *
+ *
+ * Crude Example:
+ *
+ * <code>
+ * &lt;switch value=&quot;${foo}&quot;&gt;
+ * &lt;case value=&quot;bar&quot;&gt;
+ * &lt;echo message=&quot;The value of property foo is bar&quot; /&gt;
+ * &lt;/case&gt;
+ * &lt;case value=&quot;baz&quot;&gt;
+ * &lt;echo message=&quot;The value of property foo is baz&quot; /&gt;
+ * &lt;/case&gt;
+ * &lt;default&gt;
+ * &lt;echo message=&quot;The value of property foo is not sensible&quot; /&gt;
+ * &lt;/default&gt;
+ * &lt;/switch&gt;
+ * </code>
+ *
+ * </pre>
+ *
+ * @author <a href="mailto:[email protected]">Matthew Inger</a>
+ * @author <a href="mailto:[email protected]">Stefan Bodewig</a>
+ */
+public class Switch extends Task
+{
+ private String value;
+ private Vector cases;
+ private Sequential defaultCase;
+ private boolean caseInsensitive;
+
+ /***
+ * Default Constructor
+ */
+ public Switch()
+ {
+ cases = new Vector();
+ }
+
+ public void execute()
+ throws BuildException
+ {
+ if (value == null)
+ throw new BuildException("Value is missing");
+ if (cases.size() == 0 && defaultCase == null)
+ throw new BuildException("No cases supplied");
+
+ Sequential selectedCase = defaultCase;
+
+ int sz = cases.size();
+ for (int i=0;i<sz;i++)
+ {
+ Case c = (Case)(cases.elementAt(i));
+
+ String cvalue = c.value;
+ if (cvalue == null) {
+ throw new BuildException("Value is required for case.");
+ }
+ String mvalue = value;
+
+ if (caseInsensitive)
+ {
+ cvalue = cvalue.toUpperCase();
+ mvalue = mvalue.toUpperCase();
+ }
+
+ if (cvalue.equals(mvalue) && c != defaultCase)
+ selectedCase = c;
+ }
+
+ if (selectedCase == null) {
+ throw new BuildException("No case matched the value " + value
+ + " and no default has been specified.");
+ }
+ selectedCase.perform();
+ }
+
+ /***
+ * Sets the value being switched on
+ */
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+ public void setCaseInsensitive(boolean c)
+ {
+ caseInsensitive = c;
+ }
+
+ public final class Case extends Sequential
+ {
+ private String value;
+
+ public Case()
+ {
+ super();
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+ public void execute()
+ throws BuildException
+ {
+ super.execute();
+ }
+
+ public boolean equals(Object o)
+ {
+ boolean res = false;
+ Case c = (Case)o;
+ if (c.value.equals(value))
+ res = true;
+ return res;
+ }
+ }
+
+ /***
+ * Creates the &lt;case&gt; tag
+ */
+ public Switch.Case createCase()
+ throws BuildException
+ {
+ Switch.Case res = new Switch.Case();
+ cases.addElement(res);
+ return res;
+ }
+
+ /***
+ * Creates the &lt;default&gt; tag
+ */
+ public void addDefault(Sequential res)
+ throws BuildException
+ {
+ if (defaultCase != null)
+ throw new BuildException("Cannot specify multiple default cases");
+
+ defaultCase = res;
+ }
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/37/e0aa462ee2cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/37/e0aa462ee2cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..0aa4537
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/37/e0aa462ee2cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import org.apache.tools.ant.BuildException;
+
+/***
+ *
+ * @author minger
+ * @ant.task name="clearcredentials"
+ *
+ */
+public class ClearCredentialsTask
+ extends AbstractHttpStateTypeTask {
+
+ private boolean proxy = false;
+
+ public void setProxy(boolean proxy) {
+ this.proxy = proxy;
+ }
+
+ protected void execute(HttpStateType stateType) throws BuildException {
+ if (proxy) {
+ stateType.getState().clearProxyCredentials();
+ }
+ else {
+ stateType.getState().clearCredentials();
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3a/c04412f6decc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/3a/c04412f6decc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..c5937e9
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/3a/c04412f6decc001b1cb5d1e6b2b8577e
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+/**
+ * Ant task that runs a target without creating a new project.
+ *
+ * @author Nicola Ken Barozzi [email protected]
+ * @ant.task name="runtarget"
+ */
+public class RunTargetTask extends Task {
+
+ private String target = null;
+
+ /**
+ * The target attribute
+ *
+ * @param target the name of a target to execute
+ */
+ public void setTarget(String target) {
+ this.target = target;
+ }
+
+ /**
+ * execute the target
+ *
+ * @exception BuildException if a target is not specified
+ */
+ public void execute() throws BuildException {
+ if (target == null) {
+ throw new BuildException("target property required");
+ }
+
+ getProject().executeTarget(target);
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3a/e0bc1035c3cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/3a/e0bc1035c3cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..80eee29
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/3a/e0bc1035c3cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,465 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ * @author Matt Inger
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private Path currPath;
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ private Path getOrCreatePath() {
+ if (currPath == null) {
+ currPath = new Path(getProject());
+ }
+ return currPath;
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfigured(Path path) {
+ getOrCreatePath().append(path);
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfiguredPath(Path path) {
+ addConfigured(path);
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && currPath == null && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or path or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ // Take Care of the path element
+ String[] pathElements = new String[0];
+ if (currPath != null) {
+ pathElements = currPath.list();
+ }
+ for (int i = 0; i < pathElements.length; i++) {
+ File nextFile = new File(pathElements[i]);
+ doToken(nextFile.getAbsolutePath());
+ }
+
+ // Take care of iterators
+ for (Iterator i = hasIterators.iterator(); i.hasNext();) {
+ Iterator it = ((HasIterator) i.next()).iterator();
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void add(FileSet fileset) {
+ getOrCreatePath().addFileset(fileset);
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void addFileSet(FileSet fileset) {
+ add(fileset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void add(DirSet dirset) {
+ getOrCreatePath().addDirset(dirset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void addDirSet(DirSet dirset) {
+ add(dirset);
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3b/40e69c52dbcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/3b/40e69c52dbcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..4d538df
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/3b/40e69c52dbcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.sf.antcontrib.logic;
+
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.Sequential;
+import org.apache.tools.ant.taskdefs.condition.Condition;
+import org.apache.tools.ant.taskdefs.condition.ConditionBase;
+
+/**
+ * Perform some tasks based on whether a given condition holds true or
+ * not.
+ *
+ * <p>This task is heavily based on the Condition framework that can
+ * be found in Ant 1.4 and later, therefore it cannot be used in
+ * conjunction with versions of Ant prior to 1.4.</p>
+ *
+ * <p>This task doesn't have any attributes, the condition to test is
+ * specified by a nested element - see the documentation of your
+ * <code>&lt;condition&gt;</code> task (see
+ * <a href="http://jakarta.apache.org/ant/manual/CoreTasks/condition.html">the
+ * online documentation</a> for example) for a complete list of nested
+ * elements.</p>
+ *
+ * <p>Just like the <code>&lt;condition&gt;</code> task, only a single
+ * condition can be specified - you combine them using
+ * <code>&lt;and&gt;</code> or <code>&lt;or&gt;</code> conditions.</p>
+ *
+ * <p>In addition to the condition, you can specify three different
+ * child elements, <code>&lt;elseif&gt;</code>, <code>&lt;then&gt;</code> and
+ * <code>&lt;else&gt;</code>. All three subelements are optional.
+ *
+ * Both <code>&lt;then&gt;</code> and <code>&lt;else&gt;</code> must not be
+ * used more than once inside the if task. Both are
+ * containers for Ant tasks, just like Ant's
+ * <code>&lt;parallel&gt;</code> and <code>&lt;sequential&gt;</code>
+ * tasks - in fact they are implemented using the same class as Ant's
+ * <code>&lt;sequential&gt;</code> task.</p>
+ *
+ * The <code>&lt;elseif&gt;</code> behaves exactly like an <code>&lt;if&gt;</code>
+ * except that it cannot contain the <code>&lt;else&gt;</code> element
+ * inside of it. You may specify as may of these as you like, and the
+ * order they are specified is the order they are evaluated in. If the
+ * condition on the <code>&lt;if&gt;</code> is false, then the first
+ * <code>&lt;elseif&gt;</code> who's conditional evaluates to true
+ * will be executed. The <code>&lt;else&gt;</code> will be executed
+ * only if the <code>&lt;if&gt;</code> and all <code>&lt;elseif&gt;</code>
+ * conditions are false.
+ *
+ * <p>Use the following task to define the <code>&lt;if&gt;</code>
+ * task before you use it the first time:</p>
+ *
+ * <pre><code>
+ * &lt;taskdef name="if" classname="net.sf.antcontrib.logic.IfTask" /&gt;
+ * </code></pre>
+ *
+ * <h3>Crude Example</h3>
+ *
+ * <pre><code>
+ * &lt;if&gt;
+ * &lt;equals arg1=&quot;${foo}&quot; arg2=&quot;bar&quot; /&gt;
+ * &lt;then&gt;
+ * &lt;echo message=&quot;The value of property foo is bar&quot; /&gt;
+ * &lt;/then&gt;
+ * &lt;else&gt;
+ * &lt;echo message=&quot;The value of property foo is not bar&quot; /&gt;
+ * &lt;/else&gt;
+ * &lt;/if&gt;
+ * </code>
+ *
+ * <code>
+ * &lt;if&gt;
+ * &lt;equals arg1=&quot;${foo}&quot; arg2=&quot;bar&quot; /&gt;
+ * &lt;then&gt;
+ * &lt;echo message=&quot;The value of property foo is 'bar'&quot; /&gt;
+ * &lt;/then&gt;
+ *
+ * &lt;elseif&gt;
+ * &lt;equals arg1=&quot;${foo}&quot; arg2=&quot;foo&quot; /&gt;
+ * &lt;then&gt;
+ * &lt;echo message=&quot;The value of property foo is 'foo'&quot; /&gt;
+ * &lt;/then&gt;
+ * &lt;/elseif&gt;
+ *
+ * &lt;else&gt;
+ * &lt;echo message=&quot;The value of property foo is not 'foo' or 'bar'&quot; /&gt;
+ * &lt;/else&gt;
+ * &lt;/if&gt;
+ * </code></pre>
+ *
+ * @author <a href="mailto:[email protected]">Stefan Bodewig</a>
+ */
+public class IfTask extends ConditionBase {
+
+ public static final class ElseIf
+ extends ConditionBase
+ {
+ private Sequential thenTasks = null;
+
+ public void addThen(Sequential t)
+ {
+ if (thenTasks != null)
+ {
+ throw new BuildException("You must not nest more than one <then> into <elseif>");
+ }
+ thenTasks = t;
+ }
+
+ public boolean eval()
+ throws BuildException
+ {
+ if (countConditions() > 1) {
+ throw new BuildException("You must not nest more than one condition into <elseif>");
+ }
+ if (countConditions() < 1) {
+ throw new BuildException("You must nest a condition into <elseif>");
+ }
+ Condition c = (Condition) getConditions().nextElement();
+
+ return c.eval();
+ }
+
+ public void execute()
+ throws BuildException
+ {
+ if (thenTasks != null)
+ {
+ thenTasks.execute();
+ }
+ }
+ }
+
+ private Sequential thenTasks = null;
+ private Vector elseIfTasks = new Vector();
+ private Sequential elseTasks = null;
+
+ /***
+ * A nested Else if task
+ */
+ public void addElseIf(ElseIf ei)
+ {
+ elseIfTasks.addElement(ei);
+ }
+
+ /**
+ * A nested &lt;then&gt; element - a container of tasks that will
+ * be run if the condition holds true.
+ *
+ * <p>Not required.</p>
+ */
+ public void addThen(Sequential t) {
+ if (thenTasks != null) {
+ throw new BuildException("You must not nest more than one <then> into <if>");
+ }
+ thenTasks = t;
+ }
+
+ /**
+ * A nested &lt;else&gt; element - a container of tasks that will
+ * be run if the condition doesn't hold true.
+ *
+ * <p>Not required.</p>
+ */
+ public void addElse(Sequential e) {
+ if (elseTasks != null) {
+ throw new BuildException("You must not nest more than one <else> into <if>");
+ }
+ elseTasks = e;
+ }
+
+ public void execute() throws BuildException {
+ if (countConditions() > 1) {
+ throw new BuildException("You must not nest more than one condition into <if>");
+ }
+ if (countConditions() < 1) {
+ throw new BuildException("You must nest a condition into <if>");
+ }
+ Condition c = (Condition) getConditions().nextElement();
+ if (c.eval()) {
+ if (thenTasks != null) {
+ thenTasks.execute();
+ }
+ }
+ else
+ {
+ boolean done = false;
+ int sz = elseIfTasks.size();
+ for (int i=0;i<sz && ! done;i++)
+ {
+
+ ElseIf ei = (ElseIf)(elseIfTasks.elementAt(i));
+ if (ei.eval())
+ {
+ done = true;
+ ei.execute();
+ }
+ }
+
+ if (!done && elseTasks != null)
+ {
+ elseTasks.execute();
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3c/a09ea1dce8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/3c/a09ea1dce8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..1cb65cd
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/3c/a09ea1dce8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.URI;
+import org.apache.commons.httpclient.URIException;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.Property;
+import org.apache.tools.ant.util.FileUtils;
+
+public abstract class AbstractMethodTask
+ extends Task {
+
+ private HttpMethodBase method;
+ private File responseDataFile;
+ private String responseDataProperty;
+ private String statusCodeProperty;
+ private HttpClient httpClient;
+ private List responseHeaders = new ArrayList();
+
+ public static class ResponseHeader {
+ private String name;
+ private String property;
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getProperty() {
+ return property;
+ }
+ public void setProperty(String property) {
+ this.property = property;
+ }
+ }
+
+ protected abstract HttpMethodBase createNewMethod();
+ protected void configureMethod(HttpMethodBase method) {
+ }
+ protected void cleanupResources(HttpMethodBase method) {
+ }
+
+ public void addConfiguredResponseHeader(ResponseHeader responseHeader) {
+ this.responseHeaders.add(responseHeader);
+ }
+
+ public void addConfiguredHttpClient(HttpClientType httpClientType) {
+ this.httpClient = httpClientType.getClient();
+ }
+
+ protected HttpMethodBase createMethodIfNecessary() {
+ if (method == null) {
+ method = createNewMethod();
+ }
+ return method;
+ }
+
+ public void setResponseDataFile(File responseDataFile) {
+ this.responseDataFile = responseDataFile;
+ }
+
+ public void setResponseDataProperty(String responseDataProperty) {
+ this.responseDataProperty = responseDataProperty;
+ }
+
+ public void setStatusCodeProperty(String statusCodeProperty) {
+ this.statusCodeProperty = statusCodeProperty;
+ }
+
+ public void setClientRefId(String clientRefId) {
+ Object clientRef = getProject().getReference(clientRefId);
+ if (clientRef == null) {
+ throw new BuildException("Reference '" + clientRefId + "' does not exist.");
+ }
+ if (! (clientRef instanceof HttpClientType)) {
+ throw new BuildException("Reference '" + clientRefId + "' is of the wrong type.");
+ }
+ httpClient = ((HttpClientType) clientRef).getClient();
+ }
+
+ public void setDoAuthentication(boolean doAuthentication) {
+ createMethodIfNecessary().setDoAuthentication(doAuthentication);
+ }
+
+ public void setFollowRedirects(boolean doFollowRedirects) {
+ createMethodIfNecessary().setFollowRedirects(doFollowRedirects);
+ }
+
+ public void addConfiguredParams(MethodParams params) {
+ createMethodIfNecessary().setParams(params);
+ }
+
+ public void setPath(String path) {
+ createMethodIfNecessary().setPath(path);
+ }
+
+ public void setURL(String url) {
+ try {
+ createMethodIfNecessary().setURI(new URI(url, false));
+ }
+ catch (URIException e) {
+ throw new BuildException(e);
+ }
+ }
+
+ public void setQueryString(String queryString) {
+ createMethodIfNecessary().setQueryString(queryString);
+ }
+
+ public void addConfiguredHeader(Header header) {
+ createMethodIfNecessary().setRequestHeader(header);
+ }
+
+ public void execute() throws BuildException {
+ if (httpClient == null) {
+ httpClient = new HttpClient();
+ }
+
+ HttpMethodBase method = createMethodIfNecessary();
+ configureMethod(method);
+ try {
+ int statusCode = httpClient.executeMethod(method);
+ if (statusCodeProperty != null) {
+ Property p = (Property)getProject().createTask("property");
+ p.setName(statusCodeProperty);
+ p.setValue(String.valueOf(statusCode));
+ p.perform();
+ }
+
+ Iterator it = responseHeaders.iterator();
+ while (it.hasNext()) {
+ ResponseHeader header = (ResponseHeader)it.next();
+ Property p = (Property)getProject().createTask("property");
+ p.setName(header.getProperty());
+ Header h = method.getResponseHeader(header.getName());
+ if (h != null && h.getValue() != null) {
+ p.setValue(h.getValue());
+ p.perform();
+ }
+
+ }
+ if (responseDataProperty != null) {
+ Property p = (Property)getProject().createTask("property");
+ p.setName(responseDataProperty);
+ p.setValue(method.getResponseBodyAsString());
+ p.perform();
+ }
+ else if (responseDataFile != null) {
+ FileOutputStream fos = null;
+ InputStream is = null;
+ try {
+ is = method.getResponseBodyAsStream();
+ fos = new FileOutputStream(responseDataFile);
+ byte buf[] = new byte[10*1024];
+ int read = 0;
+ while ((read = is.read(buf, 0, 10*1024)) != -1) {
+ fos.write(buf, 0, read);
+ }
+ }
+ finally {
+ FileUtils.close(fos);
+ FileUtils.close(is);
+ }
+ }
+ }
+ catch (IOException e) {
+ throw new BuildException(e);
+ }
+ finally {
+ cleanupResources(method);
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3e/b074f67ac4cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/3e/b074f67ac4cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..314fcb0
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/3e/b074f67ac4cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,439 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.ResourceCollection;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ * @author Matt Inger
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+ private List resourceCollections = new ArrayList();
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ public void add(ResourceCollection resourceCollection) {
+ this.resourceCollections.add(resourceCollection);
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && resourceCollections.isEmpty() && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or resources or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ // Take Care of the path element
+ String[] pathElements = new String[0];
+ if (currPath != null) {
+ pathElements = currPath.list();
+ }
+ for (int i = 0; i < pathElements.length; i++) {
+ File nextFile = new File(pathElements[i]);
+ doToken(nextFile.getAbsolutePath());
+ }
+
+ // Take care of iterators
+ for (Iterator i = hasIterators.iterator(); i.hasNext();) {
+ Iterator it = ((HasIterator) i.next()).iterator();
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void add(FileSet fileset) {
+ getOrCreatePath().addFileset(fileset);
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void addFileSet(FileSet fileset) {
+ add(fileset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void add(DirSet dirset) {
+ getOrCreatePath().addDirset(dirset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void addDirSet(DirSet dirset) {
+ add(dirset);
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3f/a05c7330e7cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/3f/a05c7330e7cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..f5e2553
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/3f/a05c7330e7cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,391 @@
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import org.apache.tools.ant.AntClassLoader;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildListener;
+import org.apache.tools.ant.Executor;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Target;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.input.InputHandler;
+import org.apache.tools.ant.types.FilterSet;
+import org.apache.tools.ant.types.Path;
+
+public class ProjectDelegate
+extends Project {
+
+ private Project delegate;
+ private Project subproject;
+
+ public ProjectDelegate(Project delegate) {
+ super();
+ this.delegate = delegate;
+ }
+
+ public Project getSubproject() {
+ return subproject;
+ }
+
+ public void addBuildListener(BuildListener arg0) {
+ delegate.addBuildListener(arg0);
+ }
+
+ public void addDataTypeDefinition(String arg0, Class arg1) {
+ delegate.addDataTypeDefinition(arg0, arg1);
+ }
+
+ public void addFilter(String arg0, String arg1) {
+ delegate.addFilter(arg0, arg1);
+ }
+
+ public void addOrReplaceTarget(String arg0, Target arg1) {
+ delegate.addOrReplaceTarget(arg0, arg1);
+ }
+
+ public void addOrReplaceTarget(Target arg0) {
+ delegate.addOrReplaceTarget(arg0);
+ }
+
+ public void addReference(String arg0, Object arg1) {
+ delegate.addReference(arg0, arg1);
+ }
+
+ public void addTarget(String arg0, Target arg1) throws BuildException {
+ delegate.addTarget(arg0, arg1);
+ }
+
+ public void addTarget(Target arg0) throws BuildException {
+ delegate.addTarget(arg0);
+ }
+
+ public void addTaskDefinition(String arg0, Class arg1) throws BuildException {
+ delegate.addTaskDefinition(arg0, arg1);
+ }
+
+ public void checkTaskClass(Class arg0) throws BuildException {
+ delegate.checkTaskClass(arg0);
+ }
+
+ public void copyFile(File arg0, File arg1, boolean arg2, boolean arg3, boolean arg4) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2, arg3, arg4);
+ }
+
+ public void copyFile(File arg0, File arg1, boolean arg2, boolean arg3) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2, arg3);
+ }
+
+ public void copyFile(File arg0, File arg1, boolean arg2) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2);
+ }
+
+ public void copyFile(File arg0, File arg1) throws IOException {
+ delegate.copyFile(arg0, arg1);
+ }
+
+ public void copyFile(String arg0, String arg1, boolean arg2, boolean arg3, boolean arg4) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2, arg3, arg4);
+ }
+
+ public void copyFile(String arg0, String arg1, boolean arg2, boolean arg3) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2, arg3);
+ }
+
+ public void copyFile(String arg0, String arg1, boolean arg2) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2);
+ }
+
+ public void copyFile(String arg0, String arg1) throws IOException {
+ delegate.copyFile(arg0, arg1);
+ }
+
+ public void copyInheritedProperties(Project arg0) {
+ delegate.copyInheritedProperties(arg0);
+ }
+
+ public void copyUserProperties(Project arg0) {
+ delegate.copyUserProperties(arg0);
+ }
+
+ public AntClassLoader createClassLoader(Path arg0) {
+ return delegate.createClassLoader(arg0);
+ }
+
+ public Object createDataType(String arg0) throws BuildException {
+ return delegate.createDataType(arg0);
+ }
+
+ public Task createTask(String arg0) throws BuildException {
+ return delegate.createTask(arg0);
+ }
+
+ public int defaultInput(byte[] arg0, int arg1, int arg2) throws IOException {
+ return delegate.defaultInput(arg0, arg1, arg2);
+ }
+
+ public void demuxFlush(String arg0, boolean arg1) {
+ delegate.demuxFlush(arg0, arg1);
+ }
+
+ public int demuxInput(byte[] arg0, int arg1, int arg2) throws IOException {
+ return delegate.demuxInput(arg0, arg1, arg2);
+ }
+
+ public void demuxOutput(String arg0, boolean arg1) {
+ delegate.demuxOutput(arg0, arg1);
+ }
+
+ public boolean equals(Object arg0) {
+ return delegate.equals(arg0);
+ }
+
+ public void executeSortedTargets(Vector arg0) throws BuildException {
+ delegate.executeSortedTargets(arg0);
+ }
+
+ public void executeTarget(String arg0) throws BuildException {
+ delegate.executeTarget(arg0);
+ }
+
+ public void executeTargets(Vector arg0) throws BuildException {
+ delegate.executeTargets(arg0);
+ }
+
+ public void fireBuildFinished(Throwable arg0) {
+ delegate.fireBuildFinished(arg0);
+ }
+
+ public void fireBuildStarted() {
+ delegate.fireBuildStarted();
+ }
+
+ public void fireSubBuildFinished(Throwable arg0) {
+ delegate.fireSubBuildFinished(arg0);
+ }
+
+ public void fireSubBuildStarted() {
+ delegate.fireSubBuildStarted();
+ }
+
+ public File getBaseDir() {
+ return delegate.getBaseDir();
+ }
+
+ public Vector getBuildListeners() {
+ return delegate.getBuildListeners();
+ }
+
+ public ClassLoader getCoreLoader() {
+ return delegate.getCoreLoader();
+ }
+
+ public Hashtable getDataTypeDefinitions() {
+ return delegate.getDataTypeDefinitions();
+ }
+
+ public InputStream getDefaultInputStream() {
+ return delegate.getDefaultInputStream();
+ }
+
+ public String getDefaultTarget() {
+ return delegate.getDefaultTarget();
+ }
+
+ public String getDescription() {
+ return delegate.getDescription();
+ }
+
+ public String getElementName(Object arg0) {
+ return delegate.getElementName(arg0);
+ }
+
+ public Executor getExecutor() {
+ return delegate.getExecutor();
+ }
+
+ public Hashtable getFilters() {
+ return delegate.getFilters();
+ }
+
+ public FilterSet getGlobalFilterSet() {
+ return delegate.getGlobalFilterSet();
+ }
+
+ public InputHandler getInputHandler() {
+ return delegate.getInputHandler();
+ }
+
+ public String getName() {
+ return delegate.getName();
+ }
+
+ public Hashtable getProperties() {
+ return delegate.getProperties();
+ }
+
+ public String getProperty(String arg0) {
+ return delegate.getProperty(arg0);
+ }
+
+ public Object getReference(String arg0) {
+ return delegate.getReference(arg0);
+ }
+
+ public Hashtable getReferences() {
+ return delegate.getReferences();
+ }
+
+ public Hashtable getTargets() {
+ return delegate.getTargets();
+ }
+
+ public Hashtable getTaskDefinitions() {
+ return delegate.getTaskDefinitions();
+ }
+
+ public Task getThreadTask(Thread arg0) {
+ return delegate.getThreadTask(arg0);
+ }
+
+ public Hashtable getUserProperties() {
+ return delegate.getUserProperties();
+ }
+
+ public String getUserProperty(String arg0) {
+ return delegate.getUserProperty(arg0);
+ }
+
+ public int hashCode() {
+ return delegate.hashCode();
+ }
+
+ public void init() throws BuildException {
+ delegate.init();
+ }
+
+ public void initSubProject(Project arg0) {
+ delegate.initSubProject(arg0);
+ this.subproject = arg0;
+ }
+
+ public boolean isKeepGoingMode() {
+ return delegate.isKeepGoingMode();
+ }
+
+ public void log(String arg0, int arg1) {
+ delegate.log(arg0, arg1);
+ }
+
+ public void log(String arg0) {
+ delegate.log(arg0);
+ }
+
+ public void log(Target arg0, String arg1, int arg2) {
+ delegate.log(arg0, arg1, arg2);
+ }
+
+ public void log(Task arg0, String arg1, int arg2) {
+ delegate.log(arg0, arg1, arg2);
+ }
+
+ public void registerThreadTask(Thread arg0, Task arg1) {
+ delegate.registerThreadTask(arg0, arg1);
+ }
+
+ public void removeBuildListener(BuildListener arg0) {
+ delegate.removeBuildListener(arg0);
+ }
+
+ public String replaceProperties(String arg0) throws BuildException {
+ return delegate.replaceProperties(arg0);
+ }
+
+ public File resolveFile(String arg0, File arg1) {
+ return delegate.resolveFile(arg0, arg1);
+ }
+
+ public File resolveFile(String arg0) {
+ return delegate.resolveFile(arg0);
+ }
+
+ public void setBaseDir(File arg0) throws BuildException {
+ delegate.setBaseDir(arg0);
+ }
+
+ public void setBasedir(String arg0) throws BuildException {
+ delegate.setBasedir(arg0);
+ }
+
+ public void setCoreLoader(ClassLoader arg0) {
+ delegate.setCoreLoader(arg0);
+ }
+
+ public void setDefault(String arg0) {
+ delegate.setDefault(arg0);
+ }
+
+ public void setDefaultInputStream(InputStream arg0) {
+ delegate.setDefaultInputStream(arg0);
+ }
+
+ public void setDefaultTarget(String arg0) {
+ delegate.setDefaultTarget(arg0);
+ }
+
+ public void setDescription(String arg0) {
+ delegate.setDescription(arg0);
+ }
+
+ public void setExecutor(Executor arg0) {
+ delegate.setExecutor(arg0);
+ }
+
+ public void setFileLastModified(File arg0, long arg1) throws BuildException {
+ delegate.setFileLastModified(arg0, arg1);
+ }
+
+ public void setInheritedProperty(String arg0, String arg1) {
+ delegate.setInheritedProperty(arg0, arg1);
+ }
+
+ public void setInputHandler(InputHandler arg0) {
+ delegate.setInputHandler(arg0);
+ }
+
+ public void setJavaVersionProperty() throws BuildException {
+ delegate.setJavaVersionProperty();
+ }
+
+ public void setKeepGoingMode(boolean arg0) {
+ delegate.setKeepGoingMode(arg0);
+ }
+
+ public void setName(String arg0) {
+ delegate.setName(arg0);
+ }
+
+ public void setNewProperty(String arg0, String arg1) {
+ delegate.setNewProperty(arg0, arg1);
+ }
+
+ public void setProperty(String arg0, String arg1) {
+ delegate.setProperty(arg0, arg1);
+ }
+
+ public void setSystemProperties() {
+ delegate.setSystemProperties();
+ }
+
+ public void setUserProperty(String arg0, String arg1) {
+ delegate.setUserProperty(arg0, arg1);
+ }
+
+ public String toString() {
+ return delegate.toString();
+ }
+} \ No newline at end of file
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4/707d014ee1cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/4/707d014ee1cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..ff4a9a4
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/4/707d014ee1cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,14 @@
+<antlib>
+<XDtClass:forAllClasses><XDtClass:ifHasClassTag tagName="ant:task">
+<taskdef name="<XDtClass:classTagValue tagName="ant:task" paramName="name"/>"
+ classname="<XDtClass:fullClassName />"
+ <XDtClass:ifHasClassTag tagName="ant:task" paramName="ignore">onerror="<XDtClass:classTagValue tagName="ant:task" paramName="ignore"/>"</XDtClass:ifHasClassTag> />
+</XDtClass:ifHasClassTag>
+<XDtClass:ifHasClassTag tagName="ant:type">
+<typedef name="<XDtClass:classTagValue tagName="ant:type" paramName="name"/>"
+ classname="<XDtClass:fullClassName />"
+ <XDtClass:ifHasClassTag tagName="ant:task" paramName="ignore">onerror="<XDtClass:classTagValue tagName="ant:task" paramName="ignore"/>"</XDtClass:ifHasClassTag> />
+<XDtClass:classTagValue tagName="ant:type" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag
+></XDtClass:forAllClasses>
+</antlib> \ No newline at end of file
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/40/d068f945e2cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/40/d068f945e2cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..fdba944
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/40/d068f945e2cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import java.util.Date;
+
+import org.apache.tools.ant.BuildException;
+
+/***
+ *
+ * @author minger
+ * @ant.task name="purgeexpiredcookies"
+ *
+ */
+public class PurgeExpiredCookiesTask
+ extends AbstractHttpStateTypeTask {
+
+ private Date expiredDate;
+
+ public void setExpiredDate(Date expiredDate) {
+ this.expiredDate = expiredDate;
+ }
+
+ protected void execute(HttpStateType stateType) throws BuildException {
+ if (expiredDate != null) {
+ stateType.getState().purgeExpiredCookies(expiredDate);
+ }
+ else {
+ stateType.getState().purgeExpiredCookies();
+ }
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/41/60c9c248dfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/41/60c9c248dfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..2da6ff5
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/41/60c9c248dfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,443 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ package net.sf.antcontrib.inifile;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.Property;
+
+
+/****************************************************************************
+ * Place class description here.
+ *
+ * @author <a href='mailto:[email protected]'>Matthew Inger</a>
+ * @author <additional author>
+ *
+ * @since
+ *
+ ****************************************************************************/
+
+
+public class IniFileTask
+ extends Task
+{
+ public static abstract class IniOperation
+ {
+ private String section;
+ private String property;
+
+ public IniOperation()
+ {
+ super();
+ }
+
+ public String getSection()
+ {
+ return section;
+ }
+
+
+ public void setSection(String section)
+ {
+ this.section = section;
+ }
+
+
+ public String getProperty()
+ {
+ return property;
+ }
+
+
+ public void setProperty(String property)
+ {
+ this.property = property;
+ }
+
+ public void execute(Project project, IniFile iniFile)
+ {
+ operate(iniFile);
+ }
+
+ protected abstract void operate(IniFile file);
+ }
+
+ public static abstract class IniOperationConditional extends IniOperation
+ {
+ private String ifCond;
+ private String unlessCond;
+
+ public IniOperationConditional()
+ {
+ super();
+ }
+
+ public void setIf(String ifCond)
+ {
+ this.ifCond = ifCond;
+ }
+
+ public void setUnless(String unlessCond)
+ {
+ this.unlessCond = unlessCond;
+ }
+
+ /**
+ * Returns true if the define's if and unless conditions
+ * (if any) are satisfied.
+ */
+ public boolean isActive(org.apache.tools.ant.Project p)
+ {
+ if (ifCond != null && p.getProperty(ifCond) == null)
+ {
+ return false;
+ }
+ else if (unlessCond != null && p.getProperty(unlessCond) != null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ public void execute(Project project, IniFile iniFile)
+ {
+ if (isActive(project))
+ operate(iniFile);
+ }
+ }
+
+ public static abstract class IniOperationPropertySetter extends IniOperation
+ {
+ private boolean override;
+ private String resultproperty;
+
+ public IniOperationPropertySetter()
+ {
+ super();
+ }
+
+ public void setOverride(boolean override)
+ {
+ this.override = override;
+ }
+
+ public void setResultProperty(String resultproperty)
+ {
+ this.resultproperty = resultproperty;
+ }
+
+ protected final void setResultPropertyValue(Project project, String value)
+ {
+ if (value != null)
+ {
+ if (override)
+ {
+ if (project.getUserProperty(resultproperty) == null)
+ project.setProperty(resultproperty, value);
+ else
+ project.setUserProperty(resultproperty, value);
+ }
+ else
+ {
+ Property p = (Property)project.createTask("property");
+ p.setName(resultproperty);
+ p.setValue(value);
+ p.execute();
+ }
+ }
+ }
+ }
+
+ public static final class Remove
+ extends IniOperationConditional
+ {
+ public Remove()
+ {
+ super();
+ }
+
+ protected void operate(IniFile file)
+ {
+ String secName = getSection();
+ String propName = getProperty();
+
+ if (propName == null)
+ {
+ file.removeSection(secName);
+ }
+ else
+ {
+ IniSection section = file.getSection(secName);
+ if (section != null)
+ section.removeProperty(propName);
+ }
+ }
+ }
+
+
+ public final class Set
+ extends IniOperationConditional
+ {
+ private String value;
+ private String operation;
+
+ public Set()
+ {
+ super();
+ }
+
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+
+ public void setOperation(String operation)
+ {
+ this.operation = operation;
+ }
+
+
+ protected void operate(IniFile file)
+ {
+ String secName = getSection();
+ String propName = getProperty();
+
+ IniSection section = file.getSection(secName);
+ if (section == null)
+ {
+ section = new IniSection(secName);
+ file.setSection(section);
+ }
+
+ if (propName != null)
+ {
+ if (operation != null)
+ {
+ if ("+".equals(operation))
+ {
+ IniProperty prop = section.getProperty(propName);
+ value = prop.getValue();
+ int intVal = Integer.parseInt(value) + 1;
+ value = String.valueOf(intVal);
+ }
+ else if ("-".equals(operation))
+ {
+ IniProperty prop = section.getProperty(propName);
+ value = prop.getValue();
+ int intVal = Integer.parseInt(value) - 1;
+ value = String.valueOf(intVal);
+ }
+ }
+ section.setProperty(new IniProperty(propName, value));
+ }
+ }
+ }
+
+ public final class Exists
+ extends IniOperationPropertySetter
+ {
+ public Exists()
+ {
+ super();
+ }
+
+ protected void operate(IniFile file)
+ {
+ boolean exists = false;
+ String secName = getSection();
+ String propName = getProperty();
+
+ if (secName == null)
+ throw new BuildException("You must supply a section to search for.");
+
+ if (propName == null)
+ exists = (file.getSection(secName) != null);
+ else
+ exists = (file.getProperty(secName, propName) != null);
+
+ setResultPropertyValue(getProject(), Boolean.valueOf(exists).toString());
+ }
+ }
+
+ public final class Get
+ extends IniOperationPropertySetter
+ {
+ public Get()
+ {
+ super();
+ }
+
+ protected void operate(IniFile file)
+ {
+ String secName = getSection();
+ String propName = getProperty();
+
+ if (secName == null)
+ throw new BuildException("You must supply a section to search for.");
+
+ if (propName == null)
+ throw new BuildException("You must supply a property name to search for.");
+
+ setResultPropertyValue(getProject(), file.getProperty(secName, propName));
+ }
+ }
+
+ private File source;
+ private File dest;
+ private Vector operations;
+
+ public IniFileTask()
+ {
+ super();
+ this.operations = new Vector();
+ }
+
+ public Set createSet()
+ {
+ Set set = new Set();
+ operations.add(set);
+ return set;
+ }
+
+ public Remove createRemove()
+ {
+ Remove remove = new Remove();
+ operations.add(remove);
+ return remove;
+ }
+
+ public Exists createExists()
+ {
+ Exists exists = new Exists();
+ operations.add(exists);
+ return exists;
+ }
+
+ public Get createGet()
+ {
+ Get get = new Get();
+ operations.add(get);
+ return get;
+ }
+
+ public void setSource(File source)
+ {
+ this.source = source;
+ }
+
+
+ public void setDest(File dest)
+ {
+ this.dest = dest;
+ }
+
+
+ public void execute()
+ throws BuildException
+ {
+ if (dest == null)
+ throw new BuildException("You must supply a dest file to write to.");
+
+ IniFile iniFile = null;
+
+ try
+ {
+ iniFile = readIniFile(source);
+ }
+ catch (IOException e)
+ {
+ throw new BuildException(e);
+ }
+
+ Iterator it = operations.iterator();
+ IniOperation operation = null;
+ while (it.hasNext())
+ {
+ operation = (IniOperation)it.next();
+ operation.execute(getProject(), iniFile);
+ }
+
+ FileWriter writer = null;
+
+ try
+ {
+ try
+ {
+ writer = new FileWriter(dest);
+ iniFile.write(writer);
+ }
+ finally
+ {
+ try
+ {
+ if (writer != null)
+ writer.close();
+ }
+ catch (IOException e)
+ {
+ ; // gulp
+ }
+ }
+ }
+ catch (IOException e)
+ {
+ throw new BuildException(e);
+ }
+
+ }
+
+
+ private IniFile readIniFile(File source)
+ throws IOException
+ {
+ FileReader reader = null;
+ IniFile iniFile = new IniFile();
+
+ if (source == null)
+ return iniFile;
+
+ try
+ {
+ reader = new FileReader(source);
+ iniFile.read(reader);
+ }
+ finally
+ {
+ try
+ {
+ if (reader != null)
+ reader.close();
+ }
+ catch (IOException e)
+ {
+ ; // gulp
+ }
+ }
+
+ return iniFile;
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/44/b010d665e0cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/44/b010d665e0cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..013014c
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/44/b010d665e0cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,352 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.property;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Properties;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.ProjectHelper;
+import org.apache.tools.ant.Task;
+
+/**
+ * Similar to Property, but this property is mutable. In fact, much of the code
+ * in this class is copy and paste from Property. In general, the standard Ant
+ * property should be used, but occasionally it is useful to use a mutable
+ * property.
+ * <p>
+ * This used to be a nice little task that took advantage of what is probably
+ * a flaw in the Ant Project API -- setting a "user" property programatically
+ * causes the project to overwrite a previously set property. Now this task
+ * has become more violent and employs a technique known as "object rape" to
+ * directly access the Project's private property hashtable.
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ *
+ * @author Dale Anson, [email protected]
+ * @since Ant 1.5
+ * @version $Revision: 1.6 $
+ */
+public class Variable extends Task {
+
+ // attribute storage
+ private String value = "";
+ private String name = null;
+ private File file = null;
+ private boolean remove = false;
+
+
+ /**
+ * Set the name of the property. Required unless 'file' is used.
+ *
+ * @param name the name of the property.
+ */
+ public void setName( String name ) {
+ this.name = name;
+ }
+
+
+ /**
+ * Set the value of the property. Optional, defaults to "".
+ *
+ * @param value the value of the property.
+ */
+ public void setValue( String value ) {
+ this.value = value;
+ }
+
+
+ /**
+ * Set the name of a file to read properties from. Optional.
+ *
+ * @param file the file to read properties from.
+ */
+ public void setFile( File file ) {
+ this.file = file;
+ }
+
+ /**
+ * Determines whether the property should be removed from the project.
+ * Default is false. Once removed, conditions that check for property
+ * existence will find this property does not exist.
+ *
+ * @param b set to true to remove the property from the project.
+ */
+ public void setUnset( boolean b ) {
+ remove = b;
+ }
+
+
+ /**
+ * Execute this task.
+ *
+ * @exception BuildException Description of the Exception
+ */
+ public void execute() throws BuildException {
+ if ( remove ) {
+ if ( name == null || name.equals( "" ) ) {
+ throw new BuildException( "The 'name' attribute is required with 'unset'." );
+ }
+ removeProperty( name );
+ return ;
+ }
+ if ( file == null ) {
+ // check for the required name attribute
+ if ( name == null || name.equals( "" ) ) {
+ throw new BuildException( "The 'name' attribute is required." );
+ }
+
+ // check for the required value attribute
+ if ( value == null ) {
+ value = "";
+ }
+
+ // adjust the property value if necessary -- is this necessary?
+ // Doesn't Ant do this automatically?
+ value = getProject().replaceProperties( value );
+
+ // set the property
+ forceProperty( name, value );
+ }
+ else {
+ if ( !file.exists() ) {
+ throw new BuildException( file.getAbsolutePath() + " does not exists." );
+ }
+ loadFile( file );
+ }
+ }
+
+ /**
+ * Remove a property from the project's property table and the userProperty table.
+ * Note that Ant 1.6 uses a helper for this.
+ */
+ private void removeProperty( String name ) {
+ Hashtable properties = null;
+ // Ant 1.5 stores properties in Project
+ try {
+ properties = ( Hashtable ) getValue( getProject(), "properties" );
+ if ( properties != null ) {
+ properties.remove( name );
+ }
+ }
+ catch ( Exception e ) {
+ // ignore, could be Ant 1.6
+ }
+ try {
+ properties = ( Hashtable ) getValue( getProject(), "userProperties" );
+ if ( properties != null ) {
+ properties.remove( name );
+ }
+ }
+ catch ( Exception e ) {
+ // ignore, could be Ant 1.6
+ }
+
+ // Ant 1.6 uses a PropertyHelper, can check for it by checking for a
+ // reference to "ant.PropertyHelper"
+ try {
+ Object property_helper = getProject().getReference( "ant.PropertyHelper" );
+ if ( property_helper != null ) {
+ try {
+ properties = ( Hashtable ) getValue( property_helper, "properties" );
+ if ( properties != null ) {
+ properties.remove( name );
+ }
+ }
+ catch ( Exception e ) {
+ // ignore
+ }
+ try {
+ properties = ( Hashtable ) getValue( property_helper, "userProperties" );
+ if ( properties != null ) {
+ properties.remove( name );
+ }
+ }
+ catch ( Exception e ) {
+ // ignore
+ }
+ }
+ }
+ catch ( Exception e ) {
+ // ignore, could be Ant 1.5
+ }
+ }
+
+ private void forceProperty( String name, String value ) {
+ try {
+ Hashtable properties = ( Hashtable ) getValue( getProject(), "properties" );
+ if ( properties == null ) {
+ getProject().setUserProperty( name, value );
+ }
+ else {
+ properties.put( name, value );
+ }
+ }
+ catch ( Exception e ) {
+ getProject().setUserProperty( name, value );
+ }
+ }
+
+
+ /**
+ * Object rape: fondle the private parts of an object without it's
+ * permission.
+ *
+ * @param thisClass The class to rape.
+ * @param fieldName The field to fondle
+ * @return The field value
+ * @exception NoSuchFieldException Darn, nothing to fondle.
+ */
+ private Field getField( Class thisClass, String fieldName ) throws NoSuchFieldException {
+ if ( thisClass == null ) {
+ throw new NoSuchFieldException( "Invalid field : " + fieldName );
+ }
+ try {
+ return thisClass.getDeclaredField( fieldName );
+ }
+ catch ( NoSuchFieldException e ) {
+ return getField( thisClass.getSuperclass(), fieldName );
+ }
+ }
+
+
+ /**
+ * Object rape: fondle the private parts of an object without it's
+ * permission.
+ *
+ * @param instance the object instance
+ * @param fieldName the name of the field
+ * @return an object representing the value of the
+ * field
+ * @exception IllegalAccessException foiled by the security manager
+ * @exception NoSuchFieldException Darn, nothing to fondle
+ */
+ private Object getValue( Object instance, String fieldName )
+ throws IllegalAccessException, NoSuchFieldException {
+ Field field = getField( instance.getClass(), fieldName );
+ field.setAccessible( true );
+ return field.get( instance );
+ }
+
+
+ /**
+ * load variables from a file
+ *
+ * @param file file to load
+ * @exception BuildException Description of the Exception
+ */
+ private void loadFile( File file ) throws BuildException {
+ Properties props = new Properties();
+ try {
+ if ( file.exists() ) {
+ FileInputStream fis = new FileInputStream( file );
+ try {
+ props.load( fis );
+ }
+ finally {
+ if ( fis != null ) {
+ fis.close();
+ }
+ }
+ addProperties( props );
+ }
+ else {
+ log( "Unable to find property file: " + file.getAbsolutePath(),
+ Project.MSG_VERBOSE );
+ }
+ }
+ catch ( IOException ex ) {
+ throw new BuildException( ex, location );
+ }
+ }
+
+
+ /**
+ * iterate through a set of properties, resolve them, then assign them
+ *
+ * @param props The feature to be added to the Properties attribute
+ */
+ protected void addProperties( Properties props ) {
+ resolveAllProperties( props );
+ Enumeration e = props.keys();
+ while ( e.hasMoreElements() ) {
+ String name = ( String ) e.nextElement();
+ String value = props.getProperty( name );
+ forceProperty( name, value );
+ }
+ }
+
+
+ /**
+ * resolve properties inside a properties hashtable
+ *
+ * @param props properties object to resolve
+ * @exception BuildException Description of the Exception
+ */
+ private void resolveAllProperties( Properties props ) throws BuildException {
+ for ( Enumeration e = props.keys(); e.hasMoreElements(); ) {
+ String name = ( String ) e.nextElement();
+ String value = props.getProperty( name );
+
+ boolean resolved = false;
+ while ( !resolved ) {
+ Vector fragments = new Vector();
+ Vector propertyRefs = new Vector();
+ ProjectHelper.parsePropertyString( value, fragments,
+ propertyRefs );
+
+ resolved = true;
+ if ( propertyRefs.size() != 0 ) {
+ StringBuffer sb = new StringBuffer();
+ Enumeration i = fragments.elements();
+ Enumeration j = propertyRefs.elements();
+ while ( i.hasMoreElements() ) {
+ String fragment = ( String ) i.nextElement();
+ if ( fragment == null ) {
+ String propertyName = ( String ) j.nextElement();
+ if ( propertyName.equals( name ) ) {
+ throw new BuildException( "Property " + name
+ + " was circularly "
+ + "defined." );
+ }
+ fragment = getProject().getProperty( propertyName );
+ if ( fragment == null ) {
+ if ( props.containsKey( propertyName ) ) {
+ fragment = props.getProperty( propertyName );
+ resolved = false;
+ }
+ else {
+ fragment = "${" + propertyName + "}";
+ }
+ }
+ }
+ sb.append( fragment );
+ }
+ value = sb.toString();
+ props.put( name, value );
+ }
+ }
+ }
+ }
+
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/44/c05d37dadacc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/44/c05d37dadacc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..f044a7a
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/44/c05d37dadacc001b1cb5d1e6b2b8577e
@@ -0,0 +1,466 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.ant16;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ * @author Matt Inger
+ * @ant.task name=for
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private Path currPath;
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ private Path getOrCreatePath() {
+ if (currPath == null) {
+ currPath = new Path(getProject());
+ }
+ return currPath;
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfigured(Path path) {
+ getOrCreatePath().append(path);
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfiguredPath(Path path) {
+ addConfigured(path);
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && currPath == null && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or path or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ // Take Care of the path element
+ String[] pathElements = new String[0];
+ if (currPath != null) {
+ pathElements = currPath.list();
+ }
+ for (int i = 0; i < pathElements.length; i++) {
+ File nextFile = new File(pathElements[i]);
+ doToken(nextFile.getAbsolutePath());
+ }
+
+ // Take care of iterators
+ for (Iterator i = hasIterators.iterator(); i.hasNext();) {
+ Iterator it = ((HasIterator) i.next()).iterator();
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void add(FileSet fileset) {
+ getOrCreatePath().addFileset(fileset);
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void addFileSet(FileSet fileset) {
+ add(fileset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void add(DirSet dirset) {
+ getOrCreatePath().addDirset(dirset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void addDirSet(DirSet dirset) {
+ add(dirset);
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/45/00f8bf83d8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/45/00f8bf83d8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..4eded2c
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/45/00f8bf83d8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,6 @@
+<XDtClass:forAllClasses>
+<XDtClass:ifHasClassTag tagName="ant:task" paramName="name">
+<XDtClass:classTagValue tagName="ant:task" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag>
+</XDtClass:forAllClasses>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/46/3022b241e2cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/46/3022b241e2cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..7bfbefd
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/46/3022b241e2cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import org.apache.commons.httpclient.Cookie;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.auth.AuthScope;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.DataType;
+
+/***
+ *
+ * @author minger
+ * @ant.type name="httpstate"
+ *
+ */
+public class HttpStateType
+ extends DataType {
+
+ private HttpState state;
+
+ public HttpStateType(Project p) {
+ super();
+ setProject(p);
+
+ state = new HttpState();
+ }
+
+ public HttpState getState() {
+ if (isReference()) {
+ return getRef().getState();
+ }
+ else {
+ return state;
+ }
+ }
+
+ protected HttpStateType getRef() {
+ return (HttpStateType) super.getCheckedRef(HttpStateType.class,
+ "http-state");
+ }
+
+ public void addConfiguredCredentials(Credentials credentials) {
+ if (isReference()) {
+ tooManyAttributes();
+ }
+
+ AuthScope scope = new AuthScope(credentials.getHost(),
+ credentials.getPort(),
+ credentials.getRealm(),
+ credentials.getScheme());
+
+ UsernamePasswordCredentials c = new UsernamePasswordCredentials(
+ credentials.getUsername(),
+ credentials.getPassword());
+
+ state.setCredentials(scope, c);
+ }
+
+ public void addConfiguredProxyCredentials(Credentials credentials) {
+ if (isReference()) {
+ tooManyAttributes();
+ }
+
+ AuthScope scope = new AuthScope(credentials.getHost(),
+ credentials.getPort(),
+ credentials.getRealm(),
+ credentials.getScheme());
+
+ UsernamePasswordCredentials c = new UsernamePasswordCredentials(
+ credentials.getUsername(),
+ credentials.getPassword());
+
+ state.setProxyCredentials(scope, c);
+ }
+
+ public void addConfiguredCookie(Cookie cookie) {
+ if (isReference()) {
+ tooManyAttributes();
+ }
+
+ state.addCookie(cookie);
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/46/3054e63ce0cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/46/3054e63ce0cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..558c4ac
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/46/3054e63ce0cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.property;
+
+import org.apache.tools.ant.BuildException;
+
+/***
+ * Task definition for the propertycopy task, which copies the value of a
+ * named property to another property. This is useful when you need to
+ * plug in the value of another property in order to get a property name
+ * and then want to get the value of that property name.
+ *
+ * <pre>
+ * Usage:
+ *
+ * Task declaration in the project:
+ * <code>
+ * &lt;taskdef name="propertycopy" classname="net.sf.antcontrib.property.PropertyCopy" /&gt;
+ * </code>
+ *
+ * Call Syntax:
+ * <code>
+ * &lt;propertycopy name="propname" from="copyfrom" (silent="true|false")? /&gt;
+ * </code>
+ *
+ * Attributes:
+ * name --&gt; The name of the property you wish to set with the value
+ * from --&gt; The name of the property you wish to copy the value from
+ * silent --&gt; Do you want to suppress the error if the "from" property
+ * does not exist, and just not set the property "name". Default
+ * is false.
+ *
+ * Example:
+ * &lt;property name="org" value="MyOrg" /&gt;
+ * &lt;property name="org.MyOrg.DisplayName" value="My Organiziation" /&gt;
+ * &lt;propertycopy name="displayName" from="org.${org}.DisplayName" /&gt;
+ * &lt;echo message="${displayName}" /&gt;
+ * </pre>
+ *
+ * @author <a href="mailto:[email protected]">Matthew Inger</a>
+ */
+public class PropertyCopy
+ extends AbstractPropertySetterTask
+{
+ private String from;
+ private boolean silent;
+
+ /***
+ * Default Constructor
+ */
+ public PropertyCopy()
+ {
+ super();
+ this.from = null;
+ this.silent = false;
+ }
+
+ public void setName(String name)
+ {
+ setProperty(name);
+ }
+
+ public void setFrom(String from)
+ {
+ this.from = from;
+ }
+
+ public void setSilent(boolean silent)
+ {
+ this.silent = silent;
+ }
+
+ protected void validate()
+ {
+ super.validate();
+ if (from == null)
+ throw new BuildException("Missing the 'from' attribute.");
+ }
+
+ public void execute()
+ throws BuildException
+ {
+ validate();
+
+ String value = getProject().getProperty(from);
+
+ if (value == null && ! silent)
+ throw new BuildException("Property '" + from + "' is not defined.");
+
+ if (value != null)
+ setPropertyValue(value);
+ }
+
+}
+
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/48/1007d258c3cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/48/1007d258c3cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..3400378
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/48/1007d258c3cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,470 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.ResourceCollection;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ * @author Matt Inger
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private Path currPath;
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+ private List resourceCollections = new ArrayList();
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ public void add(ResourceCollection resourceCollection) {
+ this.resourceCollections.add(resourceCollection);
+ }
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ private Path getOrCreatePath() {
+ if (currPath == null) {
+ currPath = new Path(getProject());
+ }
+ return currPath;
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfigured(Path path) {
+ getOrCreatePath().append(path);
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfiguredPath(Path path) {
+ addConfigured(path);
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && currPath == null && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or path or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ // Take Care of the path element
+ String[] pathElements = new String[0];
+ if (currPath != null) {
+ pathElements = currPath.list();
+ }
+ for (int i = 0; i < pathElements.length; i++) {
+ File nextFile = new File(pathElements[i]);
+ doToken(nextFile.getAbsolutePath());
+ }
+
+ // Take care of iterators
+ for (Iterator i = hasIterators.iterator(); i.hasNext();) {
+ Iterator it = ((HasIterator) i.next()).iterator();
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void add(FileSet fileset) {
+ getOrCreatePath().addFileset(fileset);
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void addFileSet(FileSet fileset) {
+ add(fileset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void add(DirSet dirset) {
+ getOrCreatePath().addDirset(dirset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void addDirSet(DirSet dirset) {
+ add(dirset);
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/48/20fe8a19e8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/48/20fe8a19e8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..71ab6ce
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/48/20fe8a19e8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.condition;
+
+import org.apache.tools.ant.taskdefs.condition.ConditionBase;
+
+/**
+ * Extends ConditionBase so I can get access to the condition count and the
+ * first condition. This is the class that the BooleanConditionTask is proxy
+ * for.
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ *
+ * @author Dale Anson, [email protected]
+ */
+public class BooleanConditionBase extends ConditionBase {
+
+ /**
+ * Adds a feature to the IsPropertyTrue attribute of the BooleanConditionBase
+ * object
+ *
+ * @param i The feature to be added to the IsPropertyTrue attribute
+ */
+ public void addIsPropertyTrue( IsPropertyTrue i ) {
+ super.add( i );
+ }
+
+ /**
+ * Adds a feature to the IsPropertyFalse attribute of the
+ * BooleanConditionBase object
+ *
+ * @param i The feature to be added to the IsPropertyFalse attribute
+ */
+ public void addIsPropertyFalse( IsPropertyFalse i ) {
+ super.add( i );
+ }
+
+ public void addIsGreaterThan( IsGreaterThan i) {
+ super.add(i);
+ }
+
+ public void addIsLessThan( IsLessThan i) {
+ super.add(i);
+ }
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/49/404e9e48dbcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/49/404e9e48dbcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..232bd83
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/49/404e9e48dbcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import net.sf.antcontrib.logic.condition.BooleanConditionBase;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.ProjectHelper;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.TaskContainer;
+import org.apache.tools.ant.taskdefs.Exit;
+import org.apache.tools.ant.taskdefs.Sequential;
+import org.apache.tools.ant.taskdefs.condition.Condition;
+import org.apache.tools.ant.taskdefs.condition.Equals;
+
+
+/**
+ *
+ */
+public class Assert
+ extends BooleanConditionBase {
+
+ private List tasks = new ArrayList();
+ private String message;
+ private boolean failOnError = true;
+ private boolean execute = true;
+ private Sequential sequential;
+ private String name;
+ private String value;
+
+ public Sequential createSequential() {
+ this.sequential = (Sequential) getProject().createTask("sequential");
+ return this.sequential;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public BooleanConditionBase createBool() {
+ return this;
+ }
+
+ public void setExecute(boolean execute) {
+ this.execute = execute;
+ }
+
+ public void setFailOnError(boolean failOnError) {
+ this.failOnError = failOnError;
+ }
+
+ public void execute() {
+ String value = getProject().getProperty("ant.enable.asserts");
+ boolean assertsEnabled = Project.toBoolean(value);
+
+ if (assertsEnabled) {
+ if (name != null) {
+ if (value == null) {
+ throw new BuildException("The 'value' attribute must accompany the 'name' attribute.");
+ }
+ String propVal = getProject().replaceProperties("${" + name + "}");
+ Equals e = new Equals();
+ e.setArg1(propVal);
+ e.setArg2(value);
+ addEquals(e);
+ }
+
+ if (countConditions() == 0) {
+ throw new BuildException("There is no condition specified.");
+ }
+ else if (countConditions() > 1) {
+ throw new BuildException("There must be exactly one condition specified.");
+ }
+
+ Condition c = (Condition) getConditions().nextElement();
+ if (! c.eval()) {
+ if (failOnError) {
+ Exit fail = (Exit) getProject().createTask("fail");
+ fail.setMessage(message);
+ fail.execute();
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4a/a0d35eb7dfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/4a/a0d35eb7dfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..cfd0923
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/4a/a0d35eb7dfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import org.apache.tools.ant.BuildException;
+
+public class ClearCredentialsTask
+ extends AbstractHttpStateTypeTask {
+
+ private boolean proxy = false;
+
+ public void setProxy(boolean proxy) {
+ this.proxy = proxy;
+ }
+
+ protected void execute(HttpStateType stateType) throws BuildException {
+ if (proxy) {
+ stateType.getState().clearProxyCredentials();
+ }
+ else {
+ stateType.getState().clearCredentials();
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4b/506700ece8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/4b/506700ece8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/4b/506700ece8cc001b1cb5d1e6b2b8577e
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4e/50b9433ce5cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/4e/50b9433ce5cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..e51c5f5
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/4e/50b9433ce5cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Ant;
+
+/**
+ * Subclass of CallTarget which allows us to fetch
+ * properties which are set in the scope of the called
+ * target, and set them in the scope of the calling target.
+ * Normally, these properties are thrown away as soon as the
+ * called target completes execution.
+ *
+ * @author inger
+ * @author Dale Anson, [email protected]
+ * @ant.task name="antfetch"
+ */
+public class AntFetch extends Ant {
+ /** the name of the property to fetch from the new project */
+ private String returnName = null;
+
+ private ProjectDelegate fakeProject = null;
+
+ public void setProject(Project realProject) {
+ fakeProject = new ProjectDelegate(realProject);
+ super.setProject(fakeProject);
+ }
+
+ /**
+ * Do the execution.
+ *
+ * @exception BuildException Description of the Exception
+ */
+ public void execute() throws BuildException {
+ super.execute();
+
+ // copy back the props if possible
+ if ( returnName != null ) {
+ StringTokenizer st = new StringTokenizer( returnName, "," );
+ while ( st.hasMoreTokens() ) {
+ String name = st.nextToken().trim();
+ String value = fakeProject.getSubproject().getUserProperty( name );
+ if ( value != null ) {
+ getProject().setUserProperty( name, value );
+ }
+ else {
+ value = fakeProject.getSubproject().getProperty( name );
+ if ( value != null ) {
+ getProject().setProperty( name, value );
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Set the property or properties that are set in the new project to be
+ * transfered back to the original project. As with all properties, if the
+ * property already exists in the original project, it will not be overridden
+ * by a different value from the new project.
+ *
+ * @param r the name of a property in the new project to set in the original
+ * project. This may be a comma separate list of properties.
+ */
+ public void setReturn( String r ) {
+ returnName = r;
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/50/90cd5938e8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/50/90cd5938e8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..3df48eb
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/50/90cd5938e8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.condition;
+
+import java.lang.reflect.Field;
+import java.util.Vector;
+
+import org.apache.tools.ant.taskdefs.condition.ConditionBase;
+
+/**
+ * Extends ConditionBase so I can get access to the condition count and the
+ * first condition. This is the class that the BooleanConditionTask is proxy
+ * for.
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ *
+ * @author Dale Anson, [email protected]
+ */
+public class BooleanConditionBase extends ConditionBase {
+
+ private Vector conditions;
+
+ public BooleanConditionBase() {
+ this.conditions = getConditions();
+ }
+
+ private Vector getConditions() {
+ Field f = ConditionBase.class.getDeclaredField("conditions");
+ f.setAccessible(true);
+ Vector v = (Vector) f.get(this);
+ return v;
+ }
+ /**
+ * Adds a feature to the IsPropertyTrue attribute of the BooleanConditionBase
+ * object
+ *
+ * @param i The feature to be added to the IsPropertyTrue attribute
+ */
+ public void addIsPropertyTrue( IsPropertyTrue i ) {
+ getConditions().add( i );
+ }
+
+ /**
+ * Adds a feature to the IsPropertyFalse attribute of the
+ * BooleanConditionBase object
+ *
+ * @param i The feature to be added to the IsPropertyFalse attribute
+ */
+ public void addIsPropertyFalse( IsPropertyFalse i ) {
+ getConditions().add( i );
+ }
+
+ public void addIsGreaterThan( IsGreaterThan i) {
+ getConditions().add(i);
+ }
+
+ public void addIsLessThan( IsLessThan i) {
+ getConditions().add(i);
+ }
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/50/d0de8453e7cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/50/d0de8453e7cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..00a997a
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/50/d0de8453e7cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import net.sf.antcontrib.logic.condition.BooleanConditionBase;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Exit;
+import org.apache.tools.ant.taskdefs.Sequential;
+import org.apache.tools.ant.taskdefs.condition.Condition;
+import org.apache.tools.ant.taskdefs.condition.Equals;
+
+
+/**
+ *
+ * @ant.task name="assert"
+ */
+public class Assert
+ extends BooleanConditionBase {
+
+ private List tasks = new ArrayList();
+ private String message;
+ private boolean failOnError = true;
+ private boolean execute = true;
+ private Sequential sequential;
+ private String name;
+ private String value;
+
+ public Sequential createSequential() {
+ this.sequential = (Sequential) getProject().createTask("sequential");
+ return this.sequential;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public BooleanConditionBase createBool() {
+ return this;
+ }
+
+ public void setExecute(boolean execute) {
+ this.execute = execute;
+ }
+
+ public void setFailOnError(boolean failOnError) {
+ this.failOnError = failOnError;
+ }
+
+ public void execute() {
+ String enable = getProject().getProperty("ant.enable.asserts");
+ boolean assertsEnabled = Project.toBoolean(enable);
+
+ if (assertsEnabled) {
+ if (name != null) {
+ if (value == null) {
+ throw new BuildException("The 'value' attribute must accompany the 'name' attribute.");
+ }
+ String propVal = getProject().replaceProperties("${" + name + "}");
+ Equals e = new Equals();
+ e.setArg1(propVal);
+ e.setArg2(value);
+ addEquals(e);
+ }
+
+ if (countConditions() == 0) {
+ throw new BuildException("There is no condition specified.");
+ }
+ else if (countConditions() > 1) {
+ throw new BuildException("There must be exactly one condition specified.");
+ }
+
+ Condition c = (Condition) getConditions().nextElement();
+ if (! c.eval()) {
+ if (failOnError) {
+ Exit fail = (Exit) getProject().createTask("fail");
+ fail.setMessage(message);
+ fail.execute();
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/52/701c9e8de8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/52/701c9e8de8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..8af3d95
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/52/701c9e8de8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.condition;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.condition.IsTrue;
+
+/**
+ * Extends IsTrue condition to check the value of a specified property.
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ *
+ * @author Dale Anson, [email protected]
+ * @version $Revision: 1.3 $
+ * @ant.type name="ispropertytrue"
+ */
+public class IsPropertyTrue extends IsTrue {
+
+ private String name = null;
+
+ public void setProperty( String name ) {
+ this.name = name;
+ }
+
+ public boolean eval() throws BuildException {
+ if ( name == null )
+ throw new BuildException( "Property name must be set." );
+ String value = getProject().getProperty( name );
+ if ( value == null )
+ return false;
+ return getProject().toBoolean( value );
+ }
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/53/30a6352cd7cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/53/30a6352cd7cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..74eb454
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/53/30a6352cd7cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,4 @@
+<XDtClass:forAllClasses>
+ <XDtClass:classTagValue tagName="ant.task" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:forAllClasses>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/54/b0cdc3bbdacc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/54/b0cdc3bbdacc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..4eded2c
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/54/b0cdc3bbdacc001b1cb5d1e6b2b8577e
@@ -0,0 +1,6 @@
+<XDtClass:forAllClasses>
+<XDtClass:ifHasClassTag tagName="ant:task" paramName="name">
+<XDtClass:classTagValue tagName="ant:task" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag>
+</XDtClass:forAllClasses>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/54/f0b1a95be0cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/54/f0b1a95be0cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..4da616e
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/54/f0b1a95be0cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ package net.sf.antcontrib.property;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.StringTokenizer;
+import java.util.Vector;
+import java.util.Locale;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Reference;
+
+/****************************************************************************
+ * Place class description here.
+ *
+ * @author <a href='mailto:[email protected]'>Matthew Inger</a>
+ * @author <additional author>
+ *
+ * @since
+ * @ant.task name="sort"
+ *
+ ****************************************************************************/
+
+
+public class SortList
+ extends AbstractPropertySetterTask
+{
+ private String value;
+ private Reference ref;
+ private boolean casesensitive = true;
+ private boolean numeric = false;
+ private String delimiter = ",";
+ private File orderPropertyFile;
+ private String orderPropertyFilePrefix;
+
+ public SortList()
+ {
+ super();
+ }
+
+ public void setNumeric(boolean numeric)
+ {
+ this.numeric = numeric;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+
+ public void setRefid(Reference ref)
+ {
+ this.ref = ref;
+ }
+
+
+ public void setCasesensitive(boolean casesenstive)
+ {
+ this.casesensitive = casesenstive;
+ }
+
+ public void setDelimiter(String delimiter)
+ {
+ this.delimiter = delimiter;
+ }
+
+
+ public void setOrderPropertyFile(File orderPropertyFile)
+ {
+ this.orderPropertyFile = orderPropertyFile;
+ }
+
+
+ public void setOrderPropertyFilePrefix(String orderPropertyFilePrefix)
+ {
+ this.orderPropertyFilePrefix = orderPropertyFilePrefix;
+ }
+
+
+ private static void mergeSort(String src[],
+ String dest[],
+ int low,
+ int high,
+ boolean caseSensitive,
+ boolean numeric) {
+ int length = high - low;
+
+ // Insertion sort on smallest arrays
+ if (length < 7) {
+ for (int i=low; i<high; i++)
+ for (int j=i; j>low &&
+ compare(dest[j-1],dest[j], caseSensitive, numeric)>0; j--)
+ swap(dest, j, j-1);
+ return;
+ }
+
+ // Recursively sort halves of dest into src
+ int mid = (low + high)/2;
+ mergeSort(dest, src, low, mid, caseSensitive, numeric);
+ mergeSort(dest, src, mid, high, caseSensitive, numeric);
+
+ // If list is already sorted, just copy from src to dest. This is an
+ // optimization that results in faster sorts for nearly ordered lists.
+ if (compare(src[mid-1], src[mid], caseSensitive, numeric) <= 0) {
+ System.arraycopy(src, low, dest, low, length);
+ return;
+ }
+
+ // Merge sorted halves (now in src) into dest
+ for(int i = low, p = low, q = mid; i < high; i++) {
+ if (q>=high || p<mid && compare(src[p], src[q], caseSensitive, numeric)<=0)
+ dest[i] = src[p++];
+ else
+ dest[i] = src[q++];
+ }
+ }
+
+ private static int compare(String s1,
+ String s2,
+ boolean casesensitive,
+ boolean numeric)
+ {
+ int res = 0;
+
+ if (numeric)
+ {
+ double d1 = new Double(s1).doubleValue();
+ double d2 = new Double(s2).doubleValue();
+ if (d1 < d2)
+ res = -1;
+ else if (d1 == d2)
+ res = 0;
+ else
+ res = 1;
+ }
+ else if (casesensitive)
+ {
+ res = s1.compareTo(s2);
+ }
+ else
+ {
+ Locale l = Locale.getDefault();
+ res = s1.toLowerCase(l).compareTo(s2.toLowerCase(l));
+ }
+
+ return res;
+ }
+
+ /**
+ * Swaps x[a] with x[b].
+ */
+ private static void swap(Object x[], int a, int b) {
+ Object t = x[a];
+ x[a] = x[b];
+ x[b] = t;
+ }
+
+
+ private Vector sortByOrderPropertyFile(Vector props)
+ throws IOException
+ {
+ FileReader fr = null;
+ Vector orderedProps = new Vector();
+
+ try
+ {
+ fr = new FileReader(orderPropertyFile);
+ BufferedReader br = new BufferedReader(fr);
+ String line = "";
+ String pname = "";
+ int pos = 0;
+ while ((line = br.readLine()) != null)
+ {
+ pos = line.indexOf('#');
+ if (pos != -1)
+ line = line.substring(0, pos).trim();
+
+ if (line.length() > 0)
+ {
+ pos = line.indexOf('=');
+ if (pos != -1)
+ pname = line.substring(0,pos).trim();
+ else
+ pname = line.trim();
+
+ String prefPname = pname;
+ if (orderPropertyFilePrefix != null)
+ prefPname = orderPropertyFilePrefix + "." + prefPname;
+
+ if (props.contains(prefPname) &&
+ ! orderedProps.contains(prefPname))
+ {
+ orderedProps.addElement(prefPname);
+ }
+ }
+ }
+
+ Enumeration e = props.elements();
+ while (e.hasMoreElements())
+ {
+ String prop = (String)(e.nextElement());
+ if (! orderedProps.contains(prop))
+ orderedProps.addElement(prop);
+ }
+
+ return orderedProps;
+ }
+ finally
+ {
+ try
+ {
+ if (fr != null)
+ fr.close();
+ }
+ catch (IOException e)
+ {
+ ; // gulp
+ }
+ }
+ }
+
+ protected void validate()
+ {
+ super.validate();
+ }
+
+ public void execute()
+ {
+ validate();
+
+ String val = value;
+ if (val == null && ref != null)
+ val = ref.getReferencedObject(project).toString();
+
+ if (val == null)
+ throw new BuildException("Either the 'Value' or 'Refid' attribute must be set.");
+
+ StringTokenizer st = new StringTokenizer(val, delimiter);
+ Vector vec = new Vector(st.countTokens());
+ while (st.hasMoreTokens())
+ vec.addElement(st.nextToken());
+
+
+ String propList[] = null;
+
+ if (orderPropertyFile != null)
+ {
+ try
+ {
+ Vector sorted = sortByOrderPropertyFile(vec);
+ propList = new String[sorted.size()];
+ sorted.copyInto(propList);
+ }
+ catch (IOException e)
+ {
+ throw new BuildException(e);
+ }
+ }
+ else
+ {
+ String s[] = (String[])(vec.toArray(new String[vec.size()]));
+ propList = new String[s.length];
+ System.arraycopy(s, 0, propList, 0, s.length);
+ mergeSort(s, propList, 0, s.length, casesensitive, numeric);
+ }
+
+ StringBuffer sb = new StringBuffer();
+ for (int i=0;i<propList.length;i++)
+ {
+ if (i != 0) sb.append(delimiter);
+ sb.append(propList[i]);
+ }
+
+ setPropertyValue(sb.toString());
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/55/10bc84d5e3cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/55/10bc84d5e3cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..d360825
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/55/10bc84d5e3cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.condition;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.condition.Equals;
+
+/**
+ * Extends Equals condition to test if the first argument is greater than the
+ * second argument. Will deal with base 10 integer and decimal numbers, otherwise,
+ * treats arguments as Strings.
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ *
+ * @author Dale Anson, [email protected]
+ * @version $Revision: 1.4 $
+ */
+public class IsGreaterThan extends Equals {
+
+ private String arg1, arg2;
+ private boolean trim = false;
+ private boolean caseSensitive = true;
+
+ public void setArg1(String a1) {
+ arg1 = a1;
+ }
+
+ public void setArg2(String a2) {
+ arg2 = a2;
+ }
+
+ /**
+ * Should we want to trim the arguments before comparing them?
+ *
+ * @since Revision: 1.3, Ant 1.5
+ */
+ public void setTrim(boolean b) {
+ trim = b;
+ }
+
+ /**
+ * Should the comparison be case sensitive?
+ *
+ * @since Revision: 1.3, Ant 1.5
+ */
+ public void setCasesensitive(boolean b) {
+ caseSensitive = b;
+ }
+
+ public boolean eval() throws BuildException {
+ if (arg1 == null || arg2 == null) {
+ throw new BuildException("both arg1 and arg2 are required in "
+ + "greater than");
+ }
+
+ if (trim) {
+ arg1 = arg1.trim();
+ arg2 = arg2.trim();
+ }
+
+ // check if args are numbers
+ try {
+ double num1 = Double.parseDouble(arg1);
+ double num2 = Double.parseDouble(arg2);
+ return num1 > num2;
+ }
+ catch(NumberFormatException nfe) {
+ // ignored, fall thru to string comparision
+ }
+
+ return caseSensitive ? arg1.compareTo(arg2) > 0 : arg1.compareToIgnoreCase(arg2) > 0;
+ }
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/55/b0f9ab54e7cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/55/b0f9ab54e7cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..cbc284d
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/55/b0f9ab54e7cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import net.sf.antcontrib.logic.condition.BooleanConditionBase;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Exit;
+import org.apache.tools.ant.taskdefs.Sequential;
+import org.apache.tools.ant.taskdefs.condition.Condition;
+import org.apache.tools.ant.taskdefs.condition.Equals;
+
+
+/**
+ *
+ * @ant.task name="assert"
+ */
+public class Assert
+ extends BooleanConditionBase {
+
+ private String message;
+ private boolean failOnError = true;
+ private boolean execute = true;
+ private Sequential sequential;
+ private String name;
+ private String value;
+
+ public Sequential createSequential() {
+ this.sequential = (Sequential) getProject().createTask("sequential");
+ return this.sequential;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public BooleanConditionBase createBool() {
+ return this;
+ }
+
+ public void setExecute(boolean execute) {
+ this.execute = execute;
+ }
+
+ public void setFailOnError(boolean failOnError) {
+ this.failOnError = failOnError;
+ }
+
+ public void execute() {
+ String enable = getProject().getProperty("ant.enable.asserts");
+ boolean assertsEnabled = Project.toBoolean(enable);
+
+ if (assertsEnabled) {
+ if (name != null) {
+ if (value == null) {
+ throw new BuildException("The 'value' attribute must accompany the 'name' attribute.");
+ }
+ String propVal = getProject().replaceProperties("${" + name + "}");
+ Equals e = new Equals();
+ e.setArg1(propVal);
+ e.setArg2(value);
+ addEquals(e);
+ }
+
+ if (countConditions() == 0) {
+ throw new BuildException("There is no condition specified.");
+ }
+ else if (countConditions() > 1) {
+ throw new BuildException("There must be exactly one condition specified.");
+ }
+
+ Condition c = (Condition) getConditions().nextElement();
+ if (! c.eval()) {
+ if (failOnError) {
+ Exit fail = (Exit) getProject().createTask("fail");
+ fail.setMessage(message);
+ fail.execute();
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/56/105bfb09e0cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/56/105bfb09e0cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..3b34d8f
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/56/105bfb09e0cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.platform;
+
+
+import java.io.File;
+import java.io.FileOutputStream;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.ExecTask;
+import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.util.FileUtils;
+
+/**
+ * A generic front-end for passing "shell lines" to any application which can
+ * accept a filename containing script input (bash, perl, csh, tcsh, etc.).
+ * see antcontrib doc for useage
+ *
+ * @author stephan beal
+ *@author peter reilly
+ */
+
+public class ShellScriptTask extends ExecTask {
+
+ private StringBuffer script = new StringBuffer();
+ private String shell = null;
+ private File tmpFile;
+ private String tmpSuffix = null;
+
+ /**
+ * Adds s to the lines of script code.
+ */
+ public void addText(String s) {
+ script.append(getProject().replaceProperties(s));
+ }
+
+ /**
+ * Sets script code to s.
+ */
+ public void setInputString(String s) {
+ script.append(s);
+ }
+
+ /**
+ * Sets the shell used to run the script.
+ * @param shell the shell to use (bash is default)
+ */
+ public void setShell(String shell) {
+ this.shell = shell;
+ }
+
+ /**
+ * Sets the shell used to run the script.
+ * @param shell the shell to use (bash is default)
+ */
+ public void setExecutable(String shell) {
+ this.shell = shell;
+ }
+
+ /**
+ * Disallow the command attribute of parent class ExecTask.
+ * ant.attribute ignore="true"
+ * @param notUsed not used
+ * @throws BuildException if called
+ */
+ public void setCommand(Commandline notUsed) {
+ throw new BuildException("Attribute command is not supported");
+ }
+
+
+ /**
+ * Sets the suffix for the tmp file used to
+ * contain the script.
+ * This is useful for cmd.exe as one can
+ * use cmd /c call x.bat
+ * @param tmpSuffix the suffix to use
+ */
+
+ public void setTmpSuffix(String tmpSuffix) {
+ this.tmpSuffix = tmpSuffix;
+ }
+
+ /**
+ * execute the task
+ */
+ public void execute() throws BuildException {
+ // Remove per peter's comments. Makes sense.
+ /*
+ if (shell == null)
+ {
+ // Get the default shell
+ shell = Platform.getDefaultShell();
+
+ // Get the default shell arguments
+ String args[] = Platform.getDefaultShellArguments();
+ for (int i=args.length-1;i>=0;i--)
+ this.cmdl.createArgument(true).setValue(args[i]);
+
+ // Get the default script suffix
+ if (tmpSuffix == null)
+ tmpSuffix = Platform.getDefaultScriptSuffix();
+
+ }
+ */
+ if (shell == null)
+ throw new BuildException("You must specify a shell to run.");
+
+ try {
+ /* // The following may be used when ant 1.6 is used.
+ if (tmpSuffix == null)
+ super.setInputString(script.toString());
+ else
+ */
+ {
+ writeScript();
+ super.createArg().setValue(tmpFile.getAbsolutePath());
+ }
+ super.setExecutable(shell);
+ super.execute();
+ }
+ finally {
+ if (tmpFile != null) {
+ if (! tmpFile.delete()) {
+ log("Non-fatal error: could not delete temporary file " +
+ tmpFile.getAbsolutePath());
+ }
+ }
+ }
+ }
+
+ /**
+ * Writes the script lines to a temp file.
+ */
+ protected void writeScript() throws BuildException {
+ FileOutputStream os = null;
+ try {
+ FileUtils fileUtils = FileUtils.newFileUtils();
+ // NB: use File.io.createTempFile whenever jdk 1.2 is allowed
+ tmpFile = fileUtils.createTempFile("script", tmpSuffix, null);
+ os = new java.io.FileOutputStream(tmpFile);
+ String string = script.toString();
+ os.write(string.getBytes(), 0, string.length());
+ os.close();
+ }
+ catch (Exception e) {
+ throw new BuildException(e);
+ }
+ finally {
+ try {os.close();} catch (Throwable t) {}
+ }
+ }
+
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/57/905d2c8fe8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/57/905d2c8fe8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..eb74f93
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/57/905d2c8fe8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.condition;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.condition.IsTrue;
+
+/**
+ * Extends IsTrue condition to check the value of a specified property.
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ *
+ * @author Dale Anson, [email protected]
+ * @version $Revision: 1.3 $
+ * @ant.type name="ispropertytrue"
+ */
+public class IsPropertyTrue extends IsTrue {
+
+ private String name = null;
+
+ public void setProperty( String name ) {
+ this.name = name;
+ }
+
+ public boolean eval() throws BuildException {
+ if ( name == null )
+ throw new BuildException( "Property name must be set." );
+ String value = getProject().getProperty( name );
+ if ( value == null )
+ return false;
+ return Project..toBoolean( value );
+ }
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/59/c0c8c246e1cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/59/c0c8c246e1cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..62b2e17
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/59/c0c8c246e1cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,9 @@
+<antlib>
+<XDtClass:forAllClasses><XDtClass:ifHasClassTag tagName="ant:task"
+><XDtClass:classTagValue tagName="ant:task" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag
+><XDtClass:ifHasClassTag tagName="ant:type"
+><XDtClass:classTagValue tagName="ant:type" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag
+></XDtClass:forAllClasses>
+</antlib> \ No newline at end of file
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5a/e048ee04dfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/5a/e048ee04dfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..da4ccd8
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/5a/e048ee04dfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,285 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Reference;
+
+
+/***
+ * Task definition for the foreach task. The foreach task iterates
+ * over a list, a list of filesets, or both.
+ *
+ * <pre>
+ *
+ * Usage:
+ *
+ * Task declaration in the project:
+ * <code>
+ * &lt;taskdef name="latesttimestamp" classname="net.sf.antcontrib.logic.TimestampSelector" /&gt;
+ * </code>
+ *
+ * Call Syntax:
+ * <code>
+ * &lt;timestampselector
+ * [property="prop" | outputsetref="id"]
+ * [count="num"]
+ * [age="eldest|youngest"]
+ * [pathSep=","]
+ * [pathref="ref"] &gt;
+ * &lt;path&gt;
+ * ...
+ * &lt;/path&gt;
+ * &lt;/latesttimestamp&gt;
+ * </code>
+ *
+ * Attributes:
+ * outputsetref --> The reference of the output Path set which will contain the
+ * files with the latest timestamps.
+ * property --> The name of the property to set with file having the latest
+ * timestamp. If you specify the "count" attribute, you will get
+ * the lastest N files. These will be the absolute pathnames
+ * count --> How many of the latest files do you wish to find
+ * pathSep --> What to use as the path separator when using the "property"
+ * attribute, in conjunction with the "count" attribute
+ * pathref --> The reference of the path which is the input set of files.
+ *
+ * </pre>
+ * @author <a href="mailto:[email protected]">Matthew Inger</a>
+ */
+public class TimestampSelector extends Task
+{
+ private static final String AGE_ELDEST = "eldest";
+ private static final String AGE_YOUNGEST = "youngest";
+
+ private String property;
+ private Path path;
+ private String outputSetId;
+ private int count = 1;
+ private char pathSep = ',';
+ private String age = AGE_YOUNGEST;
+
+
+ /***
+ * Default Constructor
+ */
+ public TimestampSelector()
+ {
+ super();
+ }
+
+
+ public void doFileSetExecute(String paths[])
+ throws BuildException
+ {
+
+ }
+
+ // Sorts entire array
+ public void sort(Vector array)
+ {
+ sort(array, 0, array.size() - 1);
+ }
+
+ // Sorts partial array
+ protected void sort(Vector array, int start, int end)
+ {
+ int p;
+ if (end > start)
+ {
+ p = partition(array, start, end);
+ sort(array, start, p-1);
+ sort(array, p+1, end);
+ }
+ }
+
+ protected int compare(File a, File b)
+ {
+ if (age.equalsIgnoreCase(AGE_ELDEST))
+ return new Long(a.lastModified()).compareTo(new Long(b.lastModified()));
+ else
+ return new Long(b.lastModified()).compareTo(new Long(a.lastModified()));
+ }
+
+ protected int partition(Vector array, int start, int end)
+ {
+ int left, right;
+ File partitionElement;
+
+ partitionElement = (File)array.elementAt(end);
+
+ left = start - 1;
+ right = end;
+ for (;;)
+ {
+ while (compare(partitionElement, (File)array.elementAt(++left)) == 1)
+ {
+ if (left == end) break;
+ }
+ while (compare(partitionElement, (File)array.elementAt(--right)) == -1)
+ {
+ if (right == start) break;
+ }
+ if (left >= right) break;
+ swap(array, left, right);
+ }
+ swap(array, left, end);
+
+ return left;
+ }
+
+ protected void swap(Vector array, int i, int j)
+ {
+ Object temp;
+
+ temp = array.elementAt(i);
+ array.setElementAt(array.elementAt(j), i);
+ array.setElementAt(temp, j);
+ }
+
+ public void execute()
+ throws BuildException
+ {
+ if (property == null && outputSetId == null)
+ throw new BuildException("Property or OutputSetId must be specified.");
+ if (path == null)
+ throw new BuildException("A path element or pathref attribute must be specified.");
+
+ // Figure out the list of existing file elements
+ // from the designated path
+ String s[] = path.list();
+ Vector v = new Vector();
+ for (int i=0;i<s.length;i++)
+ {
+ File f = new File(s[i]);
+ if (f.exists())
+ v.addElement(f);
+ }
+
+ // Sort the vector, need to make java 1.1 compliant
+ sort(v);
+
+ // Pull off the first N items
+ Vector v2 = new Vector();
+ int sz = v.size();
+ for (int i=0;i<sz && i<count;i++)
+ v2.add(v.elementAt(i));
+
+
+
+
+ // Build the resulting Path object
+ Path path = new Path(getProject());
+ sz = v2.size();
+ for (int i=0;i<sz;i++)
+ {
+ File f = (File)(v.elementAt(i));
+ Path p = new Path(getProject(), f.getAbsolutePath());
+ path.addExisting(p);
+ }
+
+
+ if (outputSetId != null)
+ {
+ // Add the reference to the project
+ getProject().addReference(outputSetId, path);
+ }
+ else
+ {
+ // Concat the paths, and put them in a property
+ // which is separated list of the files, using the
+ // "pathSep" attribute as the separator
+ String paths[] = path.list();
+ StringBuffer sb = new StringBuffer();
+ for (int i=0;i<paths.length;i++)
+ {
+ if (i != 0) sb.append(pathSep);
+ sb.append(paths[i]);
+ }
+
+ if (paths.length != 0)
+ getProject().setProperty(property, sb.toString());
+ }
+ }
+
+
+ public void setProperty(String property)
+ {
+ if (outputSetId != null)
+ throw new BuildException("Cannot set both Property and OutputSetId.");
+
+ this.property = property;
+ }
+
+ public void setCount(int count)
+ {
+ this.count = count;
+ }
+
+ public void setAge(String age)
+ {
+ if (age.equalsIgnoreCase(AGE_ELDEST) ||
+ age.equalsIgnoreCase(AGE_YOUNGEST))
+ this.age = age;
+ else
+ throw new BuildException("Invalid age: " + age);
+ }
+
+ public void setPathSep(char pathSep)
+ {
+ this.pathSep = pathSep;
+ }
+
+ public void setOutputSetId(String outputSetId)
+ {
+ if (property != null)
+ throw new BuildException("Cannot set both Property and OutputSetId.");
+ this.outputSetId = outputSetId;
+ }
+
+ public void setPathRef(Reference ref)
+ throws BuildException
+ {
+ if (path == null)
+ {
+ path = new Path(getProject());
+ path.setRefid(ref);
+ }
+ else
+ {
+ throw new BuildException("Path element already specified.");
+ }
+ }
+
+
+ public Path createPath()
+ throws BuildException
+ {
+ if (path == null)
+ path = new Path(getProject());
+ else
+ throw new BuildException("Path element already specified.");
+ return path;
+ }
+
+}
+
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5c/50e5b4e7c4cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/5c/50e5b4e7c4cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..2f36c77
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/5c/50e5b4e7c4cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,400 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.Resource;
+import org.apache.tools.ant.types.ResourceCollection;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ * @author Matt Inger
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+ private List resourceCollections = new ArrayList();
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ public void add(ResourceCollection resourceCollection) {
+ this.resourceCollections.add(resourceCollection);
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && resourceCollections.isEmpty() && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or resources or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ Iterator it = resourceCollections.iterator();
+ while (it.hasNext()) {
+ ResourceCollection c = (ResourceCollection) it.next();
+ Iterator rit = c.iterator();
+ while (rit.hasNext()) {
+ Resource r = (Resource) rit.next();
+ doToken(r.toString());
+ }
+ }
+
+ it = hasIterators.iterator();
+ while (it.hasNext()) {
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5c/a021a44ae1cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/5c/a021a44ae1cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..b8d049a
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/5c/a021a44ae1cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,14 @@
+<antlib>
+<XDtClass:forAllClasses><XDtClass:ifHasClassTag tagName="ant:task">
+<taskdef name="<XDtClass:classTagValue tagName="ant:task" paramName="name"/>"
+ classname="<XDtClass:fullClassName />"
+ <XDtClass:ifHasClassTag tagName="ant:task" paramName="ignore">onerror="<XDtClass:classTagValue tagName="ant:task" paramName="ignore"/>"</XDtClass:ifHasClassTag> />
+</XDtClass:ifHasClassTag>
+<XDtClass:ifHasClassTag tagName="ant:type">
+<taskdef name="<XDtClass:classTagValue tagName="ant:type" paramName="name"/>"
+ classname="<XDtClass:fullClassName />"
+ <XDtClass:ifHasClassTag tagName="ant:task" paramName="ignore">onerror="<XDtClass:classTagValue tagName="ant:task" paramName="ignore"/>"</XDtClass:ifHasClassTag> />
+<XDtClass:classTagValue tagName="ant:type" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag
+></XDtClass:forAllClasses>
+</antlib> \ No newline at end of file
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5c/d03e8612e0cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/5c/d03e8612e0cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..69990bd
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/5c/d03e8612e0cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.process;
+
+import org.apache.tools.ant.taskdefs.Sequential;
+
+
+/****************************************************************************
+ * Place class description here.
+ *
+ * @author <a href='mailto:[email protected]'>Matthew Inger</a>
+ * @author <additional author>
+ *
+ * @since
+ *
+ ****************************************************************************/
+
+
+public class ForgetTask
+ extends Sequential
+ implements Runnable
+{
+ private boolean daemon = true;
+
+ public ForgetTask()
+ {
+ super();
+ }
+
+
+ public void setDaemon(boolean daemon)
+ {
+ this.daemon = daemon;
+ }
+
+
+ public void execute()
+ {
+ Thread t = new Thread(this);
+ t.setDaemon(daemon);
+ t.start();
+ }
+
+ public void run()
+ {
+ super.execute();
+ }
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5d/a0a1d5d2e3cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/5d/a0a1d5d2e3cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..d1060ab
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/5d/a0a1d5d2e3cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.condition;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.condition.IsTrue;
+
+/**
+ * Extends IsTrue condition to check the value of a specified property.
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ *
+ * @author Dale Anson, [email protected]
+ * @version $Revision: 1.3 $
+ */
+public class IsPropertyTrue extends IsTrue {
+
+ private String name = null;
+
+ public void setProperty( String name ) {
+ this.name = name;
+ }
+
+ public boolean eval() throws BuildException {
+ if ( name == null )
+ throw new BuildException( "Property name must be set." );
+ String value = getProject().getProperty( name );
+ if ( value == null )
+ return false;
+ return getProject().toBoolean( value );
+ }
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5e/80ae3dd5c3cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/5e/80ae3dd5c3cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..1d72531
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/5e/80ae3dd5c3cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,439 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.ResourceCollection;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ * @author Matt Inger
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+ private List resourceCollections = new ArrayList();
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ public void add(ResourceCollection resourceCollection) {
+ this.resourceCollections.add(resourceCollection);
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && currPath == null && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or path or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ // Take Care of the path element
+ String[] pathElements = new String[0];
+ if (currPath != null) {
+ pathElements = currPath.list();
+ }
+ for (int i = 0; i < pathElements.length; i++) {
+ File nextFile = new File(pathElements[i]);
+ doToken(nextFile.getAbsolutePath());
+ }
+
+ // Take care of iterators
+ for (Iterator i = hasIterators.iterator(); i.hasNext();) {
+ Iterator it = ((HasIterator) i.next()).iterator();
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void add(FileSet fileset) {
+ getOrCreatePath().addFileset(fileset);
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void addFileSet(FileSet fileset) {
+ add(fileset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void add(DirSet dirset) {
+ getOrCreatePath().addDirset(dirset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void addDirSet(DirSet dirset) {
+ add(dirset);
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5e/d02bec52e8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/5e/d02bec52e8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..19d1707
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/5e/d02bec52e8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.condition;
+
+import java.lang.reflect.Field;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.condition.ConditionBase;
+
+/**
+ * Extends ConditionBase so I can get access to the condition count and the
+ * first condition. This is the class that the BooleanConditionTask is proxy
+ * for.
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ *
+ * @author Dale Anson, [email protected]
+ */
+public class BooleanConditionBase extends ConditionBase {
+
+ private Vector conditions;
+
+ public BooleanConditionBase() {
+ this.conditions = getParentConditions();
+ }
+
+ private Vector getParentConditions() {
+ try {
+ Field f = ConditionBase.class.getDeclaredField("conditions");
+ f.setAccessible(true);
+ Vector v = (Vector) f.get(this);
+ return v;
+ }
+ catch (NoSuchFieldException e) {
+ throw new BuildException(e);
+ }
+ catch (IllegalAccessException e) {
+ throw new BuildException(e);
+ }
+ }
+ /**
+ * Adds a feature to the IsPropertyTrue attribute of the BooleanConditionBase
+ * object
+ *
+ * @param i The feature to be added to the IsPropertyTrue attribute
+ */
+ public void addIsPropertyTrue( IsPropertyTrue i ) {
+ getConditions().add( i );
+ }
+
+ /**
+ * Adds a feature to the IsPropertyFalse attribute of the
+ * BooleanConditionBase object
+ *
+ * @param i The feature to be added to the IsPropertyFalse attribute
+ */
+ public void addIsPropertyFalse( IsPropertyFalse i ) {
+ getConditions().add( i );
+ }
+
+ public void addIsGreaterThan( IsGreaterThan i) {
+ getConditions().add(i);
+ }
+
+ public void addIsLessThan( IsLessThan i) {
+ getConditions().add(i);
+ }
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5e/e01425c7d8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/5e/e01425c7d8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..21f99b7
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/5e/e01425c7d8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,466 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.ant16;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ * @author Matt Inger
+ * @task name=for
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private Path currPath;
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ private Path getOrCreatePath() {
+ if (currPath == null) {
+ currPath = new Path(getProject());
+ }
+ return currPath;
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfigured(Path path) {
+ getOrCreatePath().append(path);
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfiguredPath(Path path) {
+ addConfigured(path);
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && currPath == null && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or path or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ // Take Care of the path element
+ String[] pathElements = new String[0];
+ if (currPath != null) {
+ pathElements = currPath.list();
+ }
+ for (int i = 0; i < pathElements.length; i++) {
+ File nextFile = new File(pathElements[i]);
+ doToken(nextFile.getAbsolutePath());
+ }
+
+ // Take care of iterators
+ for (Iterator i = hasIterators.iterator(); i.hasNext();) {
+ Iterator it = ((HasIterator) i.next()).iterator();
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void add(FileSet fileset) {
+ getOrCreatePath().addFileset(fileset);
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void addFileSet(FileSet fileset) {
+ add(fileset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void add(DirSet dirset) {
+ getOrCreatePath().addDirset(dirset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void addDirSet(DirSet dirset) {
+ add(dirset);
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6/c021d3dfe3cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/6/c021d3dfe3cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..5e9b665
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/6/c021d3dfe3cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.ant16;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import net.sf.antcontrib.logic.condition.BooleanConditionBase;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.ProjectHelper;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.TaskContainer;
+import org.apache.tools.ant.taskdefs.Exit;
+import org.apache.tools.ant.taskdefs.Sequential;
+import org.apache.tools.ant.taskdefs.condition.Condition;
+import org.apache.tools.ant.taskdefs.condition.ConditionBase;
+import org.apache.tools.ant.taskdefs.condition.Equals;
+
+
+/**
+ *
+ * @ant.task name="assert"
+ */
+public class Assert
+ extends ConditionBase {
+
+ private List tasks = new ArrayList();
+ private String message;
+ private boolean failOnError = true;
+ private boolean execute = true;
+ private Sequential sequential;
+ private String name;
+ private String value;
+
+ public Sequential createSequential() {
+ this.sequential = (Sequential) getProject().createTask("sequential");
+ return this.sequential;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public BooleanConditionBase createBool() {
+ return this;
+ }
+
+ public void setExecute(boolean execute) {
+ this.execute = execute;
+ }
+
+ public void setFailOnError(boolean failOnError) {
+ this.failOnError = failOnError;
+ }
+
+ public void execute() {
+ String value = getProject().getProperty("ant.enable.asserts");
+ boolean assertsEnabled = Project.toBoolean(value);
+
+ if (assertsEnabled) {
+ if (name != null) {
+ if (value == null) {
+ throw new BuildException("The 'value' attribute must accompany the 'name' attribute.");
+ }
+ String propVal = getProject().replaceProperties("${" + name + "}");
+ Equals e = new Equals();
+ e.setArg1(propVal);
+ e.setArg2(value);
+ addEquals(e);
+ }
+
+ if (countConditions() == 0) {
+ throw new BuildException("There is no condition specified.");
+ }
+ else if (countConditions() > 1) {
+ throw new BuildException("There must be exactly one condition specified.");
+ }
+
+ Condition c = (Condition) getConditions().nextElement();
+ if (! c.eval()) {
+ if (failOnError) {
+ Exit fail = (Exit) getProject().createTask("fail");
+ fail.setMessage(message);
+ fail.execute();
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/60/60e21d0cdfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/60/60e21d0cdfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..9dde23f
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/60/60e21d0cdfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,283 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Reference;
+
+
+/***
+ *
+ * <pre>
+ *
+ * Usage:
+ *
+ * Task declaration in the project:
+ * <code>
+ * &lt;taskdef name="latesttimestamp" classname="net.sf.antcontrib.logic.TimestampSelector" /&gt;
+ * </code>
+ *
+ * Call Syntax:
+ * <code>
+ * &lt;timestampselector
+ * [property="prop" | outputsetref="id"]
+ * [count="num"]
+ * [age="eldest|youngest"]
+ * [pathSep=","]
+ * [pathref="ref"] &gt;
+ * &lt;path&gt;
+ * ...
+ * &lt;/path&gt;
+ * &lt;/latesttimestamp&gt;
+ * </code>
+ *
+ * Attributes:
+ * outputsetref --> The reference of the output Path set which will contain the
+ * files with the latest timestamps.
+ * property --> The name of the property to set with file having the latest
+ * timestamp. If you specify the "count" attribute, you will get
+ * the lastest N files. These will be the absolute pathnames
+ * count --> How many of the latest files do you wish to find
+ * pathSep --> What to use as the path separator when using the "property"
+ * attribute, in conjunction with the "count" attribute
+ * pathref --> The reference of the path which is the input set of files.
+ *
+ * </pre>
+ * @author <a href="mailto:[email protected]">Matthew Inger</a>
+ */
+public class TimestampSelector extends Task
+{
+ private static final String AGE_ELDEST = "eldest";
+ private static final String AGE_YOUNGEST = "youngest";
+
+ private String property;
+ private Path path;
+ private String outputSetId;
+ private int count = 1;
+ private char pathSep = ',';
+ private String age = AGE_YOUNGEST;
+
+
+ /***
+ * Default Constructor
+ */
+ public TimestampSelector()
+ {
+ super();
+ }
+
+
+ public void doFileSetExecute(String paths[])
+ throws BuildException
+ {
+
+ }
+
+ // Sorts entire array
+ public void sort(Vector array)
+ {
+ sort(array, 0, array.size() - 1);
+ }
+
+ // Sorts partial array
+ protected void sort(Vector array, int start, int end)
+ {
+ int p;
+ if (end > start)
+ {
+ p = partition(array, start, end);
+ sort(array, start, p-1);
+ sort(array, p+1, end);
+ }
+ }
+
+ protected int compare(File a, File b)
+ {
+ if (age.equalsIgnoreCase(AGE_ELDEST))
+ return new Long(a.lastModified()).compareTo(new Long(b.lastModified()));
+ else
+ return new Long(b.lastModified()).compareTo(new Long(a.lastModified()));
+ }
+
+ protected int partition(Vector array, int start, int end)
+ {
+ int left, right;
+ File partitionElement;
+
+ partitionElement = (File)array.elementAt(end);
+
+ left = start - 1;
+ right = end;
+ for (;;)
+ {
+ while (compare(partitionElement, (File)array.elementAt(++left)) == 1)
+ {
+ if (left == end) break;
+ }
+ while (compare(partitionElement, (File)array.elementAt(--right)) == -1)
+ {
+ if (right == start) break;
+ }
+ if (left >= right) break;
+ swap(array, left, right);
+ }
+ swap(array, left, end);
+
+ return left;
+ }
+
+ protected void swap(Vector array, int i, int j)
+ {
+ Object temp;
+
+ temp = array.elementAt(i);
+ array.setElementAt(array.elementAt(j), i);
+ array.setElementAt(temp, j);
+ }
+
+ public void execute()
+ throws BuildException
+ {
+ if (property == null && outputSetId == null)
+ throw new BuildException("Property or OutputSetId must be specified.");
+ if (path == null)
+ throw new BuildException("A path element or pathref attribute must be specified.");
+
+ // Figure out the list of existing file elements
+ // from the designated path
+ String s[] = path.list();
+ Vector v = new Vector();
+ for (int i=0;i<s.length;i++)
+ {
+ File f = new File(s[i]);
+ if (f.exists())
+ v.addElement(f);
+ }
+
+ // Sort the vector, need to make java 1.1 compliant
+ sort(v);
+
+ // Pull off the first N items
+ Vector v2 = new Vector();
+ int sz = v.size();
+ for (int i=0;i<sz && i<count;i++)
+ v2.add(v.elementAt(i));
+
+
+
+
+ // Build the resulting Path object
+ Path path = new Path(getProject());
+ sz = v2.size();
+ for (int i=0;i<sz;i++)
+ {
+ File f = (File)(v.elementAt(i));
+ Path p = new Path(getProject(), f.getAbsolutePath());
+ path.addExisting(p);
+ }
+
+
+ if (outputSetId != null)
+ {
+ // Add the reference to the project
+ getProject().addReference(outputSetId, path);
+ }
+ else
+ {
+ // Concat the paths, and put them in a property
+ // which is separated list of the files, using the
+ // "pathSep" attribute as the separator
+ String paths[] = path.list();
+ StringBuffer sb = new StringBuffer();
+ for (int i=0;i<paths.length;i++)
+ {
+ if (i != 0) sb.append(pathSep);
+ sb.append(paths[i]);
+ }
+
+ if (paths.length != 0)
+ getProject().setProperty(property, sb.toString());
+ }
+ }
+
+
+ public void setProperty(String property)
+ {
+ if (outputSetId != null)
+ throw new BuildException("Cannot set both Property and OutputSetId.");
+
+ this.property = property;
+ }
+
+ public void setCount(int count)
+ {
+ this.count = count;
+ }
+
+ public void setAge(String age)
+ {
+ if (age.equalsIgnoreCase(AGE_ELDEST) ||
+ age.equalsIgnoreCase(AGE_YOUNGEST))
+ this.age = age;
+ else
+ throw new BuildException("Invalid age: " + age);
+ }
+
+ public void setPathSep(char pathSep)
+ {
+ this.pathSep = pathSep;
+ }
+
+ public void setOutputSetId(String outputSetId)
+ {
+ if (property != null)
+ throw new BuildException("Cannot set both Property and OutputSetId.");
+ this.outputSetId = outputSetId;
+ }
+
+ public void setPathRef(Reference ref)
+ throws BuildException
+ {
+ if (path == null)
+ {
+ path = new Path(getProject());
+ path.setRefid(ref);
+ }
+ else
+ {
+ throw new BuildException("Path element already specified.");
+ }
+ }
+
+
+ public Path createPath()
+ throws BuildException
+ {
+ if (path == null)
+ path = new Path(getProject());
+ else
+ throw new BuildException("Path element already specified.");
+ return path;
+ }
+
+}
+
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/60/90dcfaefdfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/60/90dcfaefdfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..bd3279e
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/60/90dcfaefdfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import org.apache.commons.httpclient.Cookie;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.auth.AuthScope;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.DataType;
+
+public class HttpStateType
+ extends DataType {
+
+ private HttpState state;
+
+ public HttpStateType(Project p) {
+ super();
+ setProject(p);
+
+ state = new HttpState();
+ }
+
+ public HttpState getState() {
+ if (isReference()) {
+ return getRef().getState();
+ }
+ else {
+ return state;
+ }
+ }
+
+ protected HttpStateType getRef() {
+ return (HttpStateType) super.getCheckedRef(HttpStateType.class,
+ "http-state");
+ }
+
+ public void addConfiguredCredentials(Credentials credentials) {
+ if (isReference()) {
+ tooManyAttributes();
+ }
+
+ AuthScope scope = new AuthScope(credentials.getHost(),
+ credentials.getPort(),
+ credentials.getRealm(),
+ credentials.getScheme());
+
+ UsernamePasswordCredentials c = new UsernamePasswordCredentials(
+ credentials.getUsername(),
+ credentials.getPassword());
+
+ state.setCredentials(scope, c);
+ }
+
+ public void addConfiguredProxyCredentials(Credentials credentials) {
+ if (isReference()) {
+ tooManyAttributes();
+ }
+
+ AuthScope scope = new AuthScope(credentials.getHost(),
+ credentials.getPort(),
+ credentials.getRealm(),
+ credentials.getScheme());
+
+ UsernamePasswordCredentials c = new UsernamePasswordCredentials(
+ credentials.getUsername(),
+ credentials.getPassword());
+
+ state.setProxyCredentials(scope, c);
+ }
+
+ public void addConfiguredCookie(Cookie cookie) {
+ if (isReference()) {
+ tooManyAttributes();
+ }
+
+ state.addCookie(cookie);
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/61/d02ece32e2cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/61/d02ece32e2cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..b6514fc
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/61/d02ece32e2cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.methods.PostMethod;
+
+/***
+ *
+ * @author minger
+ * @ant.task name="getmethod"
+ *
+ */
+public class GetMethodTask
+ extends AbstractMethodTask {
+
+ protected HttpMethodBase createNewMethod() {
+ return new PostMethod();
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/62/50fa868fe0cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/62/50fa868fe0cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..cdad346
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/62/50fa868fe0cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,5 @@
+<XDtClass:forAllClasses>
+<XDtClass:ifHasClassTag tagName="ant:task">
+<XDtClass:classTagValue tagName="ant:task" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag>
+</XDtClass:forAllClasses> \ No newline at end of file
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/67/c08995d7dacc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/67/c08995d7dacc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..28395a7
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/67/c08995d7dacc001b1cb5d1e6b2b8577e
@@ -0,0 +1,401 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.ant17;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.Resource;
+import org.apache.tools.ant.types.ResourceCollection;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.7.0
+ * @author Peter Reilly
+ * @author Matt Inger
+ * @ant.task name=for
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+ private List resourceCollections = new ArrayList();
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ public void add(ResourceCollection resourceCollection) {
+ this.resourceCollections.add(resourceCollection);
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && resourceCollections.isEmpty() && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or resources or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ Iterator it = resourceCollections.iterator();
+ while (it.hasNext()) {
+ ResourceCollection c = (ResourceCollection) it.next();
+ Iterator rit = c.iterator();
+ while (rit.hasNext()) {
+ Resource r = (Resource) rit.next();
+ doToken(r.toString());
+ }
+ }
+
+ it = hasIterators.iterator();
+ while (it.hasNext()) {
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6a/40eb8a34e8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/6a/40eb8a34e8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..6d53405
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/6a/40eb8a34e8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.condition;
+
+import java.lang.reflect.Field;
+import java.util.Vector;
+
+import org.apache.tools.ant.taskdefs.condition.ConditionBase;
+
+/**
+ * Extends ConditionBase so I can get access to the condition count and the
+ * first condition. This is the class that the BooleanConditionTask is proxy
+ * for.
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ *
+ * @author Dale Anson, [email protected]
+ */
+public class BooleanConditionBase extends ConditionBase {
+
+ private Vector conditions;
+
+ public BooleanConditionBase() {
+ this.conditions = getConditions();
+ }
+
+ private Vector getConditions() {
+ Field f = ConditionBase.class.getDeclaredField("conditions");
+ f.setAccessible(true);
+ Vector v = (Vector) f.get(this);
+ return v;
+
+ }
+ /**
+ * Adds a feature to the IsPropertyTrue attribute of the BooleanConditionBase
+ * object
+ *
+ * @param i The feature to be added to the IsPropertyTrue attribute
+ */
+ public void addIsPropertyTrue( IsPropertyTrue i ) {
+ getConditions().add( i );
+ }
+
+ /**
+ * Adds a feature to the IsPropertyFalse attribute of the
+ * BooleanConditionBase object
+ *
+ * @param i The feature to be added to the IsPropertyFalse attribute
+ */
+ public void addIsPropertyFalse( IsPropertyFalse i ) {
+ getConditions().add( i );
+ }
+
+ public void addIsGreaterThan( IsGreaterThan i) {
+ getConditions().add(i);
+ }
+
+ public void addIsLessThan( IsLessThan i) {
+ getConditions().add(i);
+ }
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6b/007f3805e4cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/6b/007f3805e4cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..cb24673
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/6b/007f3805e4cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import net.sf.antcontrib.logic.condition.BooleanConditionBase;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.ProjectHelper;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.TaskContainer;
+import org.apache.tools.ant.taskdefs.Exit;
+import org.apache.tools.ant.taskdefs.Sequential;
+import org.apache.tools.ant.taskdefs.condition.Condition;
+import org.apache.tools.ant.taskdefs.condition.Equals;
+
+
+/**
+ *
+ * @ant.task name="assert"
+ */
+public class Assert
+ extends BooleanConditionBase {
+
+ private List tasks = new ArrayList();
+ private String message;
+ private boolean failOnError = true;
+ private boolean execute = true;
+ private Sequential sequential;
+ private String name;
+ private String value;
+
+ public Sequential createSequential() {
+ this.sequential = (Sequential) getProject().createTask("sequential");
+ return this.sequential;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public BooleanConditionBase createBool() {
+ return this;
+ }
+
+ public void setExecute(boolean execute) {
+ this.execute = execute;
+ }
+
+ public void setFailOnError(boolean failOnError) {
+ this.failOnError = failOnError;
+ }
+
+ public void execute() {
+ String value = getProject().getProperty("ant.enable.asserts");
+ boolean assertsEnabled = Project.toBoolean(value);
+
+ if (assertsEnabled) {
+ if (name != null) {
+ if (value == null) {
+ throw new BuildException("The 'value' attribute must accompany the 'name' attribute.");
+ }
+ String propVal = getProject().replaceProperties("${" + name + "}");
+ Equals e = new Equals();
+ e.setArg1(propVal);
+ e.setArg2(value);
+ addEquals(e);
+ }
+
+ if (countConditions() == 0) {
+ throw new BuildException("There is no condition specified.");
+ }
+ else if (countConditions() > 1) {
+ throw new BuildException("There must be exactly one condition specified.");
+ }
+
+ Condition c = (Condition) getConditions().nextElement();
+ if (! c.eval()) {
+ if (failOnError) {
+ Exit fail = (Exit) getProject().createTask("fail");
+ fail.setMessage(message);
+ fail.execute();
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6b/1011a45fe0cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/6b/1011a45fe0cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..cb11365
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/6b/1011a45fe0cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.property;
+
+import java.io.File;
+import java.net.URLEncoder;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.Reference;
+
+
+/****************************************************************************
+ * Place class description here.
+ *
+ * @author <a href='mailto:[email protected]'>Matthew Inger</a>
+ * @author <additional author>
+ *
+ * @since
+ *
+ ****************************************************************************/
+
+
+public class URLEncodeTask
+ extends AbstractPropertySetterTask
+{
+ private String value;
+ private Reference ref;
+
+ public void setName(String name)
+ {
+ setProperty(name);
+ }
+
+
+ public void setValue(String value)
+ {
+ this.value = URLEncoder.encode(value);
+ }
+
+ public String getValue(Project p)
+ {
+ String val = value;
+
+ if (ref != null)
+ val = ref.getReferencedObject(p).toString();
+
+ return val;
+ }
+
+ public void setLocation(File location) {
+ setValue(location.getAbsolutePath());
+ }
+
+ public void setRefid(Reference ref) {
+ this.ref = ref;
+ }
+
+ public String toString() {
+ return value == null ? "" : value;
+ }
+
+ protected void validate()
+ {
+ super.validate();
+ if (value == null && ref == null)
+ {
+ throw new BuildException("You must specify value, location or "
+ + "refid with the name attribute",
+ getLocation());
+ }
+ }
+
+ public void execute()
+ {
+ validate();
+ String val = getValue(getProject());
+ setPropertyValue(val);
+ }
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6c/90f93031e2cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/6c/90f93031e2cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..aa6ca0e
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/6c/90f93031e2cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import org.apache.commons.httpclient.Cookie;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.commons.httpclient.cookie.CookiePolicy;
+import org.apache.commons.httpclient.cookie.CookieSpec;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.Property;
+
+/***
+ *
+ * @author minger
+ * @ant.task name="getcookie"
+ *
+ */
+public class GetCookieTask
+ extends AbstractHttpStateTypeTask {
+
+ private String property;
+ private String prefix;
+ private String cookiePolicy = CookiePolicy.DEFAULT;
+
+ private String realm = null;
+ private int port = 80;
+ private String path = null;
+ private boolean secure = false;
+ private String name = null;
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setCookiePolicy(String cookiePolicy) {
+ this.cookiePolicy = cookiePolicy;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public void setPort(int port) {
+ this.port = port;
+ }
+
+ public void setRealm(String realm) {
+ this.realm = realm;
+ }
+
+ public void setSecure(boolean secure) {
+ this.secure = secure;
+ }
+
+ public void setProperty(String property) {
+ this.property = property;
+ }
+
+ private Cookie findCookie(Cookie cookies[], String name) {
+ for (int i=0;i<cookies.length;i++) {
+ if (cookies[i].getName().equals(name)) {
+ return cookies[i];
+ }
+ }
+ return null;
+ }
+ protected void execute(HttpStateType stateType) throws BuildException {
+
+ if (realm == null || path == null) {
+ throw new BuildException("'realm' and 'path' attributes are required");
+ }
+
+ HttpState state = stateType.getState();
+ CookieSpec spec = CookiePolicy.getCookieSpec(cookiePolicy);
+ Cookie cookies[] = state.getCookies();
+ Cookie matches[] = spec.match(realm, port, path, secure, cookies);
+
+ if (name != null) {
+ Cookie c = findCookie(matches, name);
+ if (c != null) {
+ matches = new Cookie[] { c };
+ }
+ else {
+ matches = new Cookie[0];
+ }
+ }
+
+
+ if (property != null) {
+ if (matches != null && matches.length > 0) {
+ Property p = (Property)getProject().createTask("property");
+ p.setName(property);
+ p.setValue(matches[0].getValue());
+ p.perform();
+ }
+ }
+ else if (prefix != null) {
+ if (matches != null && matches.length > 0) {
+ for (int i=0;i<matches.length;i++) {
+ String propName =
+ prefix +
+ matches[i].getName();
+ Property p = (Property)getProject().createTask("property");
+ p.setName(propName);
+ p.setValue(matches[i].getValue());
+ p.perform();
+ }
+ }
+ }
+ else {
+ throw new BuildException("Nothing to set");
+ }
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6c/a0290b92dfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/6c/a0290b92dfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..c41cc21
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/6c/a0290b92dfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,230 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.NameValuePair;
+import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.apache.commons.httpclient.methods.multipart.FilePart;
+import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
+import org.apache.commons.httpclient.methods.multipart.Part;
+import org.apache.commons.httpclient.methods.multipart.StringPart;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.util.FileUtils;
+
+public class PostMethodTask
+ extends AbstractMethodTask {
+
+ private List parts = new ArrayList();
+ private boolean multipart;
+ private transient FileInputStream stream;
+
+
+ public static class FilePartType {
+ private File path;
+ private String contentType = FilePart.DEFAULT_CONTENT_TYPE;
+ private String charSet = FilePart.DEFAULT_CHARSET;
+
+ public File getPath() {
+ return path;
+ }
+
+ public void setPath(File path) {
+ this.path = path;
+ }
+
+ public String getContentType() {
+ return contentType;
+ }
+
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+
+ public String getCharSet() {
+ return charSet;
+ }
+
+ public void setCharSet(String charSet) {
+ this.charSet = charSet;
+ }
+ }
+
+ public static class TextPartType {
+ private String name = "";
+ private String value = "";
+ private String charSet = StringPart.DEFAULT_CHARSET;
+ private String contentType = StringPart.DEFAULT_CONTENT_TYPE;
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getCharSet() {
+ return charSet;
+ }
+
+ public void setCharSet(String charSet) {
+ this.charSet = charSet;
+ }
+
+ public String getContentType() {
+ return contentType;
+ }
+
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+
+ public void setText(String text) {
+ this.value = text;
+ }
+ }
+
+ public void addConfiguredFile(FilePartType file) {
+ this.parts.add(file);
+ }
+
+ public void setMultipart(boolean multipart) {
+ this.multipart = multipart;
+ }
+
+ public void addConfiguredText(TextPartType text) {
+ this.parts.add(text);
+ }
+
+ public void setParameters(File parameters) {
+ PostMethod post = getPostMethod();
+ Properties p = new Properties();
+ Iterator it = p.entrySet().iterator();
+ while (it.hasNext()) {
+ Map.Entry entry = (Map.Entry) it.next();
+ post.addParameter(entry.getKey().toString(),
+ entry.getValue().toString());
+ }
+ }
+
+ protected HttpMethodBase createNewMethod() {
+ return new PostMethod();
+ }
+
+ private PostMethod getPostMethod() {
+ return ((PostMethod)createMethodIfNecessary());
+ }
+
+ public void addConfiguredParameter(NameValuePair pair) {
+ getPostMethod().setParameter(pair.getName(), pair.getValue());
+ }
+
+ public void setContentChunked(boolean contentChunked) {
+ getPostMethod().setContentChunked(contentChunked);
+ }
+
+ protected void configureMethod(HttpMethodBase method) {
+ PostMethod post = (PostMethod) method;
+
+ if (parts.size() == 1 && ! multipart) {
+ Object part = parts.get(0);
+ if (part instanceof FilePartType) {
+ FilePartType filePart = (FilePartType)part;
+ try {
+ stream = new FileInputStream(
+ filePart.getPath().getAbsolutePath());
+ post.setRequestEntity(
+ new InputStreamRequestEntity(stream,
+ filePart.getPath().length(),
+ filePart.getContentType()));
+ }
+ catch (IOException e) {
+ throw new BuildException(e);
+ }
+ }
+ else if (part instanceof TextPartType) {
+ TextPartType textPart = (TextPartType)part;
+ try {
+ post.setRequestEntity(
+ new StringRequestEntity(textPart.getValue(),
+ textPart.getContentType(),
+ textPart.getCharSet()));
+ }
+ catch (UnsupportedEncodingException e) {
+ throw new BuildException(e);
+ }
+ }
+ }
+ else if (! parts.isEmpty()){
+ Part partArray[] = new Part[parts.size()];
+ for (int i=0;i<parts.size();i++) {
+ Object part = parts.get(i);
+ if (part instanceof FilePartType) {
+ FilePartType filePart = (FilePartType)part;
+ try {
+ partArray[i] = new FilePart(filePart.getPath().getName(),
+ filePart.getPath().getName(),
+ filePart.getPath(),
+ filePart.getContentType(),
+ filePart.getCharSet());
+ }
+ catch (FileNotFoundException e) {
+ throw new BuildException(e);
+ }
+ }
+ else if (part instanceof TextPartType) {
+ TextPartType textPart = (TextPartType)part;
+ partArray[i] = new StringPart(textPart.getName(),
+ textPart.getValue(),
+ textPart.getCharSet());
+ ((StringPart)partArray[i]).setContentType(textPart.getContentType());
+ }
+ }
+ MultipartRequestEntity entity = new MultipartRequestEntity(
+ partArray,
+ post.getParams());
+ post.setRequestEntity(entity);
+ }
+ }
+
+ protected void cleanupResources(HttpMethodBase method) {
+ FileUtils.close(stream);
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6d/30d2495fd7cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/6d/30d2495fd7cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..4eded2c
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/6d/30d2495fd7cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,6 @@
+<XDtClass:forAllClasses>
+<XDtClass:ifHasClassTag tagName="ant:task" paramName="name">
+<XDtClass:classTagValue tagName="ant:task" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag>
+</XDtClass:forAllClasses>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6e/308c2f77c5cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/6e/308c2f77c5cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..35e5c63
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/6e/308c2f77c5cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,466 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ * @author Matt Inger
+ * @ant.task name=for
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private Path currPath;
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ private Path getOrCreatePath() {
+ if (currPath == null) {
+ currPath = new Path(getProject());
+ }
+ return currPath;
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfigured(Path path) {
+ getOrCreatePath().append(path);
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfiguredPath(Path path) {
+ addConfigured(path);
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && currPath == null && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or path or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ // Take Care of the path element
+ String[] pathElements = new String[0];
+ if (currPath != null) {
+ pathElements = currPath.list();
+ }
+ for (int i = 0; i < pathElements.length; i++) {
+ File nextFile = new File(pathElements[i]);
+ doToken(nextFile.getAbsolutePath());
+ }
+
+ // Take care of iterators
+ for (Iterator i = hasIterators.iterator(); i.hasNext();) {
+ Iterator it = ((HasIterator) i.next()).iterator();
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void add(FileSet fileset) {
+ getOrCreatePath().addFileset(fileset);
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void addFileSet(FileSet fileset) {
+ add(fileset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void add(DirSet dirset) {
+ getOrCreatePath().addDirset(dirset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void addDirSet(DirSet dirset) {
+ add(dirset);
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6e/502dc37ce3cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/6e/502dc37ce3cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..cb24673
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/6e/502dc37ce3cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import net.sf.antcontrib.logic.condition.BooleanConditionBase;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.ProjectHelper;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.TaskContainer;
+import org.apache.tools.ant.taskdefs.Exit;
+import org.apache.tools.ant.taskdefs.Sequential;
+import org.apache.tools.ant.taskdefs.condition.Condition;
+import org.apache.tools.ant.taskdefs.condition.Equals;
+
+
+/**
+ *
+ * @ant.task name="assert"
+ */
+public class Assert
+ extends BooleanConditionBase {
+
+ private List tasks = new ArrayList();
+ private String message;
+ private boolean failOnError = true;
+ private boolean execute = true;
+ private Sequential sequential;
+ private String name;
+ private String value;
+
+ public Sequential createSequential() {
+ this.sequential = (Sequential) getProject().createTask("sequential");
+ return this.sequential;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public BooleanConditionBase createBool() {
+ return this;
+ }
+
+ public void setExecute(boolean execute) {
+ this.execute = execute;
+ }
+
+ public void setFailOnError(boolean failOnError) {
+ this.failOnError = failOnError;
+ }
+
+ public void execute() {
+ String value = getProject().getProperty("ant.enable.asserts");
+ boolean assertsEnabled = Project.toBoolean(value);
+
+ if (assertsEnabled) {
+ if (name != null) {
+ if (value == null) {
+ throw new BuildException("The 'value' attribute must accompany the 'name' attribute.");
+ }
+ String propVal = getProject().replaceProperties("${" + name + "}");
+ Equals e = new Equals();
+ e.setArg1(propVal);
+ e.setArg2(value);
+ addEquals(e);
+ }
+
+ if (countConditions() == 0) {
+ throw new BuildException("There is no condition specified.");
+ }
+ else if (countConditions() > 1) {
+ throw new BuildException("There must be exactly one condition specified.");
+ }
+
+ Condition c = (Condition) getConditions().nextElement();
+ if (! c.eval()) {
+ if (failOnError) {
+ Exit fail = (Exit) getProject().createTask("fail");
+ fail.setMessage(message);
+ fail.execute();
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/70/708fbdccdfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/70/708fbdccdfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..4146b8e
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/70/708fbdccdfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import java.util.Date;
+
+import org.apache.tools.ant.BuildException;
+
+public class PurgeExpiredCookiesTask
+ extends AbstractHttpStateTypeTask {
+
+ private Date expiredDate;
+
+ public void setExpiredDate(Date expiredDate) {
+ this.expiredDate = expiredDate;
+ }
+
+ protected void execute(HttpStateType stateType) throws BuildException {
+ if (expiredDate != null) {
+ stateType.getState().purgeExpiredCookies(expiredDate);
+ }
+ else {
+ stateType.getState().purgeExpiredCookies();
+ }
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/70/a01386bcd7cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/70/a01386bcd7cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..1afe984
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/70/a01386bcd7cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,9 @@
+<XDtClass:forAllClasses>
+<XDtClass:forAllTags>
+ <XDtClass:name />
+</XDtClass:forAllTags>
+<XDtClass:ifHasClassTag tagName="ant:task" paramName="name">
+<XDtClass:classTagValue tagName="ant:task" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag>
+</XDtClass:forAllClasses>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/71/00e5f755c3cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/71/00e5f755c3cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..29d5dcb
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/71/00e5f755c3cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,466 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ * @author Matt Inger
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private Path currPath;
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+ private List resourceCollections = new ArrayList();
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ private Path getOrCreatePath() {
+ if (currPath == null) {
+ currPath = new Path(getProject());
+ }
+ return currPath;
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfigured(Path path) {
+ getOrCreatePath().append(path);
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfiguredPath(Path path) {
+ addConfigured(path);
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && currPath == null && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or path or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ // Take Care of the path element
+ String[] pathElements = new String[0];
+ if (currPath != null) {
+ pathElements = currPath.list();
+ }
+ for (int i = 0; i < pathElements.length; i++) {
+ File nextFile = new File(pathElements[i]);
+ doToken(nextFile.getAbsolutePath());
+ }
+
+ // Take care of iterators
+ for (Iterator i = hasIterators.iterator(); i.hasNext();) {
+ Iterator it = ((HasIterator) i.next()).iterator();
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void add(FileSet fileset) {
+ getOrCreatePath().addFileset(fileset);
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void addFileSet(FileSet fileset) {
+ add(fileset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void add(DirSet dirset) {
+ getOrCreatePath().addDirset(dirset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void addDirSet(DirSet dirset) {
+ add(dirset);
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/74/b077f08adfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/74/b077f08adfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..6366011
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/74/b077f08adfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.methods.PostMethod;
+
+public class HeadMethodTask
+ extends AbstractMethodTask {
+
+ protected HttpMethodBase createNewMethod() {
+ return new PostMethod();
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/74/d047cc4fe0cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/74/d047cc4fe0cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..433835f
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/74/d047cc4fe0cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.property;
+
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.RegularExpression;
+import org.apache.tools.ant.types.Substitution;
+import org.apache.tools.ant.util.regexp.Regexp;
+
+/****************************************************************************
+ * Place class description here.
+ *
+ * @author <a href='mailto:[email protected]'>Matthew Inger</a>
+ * @author <additional author>
+ *
+ * @since
+ *
+ ****************************************************************************/
+
+
+public class RegexTask
+ extends AbstractPropertySetterTask
+{
+ private String input;
+
+ private RegularExpression regexp;
+ private String select;
+ private Substitution replace;
+ private String defaultValue;
+
+ private boolean caseSensitive = true;
+ private boolean global = true;
+
+ public RegexTask()
+ {
+ super();
+ }
+
+ public void setInput(String input)
+ {
+ this.input = input;
+ }
+
+ public void setDefaultValue(String defaultValue)
+ {
+ this.defaultValue = defaultValue;
+ }
+
+ public void setRegexp(String regex)
+ {
+ if (this.regexp != null)
+ throw new BuildException("Cannot specify more than one regular expression");
+
+ this.regexp = new RegularExpression();
+ this.regexp.setPattern(regex);
+ }
+
+
+ public RegularExpression createRegexp()
+ {
+ if (this.regexp != null)
+ throw new BuildException("Cannot specify more than one regular expression");
+ regexp = new RegularExpression();
+ return regexp;
+ }
+
+ public void setReplace(String replace)
+ {
+ if (this.replace != null)
+ throw new BuildException("Cannot specify more than one replace expression");
+ if (select != null)
+ throw new BuildException("You cannot specify both a select and replace expression");
+ this.replace = new Substitution();
+ this.replace.setExpression(replace);
+ }
+
+ public Substitution createReplace()
+ {
+ if (replace != null)
+ throw new BuildException("Cannot specify more than one replace expression");
+ if (select != null)
+ throw new BuildException("You cannot specify both a select and replace expression");
+ replace = new Substitution();
+ return replace;
+ }
+
+ public void setSelect(String select)
+ {
+ if (replace != null)
+ throw new BuildException("You cannot specify both a select and replace expression");
+ this.select = select;
+ }
+
+ public void setCaseSensitive(boolean caseSensitive)
+ {
+ this.caseSensitive = caseSensitive;
+ }
+
+ public void setGlobal(boolean global)
+ {
+ this.global = global;
+ }
+
+ protected String doReplace()
+ throws BuildException
+ {
+ if (replace == null)
+ throw new BuildException("No replace expression specified.");
+
+ int options = 0;
+ if (! caseSensitive)
+ options |= Regexp.MATCH_CASE_INSENSITIVE;
+ if (global)
+ options |= Regexp.REPLACE_ALL;
+
+ Regexp sregex = regexp.getRegexp(project);
+
+ String output = null;
+
+ if (sregex.matches(input, options)) {
+ String expression = replace.getExpression(project);
+ output = sregex.substitute(input,
+ expression,
+ options);
+ }
+
+ if (output == null)
+ output = defaultValue;
+
+ return output;
+ }
+
+ protected String doSelect()
+ throws BuildException
+ {
+ int options = 0;
+ if (! caseSensitive)
+ options |= Regexp.MATCH_CASE_INSENSITIVE;
+
+ Regexp sregex = regexp.getRegexp(project);
+
+ String output = select;
+ Vector groups = sregex.getGroups(input, options);
+
+ if (groups != null && groups.size() > 0)
+ {
+ output = RegexUtil.select(select, groups);
+ }
+ else
+ {
+ output = null;
+ }
+
+ if (output == null)
+ output = defaultValue;
+
+ return output;
+ }
+
+
+ protected void validate()
+ {
+ super.validate();
+ if (regexp == null)
+ throw new BuildException("No match expression specified.");
+ if (replace == null && select == null)
+ throw new BuildException("You must specify either a replace or select expression");
+ }
+
+ public void execute()
+ throws BuildException
+ {
+ validate();
+
+ String output = input;
+ if (replace != null)
+ output = doReplace();
+ else
+ output = doSelect();
+
+ if (output != null)
+ setPropertyValue(output);
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/75/108dd14fe2cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/75/108dd14fe2cc001b1cb5d1e6b2b8577e
new file mode 100755
index 0000000..b64c6a8
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/75/108dd14fe2cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,279 @@
+/*
+ * Copyright (c) 2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.text.ParseException;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Expand;
+import org.apache.tools.ant.taskdefs.ImportTask;
+
+import fr.jayasoft.ivy.Artifact;
+import fr.jayasoft.ivy.DependencyResolver;
+import fr.jayasoft.ivy.Ivy;
+import fr.jayasoft.ivy.IvyContext;
+import fr.jayasoft.ivy.ModuleDescriptor;
+import fr.jayasoft.ivy.ModuleId;
+import fr.jayasoft.ivy.ModuleRevisionId;
+import fr.jayasoft.ivy.filter.FilterHelper;
+import fr.jayasoft.ivy.report.ResolveReport;
+import fr.jayasoft.ivy.repository.Repository;
+import fr.jayasoft.ivy.resolver.FileSystemResolver;
+import fr.jayasoft.ivy.resolver.IvyRepResolver;
+import fr.jayasoft.ivy.resolver.URLResolver;
+import fr.jayasoft.ivy.util.MessageImpl;
+
+/***
+ * Task to import a build file from a url. The build file can be a build.xml,
+ * or a .zip/.jar, in which case we download and extract the entire archive, and
+ * import the file "build.xml"
+ * @author inger
+ *
+ */
+public class URLImportTask
+ extends ImportTask {
+
+ private String org;
+ private String module;
+ private String rev = "latest.integration";
+ private String type = "jar";
+ private String repositoryUrl;
+ private String repositoryDir;
+ private URL ivyConfUrl;
+ private File ivyConfFile;
+ private String resource = "build.xml";
+ private String artifactPattern = "/[org]/[module]/[ext]s/[module]-[revision].[ext]";
+ private String ivyPattern = "/[org]/[module]/ivy-[revision].xml";
+ private boolean verbose = false;
+
+ public void setVerbose(boolean verbose) {
+ this.verbose = verbose;
+ }
+
+ public void setModule(String module) {
+ this.module = module;
+ }
+
+ public void setOrg(String org) {
+ this.org = org;
+ }
+
+ public void setRev(String rev) {
+ this.rev = rev;
+ }
+
+ public void setIvyConfFile(File ivyConfFile) {
+ this.ivyConfFile = ivyConfFile;
+ }
+
+ public void setIvyConfUrl(URL ivyConfUrl) {
+ this.ivyConfUrl = ivyConfUrl;
+ }
+
+ public void setArtifactPattern(String artifactPattern) {
+ this.artifactPattern = artifactPattern;
+ }
+
+ public void setIvyPattern(String ivyPattern) {
+ this.ivyPattern = ivyPattern;
+ }
+
+ public void setRepositoryDir(String repositoryDir) {
+ this.repositoryDir = repositoryDir;
+ }
+
+ public void setRepositoryUrl(String repositoryUrl) {
+ this.repositoryUrl = repositoryUrl;
+ }
+
+ public void setResource(String resource) {
+ this.resource = resource;
+ }
+
+ public void setOptional(boolean optional) {
+ throw new BuildException("'optional' property not accessed for ImportURL.");
+ }
+
+ public void setFile(String file) {
+ throw new BuildException("'file' property not accessed for ImportURL.");
+ }
+
+ public void execute()
+ throws BuildException {
+
+ MessageImpl oldMsgImpl = IvyContext.getContext().getMessageImpl();
+
+ if (! verbose) {
+ IvyContext.getContext().setMessageImpl(
+ new MessageImpl() {
+
+ public void endProgress(String arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void log(String arg0, int arg1) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void progress() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void rawlog(String arg0, int arg1) {
+ }
+ }
+ );
+ }
+ Ivy ivy = new Ivy();
+ DependencyResolver resolver = null;
+ Repository rep = null;
+
+
+ if (repositoryUrl != null) {
+ resolver = new URLResolver();
+ ((URLResolver)resolver).addArtifactPattern(
+ repositoryUrl + "/" + artifactPattern
+ );
+ ((URLResolver)resolver).addIvyPattern(
+ repositoryUrl + "/" + ivyPattern
+ );
+ resolver.setName("default");
+ }
+ else if (repositoryDir != null) {
+ resolver = new FileSystemResolver();
+ ((FileSystemResolver)resolver).addArtifactPattern(
+ repositoryDir + "/" + artifactPattern
+ );
+ ((FileSystemResolver)resolver).addIvyPattern(
+ repositoryDir + "/" + ivyPattern
+ );
+ }
+ else if (ivyConfUrl != null) {
+ try {
+ ivy.configure(ivyConfUrl);
+ resolver = ivy.getDefaultResolver();
+ }
+ catch (IOException e) {
+ throw new BuildException(e);
+ }
+ catch (ParseException e) {
+ throw new BuildException(e);
+ }
+ }
+ else if (ivyConfFile != null) {
+ try {
+ ivy.configure(ivyConfFile);
+ }
+ catch (IOException e) {
+ throw new BuildException(e);
+ }
+ catch (ParseException e) {
+ throw new BuildException(e);
+ }
+ }
+ else {
+ resolver = new IvyRepResolver();
+ }
+ resolver.setName("default");
+ ivy.addResolver(resolver);
+ ivy.setDefaultResolver(resolver.getName());
+
+
+ try {
+ ModuleId moduleId =
+ new ModuleId(org, module);
+ ModuleRevisionId revId =
+ new ModuleRevisionId(moduleId, rev);
+
+ ResolveReport resolveReport = ivy.resolve(
+ ModuleRevisionId.newInstance(org, module, rev),
+ new String[] { "*" },
+ false,
+ true,
+ ivy.getDefaultCache(),
+ new Date(),
+ ivy.doValidate(),
+ false,
+ false,
+ FilterHelper.getArtifactTypeFilter(type));
+
+ if (resolveReport.hasError()) {
+ throw new BuildException("Could not resolve resource for: " +
+ "org=" + org +
+ ";module=" + module +
+ ";rev=" + rev);
+ }
+
+ ModuleDescriptor desc = resolveReport.getModuleDescriptor();
+ List artifacts = resolveReport.getArtifacts();
+ Artifact artifact = (Artifact) artifacts.get(0);
+ log("Fetched " +
+ artifact.getModuleRevisionId().getOrganisation() + " | " +
+ artifact.getModuleRevisionId().getName() + " | " +
+ artifact.getModuleRevisionId().getRevision());
+ File file = ivy.getArchiveFileInCache(ivy.getDefaultCache(), artifact);
+
+ File importFile = null;
+
+ if ("xml".equalsIgnoreCase(type)) {
+ importFile = file;
+ }
+ else if ("jar".equalsIgnoreCase(type) ||
+ "zip".equalsIgnoreCase(type)) {
+ File dir = new File(file.getParentFile(),
+ file.getName() + ".extracted");
+ if (! dir.exists() ||
+ dir.lastModified() < file.lastModified()) {
+ dir.mkdir();
+ Expand expand = (Expand)getProject().createTask("unjar");
+ expand.setSrc(file);
+ expand.setDest(dir);
+ expand.perform();
+ }
+ importFile = new File(dir, resource);
+ if (! importFile.exists()) {
+ throw new BuildException("Cannot find a '" + resource + "' file in " +
+ file.getName());
+ }
+ }
+ else {
+ throw new BuildException("Don't know what to do with type: " + type);
+ }
+
+ super.setFile(importFile.getAbsolutePath());
+ super.execute();
+ log("Import complete.", Project.MSG_INFO);
+ }
+ catch (ParseException e) {
+ throw new BuildException(e);
+ }
+ catch (IOException e) {
+ throw new BuildException(e);
+ }
+ finally {
+ IvyContext.getContext().setMessageImpl(oldMsgImpl);
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7a/1074c631e8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/7a/1074c631e8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..f2ce50b
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/7a/1074c631e8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.condition;
+
+import java.lang.reflect.Field;
+import java.util.Vector;
+
+import org.apache.tools.ant.taskdefs.condition.ConditionBase;
+
+/**
+ * Extends ConditionBase so I can get access to the condition count and the
+ * first condition. This is the class that the BooleanConditionTask is proxy
+ * for.
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ *
+ * @author Dale Anson, [email protected]
+ */
+public class BooleanConditionBase extends ConditionBase {
+
+ private Vector getConditions() {
+ Field f = ConditionBase.class.getDeclaredField("conditions");
+ f.setAccessible(true);
+ Vector v = (Vector) f.get(this);
+ return v;
+
+ }
+ /**
+ * Adds a feature to the IsPropertyTrue attribute of the BooleanConditionBase
+ * object
+ *
+ * @param i The feature to be added to the IsPropertyTrue attribute
+ */
+ public void addIsPropertyTrue( IsPropertyTrue i ) {
+ super.add( i );
+ }
+
+ /**
+ * Adds a feature to the IsPropertyFalse attribute of the
+ * BooleanConditionBase object
+ *
+ * @param i The feature to be added to the IsPropertyFalse attribute
+ */
+ public void addIsPropertyFalse( IsPropertyFalse i ) {
+ super.add( i );
+ }
+
+ public void addIsGreaterThan( IsGreaterThan i) {
+ super.add(i);
+ }
+
+ public void addIsLessThan( IsLessThan i) {
+ super.add(i);
+ }
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7b/2094b897d8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/7b/2094b897d8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..81be83d
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/7b/2094b897d8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,6 @@
+<XDtClass:forAllClasses>
+<XDtClass:ifHasClassTag tagName="task" paramName="name">
+<XDtClass:classTagValue tagName="task" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag>
+</XDtClass:forAllClasses>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7b/20a45331dfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/7b/20a45331dfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..73105b1
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/7b/20a45331dfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ package net.sf.antcontrib.antserver.client;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Vector;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import net.sf.antcontrib.antserver.Command;
+import net.sf.antcontrib.antserver.Response;
+import net.sf.antcontrib.antserver.commands.RunAntCommand;
+import net.sf.antcontrib.antserver.commands.RunTargetCommand;
+import net.sf.antcontrib.antserver.commands.SendFileCommand;
+import net.sf.antcontrib.antserver.commands.ShutdownCommand;
+
+/****************************************************************************
+ * Place class description here.
+ *
+ * @author <a href='mailto:[email protected]'>Matthew Inger</a>
+ * @author <additional author>
+ *
+ * @since
+ * @ant.task name="if"
+ *
+ ****************************************************************************/
+
+
+public class ClientTask
+ extends Task
+{
+ private String machine = "localhost";
+ private int port = 17000;
+ private Vector commands;
+ private boolean persistant = false;
+ private boolean failOnError = true;
+
+ public ClientTask()
+ {
+ super();
+ this.commands = new Vector();
+ }
+
+
+ public void setMachine(String machine)
+ {
+ this.machine = machine;
+ }
+
+
+ public void setPort(int port)
+ {
+ this.port = port;
+ }
+
+
+ public void setPersistant(boolean persistant)
+ {
+ this.persistant = persistant;
+ }
+
+
+ public void setFailOnError(boolean failOnError)
+ {
+ this.failOnError = failOnError;
+ }
+
+
+ public void addConfiguredShutdown(ShutdownCommand cmd)
+ {
+ commands.add(cmd);
+ }
+
+ public void addConfiguredRunTarget(RunTargetCommand cmd)
+ {
+ commands.add(cmd);
+ }
+
+ public void addConfiguredRunAnt(RunAntCommand cmd)
+ {
+ commands.add(cmd);
+ }
+
+ public void addConfiguredSendFile(SendFileCommand cmd)
+ {
+ commands.add(cmd);
+ }
+
+
+ public void execute()
+ {
+ Enumeration e = commands.elements();
+ Command c = null;
+ while (e.hasMoreElements())
+ {
+ c = (Command)e.nextElement();
+ c.validate(getProject());
+ }
+
+ Client client = new Client(getProject(), machine, port);
+
+ try
+ {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+
+ try
+ {
+ int failCount = 0;
+
+ client.connect();
+
+ e = commands.elements();
+ c = null;
+ Response r = null;
+ Document d = null;
+ boolean keepGoing = true;
+ while (e.hasMoreElements() && keepGoing)
+ {
+ c = (Command)e.nextElement();
+ r = client.sendCommand(c);
+ if (! r.isSucceeded())
+ {
+ failCount++;
+ log("Command caused a build failure:" + c,
+ Project.MSG_ERR);
+ log(r.getErrorMessage(),
+ Project.MSG_ERR);
+ log(r.getErrorStackTrace(),
+ Project.MSG_DEBUG);
+ if (! persistant)
+ keepGoing = false;
+ }
+
+ try
+ {
+ ByteArrayInputStream bais =
+ new ByteArrayInputStream(r.getResultsXml().getBytes());
+ d = db.parse(bais);
+ NodeList nl = d.getElementsByTagName("target");
+ int len = nl.getLength();
+ Element element = null;
+ for (int i=0;i<len;i++)
+ {
+ element = (Element)nl.item(i);
+ getProject().log("[" + element.getAttribute("name") + "]",
+ Project.MSG_INFO);
+ }
+ }
+ catch (SAXException se)
+ {
+
+ }
+
+ if (c instanceof ShutdownCommand)
+ {
+ keepGoing = false;
+ client.shutdown();
+ }
+ }
+
+ if (failCount > 0 && failOnError)
+ throw new BuildException("One or more commands failed.");
+ }
+ finally
+ {
+ if (client != null)
+ client.disconnect();
+ }
+ }
+ catch (ParserConfigurationException ex)
+ {
+ throw new BuildException(ex);
+ }
+ catch (IOException ex)
+ {
+ throw new BuildException(ex);
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7b/e032ae79e8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/7b/e032ae79e8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..9f9eba0
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/7b/e032ae79e8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.condition;
+
+import java.lang.reflect.Field;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.condition.ConditionBase;
+
+/**
+ * Extends ConditionBase so I can get access to the condition count and the
+ * first condition. This is the class that the BooleanConditionTask is proxy
+ * for.
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ *
+ * @author Dale Anson, [email protected]
+ */
+public class BooleanConditionBase extends ConditionBase {
+
+ private Vector conditions;
+
+ public BooleanConditionBase() {
+ this.conditions = getParentConditions();
+ }
+
+ private Vector getParentConditions() {
+ try {
+ Field f = ConditionBase.class.getDeclaredField("conditions");
+ f.setAccessible(true);
+ Vector v = (Vector) f.get(this);
+ return v;
+ }
+ catch (NoSuchFieldException e) {
+ throw new BuildException(e);
+ }
+ catch (IllegalAccessException e) {
+ throw new BuildException(e);
+ }
+ }
+
+ /**
+ * Adds a feature to the IsPropertyTrue attribute of the BooleanConditionBase
+ * object
+ *
+ * @param i The feature to be added to the IsPropertyTrue attribute
+ */
+ public void addIsPropertyTrue( IsPropertyTrue i ) {
+ getParentConditions().add( i );
+ }
+
+ /**
+ * Adds a feature to the IsPropertyFalse attribute of the
+ * BooleanConditionBase object
+ *
+ * @param i The feature to be added to the IsPropertyFalse attribute
+ */
+ public void addIsPropertyFalse( IsPropertyFalse i ) {
+ getParentConditions().add( i );
+ }
+
+ public void addIsGreaterThan( IsGreaterThan i) {
+ getParentConditions().add(i);
+ }
+
+ public void addIsLessThan( IsLessThan i) {
+ getParentConditions().add(i);
+ }
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7c/105e8944e2cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/7c/105e8944e2cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..01686e3
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/7c/105e8944e2cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,236 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.NameValuePair;
+import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.apache.commons.httpclient.methods.multipart.FilePart;
+import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
+import org.apache.commons.httpclient.methods.multipart.Part;
+import org.apache.commons.httpclient.methods.multipart.StringPart;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.util.FileUtils;
+
+/***
+ *
+ * @author minger
+ * @ant.task name="postmethod"
+ *
+ */
+public class PostMethodTask
+ extends AbstractMethodTask {
+
+ private List parts = new ArrayList();
+ private boolean multipart;
+ private transient FileInputStream stream;
+
+
+ public static class FilePartType {
+ private File path;
+ private String contentType = FilePart.DEFAULT_CONTENT_TYPE;
+ private String charSet = FilePart.DEFAULT_CHARSET;
+
+ public File getPath() {
+ return path;
+ }
+
+ public void setPath(File path) {
+ this.path = path;
+ }
+
+ public String getContentType() {
+ return contentType;
+ }
+
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+
+ public String getCharSet() {
+ return charSet;
+ }
+
+ public void setCharSet(String charSet) {
+ this.charSet = charSet;
+ }
+ }
+
+ public static class TextPartType {
+ private String name = "";
+ private String value = "";
+ private String charSet = StringPart.DEFAULT_CHARSET;
+ private String contentType = StringPart.DEFAULT_CONTENT_TYPE;
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getCharSet() {
+ return charSet;
+ }
+
+ public void setCharSet(String charSet) {
+ this.charSet = charSet;
+ }
+
+ public String getContentType() {
+ return contentType;
+ }
+
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+
+ public void setText(String text) {
+ this.value = text;
+ }
+ }
+
+ public void addConfiguredFile(FilePartType file) {
+ this.parts.add(file);
+ }
+
+ public void setMultipart(boolean multipart) {
+ this.multipart = multipart;
+ }
+
+ public void addConfiguredText(TextPartType text) {
+ this.parts.add(text);
+ }
+
+ public void setParameters(File parameters) {
+ PostMethod post = getPostMethod();
+ Properties p = new Properties();
+ Iterator it = p.entrySet().iterator();
+ while (it.hasNext()) {
+ Map.Entry entry = (Map.Entry) it.next();
+ post.addParameter(entry.getKey().toString(),
+ entry.getValue().toString());
+ }
+ }
+
+ protected HttpMethodBase createNewMethod() {
+ return new PostMethod();
+ }
+
+ private PostMethod getPostMethod() {
+ return ((PostMethod)createMethodIfNecessary());
+ }
+
+ public void addConfiguredParameter(NameValuePair pair) {
+ getPostMethod().setParameter(pair.getName(), pair.getValue());
+ }
+
+ public void setContentChunked(boolean contentChunked) {
+ getPostMethod().setContentChunked(contentChunked);
+ }
+
+ protected void configureMethod(HttpMethodBase method) {
+ PostMethod post = (PostMethod) method;
+
+ if (parts.size() == 1 && ! multipart) {
+ Object part = parts.get(0);
+ if (part instanceof FilePartType) {
+ FilePartType filePart = (FilePartType)part;
+ try {
+ stream = new FileInputStream(
+ filePart.getPath().getAbsolutePath());
+ post.setRequestEntity(
+ new InputStreamRequestEntity(stream,
+ filePart.getPath().length(),
+ filePart.getContentType()));
+ }
+ catch (IOException e) {
+ throw new BuildException(e);
+ }
+ }
+ else if (part instanceof TextPartType) {
+ TextPartType textPart = (TextPartType)part;
+ try {
+ post.setRequestEntity(
+ new StringRequestEntity(textPart.getValue(),
+ textPart.getContentType(),
+ textPart.getCharSet()));
+ }
+ catch (UnsupportedEncodingException e) {
+ throw new BuildException(e);
+ }
+ }
+ }
+ else if (! parts.isEmpty()){
+ Part partArray[] = new Part[parts.size()];
+ for (int i=0;i<parts.size();i++) {
+ Object part = parts.get(i);
+ if (part instanceof FilePartType) {
+ FilePartType filePart = (FilePartType)part;
+ try {
+ partArray[i] = new FilePart(filePart.getPath().getName(),
+ filePart.getPath().getName(),
+ filePart.getPath(),
+ filePart.getContentType(),
+ filePart.getCharSet());
+ }
+ catch (FileNotFoundException e) {
+ throw new BuildException(e);
+ }
+ }
+ else if (part instanceof TextPartType) {
+ TextPartType textPart = (TextPartType)part;
+ partArray[i] = new StringPart(textPart.getName(),
+ textPart.getValue(),
+ textPart.getCharSet());
+ ((StringPart)partArray[i]).setContentType(textPart.getContentType());
+ }
+ }
+ MultipartRequestEntity entity = new MultipartRequestEntity(
+ partArray,
+ post.getParams());
+ post.setRequestEntity(entity);
+ }
+ }
+
+ protected void cleanupResources(HttpMethodBase method) {
+ FileUtils.close(stream);
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7c/9015cd20e5cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/7c/9015cd20e5cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..f5e2553
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/7c/9015cd20e5cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,391 @@
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import org.apache.tools.ant.AntClassLoader;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildListener;
+import org.apache.tools.ant.Executor;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Target;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.input.InputHandler;
+import org.apache.tools.ant.types.FilterSet;
+import org.apache.tools.ant.types.Path;
+
+public class ProjectDelegate
+extends Project {
+
+ private Project delegate;
+ private Project subproject;
+
+ public ProjectDelegate(Project delegate) {
+ super();
+ this.delegate = delegate;
+ }
+
+ public Project getSubproject() {
+ return subproject;
+ }
+
+ public void addBuildListener(BuildListener arg0) {
+ delegate.addBuildListener(arg0);
+ }
+
+ public void addDataTypeDefinition(String arg0, Class arg1) {
+ delegate.addDataTypeDefinition(arg0, arg1);
+ }
+
+ public void addFilter(String arg0, String arg1) {
+ delegate.addFilter(arg0, arg1);
+ }
+
+ public void addOrReplaceTarget(String arg0, Target arg1) {
+ delegate.addOrReplaceTarget(arg0, arg1);
+ }
+
+ public void addOrReplaceTarget(Target arg0) {
+ delegate.addOrReplaceTarget(arg0);
+ }
+
+ public void addReference(String arg0, Object arg1) {
+ delegate.addReference(arg0, arg1);
+ }
+
+ public void addTarget(String arg0, Target arg1) throws BuildException {
+ delegate.addTarget(arg0, arg1);
+ }
+
+ public void addTarget(Target arg0) throws BuildException {
+ delegate.addTarget(arg0);
+ }
+
+ public void addTaskDefinition(String arg0, Class arg1) throws BuildException {
+ delegate.addTaskDefinition(arg0, arg1);
+ }
+
+ public void checkTaskClass(Class arg0) throws BuildException {
+ delegate.checkTaskClass(arg0);
+ }
+
+ public void copyFile(File arg0, File arg1, boolean arg2, boolean arg3, boolean arg4) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2, arg3, arg4);
+ }
+
+ public void copyFile(File arg0, File arg1, boolean arg2, boolean arg3) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2, arg3);
+ }
+
+ public void copyFile(File arg0, File arg1, boolean arg2) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2);
+ }
+
+ public void copyFile(File arg0, File arg1) throws IOException {
+ delegate.copyFile(arg0, arg1);
+ }
+
+ public void copyFile(String arg0, String arg1, boolean arg2, boolean arg3, boolean arg4) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2, arg3, arg4);
+ }
+
+ public void copyFile(String arg0, String arg1, boolean arg2, boolean arg3) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2, arg3);
+ }
+
+ public void copyFile(String arg0, String arg1, boolean arg2) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2);
+ }
+
+ public void copyFile(String arg0, String arg1) throws IOException {
+ delegate.copyFile(arg0, arg1);
+ }
+
+ public void copyInheritedProperties(Project arg0) {
+ delegate.copyInheritedProperties(arg0);
+ }
+
+ public void copyUserProperties(Project arg0) {
+ delegate.copyUserProperties(arg0);
+ }
+
+ public AntClassLoader createClassLoader(Path arg0) {
+ return delegate.createClassLoader(arg0);
+ }
+
+ public Object createDataType(String arg0) throws BuildException {
+ return delegate.createDataType(arg0);
+ }
+
+ public Task createTask(String arg0) throws BuildException {
+ return delegate.createTask(arg0);
+ }
+
+ public int defaultInput(byte[] arg0, int arg1, int arg2) throws IOException {
+ return delegate.defaultInput(arg0, arg1, arg2);
+ }
+
+ public void demuxFlush(String arg0, boolean arg1) {
+ delegate.demuxFlush(arg0, arg1);
+ }
+
+ public int demuxInput(byte[] arg0, int arg1, int arg2) throws IOException {
+ return delegate.demuxInput(arg0, arg1, arg2);
+ }
+
+ public void demuxOutput(String arg0, boolean arg1) {
+ delegate.demuxOutput(arg0, arg1);
+ }
+
+ public boolean equals(Object arg0) {
+ return delegate.equals(arg0);
+ }
+
+ public void executeSortedTargets(Vector arg0) throws BuildException {
+ delegate.executeSortedTargets(arg0);
+ }
+
+ public void executeTarget(String arg0) throws BuildException {
+ delegate.executeTarget(arg0);
+ }
+
+ public void executeTargets(Vector arg0) throws BuildException {
+ delegate.executeTargets(arg0);
+ }
+
+ public void fireBuildFinished(Throwable arg0) {
+ delegate.fireBuildFinished(arg0);
+ }
+
+ public void fireBuildStarted() {
+ delegate.fireBuildStarted();
+ }
+
+ public void fireSubBuildFinished(Throwable arg0) {
+ delegate.fireSubBuildFinished(arg0);
+ }
+
+ public void fireSubBuildStarted() {
+ delegate.fireSubBuildStarted();
+ }
+
+ public File getBaseDir() {
+ return delegate.getBaseDir();
+ }
+
+ public Vector getBuildListeners() {
+ return delegate.getBuildListeners();
+ }
+
+ public ClassLoader getCoreLoader() {
+ return delegate.getCoreLoader();
+ }
+
+ public Hashtable getDataTypeDefinitions() {
+ return delegate.getDataTypeDefinitions();
+ }
+
+ public InputStream getDefaultInputStream() {
+ return delegate.getDefaultInputStream();
+ }
+
+ public String getDefaultTarget() {
+ return delegate.getDefaultTarget();
+ }
+
+ public String getDescription() {
+ return delegate.getDescription();
+ }
+
+ public String getElementName(Object arg0) {
+ return delegate.getElementName(arg0);
+ }
+
+ public Executor getExecutor() {
+ return delegate.getExecutor();
+ }
+
+ public Hashtable getFilters() {
+ return delegate.getFilters();
+ }
+
+ public FilterSet getGlobalFilterSet() {
+ return delegate.getGlobalFilterSet();
+ }
+
+ public InputHandler getInputHandler() {
+ return delegate.getInputHandler();
+ }
+
+ public String getName() {
+ return delegate.getName();
+ }
+
+ public Hashtable getProperties() {
+ return delegate.getProperties();
+ }
+
+ public String getProperty(String arg0) {
+ return delegate.getProperty(arg0);
+ }
+
+ public Object getReference(String arg0) {
+ return delegate.getReference(arg0);
+ }
+
+ public Hashtable getReferences() {
+ return delegate.getReferences();
+ }
+
+ public Hashtable getTargets() {
+ return delegate.getTargets();
+ }
+
+ public Hashtable getTaskDefinitions() {
+ return delegate.getTaskDefinitions();
+ }
+
+ public Task getThreadTask(Thread arg0) {
+ return delegate.getThreadTask(arg0);
+ }
+
+ public Hashtable getUserProperties() {
+ return delegate.getUserProperties();
+ }
+
+ public String getUserProperty(String arg0) {
+ return delegate.getUserProperty(arg0);
+ }
+
+ public int hashCode() {
+ return delegate.hashCode();
+ }
+
+ public void init() throws BuildException {
+ delegate.init();
+ }
+
+ public void initSubProject(Project arg0) {
+ delegate.initSubProject(arg0);
+ this.subproject = arg0;
+ }
+
+ public boolean isKeepGoingMode() {
+ return delegate.isKeepGoingMode();
+ }
+
+ public void log(String arg0, int arg1) {
+ delegate.log(arg0, arg1);
+ }
+
+ public void log(String arg0) {
+ delegate.log(arg0);
+ }
+
+ public void log(Target arg0, String arg1, int arg2) {
+ delegate.log(arg0, arg1, arg2);
+ }
+
+ public void log(Task arg0, String arg1, int arg2) {
+ delegate.log(arg0, arg1, arg2);
+ }
+
+ public void registerThreadTask(Thread arg0, Task arg1) {
+ delegate.registerThreadTask(arg0, arg1);
+ }
+
+ public void removeBuildListener(BuildListener arg0) {
+ delegate.removeBuildListener(arg0);
+ }
+
+ public String replaceProperties(String arg0) throws BuildException {
+ return delegate.replaceProperties(arg0);
+ }
+
+ public File resolveFile(String arg0, File arg1) {
+ return delegate.resolveFile(arg0, arg1);
+ }
+
+ public File resolveFile(String arg0) {
+ return delegate.resolveFile(arg0);
+ }
+
+ public void setBaseDir(File arg0) throws BuildException {
+ delegate.setBaseDir(arg0);
+ }
+
+ public void setBasedir(String arg0) throws BuildException {
+ delegate.setBasedir(arg0);
+ }
+
+ public void setCoreLoader(ClassLoader arg0) {
+ delegate.setCoreLoader(arg0);
+ }
+
+ public void setDefault(String arg0) {
+ delegate.setDefault(arg0);
+ }
+
+ public void setDefaultInputStream(InputStream arg0) {
+ delegate.setDefaultInputStream(arg0);
+ }
+
+ public void setDefaultTarget(String arg0) {
+ delegate.setDefaultTarget(arg0);
+ }
+
+ public void setDescription(String arg0) {
+ delegate.setDescription(arg0);
+ }
+
+ public void setExecutor(Executor arg0) {
+ delegate.setExecutor(arg0);
+ }
+
+ public void setFileLastModified(File arg0, long arg1) throws BuildException {
+ delegate.setFileLastModified(arg0, arg1);
+ }
+
+ public void setInheritedProperty(String arg0, String arg1) {
+ delegate.setInheritedProperty(arg0, arg1);
+ }
+
+ public void setInputHandler(InputHandler arg0) {
+ delegate.setInputHandler(arg0);
+ }
+
+ public void setJavaVersionProperty() throws BuildException {
+ delegate.setJavaVersionProperty();
+ }
+
+ public void setKeepGoingMode(boolean arg0) {
+ delegate.setKeepGoingMode(arg0);
+ }
+
+ public void setName(String arg0) {
+ delegate.setName(arg0);
+ }
+
+ public void setNewProperty(String arg0, String arg1) {
+ delegate.setNewProperty(arg0, arg1);
+ }
+
+ public void setProperty(String arg0, String arg1) {
+ delegate.setProperty(arg0, arg1);
+ }
+
+ public void setSystemProperties() {
+ delegate.setSystemProperties();
+ }
+
+ public void setUserProperty(String arg0, String arg1) {
+ delegate.setUserProperty(arg0, arg1);
+ }
+
+ public String toString() {
+ return delegate.toString();
+ }
+} \ No newline at end of file
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8/20ed8defe3cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/8/20ed8defe3cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..c1ca3f9
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/8/20ed8defe3cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.ant16;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import net.sf.antcontrib.logic.condition.BooleanConditionBase;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Exit;
+import org.apache.tools.ant.taskdefs.Sequential;
+import org.apache.tools.ant.taskdefs.condition.Condition;
+import org.apache.tools.ant.taskdefs.condition.ConditionBase;
+import org.apache.tools.ant.taskdefs.condition.Equals;
+
+
+/**
+ *
+ * @ant.task name="assert"
+ */
+public class Assert
+ extends ConditionBase {
+
+ private List tasks = new ArrayList();
+ private String message;
+ private boolean failOnError = true;
+ private boolean execute = true;
+ private Sequential sequential;
+ private String name;
+ private String value;
+
+ public Sequential createSequential() {
+ this.sequential = (Sequential) getProject().createTask("sequential");
+ return this.sequential;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public ConditionBase createBool() {
+ return this;
+ }
+
+ public void setExecute(boolean execute) {
+ this.execute = execute;
+ }
+
+ public void setFailOnError(boolean failOnError) {
+ this.failOnError = failOnError;
+ }
+
+ public void execute() {
+ String value = getProject().getProperty("ant.enable.asserts");
+ boolean assertsEnabled = Project.toBoolean(value);
+
+ if (assertsEnabled) {
+ if (name != null) {
+ if (value == null) {
+ throw new BuildException("The 'value' attribute must accompany the 'name' attribute.");
+ }
+ String propVal = getProject().replaceProperties("${" + name + "}");
+ Equals e = new Equals();
+ e.setArg1(propVal);
+ e.setArg2(value);
+ addEquals(e);
+ }
+
+ if (countConditions() == 0) {
+ throw new BuildException("There is no condition specified.");
+ }
+ else if (countConditions() > 1) {
+ throw new BuildException("There must be exactly one condition specified.");
+ }
+
+ Condition c = (Condition) getConditions().nextElement();
+ if (! c.eval()) {
+ if (failOnError) {
+ Exit fail = (Exit) getProject().createTask("fail");
+ fail.setMessage(message);
+ fail.execute();
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8/f086f421d7cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/8/f086f421d7cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..4c772e4
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/8/f086f421d7cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,4 @@
+<XDtClass:forAllClasses>
+ <XDtClass:classTagValue tagName="ant:task" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:forAllClasses>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/81/b0d15befc4cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/81/b0d15befc4cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..80eee29
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/81/b0d15befc4cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,465 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ * @author Matt Inger
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private Path currPath;
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ private Path getOrCreatePath() {
+ if (currPath == null) {
+ currPath = new Path(getProject());
+ }
+ return currPath;
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfigured(Path path) {
+ getOrCreatePath().append(path);
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfiguredPath(Path path) {
+ addConfigured(path);
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && currPath == null && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or path or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ // Take Care of the path element
+ String[] pathElements = new String[0];
+ if (currPath != null) {
+ pathElements = currPath.list();
+ }
+ for (int i = 0; i < pathElements.length; i++) {
+ File nextFile = new File(pathElements[i]);
+ doToken(nextFile.getAbsolutePath());
+ }
+
+ // Take care of iterators
+ for (Iterator i = hasIterators.iterator(); i.hasNext();) {
+ Iterator it = ((HasIterator) i.next()).iterator();
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void add(FileSet fileset) {
+ getOrCreatePath().addFileset(fileset);
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void addFileSet(FileSet fileset) {
+ add(fileset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void add(DirSet dirset) {
+ getOrCreatePath().addDirset(dirset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void addDirSet(DirSet dirset) {
+ add(dirset);
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/82/b0f5a443dbcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/82/b0f5a443dbcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..177bb9e
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/82/b0f5a443dbcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Ant;
+
+/**
+ * Subclass of CallTarget which allows us to fetch
+ * properties which are set in the scope of the called
+ * target, and set them in the scope of the calling target.
+ * Normally, these properties are thrown away as soon as the
+ * called target completes execution.
+ *
+ * @author inger
+ * @author Dale Anson, [email protected]
+ */
+public class AntFetch extends Ant {
+ /** the name of the property to fetch from the new project */
+ private String returnName = null;
+
+ private ProjectDelegate fakeProject = null;
+
+ public void setProject(Project realProject) {
+ fakeProject = new ProjectDelegate(realProject);
+ super.setProject(fakeProject);
+ }
+
+ /**
+ * Do the execution.
+ *
+ * @exception BuildException Description of the Exception
+ */
+ public void execute() throws BuildException {
+ super.execute();
+
+ // copy back the props if possible
+ if ( returnName != null ) {
+ StringTokenizer st = new StringTokenizer( returnName, "," );
+ while ( st.hasMoreTokens() ) {
+ String name = st.nextToken().trim();
+ String value = fakeProject.getSubproject().getUserProperty( name );
+ if ( value != null ) {
+ getProject().setUserProperty( name, value );
+ }
+ else {
+ value = fakeProject.getSubproject().getProperty( name );
+ if ( value != null ) {
+ getProject().setProperty( name, value );
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Set the property or properties that are set in the new project to be
+ * transfered back to the original project. As with all properties, if the
+ * property already exists in the original project, it will not be overridden
+ * by a different value from the new project.
+ *
+ * @param r the name of a property in the new project to set in the original
+ * project. This may be a comma separate list of properties.
+ */
+ public void setReturn( String r ) {
+ returnName = r;
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/86/d09a3ad8c3cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/86/d09a3ad8c3cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..76148bb
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/86/d09a3ad8c3cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,439 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.ResourceCollection;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ * @author Matt Inger
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+ private List resourceCollections = new ArrayList();
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ public void add(ResourceCollection resourceCollection) {
+ this.resourceCollections.add(resourceCollection);
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && resourceCollections.isEmpty() && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or path or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ // Take Care of the path element
+ String[] pathElements = new String[0];
+ if (currPath != null) {
+ pathElements = currPath.list();
+ }
+ for (int i = 0; i < pathElements.length; i++) {
+ File nextFile = new File(pathElements[i]);
+ doToken(nextFile.getAbsolutePath());
+ }
+
+ // Take care of iterators
+ for (Iterator i = hasIterators.iterator(); i.hasNext();) {
+ Iterator it = ((HasIterator) i.next()).iterator();
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void add(FileSet fileset) {
+ getOrCreatePath().addFileset(fileset);
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void addFileSet(FileSet fileset) {
+ add(fileset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void add(DirSet dirset) {
+ getOrCreatePath().addDirset(dirset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void addDirSet(DirSet dirset) {
+ add(dirset);
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/89/30cf4029e2cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/89/30cf4029e2cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..1a75ecb
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/89/30cf4029e2cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.httpclient.Cookie;
+import org.apache.tools.ant.BuildException;
+
+/***
+ *
+ * @author minger
+ * @ant.task name="addcookie"
+ *
+ */
+public class AddCookieTask
+ extends AbstractHttpStateTypeTask {
+
+ private List cookies = new ArrayList();
+
+ public void addConfiguredCookie(Cookie cookie) {
+ this.cookies.add(cookie);
+ }
+
+ protected void execute(HttpStateType stateType) throws BuildException {
+ if (this.cookies.isEmpty()) {
+ throw new BuildException("At least one cookie must be specified.");
+ }
+
+ Iterator it = cookies.iterator();
+ while (it.hasNext()) {
+ Cookie c = (Cookie)it.next();
+ stateType.addConfiguredCookie(c);
+ }
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8b/40660d86dfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/8b/40660d86dfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..321ef23
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/8b/40660d86dfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.methods.PostMethod;
+
+public class GetMethodTask
+ extends AbstractMethodTask {
+
+ protected HttpMethodBase createNewMethod() {
+ return new PostMethod();
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8f/e05d218fe4cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/8f/e05d218fe4cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..8bdb040
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/8f/e05d218fe4cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.condition;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.condition.Equals;
+
+/**
+ * Extends Equals condition to test if the first argument is greater than the
+ * second argument. Will deal with base 10 integer and decimal numbers, otherwise,
+ * treats arguments as Strings.
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ *
+ * @author Dale Anson, [email protected]
+ * @version $Revision: 1.4 $
+ * @ant.type name="ispropertyfalse"
+ */
+public class IsGreaterThan extends Equals {
+
+ private String arg1, arg2;
+ private boolean trim = false;
+ private boolean caseSensitive = true;
+
+ public void setArg1(String a1) {
+ arg1 = a1;
+ }
+
+ public void setArg2(String a2) {
+ arg2 = a2;
+ }
+
+ /**
+ * Should we want to trim the arguments before comparing them?
+ *
+ * @since Revision: 1.3, Ant 1.5
+ */
+ public void setTrim(boolean b) {
+ trim = b;
+ }
+
+ /**
+ * Should the comparison be case sensitive?
+ *
+ * @since Revision: 1.3, Ant 1.5
+ */
+ public void setCasesensitive(boolean b) {
+ caseSensitive = b;
+ }
+
+ public boolean eval() throws BuildException {
+ if (arg1 == null || arg2 == null) {
+ throw new BuildException("both arg1 and arg2 are required in "
+ + "greater than");
+ }
+
+ if (trim) {
+ arg1 = arg1.trim();
+ arg2 = arg2.trim();
+ }
+
+ // check if args are numbers
+ try {
+ double num1 = Double.parseDouble(arg1);
+ double num2 = Double.parseDouble(arg2);
+ return num1 > num2;
+ }
+ catch(NumberFormatException nfe) {
+ // ignored, fall thru to string comparision
+ }
+
+ return caseSensitive ? arg1.compareTo(arg2) > 0 : arg1.compareToIgnoreCase(arg2) > 0;
+ }
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9/60f57655e8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/9/60f57655e8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..6df74bf
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/9/60f57655e8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.condition;
+
+import java.lang.reflect.Field;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.condition.ConditionBase;
+
+/**
+ * Extends ConditionBase so I can get access to the condition count and the
+ * first condition. This is the class that the BooleanConditionTask is proxy
+ * for.
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ *
+ * @author Dale Anson, [email protected]
+ */
+public class BooleanConditionBase extends ConditionBase {
+
+ private Vector conditions;
+
+ public BooleanConditionBase() {
+ this.conditions = getParentConditions();
+ }
+
+ private Vector getParentConditions() {
+ try {
+ Field f = ConditionBase.class.getDeclaredField("conditions");
+ f.setAccessible(true);
+ Vector v = (Vector) f.get(this);
+ return v;
+ }
+ catch (NoSuchFieldException e) {
+ throw new BuildException(e);
+ }
+ catch (IllegalAccessException e) {
+ throw new BuildException(e);
+ }
+ }
+ /**
+ * Adds a feature to the IsPropertyTrue attribute of the BooleanConditionBase
+ * object
+ *
+ * @param i The feature to be added to the IsPropertyTrue attribute
+ */
+ public void addIsPropertyTrue( IsPropertyTrue i ) {
+ getConditions().add( i );
+ }
+
+ /**
+ * Adds a feature to the IsPropertyFalse attribute of the
+ * BooleanConditionBase object
+ *
+ * @param i The feature to be added to the IsPropertyFalse attribute
+ */
+ public void addIsPropertyFalse( IsPropertyFalse i ) {
+ getConditions().add( i );
+ }
+
+ public void addIsGreaterThan( IsGreaterThan i) {
+ getConditions().add(i);
+ }
+
+ public void addIsLessThan( IsLessThan i) {
+ getConditions().add(i);
+ }
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9/901db4bedfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/9/901db4bedfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..9287145
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/9/901db4bedfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import org.apache.commons.httpclient.Cookie;
+import org.apache.commons.httpclient.HttpState;
+import org.apache.commons.httpclient.cookie.CookiePolicy;
+import org.apache.commons.httpclient.cookie.CookieSpec;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.Property;
+
+public class GetCookieTask
+ extends AbstractHttpStateTypeTask {
+
+ private String property;
+ private String prefix;
+ private String cookiePolicy = CookiePolicy.DEFAULT;
+
+ private String realm = null;
+ private int port = 80;
+ private String path = null;
+ private boolean secure = false;
+ private String name = null;
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setCookiePolicy(String cookiePolicy) {
+ this.cookiePolicy = cookiePolicy;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public void setPort(int port) {
+ this.port = port;
+ }
+
+ public void setRealm(String realm) {
+ this.realm = realm;
+ }
+
+ public void setSecure(boolean secure) {
+ this.secure = secure;
+ }
+
+ public void setProperty(String property) {
+ this.property = property;
+ }
+
+ private Cookie findCookie(Cookie cookies[], String name) {
+ for (int i=0;i<cookies.length;i++) {
+ if (cookies[i].getName().equals(name)) {
+ return cookies[i];
+ }
+ }
+ return null;
+ }
+ protected void execute(HttpStateType stateType) throws BuildException {
+
+ if (realm == null || path == null) {
+ throw new BuildException("'realm' and 'path' attributes are required");
+ }
+
+ HttpState state = stateType.getState();
+ CookieSpec spec = CookiePolicy.getCookieSpec(cookiePolicy);
+ Cookie cookies[] = state.getCookies();
+ Cookie matches[] = spec.match(realm, port, path, secure, cookies);
+
+ if (name != null) {
+ Cookie c = findCookie(matches, name);
+ if (c != null) {
+ matches = new Cookie[] { c };
+ }
+ else {
+ matches = new Cookie[0];
+ }
+ }
+
+
+ if (property != null) {
+ if (matches != null && matches.length > 0) {
+ Property p = (Property)getProject().createTask("property");
+ p.setName(property);
+ p.setValue(matches[0].getValue());
+ p.perform();
+ }
+ }
+ else if (prefix != null) {
+ if (matches != null && matches.length > 0) {
+ for (int i=0;i<matches.length;i++) {
+ String propName =
+ prefix +
+ matches[i].getName();
+ Property p = (Property)getProject().createTask("property");
+ p.setName(propName);
+ p.setValue(matches[i].getValue());
+ p.perform();
+ }
+ }
+ }
+ else {
+ throw new BuildException("Nothing to set");
+ }
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/92/00c4f154e1cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/92/00c4f154e1cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..6f6656e
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/92/00c4f154e1cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,14 @@
+<antlib>
+<XDtClass:forAllClasses><XDtClass:ifHasClassTag tagName="ant:task">
+<taskdef name="<XDtClass:classTagValue tagName="ant:task" paramName="name"/>"
+ classname="<XDtClass:fullClassName />"
+ <XDtClass:ifHasClassTag tagName="ant:task" paramName="ignore">onerror="<XDtClass:classTagValue tagName="ant:task" paramName="ignore"/>"</XDtClass:ifHasClassTag> />
+</XDtClass:ifHasClassTag>
+<XDtClass:ifHasClassTag tagName="ant:type">
+<typedef name="<XDtClass:classTagValue tagName="ant:type" paramName="name"/>"
+ classname="<XDtClass:fullClassName />"
+ <XDtClass:ifHasClassTag tagName="ant:type" paramName="ignore">onerror="<XDtClass:classTagValue tagName="ant:task" paramName="ignore"/>"</XDtClass:ifHasClassTag> />
+<XDtClass:classTagValue tagName="ant:type" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag
+></XDtClass:forAllClasses>
+</antlib> \ No newline at end of file
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/92/50f83343c3cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/92/50f83343c3cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..80eee29
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/92/50f83343c3cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,465 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ * @author Matt Inger
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private Path currPath;
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ private Path getOrCreatePath() {
+ if (currPath == null) {
+ currPath = new Path(getProject());
+ }
+ return currPath;
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfigured(Path path) {
+ getOrCreatePath().append(path);
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfiguredPath(Path path) {
+ addConfigured(path);
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && currPath == null && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or path or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ // Take Care of the path element
+ String[] pathElements = new String[0];
+ if (currPath != null) {
+ pathElements = currPath.list();
+ }
+ for (int i = 0; i < pathElements.length; i++) {
+ File nextFile = new File(pathElements[i]);
+ doToken(nextFile.getAbsolutePath());
+ }
+
+ // Take care of iterators
+ for (Iterator i = hasIterators.iterator(); i.hasNext();) {
+ Iterator it = ((HasIterator) i.next()).iterator();
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void add(FileSet fileset) {
+ getOrCreatePath().addFileset(fileset);
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void addFileSet(FileSet fileset) {
+ add(fileset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void add(DirSet dirset) {
+ getOrCreatePath().addDirset(dirset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void addDirSet(DirSet dirset) {
+ add(dirset);
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/92/f04c650dd3cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/92/f04c650dd3cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/92/f04c650dd3cc001b1cb5d1e6b2b8577e
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/94/30b2bc9cc4cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/94/30b2bc9cc4cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..73e9608
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/94/30b2bc9cc4cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,404 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Resource;
+import org.apache.tools.ant.types.ResourceCollection;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ * @author Matt Inger
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+ private List resourceCollections = new ArrayList();
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ public void add(ResourceCollection resourceCollection) {
+ this.resourceCollections.add(resourceCollection);
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && resourceCollections.isEmpty() && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or resources or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ Iterator it = resourceCollections.iterator();
+ while (it.hasNext()) {
+ ResourceCollection c = (ResourceCollection) it.next();
+ Iterator rit = c.iterator();
+ while (rit.hasNext()) {
+ Resource r = (Resource) rit.next();
+ doToken(r.toString());
+ }
+ }
+
+ it = hasIterators.iterator();
+ while (it.hasNext()) {
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/99/b0e80514dacc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/99/b0e80514dacc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..f80490d
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/99/b0e80514dacc001b1cb5d1e6b2b8577e
@@ -0,0 +1,7 @@
+<XDtClass:forAllClasses>
+<XDtClass:fullClassName />
+<XDtClass:ifHasClassTag tagName="ant:task" paramName="name">
+<XDtClass:classTagValue tagName="ant:task" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag>
+</XDtClass:forAllClasses>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9a/407293fee3cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/9a/407293fee3cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..34fb712
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/9a/407293fee3cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.ant16;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Exit;
+import org.apache.tools.ant.taskdefs.Sequential;
+import org.apache.tools.ant.taskdefs.condition.Condition;
+import org.apache.tools.ant.taskdefs.condition.ConditionBase;
+import org.apache.tools.ant.taskdefs.condition.Equals;
+
+
+/**
+ *
+ * @ant.task name="assert"
+ */
+public class Assert
+ extends ConditionBase {
+
+ private String message;
+ private boolean failOnError = true;
+ private boolean execute = true;
+ private Sequential sequential;
+ private String name;
+ private String value;
+
+ public Sequential createSequential() {
+ this.sequential = (Sequential) getProject().createTask("sequential");
+ return this.sequential;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public ConditionBase createBool() {
+ return this;
+ }
+
+ public void setExecute(boolean execute) {
+ this.execute = execute;
+ }
+
+ public void setFailOnError(boolean failOnError) {
+ this.failOnError = failOnError;
+ }
+
+ public void execute() {
+ String value = getProject().getProperty("ant.enable.asserts");
+ boolean assertsEnabled = Project.toBoolean(value);
+
+ if (assertsEnabled) {
+ if (name != null) {
+ if (value == null) {
+ throw new BuildException("The 'value' attribute must accompany the 'name' attribute.");
+ }
+ String propVal = getProject().replaceProperties("${" + name + "}");
+ Equals e = new Equals();
+ e.setArg1(propVal);
+ e.setArg2(value);
+ addEquals(e);
+ }
+
+ if (countConditions() == 0) {
+ throw new BuildException("There is no condition specified.");
+ }
+ else if (countConditions() > 1) {
+ throw new BuildException("There must be exactly one condition specified.");
+ }
+
+ Condition c = (Condition) getConditions().nextElement();
+ if (! c.eval()) {
+ if (failOnError) {
+ Exit fail = (Exit) getProject().createTask("fail");
+ fail.setMessage(message);
+ fail.execute();
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9a/90187f4fe8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/9a/90187f4fe8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..80b1f9c
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/9a/90187f4fe8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.condition;
+
+import java.lang.reflect.Field;
+import java.util.Vector;
+
+import org.apache.tools.ant.taskdefs.condition.ConditionBase;
+
+/**
+ * Extends ConditionBase so I can get access to the condition count and the
+ * first condition. This is the class that the BooleanConditionTask is proxy
+ * for.
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ *
+ * @author Dale Anson, [email protected]
+ */
+public class BooleanConditionBase extends ConditionBase {
+
+ private Vector conditions;
+
+ public BooleanConditionBase() {
+ this.conditions = getParentConditions();
+ }
+
+ private Vector getParentConditions() {
+ Field f = ConditionBase.class.getDeclaredField("conditions");
+ f.setAccessible(true);
+ Vector v = (Vector) f.get(this);
+ return v;
+ }
+ /**
+ * Adds a feature to the IsPropertyTrue attribute of the BooleanConditionBase
+ * object
+ *
+ * @param i The feature to be added to the IsPropertyTrue attribute
+ */
+ public void addIsPropertyTrue( IsPropertyTrue i ) {
+ getConditions().add( i );
+ }
+
+ /**
+ * Adds a feature to the IsPropertyFalse attribute of the
+ * BooleanConditionBase object
+ *
+ * @param i The feature to be added to the IsPropertyFalse attribute
+ */
+ public void addIsPropertyFalse( IsPropertyFalse i ) {
+ getConditions().add( i );
+ }
+
+ public void addIsGreaterThan( IsGreaterThan i) {
+ getConditions().add(i);
+ }
+
+ public void addIsLessThan( IsLessThan i) {
+ getConditions().add(i);
+ }
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9a/a06fb94ae7cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/9a/a06fb94ae7cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..4a353c4
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/9a/a06fb94ae7cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Ant;
+
+/**
+ * Subclass of CallTarget which allows us to fetch
+ * properties which are set in the scope of the called
+ * target, and set them in the scope of the calling target.
+ * Normally, these properties are thrown away as soon as the
+ * called target completes execution.
+ *
+ * @author inger
+ * @author Dale Anson, [email protected]
+ * @ant.task name="antfetch"
+ */
+public class AntFetch extends Ant {
+ /** the name of the property to fetch from the new project */
+ private String returnName = null;
+
+ /**
+ * Do the execution.
+ *
+ * @exception BuildException Description of the Exception
+ */
+ public void execute() throws BuildException {
+ super.execute();
+ // copy back the props if possible
+ if ( returnName != null ) {
+ StringTokenizer st = new StringTokenizer( returnName, "," );
+ while ( st.hasMoreTokens() ) {
+ String name = st.nextToken().trim();
+ String value = super.getProject().getProperty(returnName);
+ if ( value != null ) {
+ getProject().setUserProperty( name, value );
+ }
+ }
+ }
+ }
+
+ /**
+ * Set the property or properties that are set in the new project to be
+ * transfered back to the original project. As with all properties, if the
+ * property already exists in the original project, it will not be overridden
+ * by a different value from the new project.
+ *
+ * @param r the name of a property in the new project to set in the original
+ * project. This may be a comma separate list of properties.
+ */
+ public void setReturn( String r ) {
+ returnName = r;
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9a/d09cdadfd8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/9a/d09cdadfd8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..2caf3f1
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/9a/d09cdadfd8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,7 @@
+<XDtClass:forAllClasses>
+<XDtClass:fullClassName />
+<XDtClass:ifHasClassTag tagName="ant.task" paramName="name">
+<XDtClass:classTagValue tagName="ant.task" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag>
+</XDtClass:forAllClasses>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9d/709e9f11d7cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/9d/709e9f11d7cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..d8a15a1
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/9d/709e9f11d7cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,6 @@
+<XDtClass:forAllClasses>
+ <XDtClass:ifHasClassTag tagName="ant:task" paramName="name">
+ <XDtClass:classTagValue tagName="ant:task" paramName="name"/>=<XDtClass:fullClassName />
+ </XDtClass:ifHasClassTag>
+</XDtClass:forAllClasses>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9d/a07c2f9ce0cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/9d/a07c2f9ce0cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..836b0ba
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/9d/a07c2f9ce0cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,3 @@
+<XDtClass:forAllClasses><XDtClass:ifHasClassTag tagName="ant:task">
+<XDtClass:classTagValue tagName="ant:task" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag></XDtClass:forAllClasses> \ No newline at end of file
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9d/f0639cc5d6cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/9d/f0639cc5d6cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..97f55dc
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/9d/f0639cc5d6cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,6 @@
+<XDtClass:forAllClasses>
+ <XDtClass:ifHasClassTag tagName="ant.task" paramName="name">
+ <XDtClass:classTagValue tagName="ant.task" paramName="name"/>=<XDtClass:classOf><XDtJavaBean:beanClass/></XDtClass:classOf>
+ </XDtClass:ifHasClassTag>
+</XDtClass:forAllClasses>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9e/e0501e5edfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/9e/e0501e5edfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..3250a62
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/9e/e0501e5edfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.math;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.DynamicConfigurator;
+
+/**
+ * Task for mathematical operations.
+ *
+ * @author inger
+ */
+
+
+public class MathTask
+ extends Task
+ implements DynamicConfigurator
+{
+ // storage for result
+ private String result = null;
+ private Operation operation = null;
+ private Operation locOperation = null;
+ private String datatype = null;
+ private boolean strict = false;
+
+ public MathTask()
+ {
+ super();
+ }
+
+ public void execute()
+ throws BuildException
+ {
+ Operation op = locOperation;
+ if (op == null)
+ op = operation;
+
+ Number res = op.evaluate();
+
+ if (datatype != null)
+ res = Math.convert(res, datatype);
+ getProject().setUserProperty(result, res.toString());
+ }
+
+ public void setDynamicAttribute(String s, String s1)
+ throws BuildException {
+ throw new BuildException("No dynamic attributes for this task");
+ }
+
+ public Object createDynamicElement(String name)
+ throws BuildException {
+ Operation op = new Operation();
+ op.setOperation(name);
+ operation = op;
+ return op;
+ }
+
+ public void setResult(String result)
+ {
+ this.result = result;
+ }
+
+ public void setDatatype(String datatype)
+ {
+ this.datatype = datatype;
+ }
+
+ public void setStrict(boolean strict)
+ {
+ this.strict = strict;
+ }
+
+ private Operation getLocalOperation()
+ {
+ if (locOperation == null)
+ {
+ locOperation = new Operation();
+ locOperation.setDatatype(datatype);
+ locOperation.setStrict(strict);
+ }
+ return locOperation;
+ }
+
+ public void setOperation(String operation)
+ {
+ getLocalOperation().setOperation(operation);
+ }
+
+ public void setDataType(String dataType)
+ {
+ getLocalOperation().setDatatype(dataType);
+ }
+
+ public void setOperand1(String operand1)
+ {
+ getLocalOperation().setArg1(operand1);
+ }
+
+ public void setOperand2(String operand2)
+ {
+ getLocalOperation().setArg2(operand2);
+ }
+
+ public Operation createOperation()
+ {
+ if (locOperation != null || operation != null)
+ throw new BuildException("Only 1 operation can be specified");
+ this.operation = new Operation();
+ this.operation.setStrict(strict);
+ this.operation.setDatatype(datatype);
+ return this.operation;
+ }
+
+ // conform to old task
+ public Operation createOp()
+ {
+ return createOperation();
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a1/000553f6e3cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/a1/000553f6e3cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..05aaf6e
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a1/000553f6e3cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.ant16;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Exit;
+import org.apache.tools.ant.taskdefs.Sequential;
+import org.apache.tools.ant.taskdefs.condition.Condition;
+import org.apache.tools.ant.taskdefs.condition.ConditionBase;
+import org.apache.tools.ant.taskdefs.condition.Equals;
+
+
+/**
+ *
+ * @ant.task name="assert"
+ */
+public class Assert
+ extends ConditionBase {
+
+ private List tasks = new ArrayList();
+ private String message;
+ private boolean failOnError = true;
+ private boolean execute = true;
+ private Sequential sequential;
+ private String name;
+ private String value;
+
+ public Sequential createSequential() {
+ this.sequential = (Sequential) getProject().createTask("sequential");
+ return this.sequential;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public ConditionBase createBool() {
+ return this;
+ }
+
+ public void setExecute(boolean execute) {
+ this.execute = execute;
+ }
+
+ public void setFailOnError(boolean failOnError) {
+ this.failOnError = failOnError;
+ }
+
+ public void execute() {
+ String value = getProject().getProperty("ant.enable.asserts");
+ boolean assertsEnabled = Project.toBoolean(value);
+
+ if (assertsEnabled) {
+ if (name != null) {
+ if (value == null) {
+ throw new BuildException("The 'value' attribute must accompany the 'name' attribute.");
+ }
+ String propVal = getProject().replaceProperties("${" + name + "}");
+ Equals e = new Equals();
+ e.setArg1(propVal);
+ e.setArg2(value);
+ addEquals(e);
+ }
+
+ if (countConditions() == 0) {
+ throw new BuildException("There is no condition specified.");
+ }
+ else if (countConditions() > 1) {
+ throw new BuildException("There must be exactly one condition specified.");
+ }
+
+ Condition c = (Condition) getConditions().nextElement();
+ if (! c.eval()) {
+ if (failOnError) {
+ Exit fail = (Exit) getProject().createTask("fail");
+ fail.setMessage(message);
+ fail.execute();
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a2/c0064e18e7cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/a2/c0064e18e7cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..fc02c45
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a2/c0064e18e7cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Ant;
+
+/**
+ * Subclass of CallTarget which allows us to fetch
+ * properties which are set in the scope of the called
+ * target, and set them in the scope of the calling target.
+ * Normally, these properties are thrown away as soon as the
+ * called target completes execution.
+ *
+ * @author inger
+ * @author Dale Anson, [email protected]
+ * @ant.task name="antfetch"
+ */
+public class AntFetch extends Ant {
+ /** the name of the property to fetch from the new project */
+ private String returnName = null;
+
+ /**
+ * Do the execution.
+ *
+ * @exception BuildException Description of the Exception
+ */
+ public void execute() throws BuildException {
+ super.execute();
+ // copy back the props if possible
+ if ( returnName != null ) {
+ StringTokenizer st = new StringTokenizer( returnName, "," );
+ while ( st.hasMoreTokens() ) {
+ String name = st.nextToken().trim();
+ String value = super.getProject().getProperty(returnName);
+ if ( value != null ) {
+ getProject().setUserProperty( name, value );
+ }
+ else {
+ value = fakeProject.getSubproject().getProperty( name );
+ if ( value != null ) {
+ getProject().setProperty( name, value );
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Set the property or properties that are set in the new project to be
+ * transfered back to the original project. As with all properties, if the
+ * property already exists in the original project, it will not be overridden
+ * by a different value from the new project.
+ *
+ * @param r the name of a property in the new project to set in the original
+ * project. This may be a comma separate list of properties.
+ */
+ public void setReturn( String r ) {
+ returnName = r;
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a5/00556abad6cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/a5/00556abad6cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..a21c73e
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a5/00556abad6cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,6 @@
+<XDtClass:forAllClasses>
+ <XDtClass:ifHasClassTag tagName="ant:task" paramName="name">
+ <XDtClass:classTagValue tagName="ant:task" paramName="name"/>=<XDtClass:classOf><XDtJavaBean:beanClass/></XDtClass:classOf>
+ </XDtClass:ifHasClassTag>
+</XDtClass:forAllClasses>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a5/80d03704e7cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/a5/80d03704e7cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..e51c5f5
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a5/80d03704e7cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Ant;
+
+/**
+ * Subclass of CallTarget which allows us to fetch
+ * properties which are set in the scope of the called
+ * target, and set them in the scope of the calling target.
+ * Normally, these properties are thrown away as soon as the
+ * called target completes execution.
+ *
+ * @author inger
+ * @author Dale Anson, [email protected]
+ * @ant.task name="antfetch"
+ */
+public class AntFetch extends Ant {
+ /** the name of the property to fetch from the new project */
+ private String returnName = null;
+
+ private ProjectDelegate fakeProject = null;
+
+ public void setProject(Project realProject) {
+ fakeProject = new ProjectDelegate(realProject);
+ super.setProject(fakeProject);
+ }
+
+ /**
+ * Do the execution.
+ *
+ * @exception BuildException Description of the Exception
+ */
+ public void execute() throws BuildException {
+ super.execute();
+
+ // copy back the props if possible
+ if ( returnName != null ) {
+ StringTokenizer st = new StringTokenizer( returnName, "," );
+ while ( st.hasMoreTokens() ) {
+ String name = st.nextToken().trim();
+ String value = fakeProject.getSubproject().getUserProperty( name );
+ if ( value != null ) {
+ getProject().setUserProperty( name, value );
+ }
+ else {
+ value = fakeProject.getSubproject().getProperty( name );
+ if ( value != null ) {
+ getProject().setProperty( name, value );
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Set the property or properties that are set in the new project to be
+ * transfered back to the original project. As with all properties, if the
+ * property already exists in the original project, it will not be overridden
+ * by a different value from the new project.
+ *
+ * @param r the name of a property in the new project to set in the original
+ * project. This may be a comma separate list of properties.
+ */
+ public void setReturn( String r ) {
+ returnName = r;
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a7/40794dccc3cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/a7/40794dccc3cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..c88b76c
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a7/40794dccc3cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,471 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.ResourceCollection;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ * @author Matt Inger
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private Path currPath;
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+ private List resourceCollections = new ArrayList();
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ public void add(ResourceCollection resourceCollection) {
+ this.resourceCollections.add(resourceCollection);
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ private Path getOrCreatePath() {
+ if (currPath == null) {
+ currPath = new Path(getProject());
+ }
+ return currPath;
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfigured(Path path) {
+ getOrCreatePath().append(path);
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfiguredPath(Path path) {
+ addConfigured(path);
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && currPath == null && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or path or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ // Take Care of the path element
+ String[] pathElements = new String[0];
+ if (currPath != null) {
+ pathElements = currPath.list();
+ }
+ for (int i = 0; i < pathElements.length; i++) {
+ File nextFile = new File(pathElements[i]);
+ doToken(nextFile.getAbsolutePath());
+ }
+
+ // Take care of iterators
+ for (Iterator i = hasIterators.iterator(); i.hasNext();) {
+ Iterator it = ((HasIterator) i.next()).iterator();
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void add(FileSet fileset) {
+ getOrCreatePath().addFileset(fileset);
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void addFileSet(FileSet fileset) {
+ add(fileset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void add(DirSet dirset) {
+ getOrCreatePath().addDirset(dirset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void addDirSet(DirSet dirset) {
+ add(dirset);
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a8/9022136ee0cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/a8/9022136ee0cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..4b6548f
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a8/9022136ee0cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,369 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.walls;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.Copy;
+import org.apache.tools.ant.taskdefs.Javac;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.util.JAXPUtils;
+import org.xml.sax.HandlerBase;
+import org.xml.sax.Parser;
+import org.xml.sax.SAXException;
+/*
+ * Created on Aug 24, 2003
+ *
+ * To change the template for this generated file go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+/**
+ * FILL IN JAVADOC HERE
+ *
+ * @author Dean Hiller([email protected])
+ */
+public class CompileWithWalls extends Task {
+ private boolean setWallsTwice = false;
+ private boolean setJavacTwice = false;
+ private Walls walls;
+ private Javac javac;
+ private File wallsFile;
+ private File tempBuildDir;
+
+ private Map packagesNeedingCompiling = new HashMap();
+
+ private SAXException cachedSAXException = null;
+ private IOException cachedIOException = null;
+
+ public void setIntermediaryBuildDir(File f) {
+ tempBuildDir = f;
+ }
+
+ public File getIntermediaryBuildDir() {
+ return tempBuildDir;
+ }
+
+ public void setWalls(File f) {
+ this.wallsFile = f;
+
+ Parser parser = JAXPUtils.getParser();
+ HandlerBase hb = new WallsFileHandler(this, wallsFile);
+ parser.setDocumentHandler(hb);
+ parser.setEntityResolver(hb);
+ parser.setErrorHandler(hb);
+ parser.setDTDHandler(hb);
+ try {
+ log("about to start parsing walls file", Project.MSG_INFO);
+ parser.parse(wallsFile.toURL().toExternalForm());
+ } catch (SAXException e) {
+ cachedSAXException = e;
+ throw new ParsingWallsException("Problem parsing walls file attached:", e);
+ } catch (IOException e) {
+ cachedIOException = e;
+ throw new ParsingWallsException("IOException on walls file attached:", e);
+ }
+ }
+
+ public File getWalls() {
+ return wallsFile;
+ }
+
+
+ public Walls createWalls() {
+ if (walls != null)
+ setWallsTwice = true;
+ walls = new Walls();
+ return walls;
+ }
+ public Javac createJavac() {
+ if (javac != null)
+ setJavacTwice = true;
+ javac = new Javac();
+ return javac;
+ }
+ public void execute() throws BuildException {
+ if(cachedIOException != null)
+ throw new BuildException(cachedIOException, getLocation());
+ else if(cachedSAXException != null)
+ throw new BuildException(cachedSAXException, getLocation());
+ else if(tempBuildDir == null)
+ throw new BuildException(
+ "intermediaryBuildDir attribute must be specified on the compilewithwalls element"
+ , getLocation());
+ else if (javac == null)
+ throw new BuildException(
+ "There must be a nested javac element",
+ getLocation());
+ else if (walls == null)
+ throw new BuildException(
+ "There must be a nested walls element",
+ getLocation());
+ else if (setWallsTwice)
+ throw new BuildException(
+ "compilewithwalls task only supports one nested walls element or one walls attribute",
+ getLocation());
+ else if (setJavacTwice)
+ throw new BuildException(
+ "compilewithwalls task only supports one nested javac element",
+ getLocation());
+
+ getProject().addTaskDefinition("SilentMove", SilentMove.class);
+ getProject().addTaskDefinition("SilentCopy", SilentCopy.class);
+
+ File destDir = javac.getDestdir();
+ Path src = javac.getSrcdir();
+
+ if(src == null)
+ throw new BuildException("Javac inside compilewithwalls must have a srcdir specified");
+
+ String[] list = src.list();
+ File[] tempSrcDirs1 = new File[list.length];
+ for(int i = 0; i < list.length; i++) {
+ tempSrcDirs1[i] = getProject().resolveFile(list[i]);
+ }
+
+ String[] classpaths = new String[0];
+ if(javac.getClasspath() != null)
+ classpaths = javac.getClasspath().list();
+
+ File temp = null;
+ for(int i = 0; i < classpaths.length; i++) {
+ temp = new File(classpaths[i]);
+ if(temp.isDirectory()) {
+
+ for(int n = 0; n < tempSrcDirs1.length; n++) {
+ if(tempSrcDirs1[n].compareTo(temp) == 0)
+ throw new BuildException("The classpath cannot contain any of the\n"
+ +"src directories, but it does.\n"
+ +"srcdir="+tempSrcDirs1[n]);
+ }
+ }
+ }
+
+ //get rid of non-existent srcDirs
+ List srcDirs2 = new ArrayList();
+ for(int i = 0; i < tempSrcDirs1.length; i++) {
+ if(tempSrcDirs1[i].exists())
+ srcDirs2.add(tempSrcDirs1[i]);
+ }
+
+ if (destDir == null)
+ throw new BuildException(
+ "destdir was not specified in nested javac task",
+ getLocation());
+
+ //make sure tempBuildDir is not inside destDir or we are in trouble!!
+ if(file1IsChildOfFile2(tempBuildDir, destDir))
+ throw new BuildException("intermediaryBuildDir attribute cannot be specified\n"
+ +"to be the same as destdir or inside desdir of the javac task.\n"
+ +"This is an intermediary build directory only used by the\n"
+ +"compilewithwalls task, not the class file output directory.\n"
+ +"The class file output directory is specified in javac's destdir attribute", getLocation());
+
+ //create the tempBuildDir if it doesn't exist.
+ if(!tempBuildDir.exists()) {
+ tempBuildDir.mkdirs();
+ log("created direction="+tempBuildDir, Project.MSG_VERBOSE);
+ }
+
+ Iterator iter = walls.getPackagesToCompile();
+ while (iter.hasNext()) {
+ Package toCompile = (Package)iter.next();
+
+ File buildSpace = toCompile.getBuildSpace(tempBuildDir);
+ if(!buildSpace.exists()) {
+ buildSpace.mkdir();
+ log("created directory="+buildSpace, Project.MSG_VERBOSE);
+ }
+
+ FileSet javaIncludes2 =
+ toCompile.getJavaCopyFileSet(getProject(), getLocation());
+
+ for(int i = 0; i < srcDirs2.size(); i++) {
+ File srcDir = (File)srcDirs2.get(i);
+ javaIncludes2.setDir(srcDir);
+ log(toCompile.getPackage()+": sourceDir["+i+"]="+srcDir+" destDir="+buildSpace, Project.MSG_VERBOSE);
+ copyFiles(srcDir, buildSpace, javaIncludes2);
+ }
+
+ Path srcDir2 = toCompile.getSrcPath(tempBuildDir, getProject());
+ Path classPath = toCompile.getClasspath(tempBuildDir, getProject());
+ if(javac.getClasspath() != null)
+ classPath.addExisting(javac.getClasspath());
+
+ //unfortunately, we cannot clear the SrcDir in Javac, so we have to clone
+ //instead of just reusing the other Javac....this means added params in
+ //future releases will be missed unless this task is kept up to date.
+ //need to convert to reflection later so we don't need to keep this up to
+ //date.
+ Javac buildSpaceJavac = new Javac();
+ buildSpaceJavac.setProject(getProject());
+ buildSpaceJavac.setOwningTarget(getOwningTarget());
+ buildSpaceJavac.setTaskName(getTaskName());
+ log(toCompile.getPackage()+": Compiling");
+ log(toCompile.getPackage()+": sourceDir="+srcDir2, Project.MSG_VERBOSE);
+ log(toCompile.getPackage()+": classPath="+classPath, Project.MSG_VERBOSE);
+ log(toCompile.getPackage()+": destDir="+buildSpace, Project.MSG_VERBOSE);
+ buildSpaceJavac.setSrcdir(srcDir2);
+ buildSpaceJavac.setDestdir(buildSpace);
+ //includes not used...ie. ignored
+ //includesfile not used
+ //excludes not used
+ //excludesfile not used
+ buildSpaceJavac.setClasspath(classPath);
+ //sourcepath not used
+ buildSpaceJavac.setBootclasspath(javac.getBootclasspath());
+ //classpath not used..redefined by us
+ //sourcepathref not used...redefined by us.
+ //bootclasspathref was already copied above(see javac and you will understand)
+ buildSpaceJavac.setExtdirs(javac.getExtdirs());
+ buildSpaceJavac.setEncoding(javac.getEncoding());
+ buildSpaceJavac.setNowarn(javac.getNowarn());
+ buildSpaceJavac.setDebug(javac.getDebug());
+ buildSpaceJavac.setDebugLevel(javac.getDebugLevel());
+ buildSpaceJavac.setOptimize(javac.getOptimize());
+ buildSpaceJavac.setDeprecation(javac.getDeprecation());
+ buildSpaceJavac.setTarget(javac.getTarget());
+ buildSpaceJavac.setVerbose(javac.getVerbose());
+ buildSpaceJavac.setDepend(javac.getDepend());
+ buildSpaceJavac.setIncludeantruntime(javac.getIncludeantruntime());
+ buildSpaceJavac.setIncludejavaruntime(javac.getIncludejavaruntime());
+ buildSpaceJavac.setFork(javac.isForkedJavac());
+ buildSpaceJavac.setExecutable(javac.getJavacExecutable());
+ buildSpaceJavac.setMemoryInitialSize(javac.getMemoryInitialSize());
+ buildSpaceJavac.setMemoryMaximumSize(javac.getMemoryMaximumSize());
+ buildSpaceJavac.setFailonerror(javac.getFailonerror());
+ buildSpaceJavac.setSource(javac.getSource());
+ buildSpaceJavac.setCompiler(javac.getCompiler());
+
+ Javac.ImplementationSpecificArgument arg;
+ String[] args = javac.getCurrentCompilerArgs();
+ if(args != null) {
+ for(int i = 0; i < args.length;i++) {
+ arg = buildSpaceJavac.createCompilerArg();
+ arg.setValue(args[i]);
+ }
+ }
+
+ buildSpaceJavac.setProject(getProject());
+ buildSpaceJavac.perform();
+
+ //copy class files to javac's destDir where the user wants the class files
+ copyFiles(buildSpace, destDir, toCompile.getClassCopyFileSet(getProject(), getLocation()));
+ }
+ }
+ /**
+ * @param tempBuildDir
+ * @param destDir
+ * @return
+ */
+ private boolean file1IsChildOfFile2(File tempBuildDir, File destDir) {
+ File parent = tempBuildDir;
+ for(int i = 0; i < 1000; i++) {
+ if(parent.compareTo(destDir) == 0)
+ return true;
+ parent = parent.getParentFile();
+ if(parent == null)
+ return false;
+ }
+
+ throw new RuntimeException("You either have more than 1000 directories in"
+ +"\nyour heirarchy or this is a bug, please report. parent="+parent+" destDir="+destDir);
+ }
+
+ /**
+ * Move java or class files to temp files or moves the temp files
+ * back to java or class files. This must be done because javac
+ * is too nice and sticks already compiled classes and ones depended
+ * on in the classpath destroying the compile time wall. This way,
+ * we can keep the wall up.
+ *
+ * @param srcDir Directory to copy files from/to(Usually the java files dir or the class files dir)
+ * @param fileset The fileset of files to include in the move.
+ * @param moveToTempFile true if moving src files to temp files, false if moving temp files
+ * back to src files.
+ * @param isJavaFiles true if we are moving .java files, false if we are moving .class files.
+ */
+ private void copyFiles(
+ File srcDir,
+ File destDir,
+ FileSet fileset) {
+
+ fileset.setDir(srcDir);
+ if (!srcDir.exists())
+ throw new BuildException(
+ "Directory=" + srcDir + " does not exist",
+ getLocation());
+
+
+ //before we do this, we have to move all files not
+ //in the above fileset to xxx.java.ant-tempfile
+ //so that they don't get dragged into the compile
+ //This way we don't miss anything and all the dependencies
+ //are listed or the compile will break.
+ Copy move = (Copy)getProject().createTask("SilentCopy");
+ move.setProject(getProject());
+ move.setOwningTarget(getOwningTarget());
+ move.setTaskName(getTaskName());
+ move.setLocation(getLocation());
+ move.setTodir(destDir);
+// move.setOverwrite(true);
+ move.addFileset(fileset);
+ move.perform();
+ }
+
+ public void log(String msg, int level) {
+ super.log(msg, level);
+ }
+
+ //until 1.3 is deprecated, this is a cheat to chain exceptions.
+ private class ParsingWallsException extends RuntimeException {
+
+ private String message;
+
+ public ParsingWallsException(String message, Throwable cause) {
+ super(message);
+
+ this.message = message+"\n";
+
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ cause.printStackTrace(pw);
+
+ this.message += sw;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public String toString() {
+ return getMessage();
+ }
+ }
+} \ No newline at end of file
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a8/b0147438dacc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/a8/b0147438dacc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..ab9067c
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a8/b0147438dacc001b1cb5d1e6b2b8577e
@@ -0,0 +1,5 @@
+<XDtClass:fullClassName />
+<XDtClass:ifHasClassTag tagName="ant:task" paramName="name">
+<XDtClass:classTagValue tagName="ant:task" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/aa/7002898bc4cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/aa/7002898bc4cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..2f28373
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/aa/7002898bc4cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,441 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Resource;
+import org.apache.tools.ant.types.ResourceCollection;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ * @author Matt Inger
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+ private List resourceCollections = new ArrayList();
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ public void add(ResourceCollection resourceCollection) {
+ this.resourceCollections.add(resourceCollection);
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && resourceCollections.isEmpty() && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or resources or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ Iterator it = resourceCollections.iterator();
+ while (it.hasNext()) {
+ ResourceCollection c = (ResourceCollection) it.next();
+ Iterator rit = c.iterator();
+ while (rit.hasNext()) {
+ Resource r = (Resource) rit.next();
+ doToken(r.toString());
+ }
+ }
+
+
+ // Take care of iterators
+ for (Iterator i = hasIterators.iterator(); i.hasNext();) {
+ Iterator it = ((HasIterator) i.next()).iterator();
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void add(FileSet fileset) {
+ getOrCreatePath().addFileset(fileset);
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void addFileSet(FileSet fileset) {
+ add(fileset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void add(DirSet dirset) {
+ getOrCreatePath().addDirset(dirset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void addDirSet(DirSet dirset) {
+ add(dirset);
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ab/40aeeabbe8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/ab/40aeeabbe8cc001b1cb5d1e6b2b8577e
new file mode 100755
index 0000000..6203b27
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ab/40aeeabbe8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,280 @@
+/*
+ * Copyright (c) 2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.text.ParseException;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Expand;
+import org.apache.tools.ant.taskdefs.ImportTask;
+
+import fr.jayasoft.ivy.Artifact;
+import fr.jayasoft.ivy.DependencyResolver;
+import fr.jayasoft.ivy.Ivy;
+import fr.jayasoft.ivy.IvyContext;
+import fr.jayasoft.ivy.ModuleDescriptor;
+import fr.jayasoft.ivy.ModuleId;
+import fr.jayasoft.ivy.ModuleRevisionId;
+import fr.jayasoft.ivy.filter.FilterHelper;
+import fr.jayasoft.ivy.report.ResolveReport;
+import fr.jayasoft.ivy.repository.Repository;
+import fr.jayasoft.ivy.resolver.FileSystemResolver;
+import fr.jayasoft.ivy.resolver.IvyRepResolver;
+import fr.jayasoft.ivy.resolver.URLResolver;
+import fr.jayasoft.ivy.util.MessageImpl;
+
+/***
+ * Task to import a build file from a url. The build file can be a build.xml,
+ * or a .zip/.jar, in which case we download and extract the entire archive, and
+ * import the file "build.xml"
+ * @author inger
+ * @ant.task name="importurl" onerror="ignore"
+ *
+ */
+public class URLImportTask
+ extends ImportTask {
+
+ private String org;
+ private String module;
+ private String rev = "latest.integration";
+ private String type = "jar";
+ private String repositoryUrl;
+ private String repositoryDir;
+ private URL ivyConfUrl;
+ private File ivyConfFile;
+ private String resource = "build.xml";
+ private String artifactPattern = "/[org]/[module]/[ext]s/[module]-[revision].[ext]";
+ private String ivyPattern = "/[org]/[module]/ivy-[revision].xml";
+ private boolean verbose = false;
+
+ public void setVerbose(boolean verbose) {
+ this.verbose = verbose;
+ }
+
+ public void setModule(String module) {
+ this.module = module;
+ }
+
+ public void setOrg(String org) {
+ this.org = org;
+ }
+
+ public void setRev(String rev) {
+ this.rev = rev;
+ }
+
+ public void setIvyConfFile(File ivyConfFile) {
+ this.ivyConfFile = ivyConfFile;
+ }
+
+ public void setIvyConfUrl(URL ivyConfUrl) {
+ this.ivyConfUrl = ivyConfUrl;
+ }
+
+ public void setArtifactPattern(String artifactPattern) {
+ this.artifactPattern = artifactPattern;
+ }
+
+ public void setIvyPattern(String ivyPattern) {
+ this.ivyPattern = ivyPattern;
+ }
+
+ public void setRepositoryDir(String repositoryDir) {
+ this.repositoryDir = repositoryDir;
+ }
+
+ public void setRepositoryUrl(String repositoryUrl) {
+ this.repositoryUrl = repositoryUrl;
+ }
+
+ public void setResource(String resource) {
+ this.resource = resource;
+ }
+
+ public void setOptional(boolean optional) {
+ throw new BuildException("'optional' property not accessed for ImportURL.");
+ }
+
+ public void setFile(String file) {
+ throw new BuildException("'file' property not accessed for ImportURL.");
+ }
+
+ public void execute()
+ throws BuildException {
+
+ MessageImpl oldMsgImpl = IvyContext.getContext().getMessageImpl();
+
+ if (! verbose) {
+ IvyContext.getContext().setMessageImpl(
+ new MessageImpl() {
+
+ public void endProgress(String arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void log(String arg0, int arg1) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void progress() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void rawlog(String arg0, int arg1) {
+ }
+ }
+ );
+ }
+ Ivy ivy = new Ivy();
+ DependencyResolver resolver = null;
+ Repository rep = null;
+
+
+ if (repositoryUrl != null) {
+ resolver = new URLResolver();
+ ((URLResolver)resolver).addArtifactPattern(
+ repositoryUrl + "/" + artifactPattern
+ );
+ ((URLResolver)resolver).addIvyPattern(
+ repositoryUrl + "/" + ivyPattern
+ );
+ resolver.setName("default");
+ }
+ else if (repositoryDir != null) {
+ resolver = new FileSystemResolver();
+ ((FileSystemResolver)resolver).addArtifactPattern(
+ repositoryDir + "/" + artifactPattern
+ );
+ ((FileSystemResolver)resolver).addIvyPattern(
+ repositoryDir + "/" + ivyPattern
+ );
+ }
+ else if (ivyConfUrl != null) {
+ try {
+ ivy.configure(ivyConfUrl);
+ resolver = ivy.getDefaultResolver();
+ }
+ catch (IOException e) {
+ throw new BuildException(e);
+ }
+ catch (ParseException e) {
+ throw new BuildException(e);
+ }
+ }
+ else if (ivyConfFile != null) {
+ try {
+ ivy.configure(ivyConfFile);
+ }
+ catch (IOException e) {
+ throw new BuildException(e);
+ }
+ catch (ParseException e) {
+ throw new BuildException(e);
+ }
+ }
+ else {
+ resolver = new IvyRepResolver();
+ }
+ resolver.setName("default");
+ ivy.addResolver(resolver);
+ ivy.setDefaultResolver(resolver.getName());
+
+
+ try {
+ ModuleId moduleId =
+ new ModuleId(org, module);
+ ModuleRevisionId revId =
+ new ModuleRevisionId(moduleId, rev);
+
+ ResolveReport resolveReport = ivy.resolve(
+ ModuleRevisionId.newInstance(org, module, rev),
+ new String[] { "*" },
+ false,
+ true,
+ ivy.getDefaultCache(),
+ new Date(),
+ ivy.doValidate(),
+ false,
+ false,
+ FilterHelper.getArtifactTypeFilter(type));
+
+ if (resolveReport.hasError()) {
+ throw new BuildException("Could not resolve resource for: " +
+ "org=" + org +
+ ";module=" + module +
+ ";rev=" + rev);
+ }
+
+ ModuleDescriptor desc = resolveReport.getModuleDescriptor();
+ List artifacts = resolveReport.getArtifacts();
+ Artifact artifact = (Artifact) artifacts.get(0);
+ log("Fetched " +
+ artifact.getModuleRevisionId().getOrganisation() + " | " +
+ artifact.getModuleRevisionId().getName() + " | " +
+ artifact.getModuleRevisionId().getRevision());
+ File file = ivy.getArchiveFileInCache(ivy.getDefaultCache(), artifact);
+
+ File importFile = null;
+
+ if ("xml".equalsIgnoreCase(type)) {
+ importFile = file;
+ }
+ else if ("jar".equalsIgnoreCase(type) ||
+ "zip".equalsIgnoreCase(type)) {
+ File dir = new File(file.getParentFile(),
+ file.getName() + ".extracted");
+ if (! dir.exists() ||
+ dir.lastModified() < file.lastModified()) {
+ dir.mkdir();
+ Expand expand = (Expand)getProject().createTask("unjar");
+ expand.setSrc(file);
+ expand.setDest(dir);
+ expand.perform();
+ }
+ importFile = new File(dir, resource);
+ if (! importFile.exists()) {
+ throw new BuildException("Cannot find a '" + resource + "' file in " +
+ file.getName());
+ }
+ }
+ else {
+ throw new BuildException("Don't know what to do with type: " + type);
+ }
+
+ super.setFile(importFile.getAbsolutePath());
+ super.execute();
+ log("Import complete.", Project.MSG_INFO);
+ }
+ catch (ParseException e) {
+ throw new BuildException(e);
+ }
+ catch (IOException e) {
+ throw new BuildException(e);
+ }
+ finally {
+ IvyContext.getContext().setMessageImpl(oldMsgImpl);
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ad/402e511bdfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/ad/402e511bdfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..6c32181
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ad/402e511bdfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,419 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.antclipse;
+import java.io.File;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.Property;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Path.PathElement;
+import org.apache.tools.ant.util.RegexpPatternMapper;
+import org.xml.sax.AttributeList;
+import org.xml.sax.HandlerBase;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * Support class for the Antclipse task. Basically, it takes the .classpath Eclipse file
+ * and feeds a SAX parser. The handler is slightly different according to what we want to
+ * obtain (a classpath or a fileset)
+ * @author Adrian Spinei [email protected]
+ * @version $Revision: 1.2 $
+ * @since Ant 1.5
+ */
+public class ClassPathTask extends Task
+{
+ private String project;
+ private String idContainer = "antclipse";
+ private boolean includeSource = false; //default, do not include source
+ private boolean includeOutput = false; //default, do not include output directory
+ private boolean includeLibs = true; //default, include all libraries
+ private boolean verbose = false; //default quiet
+ RegexpPatternMapper irpm = null;
+ RegexpPatternMapper erpm = null;
+ public static final String TARGET_CLASSPATH = "classpath";
+ public static final String TARGET_FILESET = "fileset";
+ private String produce = null; //classpath by default
+
+ /**
+ * Setter for task parameter
+ * @param includeLibs Boolean, whether to include or not the project libraries. Default is true.
+ */
+ public void setIncludeLibs(boolean includeLibs)
+ {
+ this.includeLibs = includeLibs;
+ }
+
+ /**
+ * Setter for task parameter
+ * @param produce This parameter tells the task wether to produce a "classpath" or a "fileset" (multiple filesets, as a matter of fact).
+ */
+ public void setproduce(String produce)
+ {
+ this.produce = produce;
+ }
+
+ /**
+ * Setter for task parameter
+ * @param verbose Boolean, telling the app to throw some info during each step. Default is false.
+ */
+ public void setVerbose(boolean verbose)
+ {
+ this.verbose = verbose;
+ }
+
+ /**
+ * Setter for task parameter
+ * @param excludes A regexp for files to exclude. It is taken into account only when producing a classpath, doesn't work on source or output files. It is a real regexp, not a "*" expression.
+ */
+ public void setExcludes(String excludes)
+ {
+ if (excludes != null)
+ {
+ erpm = new RegexpPatternMapper();
+ erpm.setFrom(excludes);
+ erpm.setTo("."); //mandatory
+ }
+ else
+ erpm = null;
+ }
+
+ /**
+ * Setter for task parameter
+ * @param includes A regexp for files to include. It is taken into account only when producing a classpath, doesn't work on source or output files. It is a real regexp, not a "*" expression.
+ */
+ public void setIncludes(String includes)
+ {
+ if (includes != null)
+ {
+ irpm = new RegexpPatternMapper();
+ irpm.setFrom(includes);
+ irpm.setTo("."); //mandatory
+ }
+ else
+ irpm = null;
+ }
+
+ /**
+ * Setter for task parameter
+ * @param idContainer The refid which will serve to identify the deliverables. When multiple filesets are produces, their refid is a concatenation between this value and something else (usually obtained from a path). Default "antclipse"
+ */
+ public void setIdContainer(String idContainer)
+ {
+ this.idContainer = idContainer;
+ }
+
+ /**
+ * Setter for task parameter
+ * @param includeOutput Boolean, whether to include or not the project output directories. Default is false.
+ */
+ public void setIncludeOutput(boolean includeOutput)
+ {
+ this.includeOutput = includeOutput;
+ }
+
+ /**
+ * Setter for task parameter
+ * @param includeSource Boolean, whether to include or not the project source directories. Default is false.
+ */
+ public void setIncludeSource(boolean includeSource)
+ {
+ this.includeSource = includeSource;
+ }
+
+ /**
+ * Setter for task parameter
+ * @param project project name
+ */
+ public void setProject(String project)
+ {
+ this.project = project;
+ }
+
+ /**
+ * @see org.apache.tools.ant.Task#execute()
+ */
+ public void execute() throws BuildException
+ {
+ if (!TARGET_CLASSPATH.equalsIgnoreCase(this.produce) && !TARGET_FILESET.equals(this.produce))
+ throw new BuildException(
+ "Mandatory target must be either '" + TARGET_CLASSPATH + "' or '" + TARGET_FILESET + "'");
+ ClassPathParser parser = new ClassPathParser();
+ AbstractCustomHandler handler;
+ if (TARGET_CLASSPATH.equalsIgnoreCase(this.produce))
+ {
+ Path path = new Path(this.getProject());
+ this.getProject().addReference(this.idContainer, path);
+ handler = new PathCustomHandler(path);
+ }
+ else
+ {
+ FileSet fileSet = new FileSet();
+ this.getProject().addReference(this.idContainer, fileSet);
+ fileSet.setDir(new File(this.getProject().getBaseDir().getAbsolutePath().toString()));
+ handler = new FileSetCustomHandler(fileSet);
+ }
+ parser.parse(new File(this.getProject().getBaseDir().getAbsolutePath(), ".classpath"), handler);
+ }
+
+ abstract class AbstractCustomHandler extends HandlerBase
+ {
+ protected String projDir;
+ protected static final String ATTRNAME_PATH = "path";
+ protected static final String ATTRNAME_KIND = "kind";
+ protected static final String ATTR_LIB = "lib";
+ protected static final String ATTR_SRC = "src";
+ protected static final String ATTR_OUTPUT = "output";
+ protected static final String EMPTY = "";
+ }
+
+ class FileSetCustomHandler extends AbstractCustomHandler
+ {
+ private FileSet fileSet = null;
+
+ /**
+ * nazi style, forbid default constructor
+ */
+ private FileSetCustomHandler()
+ {
+ }
+
+ /**
+ * @param fileSet
+ */
+ public FileSetCustomHandler(FileSet fileSet)
+ {
+ super();
+ this.fileSet = fileSet;
+ projDir = getProject().getBaseDir().getAbsolutePath().toString();
+ }
+
+ /**
+ * @see org.xml.sax.DocumentHandler#endDocument()
+ */
+ public void endDocument() throws SAXException
+ {
+ super.endDocument();
+ if (fileSet != null && !fileSet.hasPatterns())
+ fileSet.setExcludes("**/*");
+ //exclude everything or we'll take all the project dirs
+ }
+
+ public void startElement(String tag, AttributeList attrs) throws SAXParseException
+ {
+ if (tag.equalsIgnoreCase("classpathentry"))
+ {
+ //start by checking if the classpath is coherent at all
+ String kind = attrs.getValue(ATTRNAME_KIND);
+ if (kind == null)
+ throw new BuildException("classpathentry 'kind' attribute is mandatory");
+ String path = attrs.getValue(ATTRNAME_PATH);
+ if (path == null)
+ throw new BuildException("classpathentry 'path' attribute is mandatory");
+
+ //put the outputdirectory in a property
+ if (kind.equalsIgnoreCase(ATTR_OUTPUT))
+ {
+ String propName = idContainer + "outpath";
+ Property property = new Property();
+ property.setName(propName);
+ property.setValue(path);
+ property.setProject(getProject());
+ property.execute();
+ if (verbose)
+ System.out.println("Setting property " + propName + " to value " + path);
+ }
+
+ //let's put the last source directory in a property
+ if (kind.equalsIgnoreCase(ATTR_SRC))
+ {
+ String propName = idContainer + "srcpath";
+ Property property = new Property();
+ property.setName(propName);
+ property.setValue(path);
+ property.setProject(getProject());
+ property.execute();
+ if (verbose)
+ System.out.println("Setting property " + propName + " to value " + path);
+ }
+
+ if ((kind.equalsIgnoreCase(ATTR_SRC) && includeSource)
+ || (kind.equalsIgnoreCase(ATTR_OUTPUT) && includeOutput)
+ || (kind.equalsIgnoreCase(ATTR_LIB) && includeLibs))
+ {
+ //all seem fine
+ // check the includes
+ String[] inclResult = new String[] { "all included" };
+ if (irpm != null)
+ {
+ inclResult = irpm.mapFileName(path);
+ }
+ String[] exclResult = null;
+ if (erpm != null)
+ {
+ exclResult = erpm.mapFileName(path);
+ }
+ if (inclResult != null && exclResult == null)
+ {
+ //THIS is the specific code
+ if (kind.equalsIgnoreCase(ATTR_OUTPUT))
+ {
+ //we have included output so let's build a new fileset
+ FileSet outFileSet = new FileSet();
+ String newReference = idContainer + "-" + path.replace(File.separatorChar, '-');
+ getProject().addReference(newReference, outFileSet);
+ if (verbose)
+ System.out.println(
+ "Created new fileset "
+ + newReference
+ + " containing all the files from the output dir "
+ + projDir
+ + File.separator
+ + path);
+ outFileSet.setDefaultexcludes(false);
+ outFileSet.setDir(new File(projDir + File.separator + path));
+ outFileSet.setIncludes("**/*"); //get everything
+ }
+ else
+ if (kind.equalsIgnoreCase(ATTR_SRC))
+ {
+ //we have included source so let's build a new fileset
+ FileSet srcFileSet = new FileSet();
+ String newReference = idContainer + "-" + path.replace(File.separatorChar, '-');
+ getProject().addReference(newReference, srcFileSet);
+ if (verbose)
+ System.out.println(
+ "Created new fileset "
+ + newReference
+ + " containing all the files from the source dir "
+ + projDir
+ + File.separator
+ + path);
+ srcFileSet.setDefaultexcludes(false);
+ srcFileSet.setDir(new File(projDir + File.separator + path));
+ srcFileSet.setIncludes("**/*"); //get everything
+ }
+ else
+ {
+ //not otuptut, just add file after file to the fileset
+ File file = new File(fileSet.getDir(getProject()) + "/" + path);
+ if (file.isDirectory())
+ path += "/**/*";
+ if (verbose)
+ System.out.println(
+ "Adding "
+ + path
+ + " to fileset "
+ + idContainer
+ + " at "
+ + fileSet.getDir(getProject()));
+ fileSet.setIncludes(path);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ class PathCustomHandler extends AbstractCustomHandler
+ {
+ private Path path = null;
+
+ /**
+ * @param path the path to add files
+ */
+ public PathCustomHandler(Path path)
+ {
+ super();
+ this.path = path;
+ }
+
+ /**
+ * nazi style, forbid default constructor
+ */
+ private PathCustomHandler()
+ {
+ }
+
+ public void startElement(String tag, AttributeList attrs) throws SAXParseException
+ {
+ if (tag.equalsIgnoreCase("classpathentry"))
+ {
+ //start by checking if the classpath is coherent at all
+ String kind = attrs.getValue(ATTRNAME_KIND);
+ if (kind == null)
+ throw new BuildException("classpathentry 'kind' attribute is mandatory");
+ String path = attrs.getValue(ATTRNAME_PATH);
+ if (path == null)
+ throw new BuildException("classpathentry 'path' attribute is mandatory");
+
+ //put the outputdirectory in a property
+ if (kind.equalsIgnoreCase(ATTR_OUTPUT))
+ {
+ String propName = idContainer + "outpath";
+ Property property = new Property();
+ property.setName(propName);
+ property.setValue(path);
+ property.setProject(getProject());
+ property.execute();
+ if (verbose)
+ System.out.println("Setting property " + propName + " to value " + path);
+ }
+
+ //let's put the last source directory in a property
+ if (kind.equalsIgnoreCase(ATTR_SRC))
+ {
+ String propName = idContainer + "srcpath";
+ Property property = new Property();
+ property.setName(propName);
+ property.setValue(path);
+ property.setProject(getProject());
+ property.execute();
+ if (verbose)
+ System.out.println("Setting property " + propName + " to value " + path);
+ }
+
+ if ((kind.equalsIgnoreCase(ATTR_SRC) && includeSource)
+ || (kind.equalsIgnoreCase(ATTR_OUTPUT) && includeOutput)
+ || (kind.equalsIgnoreCase(ATTR_LIB) && includeLibs))
+ {
+ //all seem fine
+ // check the includes
+ String[] inclResult = new String[] { "all included" };
+ if (irpm != null)
+ {
+ inclResult = irpm.mapFileName(path);
+ }
+ String[] exclResult = null;
+ if (erpm != null)
+ {
+ exclResult = erpm.mapFileName(path);
+ }
+ if (inclResult != null && exclResult == null)
+ {
+ //THIS is the only specific code
+ if (verbose)
+ System.out.println("Adding " + path + " to classpath " + idContainer);
+ PathElement element = this.path.createPathElement();
+ element.setLocation(new File(path));
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ad/40812526e9cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/ad/40812526e9cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..f89b7bc
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ad/40812526e9cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.property;
+
+import java.io.File;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileList;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.selectors.OrSelector;
+
+/***
+ *
+ * @author minger
+ * @ant.task name="pathfilter"
+ *
+ */
+public class PathFilterTask
+ extends Task {
+
+ private OrSelector select;
+ private Path path;
+ private String pathid;
+
+
+ public void setPathId(String pathid) {
+ this.pathid = pathid;
+ }
+
+ public OrSelector createSelect() {
+ select = new OrSelector();
+ return select;
+ }
+
+ public void addConfiguredFileSet(FileSet fileset) {
+ if (this.path == null) {
+ this.path = (Path)getProject().createDataType("path");
+ }
+ this.path.addFileset(fileset);
+ }
+
+ public void addConfiguredDirSet(DirSet dirset) {
+ if (this.path == null) {
+ this.path = (Path)getProject().createDataType("path");
+ }
+ this.path.addDirset(dirset);
+ }
+
+ public void addConfiguredFileList(FileList filelist) {
+ if (this.path == null) {
+ this.path = (Path)getProject().createDataType("path");
+ }
+ this.path.addFilelist(filelist);
+ }
+
+ public void addConfiguredPath(Path path) {
+ if (this.path == null) {
+ this.path = (Path)getProject().createDataType("path");
+ }
+ this.path.add(path);
+ }
+
+
+ public void execute() throws BuildException {
+ if (select == null) {
+ throw new BuildException("A <select> element must be specified.");
+ }
+
+ if (pathid == null) {
+ throw new BuildException("A 'pathid' attribute must be specified.");
+ }
+
+ Path selectedFiles = (Path)getProject().createDataType("path");
+
+ if (this.path != null) {
+ String files[] = this.path.list();
+ for (int i=0;i<files.length;i++) {
+ File file = new File(files[i]);
+ if (select.isSelected(file.getParentFile(),
+ file.getName(),
+ file)) {
+ selectedFiles.createPathElement().setLocation(file);
+ }
+ }
+
+ getProject().addReference(pathid, selectedFiles);
+ }
+ }
+
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ae/b03a1b42d6cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/ae/b03a1b42d6cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..687885a
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ae/b03a1b42d6cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,6 @@
+<XDtClass:forAllClasses>
+ <XDtClass:ifHasClassTag tagName="ant.task" paramName="name">
+ <XDtClass:classTagValue tagName="ant.task" paramName="name"/>=<XDtClass:classOf><XDtJavaBean:beanClass/></XDtClass>
+ </XDtClass:ifHasClassTag>
+</XDtClass:forAllClasses>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/af/c0c4421ce0cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/af/c0c4421ce0cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..b9cd7df
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/af/c0c4421ce0cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,402 @@
+
+/*
+* Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package net.sf.antcontrib.process;
+
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.TaskContainer;
+import org.apache.tools.ant.types.EnumeratedAttribute;
+
+
+/**
+ * Limits the amount of time that a task or set of tasks can run. This is useful
+ * for tasks that may "hang" or otherwise not complete in a timely fashion. This
+ * task is done when either the maxwait time has expired or all nested tasks are
+ * complete, whichever is first.
+ *
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ *
+ * @author Dale Anson
+ * @author Robert D. Rice
+ * @version $Revision: 1.6 $
+ * @since Ant 1.5
+ */
+public class Limit extends Task implements TaskContainer {
+
+
+ // storage for nested tasks
+ private Vector tasks = new Vector();
+
+
+ // time units, default value is 3 minutes.
+ private long maxwait = 180;
+ protected TimeUnit unit = TimeUnit.SECOND_UNIT;
+
+ // property to set if time limit is reached
+ private String timeoutProperty = null;
+ private String timeoutValue = "true";
+
+
+ // storage for task currently executing
+ private Task currentTask = null;
+
+
+ // used to control thread stoppage
+ private Thread taskRunner = null;
+
+
+ // should the build fail if the time limit has expired? Default is no.
+ private boolean failOnError = false;
+
+
+ private Exception exception = null;
+
+
+
+
+ /**
+ * Add a task to wait on.
+ *
+ * @param task A task to execute
+ * @exception BuildException won't happen
+ */
+ public void addTask( Task task ) throws BuildException {
+ tasks.addElement( task );
+ }
+
+
+
+
+ /**
+ * How long to wait for all nested tasks to complete, in units.
+ * Default is to wait 3 minutes.
+ *
+ * @param wait time to wait, set to 0 to wait forever.
+ */
+ public void setMaxwait( int wait ) {
+ maxwait = wait;
+ }
+
+ /**
+ * Sets the unit for the max wait. Default is minutes.
+
+ * @param unit valid values are "millisecond", "second", "minute", "hour", "day", and "week".
+
+ */
+ public void setUnit( String unit ) {
+ if ( unit == null )
+ return ;
+ if ( unit.equals( TimeUnit.SECOND ) ) {
+ setMaxWaitUnit( TimeUnit.SECOND_UNIT );
+ return ;
+ }
+ if ( unit.equals( TimeUnit.MILLISECOND ) ) {
+ setMaxWaitUnit( TimeUnit.MILLISECOND_UNIT );
+ return ;
+ }
+ if ( unit.equals( TimeUnit.MINUTE ) ) {
+ setMaxWaitUnit( TimeUnit.MINUTE_UNIT );
+ return ;
+ }
+ if ( unit.equals( TimeUnit.HOUR ) ) {
+ setMaxWaitUnit( TimeUnit.HOUR_UNIT );
+ return ;
+ }
+ if ( unit.equals( TimeUnit.DAY ) ) {
+ setMaxWaitUnit( TimeUnit.DAY_UNIT );
+ return ;
+ }
+ if ( unit.equals( TimeUnit.WEEK ) ) {
+ setMaxWaitUnit( TimeUnit.WEEK_UNIT );
+ return ;
+ }
+
+ }
+
+ /**
+ * Set a millisecond wait value.
+ * @param value the number of milliseconds to wait.
+ */
+ public void setMilliseconds( int value ) {
+ setMaxwait( value );
+ setMaxWaitUnit( TimeUnit.MILLISECOND_UNIT );
+ }
+
+ /**
+ * Set a second wait value.
+ * @param value the number of seconds to wait.
+ */
+ public void setSeconds( int value ) {
+ setMaxwait( value );
+ setMaxWaitUnit( TimeUnit.SECOND_UNIT );
+ }
+
+ /**
+ * Set a minute wait value.
+ * @param value the number of milliseconds to wait.
+ */
+ public void setMinutes( int value ) {
+ setMaxwait( value );
+ setMaxWaitUnit( TimeUnit.MINUTE_UNIT );
+ }
+
+ /**
+ * Set an hours wait value.
+ * @param value the number of hours to wait.
+ */
+ public void setHours( int value ) {
+ setMaxwait( value );
+ setMaxWaitUnit( TimeUnit.HOUR_UNIT );
+ }
+
+ /**
+ * Set a day wait value.
+ * @param value the number of days to wait.
+ */
+ public void setDays( int value ) {
+ setMaxwait( value );
+ setMaxWaitUnit( TimeUnit.DAY_UNIT );
+ }
+
+ /**
+ * Set a week wait value.
+ * @param value the number of weeks to wait.
+ */
+ public void setWeeks( int value ) {
+ setMaxwait( value );
+ setMaxWaitUnit( TimeUnit.WEEK_UNIT );
+ }
+
+ /**
+ * Set the max wait time unit, default is minutes.
+ */
+ public void setMaxWaitUnit( TimeUnit unit ) {
+ this.unit = unit;
+ }
+
+
+ /**
+ * Determines whether the build should fail if the time limit has
+ * expired on this task.
+ * Default is no.
+ *
+ * @param fail if true, fail the build if the time limit has been reached.
+ */
+ public void setFailonerror( boolean fail ) {
+ failOnError = fail;
+ }
+
+
+ /**
+ * Name the property to set after a timeout.
+ *
+ * @param p of property to set if the time limit has been reached.
+ */
+ public void setProperty( String p ) {
+ timeoutProperty = p;
+ }
+
+
+ /**
+ * The value for the property to set after a timeout, defaults to true.
+ *
+ * @param v for the property to set if the time limit has been reached.
+ */
+ public void setValue( String v ) {
+ timeoutValue = v;
+ }
+
+
+ /**
+ * Execute all nested tasks, but stopping execution of nested tasks after
+ * maxwait or when all tasks are done, whichever is first.
+ *
+ * @exception BuildException Description of the Exception
+ */
+ public void execute() throws BuildException {
+ try {
+ // start executing nested tasks
+ final Thread runner =
+ new Thread() {
+ public void run() {
+ Enumeration e = tasks.elements();
+ while ( e.hasMoreElements() ) {
+ if ( taskRunner != this ) {
+ break;
+ }
+ currentTask = ( Task ) e.nextElement();
+ try {
+ currentTask.perform();
+ }
+ catch ( Exception ex ) {
+ if ( failOnError ) {
+ exception = ex;
+ return ;
+ }
+ else {
+ exception = ex;
+ }
+ }
+ }
+ }
+ };
+ taskRunner = runner;
+ runner.start();
+ runner.join( unit.toMillis( maxwait ) );
+
+
+ // stop executing the nested tasks
+ if ( runner.isAlive() ) {
+ taskRunner = null;
+ runner.interrupt();
+ int index = tasks.indexOf( currentTask );
+ StringBuffer not_ran = new StringBuffer();
+ for ( int i = index + 1; i < tasks.size(); i++ ) {
+ not_ran.append( '<' ).append( ( ( Task ) tasks.get( i ) ).getTaskName() ).append( '>' );
+ if ( i < tasks.size() - 1 ) {
+ not_ran.append( ", " );
+ }
+ }
+
+
+ // maybe set timeout property
+ if ( timeoutProperty != null ) {
+ getProject().setNewProperty( timeoutProperty, timeoutValue );
+ }
+
+
+ // create output message
+ StringBuffer msg = new StringBuffer();
+ msg.append( "Interrupted task <" )
+ .append( currentTask.getTaskName() )
+ .append( ">. Waited " )
+ .append( ( maxwait ) ).append( " " ).append( unit.getValue() )
+ .append( ", but this task did not complete." )
+ .append( ( not_ran.length() > 0 ?
+ " The following tasks did not execute: " + not_ran.toString() + "." :
+ "" ) );
+
+
+ // deal with it
+ if ( failOnError ) {
+ throw new BuildException( msg.toString() );
+ }
+ else {
+ log( msg.toString() );
+ }
+ }
+ else if ( failOnError && exception != null ) {
+ throw new BuildException( exception );
+ }
+ }
+ catch ( Exception e ) {
+ throw new BuildException( e );
+ }
+ }
+
+
+ /**
+ * The enumeration of units:
+ * millisecond, second, minute, hour, day, week
+ * Todo: we use timestamps in many places, why not factor this out
+ */
+ public static class TimeUnit extends EnumeratedAttribute {
+
+ public static final String MILLISECOND = "millisecond";
+ public static final String SECOND = "second";
+ public static final String MINUTE = "minute";
+ public static final String HOUR = "hour";
+ public static final String DAY = "day";
+ public static final String WEEK = "week";
+
+ /** static unit objects, for use as sensible defaults */
+ public static final TimeUnit MILLISECOND_UNIT =
+ new TimeUnit( MILLISECOND );
+ public static final TimeUnit SECOND_UNIT =
+ new TimeUnit( SECOND );
+ public static final TimeUnit MINUTE_UNIT =
+ new TimeUnit( MINUTE );
+ public static final TimeUnit HOUR_UNIT =
+ new TimeUnit( HOUR );
+ public static final TimeUnit DAY_UNIT =
+ new TimeUnit( DAY );
+ public static final TimeUnit WEEK_UNIT =
+ new TimeUnit( WEEK );
+
+
+ private static final String[] units = {
+ MILLISECOND, SECOND, MINUTE, HOUR, DAY, WEEK
+ };
+
+ private Hashtable timeTable = new Hashtable();
+
+ public TimeUnit() {
+ timeTable.put( MILLISECOND, new Long( 1L ) );
+ timeTable.put( SECOND, new Long( 1000L ) );
+ timeTable.put( MINUTE, new Long( 1000L * 60L ) );
+ timeTable.put( HOUR, new Long( 1000L * 60L * 60L ) );
+ timeTable.put( DAY, new Long( 1000L * 60L * 60L * 24L ) );
+ timeTable.put( WEEK, new Long( 1000L * 60L * 60L * 24L * 7L ) );
+ }
+
+ /**
+ * private constructor
+ * used for static construction of TimeUnit objects.
+ * @param value String representing the value.
+ */
+ private TimeUnit( String value ) {
+ this( );
+ setValueProgrammatically( value );
+ }
+
+ /**
+ * set the inner value programmatically.
+ * @param value to set
+ */
+ protected void setValueProgrammatically( String value ) {
+ this.value = value;
+ }
+
+ public long getMultiplier() {
+ String key = getValue().toLowerCase();
+ Long l = ( Long ) timeTable.get( key );
+ return l.longValue();
+ }
+
+ public String[] getValues() {
+ return units;
+ }
+
+ /**
+ * convert the time in the current unit, to millis
+ * @param numberOfUnits long expressed in the current objects units
+ * @return long representing the value in millis
+ */
+ public long toMillis( long numberOfUnits ) {
+ return numberOfUnits * getMultiplier( );
+ }
+ }
+}
+
+
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b/4027c958e0cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/b/4027c958e0cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..f6e9440
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/b/4027c958e0cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,293 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ package net.sf.antcontrib.property;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.StringTokenizer;
+import java.util.Vector;
+import java.util.Locale;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.Reference;
+
+/****************************************************************************
+ * Place class description here.
+ *
+ * @author <a href='mailto:[email protected]'>Matthew Inger</a>
+ * @author <additional author>
+ *
+ * @since
+ *
+ ****************************************************************************/
+
+
+public class SortList
+ extends AbstractPropertySetterTask
+{
+ private String value;
+ private Reference ref;
+ private boolean casesensitive = true;
+ private boolean numeric = false;
+ private String delimiter = ",";
+ private File orderPropertyFile;
+ private String orderPropertyFilePrefix;
+
+ public SortList()
+ {
+ super();
+ }
+
+ public void setNumeric(boolean numeric)
+ {
+ this.numeric = numeric;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+
+ public void setRefid(Reference ref)
+ {
+ this.ref = ref;
+ }
+
+
+ public void setCasesensitive(boolean casesenstive)
+ {
+ this.casesensitive = casesenstive;
+ }
+
+ public void setDelimiter(String delimiter)
+ {
+ this.delimiter = delimiter;
+ }
+
+
+ public void setOrderPropertyFile(File orderPropertyFile)
+ {
+ this.orderPropertyFile = orderPropertyFile;
+ }
+
+
+ public void setOrderPropertyFilePrefix(String orderPropertyFilePrefix)
+ {
+ this.orderPropertyFilePrefix = orderPropertyFilePrefix;
+ }
+
+
+ private static void mergeSort(String src[],
+ String dest[],
+ int low,
+ int high,
+ boolean caseSensitive,
+ boolean numeric) {
+ int length = high - low;
+
+ // Insertion sort on smallest arrays
+ if (length < 7) {
+ for (int i=low; i<high; i++)
+ for (int j=i; j>low &&
+ compare(dest[j-1],dest[j], caseSensitive, numeric)>0; j--)
+ swap(dest, j, j-1);
+ return;
+ }
+
+ // Recursively sort halves of dest into src
+ int mid = (low + high)/2;
+ mergeSort(dest, src, low, mid, caseSensitive, numeric);
+ mergeSort(dest, src, mid, high, caseSensitive, numeric);
+
+ // If list is already sorted, just copy from src to dest. This is an
+ // optimization that results in faster sorts for nearly ordered lists.
+ if (compare(src[mid-1], src[mid], caseSensitive, numeric) <= 0) {
+ System.arraycopy(src, low, dest, low, length);
+ return;
+ }
+
+ // Merge sorted halves (now in src) into dest
+ for(int i = low, p = low, q = mid; i < high; i++) {
+ if (q>=high || p<mid && compare(src[p], src[q], caseSensitive, numeric)<=0)
+ dest[i] = src[p++];
+ else
+ dest[i] = src[q++];
+ }
+ }
+
+ private static int compare(String s1,
+ String s2,
+ boolean casesensitive,
+ boolean numeric)
+ {
+ int res = 0;
+
+ if (numeric)
+ {
+ double d1 = new Double(s1).doubleValue();
+ double d2 = new Double(s2).doubleValue();
+ if (d1 < d2)
+ res = -1;
+ else if (d1 == d2)
+ res = 0;
+ else
+ res = 1;
+ }
+ else if (casesensitive)
+ {
+ res = s1.compareTo(s2);
+ }
+ else
+ {
+ Locale l = Locale.getDefault();
+ res = s1.toLowerCase(l).compareTo(s2.toLowerCase(l));
+ }
+
+ return res;
+ }
+
+ /**
+ * Swaps x[a] with x[b].
+ */
+ private static void swap(Object x[], int a, int b) {
+ Object t = x[a];
+ x[a] = x[b];
+ x[b] = t;
+ }
+
+
+ private Vector sortByOrderPropertyFile(Vector props)
+ throws IOException
+ {
+ FileReader fr = null;
+ Vector orderedProps = new Vector();
+
+ try
+ {
+ fr = new FileReader(orderPropertyFile);
+ BufferedReader br = new BufferedReader(fr);
+ String line = "";
+ String pname = "";
+ int pos = 0;
+ while ((line = br.readLine()) != null)
+ {
+ pos = line.indexOf('#');
+ if (pos != -1)
+ line = line.substring(0, pos).trim();
+
+ if (line.length() > 0)
+ {
+ pos = line.indexOf('=');
+ if (pos != -1)
+ pname = line.substring(0,pos).trim();
+ else
+ pname = line.trim();
+
+ String prefPname = pname;
+ if (orderPropertyFilePrefix != null)
+ prefPname = orderPropertyFilePrefix + "." + prefPname;
+
+ if (props.contains(prefPname) &&
+ ! orderedProps.contains(prefPname))
+ {
+ orderedProps.addElement(prefPname);
+ }
+ }
+ }
+
+ Enumeration e = props.elements();
+ while (e.hasMoreElements())
+ {
+ String prop = (String)(e.nextElement());
+ if (! orderedProps.contains(prop))
+ orderedProps.addElement(prop);
+ }
+
+ return orderedProps;
+ }
+ finally
+ {
+ try
+ {
+ if (fr != null)
+ fr.close();
+ }
+ catch (IOException e)
+ {
+ ; // gulp
+ }
+ }
+ }
+
+ protected void validate()
+ {
+ super.validate();
+ }
+
+ public void execute()
+ {
+ validate();
+
+ String val = value;
+ if (val == null && ref != null)
+ val = ref.getReferencedObject(project).toString();
+
+ if (val == null)
+ throw new BuildException("Either the 'Value' or 'Refid' attribute must be set.");
+
+ StringTokenizer st = new StringTokenizer(val, delimiter);
+ Vector vec = new Vector(st.countTokens());
+ while (st.hasMoreTokens())
+ vec.addElement(st.nextToken());
+
+
+ String propList[] = null;
+
+ if (orderPropertyFile != null)
+ {
+ try
+ {
+ Vector sorted = sortByOrderPropertyFile(vec);
+ propList = new String[sorted.size()];
+ sorted.copyInto(propList);
+ }
+ catch (IOException e)
+ {
+ throw new BuildException(e);
+ }
+ }
+ else
+ {
+ String s[] = (String[])(vec.toArray(new String[vec.size()]));
+ propList = new String[s.length];
+ System.arraycopy(s, 0, propList, 0, s.length);
+ mergeSort(s, propList, 0, s.length, casesensitive, numeric);
+ }
+
+ StringBuffer sb = new StringBuffer();
+ for (int i=0;i<propList.length;i++)
+ {
+ if (i != 0) sb.append(delimiter);
+ sb.append(propList[i]);
+ }
+
+ setPropertyValue(sb.toString());
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b5/60ab1beed6cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/b5/60ab1beed6cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..72dd3ca
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/b5/60ab1beed6cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,4 @@
+<XDtClass:forAllClasses>
+ <XDtClass:classTagValue tagName="ant.task" paramName="name"/>=<XDtClass:classOf><XDtJavaBean:beanClass/></XDtClass:classOf>
+</XDtClass:forAllClasses>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b8/009f59b6e7cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/b8/009f59b6e7cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..f99f819
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/b8/009f59b6e7cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.condition;
+
+import org.apache.tools.ant.taskdefs.condition.ConditionBase;
+
+/**
+ * Extends ConditionBase so I can get access to the condition count and the
+ * first condition. This is the class that the BooleanConditionTask is proxy
+ * for.
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ *
+ * @author Dale Anson, [email protected]
+ */
+public class BooleanConditionBase extends ConditionBase {
+ /**
+ * Adds a feature to the IsPropertyTrue attribute of the BooleanConditionBase
+ * object
+ *
+ * @param i The feature to be added to the IsPropertyTrue attribute
+ */
+ public void addIsPropertyTrue( IsPropertyTrue i ) {
+ super.add( i );
+ }
+
+ /**
+ * Adds a feature to the IsPropertyFalse attribute of the
+ * BooleanConditionBase object
+ *
+ * @param i The feature to be added to the IsPropertyFalse attribute
+ */
+ public void addIsPropertyFalse( IsPropertyFalse i ) {
+ super.add( i );
+ }
+
+ public void addIsGreaterThan( IsGreaterThan i) {
+ super.add(i);
+ }
+
+ public void addIsLessThan( IsLessThan i) {
+ super.add(i);
+ }
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bc/b09d9f15e9cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/bc/b09d9f15e9cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..5c0c652
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/bc/b09d9f15e9cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,236 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.NameValuePair;
+import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.apache.commons.httpclient.methods.multipart.FilePart;
+import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
+import org.apache.commons.httpclient.methods.multipart.Part;
+import org.apache.commons.httpclient.methods.multipart.StringPart;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.util.FileUtils;
+
+/***
+ *
+ * @author minger
+ * @ant.task name="postmethod" onerror="ignore"
+ *
+ */
+public class PostMethodTask
+ extends AbstractMethodTask {
+
+ private List parts = new ArrayList();
+ private boolean multipart;
+ private transient FileInputStream stream;
+
+
+ public static class FilePartType {
+ private File path;
+ private String contentType = FilePart.DEFAULT_CONTENT_TYPE;
+ private String charSet = FilePart.DEFAULT_CHARSET;
+
+ public File getPath() {
+ return path;
+ }
+
+ public void setPath(File path) {
+ this.path = path;
+ }
+
+ public String getContentType() {
+ return contentType;
+ }
+
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+
+ public String getCharSet() {
+ return charSet;
+ }
+
+ public void setCharSet(String charSet) {
+ this.charSet = charSet;
+ }
+ }
+
+ public static class TextPartType {
+ private String name = "";
+ private String value = "";
+ private String charSet = StringPart.DEFAULT_CHARSET;
+ private String contentType = StringPart.DEFAULT_CONTENT_TYPE;
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getCharSet() {
+ return charSet;
+ }
+
+ public void setCharSet(String charSet) {
+ this.charSet = charSet;
+ }
+
+ public String getContentType() {
+ return contentType;
+ }
+
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+
+ public void setText(String text) {
+ this.value = text;
+ }
+ }
+
+ public void addConfiguredFile(FilePartType file) {
+ this.parts.add(file);
+ }
+
+ public void setMultipart(boolean multipart) {
+ this.multipart = multipart;
+ }
+
+ public void addConfiguredText(TextPartType text) {
+ this.parts.add(text);
+ }
+
+ public void setParameters(File parameters) {
+ PostMethod post = getPostMethod();
+ Properties p = new Properties();
+ Iterator it = p.entrySet().iterator();
+ while (it.hasNext()) {
+ Map.Entry entry = (Map.Entry) it.next();
+ post.addParameter(entry.getKey().toString(),
+ entry.getValue().toString());
+ }
+ }
+
+ protected HttpMethodBase createNewMethod() {
+ return new PostMethod();
+ }
+
+ private PostMethod getPostMethod() {
+ return ((PostMethod)createMethodIfNecessary());
+ }
+
+ public void addConfiguredParameter(NameValuePair pair) {
+ getPostMethod().setParameter(pair.getName(), pair.getValue());
+ }
+
+ public void setContentChunked(boolean contentChunked) {
+ getPostMethod().setContentChunked(contentChunked);
+ }
+
+ protected void configureMethod(HttpMethodBase method) {
+ PostMethod post = (PostMethod) method;
+
+ if (parts.size() == 1 && ! multipart) {
+ Object part = parts.get(0);
+ if (part instanceof FilePartType) {
+ FilePartType filePart = (FilePartType)part;
+ try {
+ stream = new FileInputStream(
+ filePart.getPath().getAbsolutePath());
+ post.setRequestEntity(
+ new InputStreamRequestEntity(stream,
+ filePart.getPath().length(),
+ filePart.getContentType()));
+ }
+ catch (IOException e) {
+ throw new BuildException(e);
+ }
+ }
+ else if (part instanceof TextPartType) {
+ TextPartType textPart = (TextPartType)part;
+ try {
+ post.setRequestEntity(
+ new StringRequestEntity(textPart.getValue(),
+ textPart.getContentType(),
+ textPart.getCharSet()));
+ }
+ catch (UnsupportedEncodingException e) {
+ throw new BuildException(e);
+ }
+ }
+ }
+ else if (! parts.isEmpty()){
+ Part partArray[] = new Part[parts.size()];
+ for (int i=0;i<parts.size();i++) {
+ Object part = parts.get(i);
+ if (part instanceof FilePartType) {
+ FilePartType filePart = (FilePartType)part;
+ try {
+ partArray[i] = new FilePart(filePart.getPath().getName(),
+ filePart.getPath().getName(),
+ filePart.getPath(),
+ filePart.getContentType(),
+ filePart.getCharSet());
+ }
+ catch (FileNotFoundException e) {
+ throw new BuildException(e);
+ }
+ }
+ else if (part instanceof TextPartType) {
+ TextPartType textPart = (TextPartType)part;
+ partArray[i] = new StringPart(textPart.getName(),
+ textPart.getValue(),
+ textPart.getCharSet());
+ ((StringPart)partArray[i]).setContentType(textPart.getContentType());
+ }
+ }
+ MultipartRequestEntity entity = new MultipartRequestEntity(
+ partArray,
+ post.getParams());
+ post.setRequestEntity(entity);
+ }
+ }
+
+ protected void cleanupResources(HttpMethodBase method) {
+ FileUtils.close(stream);
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c/c023cfa3e5cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/c/c023cfa3e5cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..f5e2553
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c/c023cfa3e5cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,391 @@
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import org.apache.tools.ant.AntClassLoader;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildListener;
+import org.apache.tools.ant.Executor;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Target;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.input.InputHandler;
+import org.apache.tools.ant.types.FilterSet;
+import org.apache.tools.ant.types.Path;
+
+public class ProjectDelegate
+extends Project {
+
+ private Project delegate;
+ private Project subproject;
+
+ public ProjectDelegate(Project delegate) {
+ super();
+ this.delegate = delegate;
+ }
+
+ public Project getSubproject() {
+ return subproject;
+ }
+
+ public void addBuildListener(BuildListener arg0) {
+ delegate.addBuildListener(arg0);
+ }
+
+ public void addDataTypeDefinition(String arg0, Class arg1) {
+ delegate.addDataTypeDefinition(arg0, arg1);
+ }
+
+ public void addFilter(String arg0, String arg1) {
+ delegate.addFilter(arg0, arg1);
+ }
+
+ public void addOrReplaceTarget(String arg0, Target arg1) {
+ delegate.addOrReplaceTarget(arg0, arg1);
+ }
+
+ public void addOrReplaceTarget(Target arg0) {
+ delegate.addOrReplaceTarget(arg0);
+ }
+
+ public void addReference(String arg0, Object arg1) {
+ delegate.addReference(arg0, arg1);
+ }
+
+ public void addTarget(String arg0, Target arg1) throws BuildException {
+ delegate.addTarget(arg0, arg1);
+ }
+
+ public void addTarget(Target arg0) throws BuildException {
+ delegate.addTarget(arg0);
+ }
+
+ public void addTaskDefinition(String arg0, Class arg1) throws BuildException {
+ delegate.addTaskDefinition(arg0, arg1);
+ }
+
+ public void checkTaskClass(Class arg0) throws BuildException {
+ delegate.checkTaskClass(arg0);
+ }
+
+ public void copyFile(File arg0, File arg1, boolean arg2, boolean arg3, boolean arg4) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2, arg3, arg4);
+ }
+
+ public void copyFile(File arg0, File arg1, boolean arg2, boolean arg3) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2, arg3);
+ }
+
+ public void copyFile(File arg0, File arg1, boolean arg2) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2);
+ }
+
+ public void copyFile(File arg0, File arg1) throws IOException {
+ delegate.copyFile(arg0, arg1);
+ }
+
+ public void copyFile(String arg0, String arg1, boolean arg2, boolean arg3, boolean arg4) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2, arg3, arg4);
+ }
+
+ public void copyFile(String arg0, String arg1, boolean arg2, boolean arg3) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2, arg3);
+ }
+
+ public void copyFile(String arg0, String arg1, boolean arg2) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2);
+ }
+
+ public void copyFile(String arg0, String arg1) throws IOException {
+ delegate.copyFile(arg0, arg1);
+ }
+
+ public void copyInheritedProperties(Project arg0) {
+ delegate.copyInheritedProperties(arg0);
+ }
+
+ public void copyUserProperties(Project arg0) {
+ delegate.copyUserProperties(arg0);
+ }
+
+ public AntClassLoader createClassLoader(Path arg0) {
+ return delegate.createClassLoader(arg0);
+ }
+
+ public Object createDataType(String arg0) throws BuildException {
+ return delegate.createDataType(arg0);
+ }
+
+ public Task createTask(String arg0) throws BuildException {
+ return delegate.createTask(arg0);
+ }
+
+ public int defaultInput(byte[] arg0, int arg1, int arg2) throws IOException {
+ return delegate.defaultInput(arg0, arg1, arg2);
+ }
+
+ public void demuxFlush(String arg0, boolean arg1) {
+ delegate.demuxFlush(arg0, arg1);
+ }
+
+ public int demuxInput(byte[] arg0, int arg1, int arg2) throws IOException {
+ return delegate.demuxInput(arg0, arg1, arg2);
+ }
+
+ public void demuxOutput(String arg0, boolean arg1) {
+ delegate.demuxOutput(arg0, arg1);
+ }
+
+ public boolean equals(Object arg0) {
+ return delegate.equals(arg0);
+ }
+
+ public void executeSortedTargets(Vector arg0) throws BuildException {
+ delegate.executeSortedTargets(arg0);
+ }
+
+ public void executeTarget(String arg0) throws BuildException {
+ delegate.executeTarget(arg0);
+ }
+
+ public void executeTargets(Vector arg0) throws BuildException {
+ delegate.executeTargets(arg0);
+ }
+
+ public void fireBuildFinished(Throwable arg0) {
+ delegate.fireBuildFinished(arg0);
+ }
+
+ public void fireBuildStarted() {
+ delegate.fireBuildStarted();
+ }
+
+ public void fireSubBuildFinished(Throwable arg0) {
+ delegate.fireSubBuildFinished(arg0);
+ }
+
+ public void fireSubBuildStarted() {
+ delegate.fireSubBuildStarted();
+ }
+
+ public File getBaseDir() {
+ return delegate.getBaseDir();
+ }
+
+ public Vector getBuildListeners() {
+ return delegate.getBuildListeners();
+ }
+
+ public ClassLoader getCoreLoader() {
+ return delegate.getCoreLoader();
+ }
+
+ public Hashtable getDataTypeDefinitions() {
+ return delegate.getDataTypeDefinitions();
+ }
+
+ public InputStream getDefaultInputStream() {
+ return delegate.getDefaultInputStream();
+ }
+
+ public String getDefaultTarget() {
+ return delegate.getDefaultTarget();
+ }
+
+ public String getDescription() {
+ return delegate.getDescription();
+ }
+
+ public String getElementName(Object arg0) {
+ return delegate.getElementName(arg0);
+ }
+
+ public Executor getExecutor() {
+ return delegate.getExecutor();
+ }
+
+ public Hashtable getFilters() {
+ return delegate.getFilters();
+ }
+
+ public FilterSet getGlobalFilterSet() {
+ return delegate.getGlobalFilterSet();
+ }
+
+ public InputHandler getInputHandler() {
+ return delegate.getInputHandler();
+ }
+
+ public String getName() {
+ return delegate.getName();
+ }
+
+ public Hashtable getProperties() {
+ return delegate.getProperties();
+ }
+
+ public String getProperty(String arg0) {
+ return delegate.getProperty(arg0);
+ }
+
+ public Object getReference(String arg0) {
+ return delegate.getReference(arg0);
+ }
+
+ public Hashtable getReferences() {
+ return delegate.getReferences();
+ }
+
+ public Hashtable getTargets() {
+ return delegate.getTargets();
+ }
+
+ public Hashtable getTaskDefinitions() {
+ return delegate.getTaskDefinitions();
+ }
+
+ public Task getThreadTask(Thread arg0) {
+ return delegate.getThreadTask(arg0);
+ }
+
+ public Hashtable getUserProperties() {
+ return delegate.getUserProperties();
+ }
+
+ public String getUserProperty(String arg0) {
+ return delegate.getUserProperty(arg0);
+ }
+
+ public int hashCode() {
+ return delegate.hashCode();
+ }
+
+ public void init() throws BuildException {
+ delegate.init();
+ }
+
+ public void initSubProject(Project arg0) {
+ delegate.initSubProject(arg0);
+ this.subproject = arg0;
+ }
+
+ public boolean isKeepGoingMode() {
+ return delegate.isKeepGoingMode();
+ }
+
+ public void log(String arg0, int arg1) {
+ delegate.log(arg0, arg1);
+ }
+
+ public void log(String arg0) {
+ delegate.log(arg0);
+ }
+
+ public void log(Target arg0, String arg1, int arg2) {
+ delegate.log(arg0, arg1, arg2);
+ }
+
+ public void log(Task arg0, String arg1, int arg2) {
+ delegate.log(arg0, arg1, arg2);
+ }
+
+ public void registerThreadTask(Thread arg0, Task arg1) {
+ delegate.registerThreadTask(arg0, arg1);
+ }
+
+ public void removeBuildListener(BuildListener arg0) {
+ delegate.removeBuildListener(arg0);
+ }
+
+ public String replaceProperties(String arg0) throws BuildException {
+ return delegate.replaceProperties(arg0);
+ }
+
+ public File resolveFile(String arg0, File arg1) {
+ return delegate.resolveFile(arg0, arg1);
+ }
+
+ public File resolveFile(String arg0) {
+ return delegate.resolveFile(arg0);
+ }
+
+ public void setBaseDir(File arg0) throws BuildException {
+ delegate.setBaseDir(arg0);
+ }
+
+ public void setBasedir(String arg0) throws BuildException {
+ delegate.setBasedir(arg0);
+ }
+
+ public void setCoreLoader(ClassLoader arg0) {
+ delegate.setCoreLoader(arg0);
+ }
+
+ public void setDefault(String arg0) {
+ delegate.setDefault(arg0);
+ }
+
+ public void setDefaultInputStream(InputStream arg0) {
+ delegate.setDefaultInputStream(arg0);
+ }
+
+ public void setDefaultTarget(String arg0) {
+ delegate.setDefaultTarget(arg0);
+ }
+
+ public void setDescription(String arg0) {
+ delegate.setDescription(arg0);
+ }
+
+ public void setExecutor(Executor arg0) {
+ delegate.setExecutor(arg0);
+ }
+
+ public void setFileLastModified(File arg0, long arg1) throws BuildException {
+ delegate.setFileLastModified(arg0, arg1);
+ }
+
+ public void setInheritedProperty(String arg0, String arg1) {
+ delegate.setInheritedProperty(arg0, arg1);
+ }
+
+ public void setInputHandler(InputHandler arg0) {
+ delegate.setInputHandler(arg0);
+ }
+
+ public void setJavaVersionProperty() throws BuildException {
+ delegate.setJavaVersionProperty();
+ }
+
+ public void setKeepGoingMode(boolean arg0) {
+ delegate.setKeepGoingMode(arg0);
+ }
+
+ public void setName(String arg0) {
+ delegate.setName(arg0);
+ }
+
+ public void setNewProperty(String arg0, String arg1) {
+ delegate.setNewProperty(arg0, arg1);
+ }
+
+ public void setProperty(String arg0, String arg1) {
+ delegate.setProperty(arg0, arg1);
+ }
+
+ public void setSystemProperties() {
+ delegate.setSystemProperties();
+ }
+
+ public void setUserProperty(String arg0, String arg1) {
+ delegate.setUserProperty(arg0, arg1);
+ }
+
+ public String toString() {
+ return delegate.toString();
+ }
+} \ No newline at end of file
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c1/c035d4cdc2cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/c1/c035d4cdc2cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..4290c19
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c1/c035d4cdc2cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,464 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private Path currPath;
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ private Path getOrCreatePath() {
+ if (currPath == null) {
+ currPath = new Path(getProject());
+ }
+ return currPath;
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfigured(Path path) {
+ getOrCreatePath().append(path);
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfiguredPath(Path path) {
+ addConfigured(path);
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && currPath == null && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or path or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ // Take Care of the path element
+ String[] pathElements = new String[0];
+ if (currPath != null) {
+ pathElements = currPath.list();
+ }
+ for (int i = 0; i < pathElements.length; i++) {
+ File nextFile = new File(pathElements[i]);
+ doToken(nextFile.getAbsolutePath());
+ }
+
+ // Take care of iterators
+ for (Iterator i = hasIterators.iterator(); i.hasNext();) {
+ Iterator it = ((HasIterator) i.next()).iterator();
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void add(FileSet fileset) {
+ getOrCreatePath().addFileset(fileset);
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void addFileSet(FileSet fileset) {
+ add(fileset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void add(DirSet dirset) {
+ getOrCreatePath().addDirset(dirset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void addDirSet(DirSet dirset) {
+ add(dirset);
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c1/c05e77e0e8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/c1/c05e77e0e8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..8e7fc69
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c1/c05e77e0e8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.URI;
+import org.apache.commons.httpclient.URIException;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.Property;
+import org.apache.tools.ant.util.FileUtils;
+
+public abstract class AbstractMethodTask
+ extends Task {
+
+ private HttpMethodBase method;
+ private File responseDataFile;
+ private String responseDataProperty;
+ private String statusCodeProperty;
+ private HttpClient httpClient;
+ private List responseHeaders = new ArrayList();
+
+ public static class ResponseHeader {
+ private String name;
+ private String property;
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getProperty() {
+ return property;
+ }
+ public void setProperty(String property) {
+ this.property = property;
+ }
+ }
+
+ protected abstract HttpMethodBase createNewMethod();
+ protected void configureMethod(HttpMethodBase method) {
+ }
+ protected void cleanupResources(HttpMethodBase method) {
+ }
+
+ public void addConfiguredResponseHeader(ResponseHeader responseHeader) {
+ this.responseHeaders.add(responseHeader);
+ }
+
+ public void addConfiguredHttpClient(HttpClientType httpClientType) {
+ this.httpClient = httpClientType.getClient();
+ }
+
+ protected HttpMethodBase createMethodIfNecessary() {
+ if (method == null) {
+ method = createNewMethod();
+ }
+ return method;
+ }
+
+ public void setResponseDataFile(File responseDataFile) {
+ this.responseDataFile = responseDataFile;
+ }
+
+ public void setResponseDataProperty(String responseDataProperty) {
+ this.responseDataProperty = responseDataProperty;
+ }
+
+ public void setStatusCodeProperty(String statusCodeProperty) {
+ this.statusCodeProperty = statusCodeProperty;
+ }
+
+ public void setClientRefId(String clientRefId) {
+ Object clientRef = getProject().getReference(clientRefId);
+ if (clientRef == null) {
+ throw new BuildException("Reference '" + clientRefId + "' does not exist.");
+ }
+ if (! (clientRef instanceof HttpClientType)) {
+ throw new BuildException("Reference '" + clientRefId + "' is of the wrong type.");
+ }
+ httpClient = ((HttpClientType) clientRef).getClient();
+ }
+
+ public void setDoAuthentication(boolean doAuthentication) {
+ createMethodIfNecessary().setDoAuthentication(doAuthentication);
+ }
+
+ public void setFollowRedirects(boolean doFollowRedirects) {
+ createMethodIfNecessary().setFollowRedirects(doFollowRedirects);
+ }
+
+ public void addConfiguredParams(MethodParams params) {
+ createMethodIfNecessary().setParams(params);
+ }
+
+ public void setPath(String path) {
+ createMethodIfNecessary().setPath(path);
+ }
+
+ public void setURL(String url) {
+ try {
+ createMethodIfNecessary().setURI(new URI(url, false));
+ }
+ catch (URIException e) {
+ throw new BuildException(e);
+ }
+ }
+
+ public void setQueryString(String queryString) {
+ createMethodIfNecessary().setQueryString(queryString);
+ }
+
+ public void addConfiguredHeader(Header header) {
+ createMethodIfNecessary().setRequestHeader(header);
+ }
+
+ public void execute() throws BuildException {
+ if (httpClient == null) {
+ httpClient = new HttpClient();
+ }
+
+ HttpMethodBase method = createMethodIfNecessary();
+ configureMethod(method);
+ try {
+ int statusCode = httpClient.executeMethod(method);
+ if (statusCodeProperty != null) {
+ Property p = (Property)getProject().createTask("property");
+ p.setName(statusCodeProperty);
+ p.setValue(String.valueOf(statusCode));
+ p.perform();
+ }
+
+ Iterator it = responseHeaders.iterator();
+ while (it.hasNext()) {
+ ResponseHeader header = (ResponseHeader)it.next();
+ Property p = (Property)getProject().createTask("property");
+ p.setName(header.getProperty());
+ Header h = method.getResponseHeader(header.getName());
+ if (h != null && h.getValue() != null) {
+ p.setValue(h.getValue());
+ p.perform();
+ }
+
+ }
+ if (responseDataProperty != null) {
+ Property p = (Property)getProject().createTask("property");
+ p.setName(responseDataProperty);
+ p.setValue(method.getResponseBodyAsString());
+ p.perform();
+ }
+ else if (responseDataFile != null) {
+ FileOutputStream fos = null;
+ InputStream is = null;
+ try {
+ is = method.getResponseBodyAsStream();
+ fos = new FileOutputStream(responseDataFile);
+ byte buf[] = new byte[10*1024];
+ int read = 0;
+ while ((read = is.read(buf, 0, 10*1024)) != -1) {
+ fos.write(buf, 0, read);
+ }
+ }
+ finally {
+ try {
+ if (fos != null) {
+ fos.close();
+ }
+ }
+ catch (IOException e) {
+ ;
+ }
+ try {
+ if (fis != null) {
+ fis.close();
+ }
+ }
+ catch (IOException e) {
+ ;
+ }
+ FileUtils.close(fos);
+ FileUtils.close(is);
+ }
+ }
+ }
+ catch (IOException e) {
+ throw new BuildException(e);
+ }
+ finally {
+ cleanupResources(method);
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c5/300d02a5dfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/c5/300d02a5dfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..f68c84b
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c5/300d02a5dfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.httpclient.Cookie;
+import org.apache.tools.ant.BuildException;
+
+public class AddCookieTask
+ extends AbstractHttpStateTypeTask {
+
+ private List cookies = new ArrayList();
+
+ public void addConfiguredCookie(Cookie cookie) {
+ this.cookies.add(cookie);
+ }
+
+ protected void execute(HttpStateType stateType) throws BuildException {
+ if (this.cookies.isEmpty()) {
+ throw new BuildException("At least one cookie must be specified.");
+ }
+
+ Iterator it = cookies.iterator();
+ while (it.hasNext()) {
+ Cookie c = (Cookie)it.next();
+ stateType.addConfiguredCookie(c);
+ }
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c6/704f923fe2cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/c6/704f923fe2cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..64b439e
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c6/704f923fe2cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.DataType;
+
+/***
+ *
+ * @author minger
+ * @ant.type name="httpclient"
+ */
+public class HttpClientType
+ extends DataType {
+
+ private HttpClient client;
+
+ public HttpClientType(Project p) {
+ super();
+ setProject(p);
+
+ client = new HttpClient();
+ }
+
+ public HttpClient getClient() {
+ if (isReference()) {
+ return getRef().getClient();
+ }
+ else {
+ return client;
+ }
+ }
+
+ public void setStateRefId(String stateRefId) {
+ if (isReference()) {
+ tooManyAttributes();
+ }
+ HttpStateType stateType = AbstractHttpStateTypeTask.getStateType(
+ getProject(),
+ stateRefId);
+ getClient().setState(stateType.getState());
+ }
+
+ protected HttpClientType getRef() {
+ return (HttpClientType) super.getCheckedRef(HttpClientType.class,
+ "http-client");
+ }
+
+ public ClientParams createClientParams() {
+ if (isReference()) {
+ tooManyAttributes();
+ }
+ ClientParams clientParams = new ClientParams();
+ client.setParams(clientParams);
+ return clientParams;
+ }
+
+ public HttpStateType createHttpState() {
+ if (isReference()) {
+ tooManyAttributes();
+ }
+ HttpStateType state = new HttpStateType(getProject());
+ getClient().setState(state.getState());
+ return state;
+ }
+
+ public HostConfig createHostConfig() {
+ if (isReference()) {
+ tooManyAttributes();
+ }
+ HostConfig config = new HostConfig();
+ client.setHostConfiguration(config);
+ return config;
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c6/b0b31853e0cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/c6/b0b31853e0cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..d632607
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c6/b0b31853e0cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.property;
+
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.RegularExpression;
+import org.apache.tools.ant.types.Substitution;
+import org.apache.tools.ant.util.regexp.Regexp;
+
+/****************************************************************************
+ * Place class description here.
+ *
+ * @author <a href='mailto:[email protected]'>Matthew Inger</a>
+ * @author <additional author>
+ *
+ * @since
+ * @ant.task name="propertyregexp"
+ *
+ ****************************************************************************/
+
+
+public class RegexTask
+ extends AbstractPropertySetterTask
+{
+ private String input;
+
+ private RegularExpression regexp;
+ private String select;
+ private Substitution replace;
+ private String defaultValue;
+
+ private boolean caseSensitive = true;
+ private boolean global = true;
+
+ public RegexTask()
+ {
+ super();
+ }
+
+ public void setInput(String input)
+ {
+ this.input = input;
+ }
+
+ public void setDefaultValue(String defaultValue)
+ {
+ this.defaultValue = defaultValue;
+ }
+
+ public void setRegexp(String regex)
+ {
+ if (this.regexp != null)
+ throw new BuildException("Cannot specify more than one regular expression");
+
+ this.regexp = new RegularExpression();
+ this.regexp.setPattern(regex);
+ }
+
+
+ public RegularExpression createRegexp()
+ {
+ if (this.regexp != null)
+ throw new BuildException("Cannot specify more than one regular expression");
+ regexp = new RegularExpression();
+ return regexp;
+ }
+
+ public void setReplace(String replace)
+ {
+ if (this.replace != null)
+ throw new BuildException("Cannot specify more than one replace expression");
+ if (select != null)
+ throw new BuildException("You cannot specify both a select and replace expression");
+ this.replace = new Substitution();
+ this.replace.setExpression(replace);
+ }
+
+ public Substitution createReplace()
+ {
+ if (replace != null)
+ throw new BuildException("Cannot specify more than one replace expression");
+ if (select != null)
+ throw new BuildException("You cannot specify both a select and replace expression");
+ replace = new Substitution();
+ return replace;
+ }
+
+ public void setSelect(String select)
+ {
+ if (replace != null)
+ throw new BuildException("You cannot specify both a select and replace expression");
+ this.select = select;
+ }
+
+ public void setCaseSensitive(boolean caseSensitive)
+ {
+ this.caseSensitive = caseSensitive;
+ }
+
+ public void setGlobal(boolean global)
+ {
+ this.global = global;
+ }
+
+ protected String doReplace()
+ throws BuildException
+ {
+ if (replace == null)
+ throw new BuildException("No replace expression specified.");
+
+ int options = 0;
+ if (! caseSensitive)
+ options |= Regexp.MATCH_CASE_INSENSITIVE;
+ if (global)
+ options |= Regexp.REPLACE_ALL;
+
+ Regexp sregex = regexp.getRegexp(project);
+
+ String output = null;
+
+ if (sregex.matches(input, options)) {
+ String expression = replace.getExpression(project);
+ output = sregex.substitute(input,
+ expression,
+ options);
+ }
+
+ if (output == null)
+ output = defaultValue;
+
+ return output;
+ }
+
+ protected String doSelect()
+ throws BuildException
+ {
+ int options = 0;
+ if (! caseSensitive)
+ options |= Regexp.MATCH_CASE_INSENSITIVE;
+
+ Regexp sregex = regexp.getRegexp(project);
+
+ String output = select;
+ Vector groups = sregex.getGroups(input, options);
+
+ if (groups != null && groups.size() > 0)
+ {
+ output = RegexUtil.select(select, groups);
+ }
+ else
+ {
+ output = null;
+ }
+
+ if (output == null)
+ output = defaultValue;
+
+ return output;
+ }
+
+
+ protected void validate()
+ {
+ super.validate();
+ if (regexp == null)
+ throw new BuildException("No match expression specified.");
+ if (replace == null && select == null)
+ throw new BuildException("You must specify either a replace or select expression");
+ }
+
+ public void execute()
+ throws BuildException
+ {
+ validate();
+
+ String output = input;
+ if (replace != null)
+ output = doReplace();
+ else
+ output = doSelect();
+
+ if (output != null)
+ setPropertyValue(output);
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c7/101c4325dfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/c7/101c4325dfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..8185208
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c7/101c4325dfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,420 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.antclipse;
+import java.io.File;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.Property;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Path.PathElement;
+import org.apache.tools.ant.util.RegexpPatternMapper;
+import org.xml.sax.AttributeList;
+import org.xml.sax.HandlerBase;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * Support class for the Antclipse task. Basically, it takes the .classpath Eclipse file
+ * and feeds a SAX parser. The handler is slightly different according to what we want to
+ * obtain (a classpath or a fileset)
+ * @author Adrian Spinei [email protected]
+ * @version $Revision: 1.2 $
+ * @since Ant 1.5
+ * @ant.task name="classpath"
+ */
+public class ClassPathTask extends Task
+{
+ private String project;
+ private String idContainer = "antclipse";
+ private boolean includeSource = false; //default, do not include source
+ private boolean includeOutput = false; //default, do not include output directory
+ private boolean includeLibs = true; //default, include all libraries
+ private boolean verbose = false; //default quiet
+ RegexpPatternMapper irpm = null;
+ RegexpPatternMapper erpm = null;
+ public static final String TARGET_CLASSPATH = "classpath";
+ public static final String TARGET_FILESET = "fileset";
+ private String produce = null; //classpath by default
+
+ /**
+ * Setter for task parameter
+ * @param includeLibs Boolean, whether to include or not the project libraries. Default is true.
+ */
+ public void setIncludeLibs(boolean includeLibs)
+ {
+ this.includeLibs = includeLibs;
+ }
+
+ /**
+ * Setter for task parameter
+ * @param produce This parameter tells the task wether to produce a "classpath" or a "fileset" (multiple filesets, as a matter of fact).
+ */
+ public void setproduce(String produce)
+ {
+ this.produce = produce;
+ }
+
+ /**
+ * Setter for task parameter
+ * @param verbose Boolean, telling the app to throw some info during each step. Default is false.
+ */
+ public void setVerbose(boolean verbose)
+ {
+ this.verbose = verbose;
+ }
+
+ /**
+ * Setter for task parameter
+ * @param excludes A regexp for files to exclude. It is taken into account only when producing a classpath, doesn't work on source or output files. It is a real regexp, not a "*" expression.
+ */
+ public void setExcludes(String excludes)
+ {
+ if (excludes != null)
+ {
+ erpm = new RegexpPatternMapper();
+ erpm.setFrom(excludes);
+ erpm.setTo("."); //mandatory
+ }
+ else
+ erpm = null;
+ }
+
+ /**
+ * Setter for task parameter
+ * @param includes A regexp for files to include. It is taken into account only when producing a classpath, doesn't work on source or output files. It is a real regexp, not a "*" expression.
+ */
+ public void setIncludes(String includes)
+ {
+ if (includes != null)
+ {
+ irpm = new RegexpPatternMapper();
+ irpm.setFrom(includes);
+ irpm.setTo("."); //mandatory
+ }
+ else
+ irpm = null;
+ }
+
+ /**
+ * Setter for task parameter
+ * @param idContainer The refid which will serve to identify the deliverables. When multiple filesets are produces, their refid is a concatenation between this value and something else (usually obtained from a path). Default "antclipse"
+ */
+ public void setIdContainer(String idContainer)
+ {
+ this.idContainer = idContainer;
+ }
+
+ /**
+ * Setter for task parameter
+ * @param includeOutput Boolean, whether to include or not the project output directories. Default is false.
+ */
+ public void setIncludeOutput(boolean includeOutput)
+ {
+ this.includeOutput = includeOutput;
+ }
+
+ /**
+ * Setter for task parameter
+ * @param includeSource Boolean, whether to include or not the project source directories. Default is false.
+ */
+ public void setIncludeSource(boolean includeSource)
+ {
+ this.includeSource = includeSource;
+ }
+
+ /**
+ * Setter for task parameter
+ * @param project project name
+ */
+ public void setProject(String project)
+ {
+ this.project = project;
+ }
+
+ /**
+ * @see org.apache.tools.ant.Task#execute()
+ */
+ public void execute() throws BuildException
+ {
+ if (!TARGET_CLASSPATH.equalsIgnoreCase(this.produce) && !TARGET_FILESET.equals(this.produce))
+ throw new BuildException(
+ "Mandatory target must be either '" + TARGET_CLASSPATH + "' or '" + TARGET_FILESET + "'");
+ ClassPathParser parser = new ClassPathParser();
+ AbstractCustomHandler handler;
+ if (TARGET_CLASSPATH.equalsIgnoreCase(this.produce))
+ {
+ Path path = new Path(this.getProject());
+ this.getProject().addReference(this.idContainer, path);
+ handler = new PathCustomHandler(path);
+ }
+ else
+ {
+ FileSet fileSet = new FileSet();
+ this.getProject().addReference(this.idContainer, fileSet);
+ fileSet.setDir(new File(this.getProject().getBaseDir().getAbsolutePath().toString()));
+ handler = new FileSetCustomHandler(fileSet);
+ }
+ parser.parse(new File(this.getProject().getBaseDir().getAbsolutePath(), ".classpath"), handler);
+ }
+
+ abstract class AbstractCustomHandler extends HandlerBase
+ {
+ protected String projDir;
+ protected static final String ATTRNAME_PATH = "path";
+ protected static final String ATTRNAME_KIND = "kind";
+ protected static final String ATTR_LIB = "lib";
+ protected static final String ATTR_SRC = "src";
+ protected static final String ATTR_OUTPUT = "output";
+ protected static final String EMPTY = "";
+ }
+
+ class FileSetCustomHandler extends AbstractCustomHandler
+ {
+ private FileSet fileSet = null;
+
+ /**
+ * nazi style, forbid default constructor
+ */
+ private FileSetCustomHandler()
+ {
+ }
+
+ /**
+ * @param fileSet
+ */
+ public FileSetCustomHandler(FileSet fileSet)
+ {
+ super();
+ this.fileSet = fileSet;
+ projDir = getProject().getBaseDir().getAbsolutePath().toString();
+ }
+
+ /**
+ * @see org.xml.sax.DocumentHandler#endDocument()
+ */
+ public void endDocument() throws SAXException
+ {
+ super.endDocument();
+ if (fileSet != null && !fileSet.hasPatterns())
+ fileSet.setExcludes("**/*");
+ //exclude everything or we'll take all the project dirs
+ }
+
+ public void startElement(String tag, AttributeList attrs) throws SAXParseException
+ {
+ if (tag.equalsIgnoreCase("classpathentry"))
+ {
+ //start by checking if the classpath is coherent at all
+ String kind = attrs.getValue(ATTRNAME_KIND);
+ if (kind == null)
+ throw new BuildException("classpathentry 'kind' attribute is mandatory");
+ String path = attrs.getValue(ATTRNAME_PATH);
+ if (path == null)
+ throw new BuildException("classpathentry 'path' attribute is mandatory");
+
+ //put the outputdirectory in a property
+ if (kind.equalsIgnoreCase(ATTR_OUTPUT))
+ {
+ String propName = idContainer + "outpath";
+ Property property = new Property();
+ property.setName(propName);
+ property.setValue(path);
+ property.setProject(getProject());
+ property.execute();
+ if (verbose)
+ System.out.println("Setting property " + propName + " to value " + path);
+ }
+
+ //let's put the last source directory in a property
+ if (kind.equalsIgnoreCase(ATTR_SRC))
+ {
+ String propName = idContainer + "srcpath";
+ Property property = new Property();
+ property.setName(propName);
+ property.setValue(path);
+ property.setProject(getProject());
+ property.execute();
+ if (verbose)
+ System.out.println("Setting property " + propName + " to value " + path);
+ }
+
+ if ((kind.equalsIgnoreCase(ATTR_SRC) && includeSource)
+ || (kind.equalsIgnoreCase(ATTR_OUTPUT) && includeOutput)
+ || (kind.equalsIgnoreCase(ATTR_LIB) && includeLibs))
+ {
+ //all seem fine
+ // check the includes
+ String[] inclResult = new String[] { "all included" };
+ if (irpm != null)
+ {
+ inclResult = irpm.mapFileName(path);
+ }
+ String[] exclResult = null;
+ if (erpm != null)
+ {
+ exclResult = erpm.mapFileName(path);
+ }
+ if (inclResult != null && exclResult == null)
+ {
+ //THIS is the specific code
+ if (kind.equalsIgnoreCase(ATTR_OUTPUT))
+ {
+ //we have included output so let's build a new fileset
+ FileSet outFileSet = new FileSet();
+ String newReference = idContainer + "-" + path.replace(File.separatorChar, '-');
+ getProject().addReference(newReference, outFileSet);
+ if (verbose)
+ System.out.println(
+ "Created new fileset "
+ + newReference
+ + " containing all the files from the output dir "
+ + projDir
+ + File.separator
+ + path);
+ outFileSet.setDefaultexcludes(false);
+ outFileSet.setDir(new File(projDir + File.separator + path));
+ outFileSet.setIncludes("**/*"); //get everything
+ }
+ else
+ if (kind.equalsIgnoreCase(ATTR_SRC))
+ {
+ //we have included source so let's build a new fileset
+ FileSet srcFileSet = new FileSet();
+ String newReference = idContainer + "-" + path.replace(File.separatorChar, '-');
+ getProject().addReference(newReference, srcFileSet);
+ if (verbose)
+ System.out.println(
+ "Created new fileset "
+ + newReference
+ + " containing all the files from the source dir "
+ + projDir
+ + File.separator
+ + path);
+ srcFileSet.setDefaultexcludes(false);
+ srcFileSet.setDir(new File(projDir + File.separator + path));
+ srcFileSet.setIncludes("**/*"); //get everything
+ }
+ else
+ {
+ //not otuptut, just add file after file to the fileset
+ File file = new File(fileSet.getDir(getProject()) + "/" + path);
+ if (file.isDirectory())
+ path += "/**/*";
+ if (verbose)
+ System.out.println(
+ "Adding "
+ + path
+ + " to fileset "
+ + idContainer
+ + " at "
+ + fileSet.getDir(getProject()));
+ fileSet.setIncludes(path);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ class PathCustomHandler extends AbstractCustomHandler
+ {
+ private Path path = null;
+
+ /**
+ * @param path the path to add files
+ */
+ public PathCustomHandler(Path path)
+ {
+ super();
+ this.path = path;
+ }
+
+ /**
+ * nazi style, forbid default constructor
+ */
+ private PathCustomHandler()
+ {
+ }
+
+ public void startElement(String tag, AttributeList attrs) throws SAXParseException
+ {
+ if (tag.equalsIgnoreCase("classpathentry"))
+ {
+ //start by checking if the classpath is coherent at all
+ String kind = attrs.getValue(ATTRNAME_KIND);
+ if (kind == null)
+ throw new BuildException("classpathentry 'kind' attribute is mandatory");
+ String path = attrs.getValue(ATTRNAME_PATH);
+ if (path == null)
+ throw new BuildException("classpathentry 'path' attribute is mandatory");
+
+ //put the outputdirectory in a property
+ if (kind.equalsIgnoreCase(ATTR_OUTPUT))
+ {
+ String propName = idContainer + "outpath";
+ Property property = new Property();
+ property.setName(propName);
+ property.setValue(path);
+ property.setProject(getProject());
+ property.execute();
+ if (verbose)
+ System.out.println("Setting property " + propName + " to value " + path);
+ }
+
+ //let's put the last source directory in a property
+ if (kind.equalsIgnoreCase(ATTR_SRC))
+ {
+ String propName = idContainer + "srcpath";
+ Property property = new Property();
+ property.setName(propName);
+ property.setValue(path);
+ property.setProject(getProject());
+ property.execute();
+ if (verbose)
+ System.out.println("Setting property " + propName + " to value " + path);
+ }
+
+ if ((kind.equalsIgnoreCase(ATTR_SRC) && includeSource)
+ || (kind.equalsIgnoreCase(ATTR_OUTPUT) && includeOutput)
+ || (kind.equalsIgnoreCase(ATTR_LIB) && includeLibs))
+ {
+ //all seem fine
+ // check the includes
+ String[] inclResult = new String[] { "all included" };
+ if (irpm != null)
+ {
+ inclResult = irpm.mapFileName(path);
+ }
+ String[] exclResult = null;
+ if (erpm != null)
+ {
+ exclResult = erpm.mapFileName(path);
+ }
+ if (inclResult != null && exclResult == null)
+ {
+ //THIS is the only specific code
+ if (verbose)
+ System.out.println("Adding " + path + " to classpath " + idContainer);
+ PathElement element = this.path.createPathElement();
+ element.setLocation(new File(path));
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c8/30026b2be2cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/c8/30026b2be2cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..3adc911
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c8/30026b2be2cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.tools.ant.BuildException;
+
+/***
+ *
+ * @author minger
+ * @ant.task name="addcredentials"
+ *
+ */
+public class AddCredentialsTask
+ extends AbstractHttpStateTypeTask {
+
+ private List credentials = new ArrayList();
+ private List proxyCredentials = new ArrayList();
+
+ public void addConfiguredCredentials(Credentials credentials) {
+ this.credentials.add(credentials);
+ }
+
+ public void addConfiguredProxyCredentials(Credentials credentials) {
+ this.proxyCredentials.add(credentials);
+ }
+
+ protected void execute(HttpStateType stateType) throws BuildException {
+ if (credentials.isEmpty() && proxyCredentials.isEmpty()) {
+ throw new BuildException("Either regular or proxy credentials" +
+ " must be supplied.");
+ }
+
+ Iterator it = credentials.iterator();
+ while (it.hasNext()) {
+ Credentials c = (Credentials)it.next();
+ stateType.addConfiguredCredentials(c);
+ }
+
+ it = proxyCredentials.iterator();
+ while (it.hasNext()) {
+ Credentials c = (Credentials)it.next();
+ stateType.addConfiguredProxyCredentials(c);
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c8/d0e9e056e1cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/c8/d0e9e056e1cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..9aeb889
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c8/d0e9e056e1cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,13 @@
+<antlib>
+<XDtClass:forAllClasses><XDtClass:ifHasClassTag tagName="ant:task">
+<taskdef name="<XDtClass:classTagValue tagName="ant:task" paramName="name"/>"
+ classname="<XDtClass:fullClassName />"
+ <XDtClass:ifHasClassTag tagName="ant:task" paramName="ignore">onerror="<XDtClass:classTagValue tagName="ant:task" paramName="ignore"/>"</XDtClass:ifHasClassTag> />
+</XDtClass:ifHasClassTag>
+<XDtClass:ifHasClassTag tagName="ant:type">
+<typedef name="<XDtClass:classTagValue tagName="ant:type" paramName="name"/>"
+ classname="<XDtClass:fullClassName />"
+ <XDtClass:ifHasClassTag tagName="ant:type" paramName="ignore">onerror="<XDtClass:classTagValue tagName="ant:type" paramName="ignore"/>"</XDtClass:ifHasClassTag> />
+</XDtClass:ifHasClassTag
+></XDtClass:forAllClasses>
+</antlib> \ No newline at end of file
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c9/3099f3d7e3cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/c9/3099f3d7e3cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..64c676c
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c9/3099f3d7e3cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.condition;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.condition.Equals;
+
+/**
+ * Extends Equals condition to test if the first argument is less than the
+ * second argument. Will deal with base 10 integer and decimal numbers, otherwise,
+ * treats arguments as Strings.
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ *
+ * @author Dale Anson, [email protected]
+ * @version $Revision: 1.4 $
+ */
+public class IsLessThan extends Equals {
+
+ private String arg1, arg2;
+ private boolean trim = false;
+ private boolean caseSensitive = true;
+
+ public void setArg1(String a1) {
+ arg1 = a1;
+ }
+
+ public void setArg2(String a2) {
+ arg2 = a2;
+ }
+
+ /**
+ * Should we want to trim the arguments before comparing them?
+ *
+ * @since Revision: 1.3, Ant 1.5
+ */
+ public void setTrim(boolean b) {
+ trim = b;
+ }
+
+ /**
+ * Should the comparison be case sensitive?
+ *
+ * @since Revision: 1.3, Ant 1.5
+ */
+ public void setCasesensitive(boolean b) {
+ caseSensitive = b;
+ }
+
+ public boolean eval() throws BuildException {
+ if (arg1 == null || arg2 == null) {
+ throw new BuildException("both arg1 and arg2 are required in "
+ + "less than");
+ }
+
+ if (trim) {
+ arg1 = arg1.trim();
+ arg2 = arg2.trim();
+ }
+
+ // check if args are numbers
+ try {
+ double num1 = Double.parseDouble(arg1);
+ double num2 = Double.parseDouble(arg2);
+ return num1 < num2;
+ }
+ catch(NumberFormatException nfe) {
+ // ignored, fall thru to string comparision
+ }
+
+ return caseSensitive ? arg1.compareTo(arg2) < 0 : arg1.compareToIgnoreCase(arg2) < 0;
+ }
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c9/b0ded3a3e5cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/c9/b0ded3a3e5cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..434f202
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c9/b0ded3a3e5cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.CallTarget;
+import org.apache.tools.ant.taskdefs.Property;
+
+/**
+ * Subclass of Ant which allows us to fetch
+ * properties which are set in the scope of the called
+ * target, and set them in the scope of the calling target.
+ * Normally, these properties are thrown away as soon as the
+ * called target completes execution.
+ *
+ * @author inger
+ * @author Dale Anson, [email protected]
+ * @ant.task name="antcallback"
+ */
+public class AntCallBack extends CallTarget {
+
+ /** the name of the property to fetch from the new project */
+ private String returnName = null;
+
+ private ProjectDelegate fakeProject = null;
+
+ public void setProject(Project realProject) {
+ fakeProject = new ProjectDelegate(realProject);
+ super.setProject(fakeProject);
+ }
+
+ /**
+ * Do the execution.
+ *
+ * @exception BuildException Description of the Exception
+ */
+ public void execute() throws BuildException {
+ super.execute();
+
+ // copy back the props if possible
+ if ( returnName != null ) {
+ StringTokenizer st = new StringTokenizer( returnName, "," );
+ while ( st.hasMoreTokens() ) {
+ String name = st.nextToken().trim();
+ String value = fakeProject.getSubproject().getUserProperty( name );
+ if ( value != null ) {
+ getProject().setUserProperty( name, value );
+ }
+ else {
+ value = fakeProject.getSubproject().getProperty( name );
+ if ( value != null ) {
+ getProject().setProperty( name, value );
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Set the property or properties that are set in the new project to be
+ * transfered back to the original project. As with all properties, if the
+ * property already exists in the original project, it will not be overridden
+ * by a different value from the new project.
+ *
+ * @param r the name of a property in the new project to set in the original
+ * project. This may be a comma separate list of properties.
+ */
+ public void setReturn( String r ) {
+ returnName = r;
+ }
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cb/b0eba5fde8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/cb/b0eba5fde8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..a38ef8e
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/cb/b0eba5fde8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,5 @@
+package net.sf.antcontrib.util;
+
+public class Utils {
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cc/301f065fe7cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/cc/301f065fe7cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..c88db1c
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/cc/301f065fe7cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,330 @@
+/*
+ * Copyright (c) 2001-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.design;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
+
+import net.sf.antcontrib.logic.ProjectDelegate;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Location;
+import org.apache.tools.ant.Project;
+
+
+/*
+ * Created on Aug 24, 2003
+ *
+ * To change the template for this generated file go to
+ * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
+ */
+/**
+ * FILL IN JAVADOC HERE
+ *
+ * @author Dean Hiller([email protected])
+ */
+public class Design {
+
+ private Map nameToPackage = new HashMap();
+ private Map packageNameToPackage = new HashMap();
+ private boolean isCircularDesign;
+ private Log log;
+ private Location location;
+
+ private String currentClass = null;
+ private String currentPackageName = null;
+ private Package currentAliasPackage = null;
+
+ private HashSet primitives = new HashSet();
+
+ public Design(boolean isCircularDesign, Log log, Location loc) {
+ //by default, add java as a configured package with the name java
+ Package p = new Package();
+ p.setIncludeSubpackages(true);
+ p.setName("java");
+ p.setUsed(true);
+ p.setNeedDeclarations(false);
+ p.setPackage("java");
+ addConfiguredPackage(p);
+
+ this.isCircularDesign = isCircularDesign;
+ this.log = log;
+ this.location = loc;
+
+ primitives.add("boolean");
+
+ //integral types
+ primitives.add("byte");
+ primitives.add("short");
+ primitives.add("int");
+ primitives.add("long");
+ primitives.add("char");
+
+ //floating point types
+ primitives.add("double");
+ primitives.add("float");
+ }
+
+ public Package getPackage(String nameAttribute) {
+ return (Package)nameToPackage.get(nameAttribute);
+ }
+
+ private Package retreivePack(String thePackage) {
+ if(thePackage == null)
+ throw new IllegalArgumentException("Cannot retrieve null packages");
+
+ String currentPackage = thePackage;
+ Package result = (Package)packageNameToPackage.get(currentPackage);
+ while(!Package.DEFAULT.equals(currentPackage)) {
+ log.log("p="+currentPackage+"result="+result, Project.MSG_DEBUG);
+ if(result != null) {
+ if(currentPackage.equals(thePackage))
+ return result;
+ else if(result.isIncludeSubpackages())
+ return result;
+ return null;
+ }
+ currentPackage = VerifyDesignDelegate.getPackageName(currentPackage);
+ result = (Package)packageNameToPackage.get(currentPackage);
+ }
+
+ //result must now be default package
+ if(result != null && result.isIncludeSubpackages())
+ return result;
+
+ return null;
+ }
+
+ public void addConfiguredPackage(Package p) {
+
+ String pack = p.getPackage();
+
+ Depends[] depends = p.getDepends();
+
+ if(depends != null && !isCircularDesign) {
+ //make sure all depends are in Map first
+ //circular references then are not a problem because they must
+ //put the stuff in order
+ for(int i = 0; i < depends.length; i++) {
+ Package dependsPackage = (Package)nameToPackage.get(depends[i].getName());
+
+ if(dependsPackage == null) {
+ throw new RuntimeException("package name="+p.getName()+" did not\n" +
+ "have "+depends[i]+" listed before it. circularDesign is off\n"+
+ "so package="+p.getName()+" must be moved up in the xml file");
+ }
+ }
+ }
+
+ nameToPackage.put(p.getName(), p);
+ packageNameToPackage.put(p.getPackage(), p);
+ }
+
+ /**
+ * @param className Class name of a class our currentAliasPackage depends on.
+ */
+ public void verifyDependencyOk(String className) {
+ log.log(" className="+className, Project.MSG_DEBUG);
+ if(className.startsWith("L"))
+ className = className.substring(1, className.length());
+
+ //get the classPackage our currentAliasPackage depends on....
+ String classPackage = VerifyDesignDelegate.getPackageName(className);
+
+ //check if this is an needdeclarations="false" package, if so, the dependency is ok if it
+ //is not declared
+ log.log(" classPackage="+classPackage, Project.MSG_DEBUG);
+ Package p = retreivePack(classPackage);
+ if(p == null) {
+ throw new BuildException(getErrorMessage(currentClass, className), location);
+ }
+ p.setUsed(true); //set package to used since we have classes in it
+ if(p != null && !p.isNeedDeclarations())
+ return;
+
+ String pack = currentAliasPackage.getPackage();
+
+ log.log(" AllowedDepends="+pack, Project.MSG_DEBUG);
+ log.log(" CurrentDepends="+className, Project.MSG_DEBUG);
+ if(isClassInPackage(className, currentAliasPackage))
+ return;
+
+ Depends[] depends = currentAliasPackage.getDepends();
+
+ //probably want to create a regular expression out of all the depends and just match on that
+ //each time. for now though, just get it working and do the basic(optimize later if needed)
+ for(int i = 0; i < depends.length; i++) {
+ Depends d = depends[i];
+ String name = d.getName();
+
+ Package temp = getPackage(name);
+ log.log(" AllowedDepends="+temp.getPackage(), Project.MSG_DEBUG);
+ log.log(" CurrentDepends="+className, Project.MSG_DEBUG);
+ if(isClassInPackage(className, temp)) {
+ temp.setUsed(true); //set package to used since we are depending on it(could be external package like junit)
+ currentAliasPackage.addUsedDependency(d);
+ return;
+ }
+ }
+
+ log.log("***************************************", Project.MSG_DEBUG);
+ log.log("***************************************", Project.MSG_DEBUG);
+
+ throw new BuildException(Design.getErrorMessage(currentClass, className), location);
+ }
+
+ public boolean isClassInPackage(String className, Package p) {
+ String classPackage = VerifyDesignDelegate.getPackageName(className);
+ if(p.isIncludeSubpackages()) {
+ if(className.startsWith(p.getPackage()))
+ return true;
+ } else { //if not including subpackages, the it must be the exact package.
+ if(classPackage.equals(p.getPackage()))
+ return true;
+ }
+ return false;
+ }
+ /**
+ * @param className
+ * @return whether or not this class needs to be checked. (ie. if the
+ * attribute needdepends=false, we don't care about this package.
+ */
+ public boolean needEvalCurrentClass(String className) {
+ currentClass = className;
+ String packageName = VerifyDesignDelegate.getPackageName(className);
+// log("class="+className, Project.MSG_DEBUG);
+ if(!packageName.equals(currentPackageName) || currentAliasPackage == null) {
+ currentPackageName = packageName;
+ log.log("\nEvaluating package="+currentPackageName, Project.MSG_INFO);
+ currentAliasPackage = retreivePack(packageName);
+ //DEANDO: test this scenario
+ if(currentAliasPackage == null) {
+ log.log(" class="+className, Project.MSG_VERBOSE);
+ throw new BuildException(getNoDefinitionError(className), location);
+ }
+
+ currentAliasPackage.setUsed(true);
+ }
+ log.log(" class="+className, Project.MSG_VERBOSE);
+
+ if(packageName.equals(Package.DEFAULT)) {
+ if(className.indexOf('.') != -1) {
+ throw new RuntimeException("Internal Error");
+ }
+ } else if(!className.startsWith(currentPackageName))
+ throw new RuntimeException("Internal Error");
+
+ if(!currentAliasPackage.getNeedDepends())
+ return false;
+ return true;
+ }
+
+ public String getCurrentClass() {
+ return currentClass;
+ }
+
+ void checkClass(String dependsOn) {
+ log.log(" dependsOn1="+dependsOn, Project.MSG_DEBUG);
+ if(dependsOn.endsWith("[]")) {
+ int index = dependsOn.indexOf("[");
+ dependsOn = dependsOn.substring(0, index);
+ log.log(" dependsOn2="+dependsOn, Project.MSG_DEBUG);
+ }
+
+ if(primitives.contains(dependsOn))
+ return;
+
+ //Anything in java.lang package seems to be passed in as just the
+ //className with no package like Object, String or Class, so here we try to
+ //see if the name is a java.lang class....
+ String tempTry = "java.lang."+dependsOn;
+ try {
+ Class c = VerifyDesign.class.getClassLoader().loadClass(tempTry);
+ return;
+ } catch(ClassNotFoundException e) {
+ //not found, continue on...
+ }
+ //sometimes instead of passing java.lang.String or java.lang.Object, the bcel
+ //passes just String or Object
+// if("String".equals(dependsOn) || "Object".equals(dependsOn))
+// return;
+
+ verifyDependencyOk(dependsOn);
+
+ }
+
+ public static String getErrorMessage(String className, String dependsOnClass) {
+ String s = "\nYou are violating your own design...." +
+ "\nClass = "+className+" depends on\nClass = "+dependsOnClass+
+ "\nThe dependency to allow this is not defined in your design" +
+ "\nPackage="+VerifyDesignDelegate.getPackageName(className)+" is not defined to depend on"+
+ "\nPackage="+VerifyDesignDelegate.getPackageName(dependsOnClass)+
+ "\nChange the code or the design";
+ return s;
+ }
+
+ public static String getNoDefinitionError(String className) {
+ String s = "\nPackage="+VerifyDesignDelegate.getPackageName(className)+" is not defined in the design.\n"+
+ "All packages with classes must be declared in the design file\n"+
+ "Class found in the offending package="+className;
+ return s;
+ }
+
+ public static String getWrapperMsg(File originalFile, String message) {
+ String s = "\nThe file '" + originalFile.getAbsolutePath() + "' failed due to: " + message;
+ return s;
+ }
+
+ /**
+ * @param designErrors
+ */
+ public void fillInUnusedPackages(Vector designErrors)
+ {
+ Collection values = nameToPackage.values();
+ Iterator iterator = values.iterator();
+ while(iterator.hasNext()) {
+ Package pack = (Package)iterator.next();
+ if(!pack.isUsed()) {
+ String msg = "Package name="+pack.getName()+" is unused. Full package="+pack.getPackage();
+ log.log(msg, Project.MSG_ERR);
+ designErrors.add(new BuildException(msg));
+ } else {
+ fillInUnusedDepends(designErrors, pack);
+ }
+ }
+ }
+
+ /**
+ * @param designErrors
+ * @param pack
+ */
+ private void fillInUnusedDepends(Vector designErrors, Package pack)
+ {
+ Iterator iterator = pack.getUnusedDepends().iterator();
+ while(iterator.hasNext()) {
+ Depends depends = (Depends)iterator.next();
+ String msg = "Package name="+pack.getName()+" has a dependency declared that is not true anymore. Please erase the dependency <depends>"+depends.getName()+"</depends> from package="+pack.getName();
+ log.log(msg, Project.MSG_ERR);
+ designErrors.add(new BuildException(msg));
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cd/90676c0fd3cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/cd/90676c0fd3cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..3b86d2f
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/cd/90676c0fd3cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,3 @@
+<XDtClass:ifHasClassTag tagName="ant.task" paramName="name">
+ <XDtClass:classTagValue tagName="ant.task" paramName="name"/>=<XDtClass:classOf><XDtJavaBean:beanClass/></XDtClass>
+</XDtClass:ifHasClassTag> \ No newline at end of file
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ce/30bc82b1dfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/ce/30bc82b1dfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..d5f91db
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ce/30bc82b1dfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import org.apache.tools.ant.BuildException;
+
+public class ClearCookiesTask
+ extends AbstractHttpStateTypeTask {
+
+ protected void execute(HttpStateType stateType) throws BuildException {
+ stateType.getState().clearCookies();
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cf/b00ecd4ddbcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/cf/b00ecd4ddbcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..ad822f0
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/cf/b00ecd4ddbcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,423 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.util.Enumeration;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.TaskContainer;
+import org.apache.tools.ant.taskdefs.Ant;
+import org.apache.tools.ant.taskdefs.CallTarget;
+import org.apache.tools.ant.taskdefs.Property;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Mapper;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.util.FileNameMapper;
+
+import net.sf.antcontrib.util.ThreadPool;
+import net.sf.antcontrib.util.ThreadPoolThread;
+
+/***
+ * Task definition for the foreach task. The foreach task iterates
+ * over a list, a list of filesets, or both.
+ *
+ * <pre>
+ *
+ * Usage:
+ *
+ * Task declaration in the project:
+ * <code>
+ * &lt;taskdef name="foreach" classname="net.sf.antcontrib.logic.ForEach" /&gt;
+ * </code>
+ *
+ * Call Syntax:
+ * <code>
+ * &lt;foreach list="values" target="targ" param="name"
+ * [parallel="true|false"]
+ * [delimiter="delim"] /&gt;
+ * </code>
+ *
+ * Attributes:
+ * list --> The list of values to process, with the delimiter character,
+ * indicated by the "delim" attribute, separating each value
+ * target --> The target to call for each token, passing the token as the
+ * parameter with the name indicated by the "param" attribute
+ * param --> The name of the parameter to pass the tokens in as to the
+ * target
+ * delimiter --> The delimiter string that separates the values in the "list"
+ * parameter. The default is ","
+ * parallel --> Should all targets execute in parallel. The default is false.
+ * trim --> Should we trim the list item before calling the target?
+ *
+ * </pre>
+ * @author <a href="mailto:[email protected]">Matthew Inger</a>
+ */
+public class ForEach extends Task
+{
+ private String list;
+ private String param;
+ private String delimiter;
+ private String target;
+ private boolean inheritAll;
+ private boolean inheritRefs;
+ private Vector params;
+ private Vector references;
+ private Path currPath;
+ private boolean parallel;
+ private boolean trim;
+ private int maxThreads;
+ private Mapper mapper;
+
+ /***
+ * Default Constructor
+ */
+ public ForEach()
+ {
+ super();
+ this.list = null;
+ this.param = null;
+ this.delimiter = ",";
+ this.target = null;
+ this.inheritAll = false;
+ this.inheritRefs = false;
+ this.params = new Vector();
+ this.references = new Vector();
+ this.parallel = false;
+ this.maxThreads = 5;
+ }
+
+ private void executeParallel(Vector tasks)
+ {
+ ThreadPool pool = new ThreadPool(maxThreads);
+ Enumeration e = tasks.elements();
+ Runnable r = null;
+ Vector threads = new Vector();
+
+ // start each task in it's own thread, using the
+ // pool to ensure that we don't exceed the maximum
+ // amount of threads
+ while (e.hasMoreElements())
+ {
+ // Create the Runnable object
+ final Task task = (Task)e.nextElement();
+ r = new Runnable()
+ {
+ public void run()
+ {
+ task.execute();
+ }
+ };
+
+ // Get a thread, and start the task.
+ // If there is no thread available, this will
+ // block until one becomes available
+ try
+ {
+ ThreadPoolThread tpt = pool.borrowThread();
+ tpt.setRunnable(r);
+ tpt.start();
+ threads.addElement(tpt);
+ }
+ catch (Exception ex)
+ {
+ throw new BuildException(ex);
+ }
+
+ }
+
+ // Wait for all threads to finish before we
+ // are allowed to return.
+ Enumeration te = threads.elements();
+ Thread t= null;
+ while (te.hasMoreElements())
+ {
+ t = (Thread)te.nextElement();
+ if (t.isAlive())
+ {
+ try
+ {
+ t.join();
+ }
+ catch (InterruptedException ex)
+ {
+ throw new BuildException(ex);
+ }
+ }
+ }
+ }
+
+ private void executeSequential(Vector tasks)
+ {
+ TaskContainer tc = (TaskContainer) getProject().createTask("sequential");
+ Enumeration e = tasks.elements();
+ Task t = null;
+ while (e.hasMoreElements())
+ {
+ t = (Task)e.nextElement();
+ tc.addTask(t);
+ }
+
+ ((Task)tc).execute();
+ }
+
+ public void execute()
+ throws BuildException
+ {
+ if (list == null && currPath == null) {
+ throw new BuildException("You must have a list or path to iterate through");
+ }
+ if (param == null)
+ throw new BuildException("You must supply a property name to set on each iteration in param");
+ if (target == null)
+ throw new BuildException("You must supply a target to perform");
+
+ Vector values = new Vector();
+
+ // Take Care of the list attribute
+ if (list != null)
+ {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens())
+ {
+ String tok = st.nextToken();
+ if (trim) tok = tok.trim();
+ values.addElement(tok);
+ }
+ }
+
+ String[] pathElements = new String[0];
+ if (currPath != null) {
+ pathElements = currPath.list();
+ }
+
+ for (int i=0;i<pathElements.length;i++)
+ {
+ if (mapper != null)
+ {
+ FileNameMapper m = mapper.getImplementation();
+ String mapped[] = m.mapFileName(pathElements[i]);
+ for (int j=0;j<mapped.length;j++)
+ values.addElement(mapped[j]);
+ }
+ else
+ {
+ values.addElement(new File(pathElements[i]));
+ }
+ }
+
+ Vector tasks = new Vector();
+
+ int sz = values.size();
+ CallTarget ct = null;
+ Object val = null;
+ Property p = null;
+
+ for (int i = 0; i < sz; i++) {
+ val = values.elementAt(i);
+ ct = createCallTarget();
+ p = ct.createParam();
+ p.setName(param);
+
+ if (val instanceof File)
+ p.setLocation((File)val);
+ else
+ p.setValue((String)val);
+
+ tasks.addElement(ct);
+ }
+
+ if (parallel && maxThreads > 1)
+ {
+ executeParallel(tasks);
+ }
+ else
+ {
+ executeSequential(tasks);
+ }
+ }
+
+ public void setTrim(boolean trim)
+ {
+ this.trim = trim;
+ }
+
+ public void setList(String list)
+ {
+ this.list = list;
+ }
+
+ public void setDelimiter(String delimiter)
+ {
+ this.delimiter = delimiter;
+ }
+
+ public void setParam(String param)
+ {
+ this.param = param;
+ }
+
+ public void setTarget(String target)
+ {
+ this.target = target;
+ }
+
+ public void setParallel(boolean parallel)
+ {
+ this.parallel = parallel;
+ }
+
+ /**
+ * Corresponds to <code>&lt;antcall&gt;</code>'s <code>inheritall</code>
+ * attribute.
+ */
+ public void setInheritall(boolean b) {
+ this.inheritAll = b;
+ }
+
+ /**
+ * Corresponds to <code>&lt;antcall&gt;</code>'s <code>inheritrefs</code>
+ * attribute.
+ */
+ public void setInheritrefs(boolean b) {
+ this.inheritRefs = b;
+ }
+
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * at once to execute
+ * @param maxThreads
+ */
+ public void setMaxThreads(int maxThreads)
+ {
+ this.maxThreads = maxThreads;
+ }
+
+
+ /**
+ * Corresponds to <code>&lt;antcall&gt;</code>'s nested
+ * <code>&lt;param&gt;</code> element.
+ */
+ public void addParam(Property p) {
+ params.addElement(p);
+ }
+
+ /**
+ * Corresponds to <code>&lt;antcall&gt;</code>'s nested
+ * <code>&lt;reference&gt;</code> element.
+ */
+ public void addReference(Ant.Reference r) {
+ references.addElement(r);
+ }
+
+ /**
+ * @deprecated Use createPath instead.
+ */
+ public void addFileset(FileSet set)
+ {
+ log("The nested fileset element is deprectated, use a nested path "
+ + "instead",
+ Project.MSG_WARN);
+ createPath().addFileset(set);
+ }
+
+ public Path createPath() {
+ if (currPath == null) {
+ currPath = new Path(getProject());
+ }
+ return currPath;
+ }
+
+ public Mapper createMapper()
+ {
+ mapper = new Mapper(getProject());
+ return mapper;
+ }
+
+ private CallTarget createCallTarget() {
+ CallTarget ct = (CallTarget) getProject().createTask("antcall");
+ ct.setOwningTarget(getOwningTarget());
+ ct.init();
+ ct.setTarget(target);
+ ct.setInheritAll(inheritAll);
+ ct.setInheritRefs(inheritRefs);
+ Enumeration e = params.elements();
+ while (e.hasMoreElements()) {
+ Property param = (Property) e.nextElement();
+ Property toSet = ct.createParam();
+ toSet.setName(param.getName());
+ if (param.getValue() != null) {
+ toSet.setValue(param.getValue());
+ }
+ if (param.getFile() != null) {
+ toSet.setFile(param.getFile());
+ }
+ if (param.getResource() != null) {
+ toSet.setResource(param.getResource());
+ }
+ if (param.getPrefix() != null) {
+ toSet.setPrefix(param.getPrefix());
+ }
+ if (param.getRefid() != null) {
+ toSet.setRefid(param.getRefid());
+ }
+ if (param.getEnvironment() != null) {
+ toSet.setEnvironment(param.getEnvironment());
+ }
+ if (param.getClasspath() != null) {
+ toSet.setClasspath(param.getClasspath());
+ }
+ }
+
+ e = references.elements();
+ while (e.hasMoreElements()) {
+ ct.addReference((Ant.Reference) e.nextElement());
+ }
+
+ return ct;
+ }
+
+ protected void handleOutput(String line)
+ {
+ try {
+ super.handleOutput(line);
+ }
+ // This is needed so we can run with 1.5 and 1.5.1
+ catch (IllegalAccessError e) {
+ super.handleOutput(line);
+ }
+ }
+
+ protected void handleErrorOutput(String line)
+ {
+ try {
+ super.handleErrorOutput(line);
+ }
+ // This is needed so we can run with 1.5 and 1.5.1
+ catch (IllegalAccessError e) {
+ super.handleErrorOutput(line);
+ }
+ }
+
+}
+
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d0/702716e6dacc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/d0/702716e6dacc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..7098bc9
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/d0/702716e6dacc001b1cb5d1e6b2b8577e
@@ -0,0 +1,6 @@
+<XDtClass:forAllClasses>
+<XDtClass:ifHasClassTag tagName="ant:task">
+<XDtClass:classTagValue tagName="ant:task" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag>
+</XDtClass:forAllClasses>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d5/50fb2525d8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/d5/50fb2525d8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..a043009
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/d5/50fb2525d8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,9 @@
+<XDtClass:forAllClasses>
+<XDtClass:forAllClassTags>
+ <XDtClass:name />
+</XDtClass:forAllClassTags>
+<XDtClass:ifHasClassTag tagName="ant:task" paramName="name">
+<XDtClass:classTagValue tagName="ant:task" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag>
+</XDtClass:forAllClasses>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d5/a03a78ebdfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/d5/a03a78ebdfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..64365ac
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/d5/a03a78ebdfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.DataType;
+
+public class HttpClientType
+ extends DataType {
+
+ private HttpClient client;
+
+ public HttpClientType(Project p) {
+ super();
+ setProject(p);
+
+ client = new HttpClient();
+ }
+
+ public HttpClient getClient() {
+ if (isReference()) {
+ return getRef().getClient();
+ }
+ else {
+ return client;
+ }
+ }
+
+ public void setStateRefId(String stateRefId) {
+ if (isReference()) {
+ tooManyAttributes();
+ }
+ HttpStateType stateType = AbstractHttpStateTypeTask.getStateType(
+ getProject(),
+ stateRefId);
+ getClient().setState(stateType.getState());
+ }
+
+ protected HttpClientType getRef() {
+ return (HttpClientType) super.getCheckedRef(HttpClientType.class,
+ "http-client");
+ }
+
+ public ClientParams createClientParams() {
+ if (isReference()) {
+ tooManyAttributes();
+ }
+ ClientParams clientParams = new ClientParams();
+ client.setParams(clientParams);
+ return clientParams;
+ }
+
+ public HttpStateType createHttpState() {
+ if (isReference()) {
+ tooManyAttributes();
+ }
+ HttpStateType state = new HttpStateType(getProject());
+ getClient().setState(state.getState());
+ return state;
+ }
+
+ public HostConfig createHostConfig() {
+ if (isReference()) {
+ tooManyAttributes();
+ }
+ HostConfig config = new HostConfig();
+ client.setHostConfiguration(config);
+ return config;
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d7/60548624e2cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/d7/60548624e2cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..71784a2
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/d7/60548624e2cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,13 @@
+<antlib>
+<XDtClass:forAllClasses><XDtClass:ifHasClassTag tagName="ant:task">
+<taskdef name="<XDtClass:classTagValue tagName="ant:task" paramName="name"/>"
+ classname="<XDtClass:fullClassName />"
+ <XDtClass:ifHasClassTag tagName="ant:task" paramName="ignore">onerror="<XDtClass:classTagValue tagName="ant:task" paramName="ignore"/>"</XDtClass:ifHasClassTag> />
+</XDtClass:ifHasClassTag>
+<XDtClass:ifHasClassTag tagName="ant:type">
+<typedef name="<XDtClass:classTagValue tagName="ant:type" paramName="name"/>"
+ classname="<XDtClass:fullClassName />"
+ <XDtClass:ifHasClassTag tagName="ant:type" paramName="ignore">onerror="<XDtClass:classTagValue tagName="ant:type" paramName="ignore"/>"</XDtClass:ifHasClassTag> />
+</XDtClass:ifHasClassTag>
+</XDtClass:forAllClasses>
+</antlib> \ No newline at end of file
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d8/4023cfd0e3cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/d8/4023cfd0e3cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..479f9fd
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/d8/4023cfd0e3cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.condition;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.condition.IsFalse;
+
+/**
+ * Extends IsFalse condition to check the value of a specified property.
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ *
+ * @author Dale Anson, [email protected]
+ * @version $Revision: 1.3 $
+ */
+public class IsPropertyFalse extends IsFalse {
+
+ private String name = null;
+
+ public void setProperty(String name) {
+ this.name = name;
+ }
+
+ public boolean eval() throws BuildException {
+ if (name == null)
+ throw new BuildException("Property name must be set.");
+ String value = getProject().getProperty(name);
+ if (value == null)
+ return true;
+ return !getProject().toBoolean(value);
+ }
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d9/80af19f1decc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/d9/80af19f1decc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..163bc1b
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/d9/80af19f1decc001b1cb5d1e6b2b8577e
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2004-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.sf.antcontrib.logic;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.TaskContainer;
+
+import java.util.Iterator;
+import java.util.Vector;
+
+/** Relentless is an Ant task that will relentlessly execute other tasks,
+ * ignoring any failures until all tasks have completed. If any of the
+ * executed tasks fail, then Relentless will fail; otherwise it will succeed.
+ *
+ * @author Christopher Heiny
+ * @version $Id: Relentless.java 12 2006-08-09 17:48:45Z mattinger $
+ */
+public class Relentless extends Task implements TaskContainer {
+ /** We keep the list of tasks we will execute here.
+ */
+ private Vector taskList = new Vector();
+
+ /** Flag indicating how much output to generate.
+ */
+ private boolean terse = false;
+
+ /** Creates a new Relentless task. */
+ public Relentless() {
+ }
+
+ /** This method will be called when it is time to execute the task.
+ */
+ public void execute() throws BuildException {
+ int failCount = 0;
+ int taskNo = 0;
+ if ( taskList.size() == 0 ) {
+ throw new BuildException( "No tasks specified for <relentless>." );
+ }
+ log("Relentlessly executing: " + this.getDescription());
+ Iterator iter = taskList.iterator();
+ while ( iter.hasNext() ) {
+ Task t = (Task) iter.next();
+ taskNo++;
+ String desc = t.getDescription();
+ if ( desc == null ) {
+ desc = "task " + taskNo;
+ }
+ if (!terse) log("Executing: " + desc);
+ try {
+ t.perform();
+ } catch (BuildException x) {
+ log("Task " + desc + " failed: " + x.getMessage());
+ failCount++;
+ }
+ }
+ if ( failCount > 0 ) {
+ throw new BuildException( "Relentless execution: " + failCount + " of " + taskList.size() + " tasks failed." );
+ }
+ else {
+ log("All tasks completed successfully.");
+ }
+ }
+
+ /** Ant will call this to inform us of nested tasks.
+ */
+ public void addTask(org.apache.tools.ant.Task task) {
+ taskList.add(task);
+ }
+
+ /** Set this to true to reduce the amount of output generated.
+ */
+ public void setTerse(boolean terse) {
+ this.terse = terse;
+ }
+
+ /** Retrieve the terse property, indicating how much output we will generate.
+ */
+ public boolean isTerse() {
+ return terse;
+ }
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/da/70dbc32ce2cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/da/70dbc32ce2cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..183c4b4
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/da/70dbc32ce2cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import org.apache.tools.ant.BuildException;
+
+/***
+ *
+ * @author minger
+ * @ant.task name="clearcookies"
+ *
+ */
+public class ClearCookiesTask
+ extends AbstractHttpStateTypeTask {
+
+ protected void execute(HttpStateType stateType) throws BuildException {
+ stateType.getState().clearCookies();
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/da/a0bcaaecdecc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/da/a0bcaaecdecc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..c0958b2
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/da/a0bcaaecdecc001b1cb5d1e6b2b8577e
@@ -0,0 +1,680 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.taskdefs.Sequential;
+import org.apache.tools.ant.taskdefs.condition.Condition;
+import org.apache.tools.ant.types.Mapper;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.util.FileNameMapper;
+import org.apache.tools.ant.util.FileUtils;
+
+import org.apache.tools.ant.types.EnumeratedAttribute;
+
+/**
+* Task to help in calling tasks if generated files are older
+* than source files.
+* Sets a given property or runs an internal task.
+*
+* Based on
+* org.apache.org.apache.tools.ant.taskdefs.UpToDate
+*
+* @author peter reilly
+*/
+
+public class OutOfDate extends Task implements Condition {
+
+ /**
+ * Enumerated type for collection attribute
+ *
+ * @see EnumeratedAttribute
+ */
+ public static class CollectionEnum extends EnumeratedAttribute {
+ /** Constants for the enumerations */
+ public static final int
+ SOURCES = 0, TARGETS = 1, ALLSOURCES = 2, ALLTARGETS = 3;
+
+ /**
+ * get the values
+ * @return an array of the allowed values for this attribute.
+ */
+ public String[] getValues() {
+ return new String[] {"sources", "targets", "allsources", "alltargets"};
+ }
+ }
+
+ // attributes and nested elements
+ private Task doTask = null;
+ private String property;
+ private String value = "true";
+ private boolean force = false;
+ private int verbosity = Project.MSG_VERBOSE;
+ private Vector mappers = new Vector();
+ private Path targetpaths = null;
+ private Path sourcepaths = null;
+ private String outputSources = null;
+ private String outputSourcesPath = null;
+ private String outputTargets = null;
+ private String outputTargetsPath = null;
+ private String allTargets = null;
+ private String allTargetsPath = null;
+ private String separator = " ";
+ private DeleteTargets deleteTargets = null;
+ private int collection = CollectionEnum.SOURCES;
+
+ // variables
+ private Hashtable targetSet = new Hashtable();
+ private Hashtable sourceSet = new Hashtable();
+ private Hashtable allTargetSet = new Hashtable();
+ private Hashtable allSourceSet = new Hashtable();
+
+ /**
+ * Set the collection attribute, controls what is
+ * returned by the iterator method.
+ * <dl>
+ * <li>"sources" the sources that are newer than the corresponding targets.</li>
+ * <li>"targets" the targets that are older or not present than the corresponding
+ * sources.</li>
+ * <li>"allsources" all the sources</li>
+ * <li>"alltargets" all the targets</li>
+ * </dl>
+ * @param collection "sources" the changes
+ */
+ public void setCollection(CollectionEnum collection) {
+ this.collection = collection.getIndex();
+ }
+
+ /**
+ * Defines the FileNameMapper to use (nested mapper element).
+ * @return Mappper to be configured
+ */
+ public Mapper createMapper() {
+ MyMapper mapper = new MyMapper(getProject());
+ mappers.addElement(mapper);
+ return mapper;
+ }
+
+ /**
+ * The property to set if any of the target files are outofdate with
+ * regard to any of the source files.
+ *
+ * @param property the name of the property to set if Target is outofdate.
+ */
+ public void setProperty(String property) {
+ this.property = property;
+ }
+
+ /**
+ * The separator to use to separate the files
+ * @param separator separator used in outout properties
+ */
+
+ public void setSeparator(String separator) {
+ this.separator = separator;
+ }
+
+ /**
+ * The value to set the named property to the target files
+ * are outofdate
+ *
+ * @param value the value to set the property
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /**
+ * whether to allways be outofdate
+ * @param force true means that outofdate is always set, default
+ * false
+ */
+ public void setForce(boolean force) {
+ this.force = force;
+ }
+
+ /**
+ * whether to have verbose output
+ * @param verbose true means that outofdate outputs debug info
+ */
+ public void setVerbose(boolean verbose) {
+ if (verbose) {
+ this.verbosity = Project.MSG_INFO;
+ } else {
+ this.verbosity = Project.MSG_VERBOSE;
+ }
+ }
+
+ /**
+ * Add to the target files
+ *
+ * @return a path to be configured
+ */
+ public Path createTargetfiles() {
+ if (targetpaths == null) {
+ targetpaths = new Path(getProject());
+ }
+ return targetpaths;
+ }
+
+ /**
+ * Add to the source files
+ *
+ * @return a path to be configured
+ */
+ public Path createSourcefiles() {
+ if (sourcepaths == null) {
+ sourcepaths = new Path(getProject());
+ }
+ return sourcepaths;
+ }
+
+ /**
+ * A property to contain the output source files
+ *
+ * @param outputSources the name of the property
+ */
+ public void setOutputSources(String outputSources) {
+ this.outputSources = outputSources;
+ }
+
+ /**
+ * A property to contain the output target files
+ *
+ * @param outputTargets the name of the property
+ */
+ public void setOutputTargets(String outputTargets) {
+ this.outputTargets = outputTargets;
+ }
+
+ /**
+ * A reference to contain the path of target files that
+ * are outofdate
+ *
+ * @param outputTargetsPath the name of the reference
+ */
+ public void setOutputTargetsPath(String outputTargetsPath) {
+ this.outputTargetsPath = outputTargetsPath;
+ }
+
+ /**
+ * A refernce to contain the path of all the targets
+ *
+ * @param allTargetsPath the name of the reference
+ */
+ public void setAllTargetsPath(String allTargetsPath) {
+ this.allTargetsPath = allTargetsPath;
+ }
+
+ /**
+ * A property to contain all the target filenames
+ *
+ * @param allTargets the name of the property
+ */
+ public void setAllTargets(String allTargets) {
+ this.allTargets = allTargets;
+ }
+
+ /**
+ * A reference to the path containing all the sources files.
+ *
+ * @param outputSourcesPath the name of the reference
+ */
+ public void setOutputSourcesPath(String outputSourcesPath) {
+ this.outputSourcesPath = outputSourcesPath;
+ }
+
+ /**
+ * optional nested delete element
+ * @return an element to be configured
+ */
+ public DeleteTargets createDeleteTargets() {
+ deleteTargets = new DeleteTargets();
+ return deleteTargets;
+ }
+
+ /**
+ * Embedded do parallel
+ * @param doTask the parallel to embed
+ */
+ public void addParallel(Parallel doTask) {
+ if (this.doTask != null) {
+ throw new BuildException(
+ "You must not nest more that one <parallel> or <sequential>"
+ + " into <outofdate>");
+ }
+ this.doTask = doTask;
+ }
+
+ /**
+ * Embedded do sequential.
+ * @param doTask the sequential to embed
+ */
+ public void addSequential(Sequential doTask) {
+ if (this.doTask != null) {
+ throw new BuildException(
+ "You must not nest more that one <parallel> or <sequential>"
+ + " into <outofdate>");
+ }
+ this.doTask = doTask;
+ }
+
+ /**
+ * Evaluate (all) target and source file(s) to
+ * see if the target(s) is/are outoutdate.
+ * @return true if any of the targets are outofdate
+ */
+ public boolean eval() {
+ boolean ret = false;
+ FileUtils fileUtils = FileUtils.newFileUtils();
+ if (sourcepaths == null) {
+ throw new BuildException(
+ "You must specify a <sourcefiles> element.");
+ }
+
+ if (targetpaths == null && mappers.size() == 0) {
+ throw new BuildException(
+ "You must specify a <targetfiles> or <mapper> element.");
+ }
+
+ // Source Paths
+ String[] spaths = sourcepaths.list();
+
+ for (int i = 0; i < spaths.length; i++) {
+ File sourceFile = new File(spaths[i]);
+ if (!sourceFile.exists()) {
+ throw new BuildException(sourceFile.getAbsolutePath()
+ + " not found.");
+ }
+ }
+
+ // Target Paths
+
+ if (targetpaths != null) {
+ String[] paths = targetpaths.list();
+ if (paths.length == 0) {
+ ret = true;
+ }
+ else {
+ for (int i = 0; i < paths.length; ++i) {
+ if (targetNeedsGen(paths[i], spaths)) {
+ ret = true;
+ }
+ }
+ }
+ }
+
+ // Mapper Paths
+ for (Enumeration e = mappers.elements(); e.hasMoreElements();) {
+ MyMapper mapper = (MyMapper) e.nextElement();
+
+ File relativeDir = mapper.getDir();
+ File baseDir = new File(getProject().getProperty("basedir"));
+ if (relativeDir == null) {
+ relativeDir = baseDir;
+ }
+ String[] rpaths = new String[spaths.length];
+ for (int i = 0; i < spaths.length; ++i) {
+ rpaths[i] = fileUtils.removeLeadingPath(relativeDir, new File(spaths[i]));
+ }
+
+ FileNameMapper fileNameMapper = mapper.getImplementation();
+ for (int i = 0; i < spaths.length; ++i) {
+ String[] mapped = fileNameMapper.mapFileName(rpaths[i]);
+ if (mapped != null) {
+ for (int j = 0; j < mapped.length; ++j) {
+ if (outOfDate(new File(spaths[i]),
+ fileUtils.resolveFile(
+ baseDir, mapped[j]))) {
+ ret = true;
+ }
+ }
+ }
+ }
+ }
+
+ if (allTargets != null) {
+ this.getProject().setNewProperty(
+ allTargets, setToString(allTargetSet));
+ }
+
+ if (allTargetsPath != null) {
+ this.getProject().addReference(
+ allTargetsPath, setToPath(allTargetSet));
+ }
+
+ if (outputSources != null) {
+ this.getProject().setNewProperty(
+ outputSources, setToString(sourceSet));
+ }
+
+ if (outputTargets != null) {
+ this.getProject().setNewProperty(
+ outputTargets, setToString(targetSet));
+ }
+
+ if (outputSourcesPath != null) {
+ this.getProject().addReference(
+ outputSourcesPath, setToPath(sourceSet));
+ }
+
+ if (outputTargetsPath != null) {
+ this.getProject().addReference(
+ outputTargetsPath, setToPath(targetSet));
+ }
+
+ if (force) {
+ ret = true;
+ }
+
+ if (ret && deleteTargets != null) {
+ deleteTargets.execute();
+ }
+
+ if (ret) {
+ if (property != null) {
+ this.getProject().setNewProperty(property, value);
+ }
+ }
+
+ return ret;
+ }
+
+ private boolean targetNeedsGen(String target, String[] spaths) {
+ boolean ret = false;
+ File targetFile = new File(target);
+ for (int i = 0; i < spaths.length; i++) {
+ if (outOfDate(new File(spaths[i]), targetFile)) {
+ ret = true;
+ }
+ }
+ // Special case : there are no source files, make sure the
+ // targets exist
+ if (spaths.length == 0) {
+ if (outOfDate(null, targetFile)) {
+ ret = true;
+ }
+ }
+ return ret;
+ }
+
+ /**
+ * Call evalute and return an iterator over the result
+ * @return an iterator over the result
+ */
+ public Iterator iterator() {
+ // Perhaps should check the result and return
+ // an empty set if it returns false
+ eval();
+
+ switch (collection) {
+ case CollectionEnum.SOURCES:
+ return sourceSet.values().iterator();
+ case CollectionEnum.TARGETS:
+ return targetSet.values().iterator();
+ case CollectionEnum.ALLSOURCES:
+ return allSourceSet.values().iterator();
+ case CollectionEnum.ALLTARGETS:
+ return allTargetSet.values().iterator();
+ default:
+ return sourceSet.values().iterator();
+ }
+ }
+
+ /**
+ * Sets property to true and/or executes embedded do
+ * if any of the target file(s) do not have a more recent timestamp
+ * than (each of) the source file(s).
+ */
+ public void execute() {
+ if (!eval()) {
+ return;
+ }
+
+ if (doTask != null) {
+ doTask.perform();
+ }
+
+ }
+
+
+ private boolean outOfDate(File sourceFile, File targetFile) {
+ boolean ret = false;
+ if (sourceFile != null) {
+ allSourceSet.put(sourceFile, sourceFile);
+ }
+ allTargetSet.put(targetFile, targetFile);
+ if (!targetFile.exists()) {
+ ret = true;
+ }
+ if ((!ret) && (sourceFile != null)) {
+ ret = sourceFile.lastModified() > targetFile.lastModified();
+ }
+ if (ret) {
+ if ((sourceFile != null && sourceSet.get(sourceFile) == null)
+ || targetSet.get(targetFile) == null) {
+ log("SourceFile " + sourceFile + " outofdate "
+ + "with regard to " + targetFile, verbosity);
+ }
+ if (sourceFile != null) {
+ sourceSet.put(sourceFile, sourceFile);
+ }
+ targetSet.put(targetFile, targetFile);
+ }
+ return ret;
+ }
+
+ private String setToString(Hashtable set) {
+ StringBuffer b = new StringBuffer();
+ for (Enumeration e = set.keys(); e.hasMoreElements();) {
+ File v = (File) e.nextElement();
+ if (b.length() != 0) {
+ b.append(separator);
+ }
+ String s = v.getAbsolutePath();
+ // DOTO: The following needs more work!
+ // Handle paths contains sep
+ if (s.indexOf(separator) != -1) {
+ if (s.indexOf("\"") != -1) {
+ s = "'" + s + "'";
+ } else {
+ s = "\"" + s + "\"";
+ }
+ }
+ b.append(s);
+ }
+ return b.toString();
+ }
+
+ private Path setToPath(Hashtable set) {
+ Path ret = new Path(getProject());
+ for (Enumeration e = set.keys(); e.hasMoreElements();) {
+ File v = (File) e.nextElement();
+ Path.PathElement el = ret.createPathElement();
+ el.setLocation(v);
+ }
+ return ret;
+ }
+
+ /**
+ * nested delete targets
+ */
+ public class DeleteTargets {
+ private boolean all = false;
+ private boolean quiet = false;
+ private boolean failOnError = false;
+
+ private int myLogging = Project.MSG_INFO;
+
+ /**
+ * whether to delete all the targets
+ * or just those that are newer than the
+ * corresponding sources.
+ * @param all true to delete all, default false
+ */
+ public void setAll(boolean all) {
+ this.all = all;
+ }
+
+ /**
+ * @param quiet if true suppress messages on deleting files
+ */
+ public void setQuiet(boolean quiet) {
+ this.quiet = quiet;
+ myLogging = quiet ? Project.MSG_VERBOSE : Project.MSG_INFO;
+ }
+
+ /**
+ * @param failOnError if true halt if there is a failure to delete
+ */
+ public void setFailOnError(boolean failOnError) {
+ this.failOnError = failOnError;
+ }
+
+ private void execute() {
+ if (myLogging != Project.MSG_INFO) {
+ myLogging = verbosity;
+ }
+
+ // Quiet overrides failOnError
+ if (quiet) {
+ failOnError = false;
+ }
+
+ Path toBeDeleted = null;
+ if (all) {
+ toBeDeleted = setToPath(allTargetSet);
+ } else {
+ toBeDeleted = setToPath(targetSet);
+ }
+
+ String[] names = toBeDeleted.list();
+ for (int i = 0; i < names.length; ++i) {
+ File file = new File(names[i]);
+ if (!file.exists()) {
+ continue;
+ }
+ if (file.isDirectory()) {
+ removeDir(file);
+ continue;
+ }
+ log("Deleting " + file.getAbsolutePath(), myLogging);
+ if (!file.delete()) {
+ String message =
+ "Unable to delete file " + file.getAbsolutePath();
+ if (failOnError) {
+ throw new BuildException(message);
+ } else {
+ log(message, myLogging);
+ }
+ }
+ }
+ }
+
+ private static final int DELETE_RETRY_SLEEP_MILLIS = 10;
+ /**
+ * Attempt to fix possible race condition when deleting
+ * files on WinXP. If the delete does not work,
+ * wait a little and try again.
+ */
+ private boolean delete(File f) {
+ if (!f.delete()) {
+ try {
+ Thread.sleep(DELETE_RETRY_SLEEP_MILLIS);
+ return f.delete();
+ } catch (InterruptedException ex) {
+ return f.delete();
+ }
+ }
+ return true;
+ }
+
+ private void removeDir(File d) {
+ String[] list = d.list();
+ if (list == null) {
+ list = new String[0];
+ }
+ for (int i = 0; i < list.length; i++) {
+ String s = list[i];
+ File f = new File(d, s);
+ if (f.isDirectory()) {
+ removeDir(f);
+ } else {
+ log("Deleting " + f.getAbsolutePath(), myLogging);
+ if (!f.delete()) {
+ String message = "Unable to delete file "
+ + f.getAbsolutePath();
+ if (failOnError) {
+ throw new BuildException(message);
+ } else {
+ log(message, myLogging);
+ }
+ }
+ }
+ }
+ log("Deleting directory " + d.getAbsolutePath(), myLogging);
+ if (!delete(d)) {
+ String message = "Unable to delete directory "
+ + d.getAbsolutePath();
+ if (failOnError) {
+ throw new BuildException(message);
+ } else {
+ log(message, myLogging);
+ }
+ }
+ }
+ }
+
+ /**
+ * Wrapper for mapper - includes dir
+ */
+ public static class MyMapper extends Mapper {
+ private File dir = null;
+ /**
+ * Creates a new <code>MyMapper</code> instance.
+ *
+ * @param project the current project
+ */
+ public MyMapper(Project project) {
+ super(project);
+ }
+
+ /**
+ * @param dir the directory that the from files are relative to
+ */
+ public void setDir(File dir) {
+ this.dir = dir;
+ }
+
+ /**
+ * @return the directory that the from files are relative to
+ */
+ public File getDir() {
+ return dir;
+ }
+ }
+}
+
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/de/a0586196c4cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/de/a0586196c4cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..c94e05d
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/de/a0586196c4cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,440 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Resource;
+import org.apache.tools.ant.types.ResourceCollection;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ * @author Matt Inger
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+ private List resourceCollections = new ArrayList();
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ public void add(ResourceCollection resourceCollection) {
+ this.resourceCollections.add(resourceCollection);
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && resourceCollections.isEmpty() && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or resources or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ Iterator it = resourceCollections.iterator();
+ while (it.hasNext()) {
+ ResourceCollection c = (ResourceCollection) it.next();
+ Iterator rit = c.iterator();
+ while (rit.hasNext()) {
+ Resource r = (Resource) rit.next();
+ doToken(r.toString());
+ }
+ }
+
+ it = hasIterators.iterator();
+ while (it.hasNext()) {
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void add(FileSet fileset) {
+ getOrCreatePath().addFileset(fileset);
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void addFileSet(FileSet fileset) {
+ add(fileset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void add(DirSet dirset) {
+ getOrCreatePath().addDirset(dirset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void addDirSet(DirSet dirset) {
+ add(dirset);
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e/70db95b7dacc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/e/70db95b7dacc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..f80490d
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e/70db95b7dacc001b1cb5d1e6b2b8577e
@@ -0,0 +1,7 @@
+<XDtClass:forAllClasses>
+<XDtClass:fullClassName />
+<XDtClass:ifHasClassTag tagName="ant:task" paramName="name">
+<XDtClass:classTagValue tagName="ant:task" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag>
+</XDtClass:forAllClasses>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e/c0a5f93ae8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/e/c0a5f93ae8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..53c4434
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e/c0a5f93ae8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.condition;
+
+import java.lang.reflect.Field;
+import java.util.Vector;
+
+import org.apache.tools.ant.taskdefs.condition.ConditionBase;
+
+/**
+ * Extends ConditionBase so I can get access to the condition count and the
+ * first condition. This is the class that the BooleanConditionTask is proxy
+ * for.
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ *
+ * @author Dale Anson, [email protected]
+ */
+public class BooleanConditionBase extends ConditionBase {
+
+ private Vector conditions;
+
+ public BooleanConditionBase() {
+ this.conditions = getConditions();
+ }
+
+ private Vector getParentConditions() {
+ Field f = ConditionBase.class.getDeclaredField("conditions");
+ f.setAccessible(true);
+ Vector v = (Vector) f.get(this);
+ return v;
+ }
+ /**
+ * Adds a feature to the IsPropertyTrue attribute of the BooleanConditionBase
+ * object
+ *
+ * @param i The feature to be added to the IsPropertyTrue attribute
+ */
+ public void addIsPropertyTrue( IsPropertyTrue i ) {
+ getConditions().add( i );
+ }
+
+ /**
+ * Adds a feature to the IsPropertyFalse attribute of the
+ * BooleanConditionBase object
+ *
+ * @param i The feature to be added to the IsPropertyFalse attribute
+ */
+ public void addIsPropertyFalse( IsPropertyFalse i ) {
+ getConditions().add( i );
+ }
+
+ public void addIsGreaterThan( IsGreaterThan i) {
+ getConditions().add(i);
+ }
+
+ public void addIsLessThan( IsLessThan i) {
+ getConditions().add(i);
+ }
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e6/a061da8cc4cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/e6/a061da8cc4cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..f648b6a
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e6/a061da8cc4cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,439 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Resource;
+import org.apache.tools.ant.types.ResourceCollection;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ * @author Matt Inger
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+ private List resourceCollections = new ArrayList();
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ public void add(ResourceCollection resourceCollection) {
+ this.resourceCollections.add(resourceCollection);
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && resourceCollections.isEmpty() && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or resources or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ Iterator it = resourceCollections.iterator();
+ while (it.hasNext()) {
+ ResourceCollection c = (ResourceCollection) it.next();
+ Iterator rit = c.iterator();
+ while (rit.hasNext()) {
+ Resource r = (Resource) rit.next();
+ doToken(r.toString());
+ }
+ }
+
+ it = hasIterators.iterator();
+ while (it.hasNext()) {
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void add(FileSet fileset) {
+ getOrCreatePath().addFileset(fileset);
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void addFileSet(FileSet fileset) {
+ add(fileset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void add(DirSet dirset) {
+ getOrCreatePath().addDirset(dirset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void addDirSet(DirSet dirset) {
+ add(dirset);
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e7/4049f8f4decc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/e7/4049f8f4decc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..16b87ca
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e7/4049f8f4decc001b1cb5d1e6b2b8577e
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+/**
+ * Ant task that runs a target without creating a new project.
+ *
+ * @author Nicola Ken Barozzi [email protected]
+ */
+public class RunTargetTask extends Task {
+
+ private String target = null;
+
+ /**
+ * The target attribute
+ *
+ * @param target the name of a target to execute
+ */
+ public void setTarget(String target) {
+ this.target = target;
+ }
+
+ /**
+ * execute the target
+ *
+ * @exception BuildException if a target is not specified
+ */
+ public void execute() throws BuildException {
+ if (target == null) {
+ throw new BuildException("target property required");
+ }
+
+ getProject().executeTarget(target);
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e7/8035943de2cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/e7/8035943de2cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..fa5bc08
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e7/8035943de2cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.methods.PostMethod;
+
+/***
+ *
+ * @author minger
+ * @ant.task name="headmethod"
+ *
+ */
+public class HeadMethodTask
+ extends AbstractMethodTask {
+
+ protected HttpMethodBase createNewMethod() {
+ return new PostMethod();
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e8/10892647e0cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/e8/10892647e0cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..23328c4
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e8/10892647e0cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.property;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.types.RegularExpression;
+import org.apache.tools.ant.util.regexp.Regexp;
+
+
+/****************************************************************************
+ * Place class description here.
+ *
+ * @author <a href='mailto:[email protected]'>Matthew Inger</a>
+ * @author <additional author>
+ *
+ * @since
+ *
+ ****************************************************************************/
+
+
+public class PropertySelector
+ extends AbstractPropertySetterTask
+{
+ private RegularExpression match;
+ private String select = "\\0";
+ private char delim = ',';
+ private boolean caseSensitive = true;
+ private boolean distinct = false;
+
+
+ public PropertySelector()
+ {
+ super();
+ }
+
+
+ public void setMatch(String match)
+ {
+ this.match = new RegularExpression();
+ this.match.setPattern(match);
+ }
+
+
+ public void setSelect(String select)
+ {
+ this.select = select;
+ }
+
+
+ public void setCaseSensitive(boolean caseSensitive)
+ {
+ this.caseSensitive = caseSensitive;
+ }
+
+
+ public void setDelimiter(char delim)
+ {
+ this.delim = delim;
+ }
+
+
+ public void setDistinct(boolean distinct)
+ {
+ this.distinct = distinct;
+ }
+
+
+ protected void validate()
+ {
+ super.validate();
+ if (match == null)
+ throw new BuildException("No match expression specified.");
+ }
+
+
+ public void execute()
+ throws BuildException
+ {
+ validate();
+
+ int options = 0;
+ if (!caseSensitive)
+ options |= Regexp.MATCH_CASE_INSENSITIVE;
+
+ Regexp regex = match.getRegexp(project);
+ Hashtable props = project.getProperties();
+ Enumeration e = props.keys();
+ StringBuffer buf = new StringBuffer();
+ int cnt = 0;
+
+ Vector used = new Vector();
+
+ while (e.hasMoreElements())
+ {
+ String key = (String) (e.nextElement());
+ if (regex.matches(key, options))
+ {
+ String output = select;
+ Vector groups = regex.getGroups(key, options);
+ int sz = groups.size();
+ for (int i = 0; i < sz; i++)
+ {
+ String s = (String) (groups.elementAt(i));
+
+ RegularExpression result = null;
+ result = new RegularExpression();
+ result.setPattern("\\\\" + i);
+ Regexp sregex = result.getRegexp(project);
+ output = sregex.substitute(output, s, Regexp.MATCH_DEFAULT);
+ }
+
+ if (!(distinct && used.contains(output)))
+ {
+ used.addElement(output);
+ if (cnt != 0) buf.append(delim);
+ buf.append(output);
+ cnt++;
+ }
+ }
+ }
+
+ if (buf.length() > 0)
+ setPropertyValue(buf.toString());
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e8/1094a711dfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/e8/1094a711dfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..11d31bf
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e8/1094a711dfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,242 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.Enumeration;
+import java.util.Vector;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.Sequential;
+
+/**
+ * A wrapper that lets you run a set of tasks and optionally run a
+ * different set of tasks if the first set fails and yet another set
+ * after the first one has finished.
+ *
+ * <p>This mirrors Java's try/catch/finally.</p>
+ *
+ * <p>The tasks inside of the required <code>&lt;try&gt;</code>
+ * element will be run. If one of them should throw a {@link
+ * org.apache.tools.ant.BuildException BuildException} several things
+ * can happen:</p>
+ *
+ * <ul>
+ * <li>If there is no <code>&lt;catch&gt;</code> block, the
+ * exception will be passed through to Ant.</li>
+ *
+ * <li>If the property attribute has been set, a property of the
+ * given name will be set to the message of the exception.</li>
+ *
+ * <li>If the reference attribute has been set, a reference of the
+ * given id will be created and point to the exception object.</li>
+ *
+ * <li>If there is a <code>&lt;catch&gt;</code> block, the tasks
+ * nested into it will be run.</li>
+ * </ul>
+ *
+ * <p>If a <code>&lt;finally&gt;</code> block is present, the task
+ * nested into it will be run, no matter whether the first tasks have
+ * thrown an exception or not.</p>
+ *
+ * <p><strong>Attributes:</strong></p>
+ *
+ * <table>
+ * <tr>
+ * <td>Name</td>
+ * <td>Description</td>
+ * <td>Required</td>
+ * </tr>
+ * <tr>
+ * <td>property</td>
+ * <td>Name of a property that will receive the message of the
+ * exception that has been caught (if any)</td>
+ * <td>No</td>
+ * </tr>
+ * <tr>
+ * <td>reference</td>
+ * <td>Id of a reference that will point to the exception object
+ * that has been caught (if any)</td>
+ * <td>No</td>
+ * </tr>
+ * </table>
+ *
+ * <p>Use the following task to define the <code>&lt;trycatch&gt;</code>
+ * task before you use it the first time:</p>
+ *
+ * <pre><code>
+ * &lt;taskdef name="trycatch"
+ * classname="net.sf.antcontrib.logic.TryCatchTask" /&gt;
+ * </code></pre>
+ *
+ * <h3>Crude Example</h3>
+ *
+ * <pre><code>
+ * &lt;trycatch property=&quot;foo&quot; reference=&quot;bar&quot;&gt;
+ * &lt;try&gt;
+ * &lt;fail&gt;Tada!&lt;/fail&gt;
+ * &lt;/try&gt;
+ *
+ * &lt;catch&gt;
+ * &lt;echo&gt;In &amp;lt;catch&amp;gt;.&lt;/echo&gt;
+ * &lt;/catch&gt;
+ *
+ * &lt;finally&gt;
+ * &lt;echo&gt;In &amp;lt;finally&amp;gt;.&lt;/echo&gt;
+ * &lt;/finally&gt;
+ * &lt;/trycatch&gt;
+ *
+ * &lt;echo&gt;As property: ${foo}&lt;/echo&gt;
+ * &lt;property name=&quot;baz&quot; refid=&quot;bar&quot; /&gt;
+ * &lt;echo&gt;From reference: ${baz}&lt;/echo&gt;
+ * </code></pre>
+ *
+ * <p>results in</p>
+ *
+ * <pre><code>
+ * [trycatch] Caught exception: Tada!
+ * [echo] In &lt;catch&gt;.
+ * [echo] In &lt;finally&gt;.
+ * [echo] As property: Tada!
+ * [echo] From reference: Tada!
+ * </code></pre>
+ *
+ * @author <a href="mailto:[email protected]">Stefan Bodewig</a>
+ * @author <a href="mailto:[email protected]">Dan Ritchey</a>
+ */
+public class TryCatchTask extends Task {
+
+ public static final class CatchBlock extends Sequential {
+ private String throwable = BuildException.class.getName();
+
+ public CatchBlock() {
+ super();
+ }
+
+ public void setThrowable(String throwable) {
+ this.throwable = throwable;
+ }
+
+ public boolean execute(Throwable t) throws BuildException {
+ try {
+ Class c = Thread.currentThread().getContextClassLoader().loadClass(throwable);
+ if (c.isAssignableFrom(t.getClass())) {
+ execute();
+ return true;
+ }
+ return false;
+ }
+ catch (ClassNotFoundException e) {
+ throw new BuildException(e);
+ }
+ }
+ }
+
+
+ private Sequential tryTasks = null;
+ private Vector catchBlocks = new Vector();
+ private Sequential finallyTasks = null;
+ private String property = null;
+ private String reference = null;
+
+ /**
+ * Adds a nested &lt;try&gt; block - one is required, more is
+ * forbidden.
+ */
+ public void addTry(Sequential seq) throws BuildException {
+ if (tryTasks != null) {
+ throw new BuildException("You must not specify more than one <try>");
+ }
+
+ tryTasks = seq;
+ }
+
+ public void addCatch(CatchBlock cb) {
+ catchBlocks.add(cb);
+ }
+
+ /**
+ * Adds a nested &lt;finally&gt; block - at most one is allowed.
+ */
+ public void addFinally(Sequential seq) throws BuildException {
+ if (finallyTasks != null) {
+ throw new BuildException("You must not specify more than one <finally>");
+ }
+
+ finallyTasks = seq;
+ }
+
+ /**
+ * Sets the property attribute.
+ */
+ public void setProperty(String p) {
+ property = p;
+ }
+
+ /**
+ * Sets the reference attribute.
+ */
+ public void setReference(String r) {
+ reference = r;
+ }
+
+ /**
+ * The heart of the task.
+ */
+ public void execute() throws BuildException {
+ Throwable thrown = null;
+
+ if (tryTasks == null) {
+ throw new BuildException("A nested <try> element is required");
+ }
+
+ try {
+ tryTasks.perform();
+ } catch (Throwable e) {
+ if (property != null) {
+ /*
+ * Using setProperty instead of setNewProperty to
+ * be able to compile with Ant < 1.5.
+ */
+ getProject().setProperty(property, e.getMessage());
+ }
+
+ if (reference != null) {
+ getProject().addReference(reference, e);
+ }
+
+ boolean executed = false;
+ Enumeration blocks = catchBlocks.elements();
+ while (blocks.hasMoreElements() && ! executed) {
+ CatchBlock cb = (CatchBlock)blocks.nextElement();
+ executed = cb.execute(e);
+ }
+
+ if (! executed) {
+ thrown = e;
+ }
+ } finally {
+ if (finallyTasks != null) {
+ finallyTasks.perform();
+ }
+ }
+
+ if (thrown != null) {
+ throw new BuildException(thrown);
+ }
+ }
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e8/607592f9dfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/e8/607592f9dfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..5de4163
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e8/607592f9dfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.perf;
+
+import java.util.Hashtable;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+/**
+ * Assists in timing tasks and/or targets.
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ * @author Dale Anson, [email protected]
+ * @version $Revision: 1.5 $
+ */
+public class StopWatchTask extends Task {
+
+ // storage for stopwatch name
+ private String name = null;
+
+ // storage for action
+ private String action = null;
+
+ // storage for watches
+ private static Hashtable watches = null;
+
+ // action definitions
+ private static final String STOP = "stop";
+ private static final String START = "start";
+ private static final String ELAPSED = "elapsed";
+ private static final String TOTAL = "total";
+
+
+ public void setName( String name ) {
+ this.name = name;
+ }
+
+ public void setAction( String action ) {
+ action = action.toLowerCase();
+ if ( action.equals( STOP ) ||
+ action.equals( START ) ||
+ action.equals( ELAPSED ) ||
+ action.equals( TOTAL ) ) {
+ this.action = action;
+ }
+ else {
+ throw new BuildException( "invalid action: " + action );
+ }
+ }
+
+ public void execute() {
+ if ( name == null )
+ throw new BuildException( "name is null" );
+ if ( action == null )
+ action = START;
+ if ( watches == null )
+ watches = new Hashtable();
+ StopWatch sw = ( StopWatch ) watches.get( name );
+ if ( sw == null && action.equals( START ) ) {
+ sw = new StopWatch( name );
+ watches.put( name, sw );
+ return ;
+ }
+ if ( sw == null )
+ return ;
+ if ( action.equals( START) ) {
+ sw.start();
+ return;
+ }
+ if ( action.equals( STOP ) ) {
+ sw.stop();
+ return ;
+ }
+ if ( action.equals( TOTAL ) ) {
+ String time = sw.format( sw.total() );
+ log( "[" + name + ": " + time + "]" );
+ getProject().setProperty(name, time);
+ return ;
+ }
+ if ( action.equals( ELAPSED ) ) {
+ String time = sw.format( sw.elapsed() );
+ log( "[" + name + ": " + time + "]" );
+ getProject().setProperty(name, time);
+ return ;
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e9/202e0baae8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/e9/202e0baae8cc001b1cb5d1e6b2b8577e
new file mode 100755
index 0000000..6203b27
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e9/202e0baae8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,280 @@
+/*
+ * Copyright (c) 2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.text.ParseException;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Expand;
+import org.apache.tools.ant.taskdefs.ImportTask;
+
+import fr.jayasoft.ivy.Artifact;
+import fr.jayasoft.ivy.DependencyResolver;
+import fr.jayasoft.ivy.Ivy;
+import fr.jayasoft.ivy.IvyContext;
+import fr.jayasoft.ivy.ModuleDescriptor;
+import fr.jayasoft.ivy.ModuleId;
+import fr.jayasoft.ivy.ModuleRevisionId;
+import fr.jayasoft.ivy.filter.FilterHelper;
+import fr.jayasoft.ivy.report.ResolveReport;
+import fr.jayasoft.ivy.repository.Repository;
+import fr.jayasoft.ivy.resolver.FileSystemResolver;
+import fr.jayasoft.ivy.resolver.IvyRepResolver;
+import fr.jayasoft.ivy.resolver.URLResolver;
+import fr.jayasoft.ivy.util.MessageImpl;
+
+/***
+ * Task to import a build file from a url. The build file can be a build.xml,
+ * or a .zip/.jar, in which case we download and extract the entire archive, and
+ * import the file "build.xml"
+ * @author inger
+ * @ant.task name="importurl" onerror="ignore"
+ *
+ */
+public class URLImportTask
+ extends ImportTask {
+
+ private String org;
+ private String module;
+ private String rev = "latest.integration";
+ private String type = "jar";
+ private String repositoryUrl;
+ private String repositoryDir;
+ private URL ivyConfUrl;
+ private File ivyConfFile;
+ private String resource = "build.xml";
+ private String artifactPattern = "/[org]/[module]/[ext]s/[module]-[revision].[ext]";
+ private String ivyPattern = "/[org]/[module]/ivy-[revision].xml";
+ private boolean verbose = false;
+
+ public void setVerbose(boolean verbose) {
+ this.verbose = verbose;
+ }
+
+ public void setModule(String module) {
+ this.module = module;
+ }
+
+ public void setOrg(String org) {
+ this.org = org;
+ }
+
+ public void setRev(String rev) {
+ this.rev = rev;
+ }
+
+ public void setIvyConfFile(File ivyConfFile) {
+ this.ivyConfFile = ivyConfFile;
+ }
+
+ public void setIvyConfUrl(URL ivyConfUrl) {
+ this.ivyConfUrl = ivyConfUrl;
+ }
+
+ public void setArtifactPattern(String artifactPattern) {
+ this.artifactPattern = artifactPattern;
+ }
+
+ public void setIvyPattern(String ivyPattern) {
+ this.ivyPattern = ivyPattern;
+ }
+
+ public void setRepositoryDir(String repositoryDir) {
+ this.repositoryDir = repositoryDir;
+ }
+
+ public void setRepositoryUrl(String repositoryUrl) {
+ this.repositoryUrl = repositoryUrl;
+ }
+
+ public void setResource(String resource) {
+ this.resource = resource;
+ }
+
+ public void setOptional(boolean optional) {
+ throw new BuildException("'optional' property not accessed for ImportURL.");
+ }
+
+ public void setFile(String file) {
+ throw new BuildException("'file' property not accessed for ImportURL.");
+ }
+
+ public void execute()
+ throws BuildException {
+
+ MessageImpl oldMsgImpl = IvyContext.getContext().getMessageImpl();
+
+ if (! verbose) {
+ IvyContext.getContext().setMessageImpl(
+ new MessageImpl() {
+
+ public void endProgress(String arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void log(String arg0, int arg1) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void progress() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void rawlog(String arg0, int arg1) {
+ }
+ }
+ );
+ }
+ Ivy ivy = new Ivy();
+ DependencyResolver resolver = null;
+ Repository rep = null;
+
+
+ if (repositoryUrl != null) {
+ resolver = new URLResolver();
+ ((URLResolver)resolver).addArtifactPattern(
+ repositoryUrl + "/" + artifactPattern
+ );
+ ((URLResolver)resolver).addIvyPattern(
+ repositoryUrl + "/" + ivyPattern
+ );
+ resolver.setName("default");
+ }
+ else if (repositoryDir != null) {
+ resolver = new FileSystemResolver();
+ ((FileSystemResolver)resolver).addArtifactPattern(
+ repositoryDir + "/" + artifactPattern
+ );
+ ((FileSystemResolver)resolver).addIvyPattern(
+ repositoryDir + "/" + ivyPattern
+ );
+ }
+ else if (ivyConfUrl != null) {
+ try {
+ ivy.configure(ivyConfUrl);
+ resolver = ivy.getDefaultResolver();
+ }
+ catch (IOException e) {
+ throw new BuildException(e);
+ }
+ catch (ParseException e) {
+ throw new BuildException(e);
+ }
+ }
+ else if (ivyConfFile != null) {
+ try {
+ ivy.configure(ivyConfFile);
+ }
+ catch (IOException e) {
+ throw new BuildException(e);
+ }
+ catch (ParseException e) {
+ throw new BuildException(e);
+ }
+ }
+ else {
+ resolver = new IvyRepResolver();
+ }
+ resolver.setName("default");
+ ivy.addResolver(resolver);
+ ivy.setDefaultResolver(resolver.getName());
+
+
+ try {
+ ModuleId moduleId =
+ new ModuleId(org, module);
+ ModuleRevisionId revId =
+ new ModuleRevisionId(moduleId, rev);
+
+ ResolveReport resolveReport = ivy.resolve(
+ ModuleRevisionId.newInstance(org, module, rev),
+ new String[] { "*" },
+ false,
+ true,
+ ivy.getDefaultCache(),
+ new Date(),
+ ivy.doValidate(),
+ false,
+ false,
+ FilterHelper.getArtifactTypeFilter(type));
+
+ if (resolveReport.hasError()) {
+ throw new BuildException("Could not resolve resource for: " +
+ "org=" + org +
+ ";module=" + module +
+ ";rev=" + rev);
+ }
+
+ ModuleDescriptor desc = resolveReport.getModuleDescriptor();
+ List artifacts = resolveReport.getArtifacts();
+ Artifact artifact = (Artifact) artifacts.get(0);
+ log("Fetched " +
+ artifact.getModuleRevisionId().getOrganisation() + " | " +
+ artifact.getModuleRevisionId().getName() + " | " +
+ artifact.getModuleRevisionId().getRevision());
+ File file = ivy.getArchiveFileInCache(ivy.getDefaultCache(), artifact);
+
+ File importFile = null;
+
+ if ("xml".equalsIgnoreCase(type)) {
+ importFile = file;
+ }
+ else if ("jar".equalsIgnoreCase(type) ||
+ "zip".equalsIgnoreCase(type)) {
+ File dir = new File(file.getParentFile(),
+ file.getName() + ".extracted");
+ if (! dir.exists() ||
+ dir.lastModified() < file.lastModified()) {
+ dir.mkdir();
+ Expand expand = (Expand)getProject().createTask("unjar");
+ expand.setSrc(file);
+ expand.setDest(dir);
+ expand.perform();
+ }
+ importFile = new File(dir, resource);
+ if (! importFile.exists()) {
+ throw new BuildException("Cannot find a '" + resource + "' file in " +
+ file.getName());
+ }
+ }
+ else {
+ throw new BuildException("Don't know what to do with type: " + type);
+ }
+
+ super.setFile(importFile.getAbsolutePath());
+ super.execute();
+ log("Import complete.", Project.MSG_INFO);
+ }
+ catch (ParseException e) {
+ throw new BuildException(e);
+ }
+ catch (IOException e) {
+ throw new BuildException(e);
+ }
+ finally {
+ IvyContext.getContext().setMessageImpl(oldMsgImpl);
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/eb/10ee020ce4cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/eb/10ee020ce4cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..c1d824c
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/eb/10ee020ce4cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.ant16;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Exit;
+import org.apache.tools.ant.taskdefs.Sequential;
+import org.apache.tools.ant.taskdefs.condition.Condition;
+import org.apache.tools.ant.taskdefs.condition.ConditionBase;
+import org.apache.tools.ant.taskdefs.condition.Equals;
+
+
+/**
+ *
+ * @ant.task name="assert"
+ */
+public class Assert
+ extends ConditionBase {
+
+ private String message;
+ private boolean failOnError = true;
+ private boolean execute = true;
+ private Sequential sequential;
+ private String name;
+ private String value;
+
+ public Sequential createSequential() {
+ this.sequential = (Sequential) getProject().createTask("sequential");
+ return this.sequential;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public ConditionBase createBool() {
+ return this;
+ }
+
+ public void setExecute(boolean execute) {
+ this.execute = execute;
+ }
+
+ public void setFailOnError(boolean failOnError) {
+ this.failOnError = failOnError;
+ }
+
+ public void execute() {
+ String enable = getProject().getProperty("ant.enable.asserts");
+ boolean assertsEnabled = Project.toBoolean(enable);
+
+ if (assertsEnabled) {
+ if (name != null) {
+ if (value == null) {
+ throw new BuildException("The 'value' attribute must accompany the 'name' attribute.");
+ }
+ String propVal = getProject().replaceProperties("${" + name + "}");
+ Equals e = new Equals();
+ e.setArg1(propVal);
+ e.setArg2(value);
+ addEquals(e);
+ }
+
+ if (countConditions() == 0) {
+ throw new BuildException("There is no condition specified.");
+ }
+ else if (countConditions() > 1) {
+ throw new BuildException("There must be exactly one condition specified.");
+ }
+
+ Condition c = (Condition) getConditions().nextElement();
+ if (! c.eval()) {
+ if (failOnError) {
+ Exit fail = (Exit) getProject().createTask("fail");
+ fail.setMessage(message);
+ fail.execute();
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ec/00c9fb38dfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/ec/00c9fb38dfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..74006af
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ec/00c9fb38dfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ package net.sf.antcontrib.antserver.server;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+
+/****************************************************************************
+ * Place class description here.
+ *
+ * @author <a href='mailto:[email protected]'>Matthew Inger</a>
+ * @author <additional author>
+ *
+ * @since
+ *
+ ****************************************************************************/
+
+
+public class ServerTask
+ extends Task
+{
+ private Server server;
+ private int port = 17000;
+
+ public ServerTask()
+ {
+ super();
+ }
+
+
+ public void setPort(int port)
+ {
+ this.port = port;
+ }
+
+
+ public void shutdown()
+ {
+ server.stop();
+ }
+
+ public void execute()
+ {
+ try
+ {
+ server = new Server(this, port);
+ server.start();
+ }
+ catch (InterruptedException e)
+ {
+ throw new BuildException(e);
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ec/3014ff87cbcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/ec/3014ff87cbcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..4290c19
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ec/3014ff87cbcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,464 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private Path currPath;
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ private Path getOrCreatePath() {
+ if (currPath == null) {
+ currPath = new Path(getProject());
+ }
+ return currPath;
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfigured(Path path) {
+ getOrCreatePath().append(path);
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfiguredPath(Path path) {
+ addConfigured(path);
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && currPath == null && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or path or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ // Take Care of the path element
+ String[] pathElements = new String[0];
+ if (currPath != null) {
+ pathElements = currPath.list();
+ }
+ for (int i = 0; i < pathElements.length; i++) {
+ File nextFile = new File(pathElements[i]);
+ doToken(nextFile.getAbsolutePath());
+ }
+
+ // Take care of iterators
+ for (Iterator i = hasIterators.iterator(); i.hasNext();) {
+ Iterator it = ((HasIterator) i.next()).iterator();
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void add(FileSet fileset) {
+ getOrCreatePath().addFileset(fileset);
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void addFileSet(FileSet fileset) {
+ add(fileset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void add(DirSet dirset) {
+ getOrCreatePath().addDirset(dirset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void addDirSet(DirSet dirset) {
+ add(dirset);
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ed/003408ede0cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/ed/003408ede0cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..9f6a0cb
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ed/003408ede0cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,7 @@
+<XDtClass:forAllClasses><XDtClass:ifHasClassTag tagName="ant:task"
+><XDtClass:classTagValue tagName="ant:task" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag
+><XDtClass:ifHasClassTag tagName="ant:type"
+><XDtClass:classTagValue tagName="ant:type" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag
+></XDtClass:forAllClasses> \ No newline at end of file
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ed/50e6b142dfcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/ed/50e6b142dfcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..dfffd47
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ed/50e6b142dfcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2004-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.design;
+
+import java.io.File;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.Path;
+
+/**
+ * @author dhiller
+ */
+public class VerifyDesign
+ extends Task
+ implements Log {
+
+ private VerifyDesignDelegate delegate;
+
+ public VerifyDesign() {
+ delegate = new VerifyDesignDelegate(this);
+ }
+
+ public void setJar(File f) {
+ delegate.setJar(f);
+ }
+
+ public void setDesign(File f) {
+ delegate.setDesign(f);
+ }
+
+ public void setCircularDesign(boolean isCircularDesign) {
+ delegate.setCircularDesign(isCircularDesign);
+ }
+
+ public void setDeleteFiles(boolean deleteFiles) {
+ delegate.setDeleteFiles(deleteFiles);
+ }
+
+ public void setFillInBuildException(boolean b) {
+ delegate.setFillInBuildException(b);
+ }
+
+ public void setNeedDeclarationsDefault(boolean b) {
+ delegate.setNeedDeclarationsDefault(b);
+ }
+
+ public void setNeedDependsDefault(boolean b) {
+ delegate.setNeedDependsDefault(b);
+ }
+
+ public void addConfiguredPath(Path path) {
+ delegate.addConfiguredPath(path);
+ }
+ public void execute()
+ throws BuildException {
+ delegate.execute();
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ed/80752b18e5cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/ed/80752b18e5cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..70124bd
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ed/80752b18e5cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Ant;
+
+/**
+ * Subclass of CallTarget which allows us to fetch
+ * properties which are set in the scope of the called
+ * target, and set them in the scope of the calling target.
+ * Normally, these properties are thrown away as soon as the
+ * called target completes execution.
+ *
+ * @author inger
+ * @author Dale Anson, [email protected]
+ * @ant.task name="antfetch"
+ */
+public class AntFetch extends Ant {
+ /** the name of the property to fetch from the new project */
+ private String returnName = null;
+
+ protected ProjectDelegate fakeProject = null;
+
+ public void setProject(Project realProject) {
+ fakeProject = new ProjectDelegate(realProject);
+ super.setProject(fakeProject);
+ }
+
+ /**
+ * Do the execution.
+ *
+ * @exception BuildException Description of the Exception
+ */
+ public void execute() throws BuildException {
+ super.execute();
+
+ // copy back the props if possible
+ if ( returnName != null ) {
+ StringTokenizer st = new StringTokenizer( returnName, "," );
+ while ( st.hasMoreTokens() ) {
+ String name = st.nextToken().trim();
+ String value = fakeProject.getSubproject().getUserProperty( name );
+ if ( value != null ) {
+ getProject().setUserProperty( name, value );
+ }
+ else {
+ value = fakeProject.getSubproject().getProperty( name );
+ if ( value != null ) {
+ getProject().setProperty( name, value );
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Set the property or properties that are set in the new project to be
+ * transfered back to the original project. As with all properties, if the
+ * property already exists in the original project, it will not be overridden
+ * by a different value from the new project.
+ *
+ * @param r the name of a property in the new project to set in the original
+ * project. This may be a comma separate list of properties.
+ */
+ public void setReturn( String r ) {
+ returnName = r;
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ee/40e8b13ee7cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/ee/40e8b13ee7cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..9a68619
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ee/40e8b13ee7cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.CallTarget;
+
+/**
+ * Subclass of Ant which allows us to fetch
+ * properties which are set in the scope of the called
+ * target, and set them in the scope of the calling target.
+ * Normally, these properties are thrown away as soon as the
+ * called target completes execution.
+ *
+ * @author inger
+ * @author Dale Anson, [email protected]
+ * @ant.task name="antcallback"
+ */
+public class AntCallBack extends CallTarget {
+
+ /** the name of the property to fetch from the new project */
+ private String returnName = null;
+
+ /**
+ * Do the execution.
+ *
+ * @exception BuildException Description of the Exception
+ */
+ public void execute() throws BuildException {
+ super.execute();
+
+ // copy back the props if possible
+ if ( returnName != null ) {
+ StringTokenizer st = new StringTokenizer( returnName, "," );
+ while ( st.hasMoreTokens() ) {
+ String name = st.nextToken().trim();
+ String value = super.getProject().getProperty(returnName);
+ if ( value != null ) {
+ getProject().setUserProperty( name, value );
+ }
+ }
+ }
+ }
+
+ /**
+ * Set the property or properties that are set in the new project to be
+ * transfered back to the original project. As with all properties, if the
+ * property already exists in the original project, it will not be overridden
+ * by a different value from the new project.
+ *
+ * @param r the name of a property in the new project to set in the original
+ * project. This may be a comma separate list of properties.
+ */
+ public void setReturn( String r ) {
+ returnName = r;
+ }
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ee/c01f073edbcc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/ee/c01f073edbcc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..744d387
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ee/c01f073edbcc001b1cb5d1e6b2b8577e
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.CallTarget;
+import org.apache.tools.ant.taskdefs.Property;
+
+/**
+ * Subclass of Ant which allows us to fetch
+ * properties which are set in the scope of the called
+ * target, and set them in the scope of the calling target.
+ * Normally, these properties are thrown away as soon as the
+ * called target completes execution.
+ *
+ * @author inger
+ * @author Dale Anson, [email protected]
+ */
+public class AntCallBack extends CallTarget {
+
+ /** the name of the property to fetch from the new project */
+ private String returnName = null;
+
+ private ProjectDelegate fakeProject = null;
+
+ public void setProject(Project realProject) {
+ fakeProject = new ProjectDelegate(realProject);
+ super.setProject(fakeProject);
+ }
+
+ /**
+ * Do the execution.
+ *
+ * @exception BuildException Description of the Exception
+ */
+ public void execute() throws BuildException {
+ super.execute();
+
+ // copy back the props if possible
+ if ( returnName != null ) {
+ StringTokenizer st = new StringTokenizer( returnName, "," );
+ while ( st.hasMoreTokens() ) {
+ String name = st.nextToken().trim();
+ String value = fakeProject.getSubproject().getUserProperty( name );
+ if ( value != null ) {
+ getProject().setUserProperty( name, value );
+ }
+ else {
+ value = fakeProject.getSubproject().getProperty( name );
+ if ( value != null ) {
+ getProject().setProperty( name, value );
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Set the property or properties that are set in the new project to be
+ * transfered back to the original project. As with all properties, if the
+ * property already exists in the original project, it will not be overridden
+ * by a different value from the new project.
+ *
+ * @param r the name of a property in the new project to set in the original
+ * project. This may be a comma separate list of properties.
+ */
+ public void setReturn( String r ) {
+ returnName = r;
+ }
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ee/e0cb4c28dacc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/ee/e0cb4c28dacc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..a717f28
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ee/e0cb4c28dacc001b1cb5d1e6b2b8577e
@@ -0,0 +1,4 @@
+<XDtClass:ifHasClassTag tagName="ant.task" paramName="name">
+<XDtClass:classTagValue tagName="ant.task" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f/50480a4ee7cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/f/50480a4ee7cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..c9a6de2
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f/50480a4ee7cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import net.sf.antcontrib.logic.condition.BooleanConditionBase;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.ProjectHelper;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.TaskContainer;
+import org.apache.tools.ant.taskdefs.Exit;
+import org.apache.tools.ant.taskdefs.Sequential;
+import org.apache.tools.ant.taskdefs.condition.Condition;
+import org.apache.tools.ant.taskdefs.condition.Equals;
+
+
+/**
+ *
+ * @ant.task name="assert"
+ */
+public class Assert
+ extends BooleanConditionBase {
+
+ private List tasks = new ArrayList();
+ private String message;
+ private boolean failOnError = true;
+ private boolean execute = true;
+ private Sequential sequential;
+ private String name;
+ private String value;
+
+ public Sequential createSequential() {
+ this.sequential = (Sequential) getProject().createTask("sequential");
+ return this.sequential;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public BooleanConditionBase createBool() {
+ return this;
+ }
+
+ public void setExecute(boolean execute) {
+ this.execute = execute;
+ }
+
+ public void setFailOnError(boolean failOnError) {
+ this.failOnError = failOnError;
+ }
+
+ public void execute() {
+ String enable = getProject().getProperty("ant.enable.asserts");
+ boolean assertsEnabled = Project.toBoolean(enable);
+
+ if (assertsEnabled) {
+ if (name != null) {
+ if (value == null) {
+ throw new BuildException("The 'value' attribute must accompany the 'name' attribute.");
+ }
+ String propVal = getProject().replaceProperties("${" + name + "}");
+ Equals e = new Equals();
+ e.setArg1(propVal);
+ e.setArg2(value);
+ addEquals(e);
+ }
+
+ if (countConditions() == 0) {
+ throw new BuildException("There is no condition specified.");
+ }
+ else if (countConditions() > 1) {
+ throw new BuildException("There must be exactly one condition specified.");
+ }
+
+ Condition c = (Condition) getConditions().nextElement();
+ if (! c.eval()) {
+ if (failOnError) {
+ Exit fail = (Exit) getProject().createTask("fail");
+ fail.setMessage(message);
+ fail.execute();
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+ else {
+ if (execute) {
+ this.sequential.execute();
+ }
+ }
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f0/003fa905e0cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/f0/003fa905e0cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..851969b
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f0/003fa905e0cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.platform;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+/***
+ * Task definition for the <code>OsFamily</code> task.
+ * This task sets the property indicated in the "property"
+ * attribute with the string representing the operating
+ * system family. Possible values include "unix", "dos", "mac"
+ * and "windows".
+ *
+ * <pre>
+ *
+ * Task Declaration:
+ *
+ * <code>
+ * &lt;taskdef name="osfamily" classname="net.sf.antcontrib.platform.OsFamily" /&gt;
+ * </code>
+ *
+ * Usage:
+ * <code>
+ * &lt;osfamily property="propname" /&gt;
+ * </code>
+ *
+ * Attributes:
+ * property --> The name of the property to set with the OS family name
+ *
+ * </pre>
+ * @author <a href="mailto:[email protected]">Matthew Inger</a>
+ */
+public class OsFamily extends Task
+{
+ private String property;
+
+ public OsFamily()
+ {
+ }
+
+ public void setProperty(String property)
+ {
+ this.property = property;
+ }
+
+ public void execute()
+ throws BuildException
+ {
+ if (property == null)
+ throw new BuildException("The attribute 'property' is required " +
+ "for the OsFamily task.");
+
+ String familyStr = Platform.getOsFamilyName();
+ if (familyStr != null)
+ getProject().setProperty(property, familyStr);
+ }
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f0/4062814be1cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/f0/4062814be1cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..772a4c1
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f0/4062814be1cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,14 @@
+<antlib>
+<XDtClass:forAllClasses><XDtClass:ifHasClassTag tagName="ant:task">
+<taskdef name="<XDtClass:classTagValue tagName="ant:task" paramName="name"/>"
+ classname="<XDtClass:fullClassName />"
+ <XDtClass:ifHasClassTag tagName="ant:task" paramName="ignore">onerror="<XDtClass:classTagValue tagName="ant:task" paramName="ignore"/>"</XDtClass:ifHasClassTag> />
+</XDtClass:ifHasClassTag>
+<XDtClass:ifHasClassTag tagName="ant:type">
+<ypedef name="<XDtClass:classTagValue tagName="ant:type" paramName="name"/>"
+ classname="<XDtClass:fullClassName />"
+ <XDtClass:ifHasClassTag tagName="ant:task" paramName="ignore">onerror="<XDtClass:classTagValue tagName="ant:task" paramName="ignore"/>"</XDtClass:ifHasClassTag> />
+<XDtClass:classTagValue tagName="ant:type" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag
+></XDtClass:forAllClasses>
+</antlib> \ No newline at end of file
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f2/8090c670e5cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/f2/8090c670e5cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..f2c07c1
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f2/8090c670e5cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,391 @@
+package net.sf.antcontrib.logic.ant17;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import org.apache.tools.ant.AntClassLoader;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildListener;
+import org.apache.tools.ant.Executor;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Target;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.input.InputHandler;
+import org.apache.tools.ant.types.FilterSet;
+import org.apache.tools.ant.types.Path;
+
+public class ProjectDelegate
+extends Project {
+
+ private Project delegate;
+ private Project subproject;
+
+ public ProjectDelegate(Project delegate) {
+ super();
+ this.delegate = delegate;
+ }
+
+ public Project getSubproject() {
+ return subproject;
+ }
+
+ public void addBuildListener(BuildListener arg0) {
+ delegate.addBuildListener(arg0);
+ }
+
+ public void addDataTypeDefinition(String arg0, Class arg1) {
+ delegate.addDataTypeDefinition(arg0, arg1);
+ }
+
+ public void addFilter(String arg0, String arg1) {
+ delegate.addFilter(arg0, arg1);
+ }
+
+ public void addOrReplaceTarget(String arg0, Target arg1) {
+ delegate.addOrReplaceTarget(arg0, arg1);
+ }
+
+ public void addOrReplaceTarget(Target arg0) {
+ delegate.addOrReplaceTarget(arg0);
+ }
+
+ public void addReference(String arg0, Object arg1) {
+ delegate.addReference(arg0, arg1);
+ }
+
+ public void addTarget(String arg0, Target arg1) throws BuildException {
+ delegate.addTarget(arg0, arg1);
+ }
+
+ public void addTarget(Target arg0) throws BuildException {
+ delegate.addTarget(arg0);
+ }
+
+ public void addTaskDefinition(String arg0, Class arg1) throws BuildException {
+ delegate.addTaskDefinition(arg0, arg1);
+ }
+
+ public void checkTaskClass(Class arg0) throws BuildException {
+ delegate.checkTaskClass(arg0);
+ }
+
+ public void copyFile(File arg0, File arg1, boolean arg2, boolean arg3, boolean arg4) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2, arg3, arg4);
+ }
+
+ public void copyFile(File arg0, File arg1, boolean arg2, boolean arg3) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2, arg3);
+ }
+
+ public void copyFile(File arg0, File arg1, boolean arg2) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2);
+ }
+
+ public void copyFile(File arg0, File arg1) throws IOException {
+ delegate.copyFile(arg0, arg1);
+ }
+
+ public void copyFile(String arg0, String arg1, boolean arg2, boolean arg3, boolean arg4) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2, arg3, arg4);
+ }
+
+ public void copyFile(String arg0, String arg1, boolean arg2, boolean arg3) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2, arg3);
+ }
+
+ public void copyFile(String arg0, String arg1, boolean arg2) throws IOException {
+ delegate.copyFile(arg0, arg1, arg2);
+ }
+
+ public void copyFile(String arg0, String arg1) throws IOException {
+ delegate.copyFile(arg0, arg1);
+ }
+
+ public void copyInheritedProperties(Project arg0) {
+ delegate.copyInheritedProperties(arg0);
+ }
+
+ public void copyUserProperties(Project arg0) {
+ delegate.copyUserProperties(arg0);
+ }
+
+ public AntClassLoader createClassLoader(Path arg0) {
+ return delegate.createClassLoader(arg0);
+ }
+
+ public Object createDataType(String arg0) throws BuildException {
+ return delegate.createDataType(arg0);
+ }
+
+ public Task createTask(String arg0) throws BuildException {
+ return delegate.createTask(arg0);
+ }
+
+ public int defaultInput(byte[] arg0, int arg1, int arg2) throws IOException {
+ return delegate.defaultInput(arg0, arg1, arg2);
+ }
+
+ public void demuxFlush(String arg0, boolean arg1) {
+ delegate.demuxFlush(arg0, arg1);
+ }
+
+ public int demuxInput(byte[] arg0, int arg1, int arg2) throws IOException {
+ return delegate.demuxInput(arg0, arg1, arg2);
+ }
+
+ public void demuxOutput(String arg0, boolean arg1) {
+ delegate.demuxOutput(arg0, arg1);
+ }
+
+ public boolean equals(Object arg0) {
+ return delegate.equals(arg0);
+ }
+
+ public void executeSortedTargets(Vector arg0) throws BuildException {
+ delegate.executeSortedTargets(arg0);
+ }
+
+ public void executeTarget(String arg0) throws BuildException {
+ delegate.executeTarget(arg0);
+ }
+
+ public void executeTargets(Vector arg0) throws BuildException {
+ delegate.executeTargets(arg0);
+ }
+
+ public void fireBuildFinished(Throwable arg0) {
+ delegate.fireBuildFinished(arg0);
+ }
+
+ public void fireBuildStarted() {
+ delegate.fireBuildStarted();
+ }
+
+ public void fireSubBuildFinished(Throwable arg0) {
+ delegate.fireSubBuildFinished(arg0);
+ }
+
+ public void fireSubBuildStarted() {
+ delegate.fireSubBuildStarted();
+ }
+
+ public File getBaseDir() {
+ return delegate.getBaseDir();
+ }
+
+ public Vector getBuildListeners() {
+ return delegate.getBuildListeners();
+ }
+
+ public ClassLoader getCoreLoader() {
+ return delegate.getCoreLoader();
+ }
+
+ public Hashtable getDataTypeDefinitions() {
+ return delegate.getDataTypeDefinitions();
+ }
+
+ public InputStream getDefaultInputStream() {
+ return delegate.getDefaultInputStream();
+ }
+
+ public String getDefaultTarget() {
+ return delegate.getDefaultTarget();
+ }
+
+ public String getDescription() {
+ return delegate.getDescription();
+ }
+
+ public String getElementName(Object arg0) {
+ return delegate.getElementName(arg0);
+ }
+
+ public Executor getExecutor() {
+ return delegate.getExecutor();
+ }
+
+ public Hashtable getFilters() {
+ return delegate.getFilters();
+ }
+
+ public FilterSet getGlobalFilterSet() {
+ return delegate.getGlobalFilterSet();
+ }
+
+ public InputHandler getInputHandler() {
+ return delegate.getInputHandler();
+ }
+
+ public String getName() {
+ return delegate.getName();
+ }
+
+ public Hashtable getProperties() {
+ return delegate.getProperties();
+ }
+
+ public String getProperty(String arg0) {
+ return delegate.getProperty(arg0);
+ }
+
+ public Object getReference(String arg0) {
+ return delegate.getReference(arg0);
+ }
+
+ public Hashtable getReferences() {
+ return delegate.getReferences();
+ }
+
+ public Hashtable getTargets() {
+ return delegate.getTargets();
+ }
+
+ public Hashtable getTaskDefinitions() {
+ return delegate.getTaskDefinitions();
+ }
+
+ public Task getThreadTask(Thread arg0) {
+ return delegate.getThreadTask(arg0);
+ }
+
+ public Hashtable getUserProperties() {
+ return delegate.getUserProperties();
+ }
+
+ public String getUserProperty(String arg0) {
+ return delegate.getUserProperty(arg0);
+ }
+
+ public int hashCode() {
+ return delegate.hashCode();
+ }
+
+ public void init() throws BuildException {
+ delegate.init();
+ }
+
+ public void initSubProject(Project arg0) {
+ delegate.initSubProject(arg0);
+ this.subproject = arg0;
+ }
+
+ public boolean isKeepGoingMode() {
+ return delegate.isKeepGoingMode();
+ }
+
+ public void log(String arg0, int arg1) {
+ delegate.log(arg0, arg1);
+ }
+
+ public void log(String arg0) {
+ delegate.log(arg0);
+ }
+
+ public void log(Target arg0, String arg1, int arg2) {
+ delegate.log(arg0, arg1, arg2);
+ }
+
+ public void log(Task arg0, String arg1, int arg2) {
+ delegate.log(arg0, arg1, arg2);
+ }
+
+ public void registerThreadTask(Thread arg0, Task arg1) {
+ delegate.registerThreadTask(arg0, arg1);
+ }
+
+ public void removeBuildListener(BuildListener arg0) {
+ delegate.removeBuildListener(arg0);
+ }
+
+ public String replaceProperties(String arg0) throws BuildException {
+ return delegate.replaceProperties(arg0);
+ }
+
+ public File resolveFile(String arg0, File arg1) {
+ return delegate.resolveFile(arg0, arg1);
+ }
+
+ public File resolveFile(String arg0) {
+ return delegate.resolveFile(arg0);
+ }
+
+ public void setBaseDir(File arg0) throws BuildException {
+ delegate.setBaseDir(arg0);
+ }
+
+ public void setBasedir(String arg0) throws BuildException {
+ delegate.setBasedir(arg0);
+ }
+
+ public void setCoreLoader(ClassLoader arg0) {
+ delegate.setCoreLoader(arg0);
+ }
+
+ public void setDefault(String arg0) {
+ delegate.setDefault(arg0);
+ }
+
+ public void setDefaultInputStream(InputStream arg0) {
+ delegate.setDefaultInputStream(arg0);
+ }
+
+ public void setDefaultTarget(String arg0) {
+ delegate.setDefaultTarget(arg0);
+ }
+
+ public void setDescription(String arg0) {
+ delegate.setDescription(arg0);
+ }
+
+ public void setExecutor(Executor arg0) {
+ delegate.setExecutor(arg0);
+ }
+
+ public void setFileLastModified(File arg0, long arg1) throws BuildException {
+ delegate.setFileLastModified(arg0, arg1);
+ }
+
+ public void setInheritedProperty(String arg0, String arg1) {
+ delegate.setInheritedProperty(arg0, arg1);
+ }
+
+ public void setInputHandler(InputHandler arg0) {
+ delegate.setInputHandler(arg0);
+ }
+
+ public void setJavaVersionProperty() throws BuildException {
+ delegate.setJavaVersionProperty();
+ }
+
+ public void setKeepGoingMode(boolean arg0) {
+ delegate.setKeepGoingMode(arg0);
+ }
+
+ public void setName(String arg0) {
+ delegate.setName(arg0);
+ }
+
+ public void setNewProperty(String arg0, String arg1) {
+ delegate.setNewProperty(arg0, arg1);
+ }
+
+ public void setProperty(String arg0, String arg1) {
+ delegate.setProperty(arg0, arg1);
+ }
+
+ public void setSystemProperties() {
+ delegate.setSystemProperties();
+ }
+
+ public void setUserProperty(String arg0, String arg1) {
+ delegate.setUserProperty(arg0, arg1);
+ }
+
+ public String toString() {
+ return delegate.toString();
+ }
+} \ No newline at end of file
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f3/70c6cd90c5cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/f3/70c6cd90c5cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..c202cf7
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f3/70c6cd90c5cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,401 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.ant17;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.Resource;
+import org.apache.tools.ant.types.ResourceCollection;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ * @author Matt Inger
+ * @ant.task name=for
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+ private List resourceCollections = new ArrayList();
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ public void add(ResourceCollection resourceCollection) {
+ this.resourceCollections.add(resourceCollection);
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && resourceCollections.isEmpty() && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or resources or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ Iterator it = resourceCollections.iterator();
+ while (it.hasNext()) {
+ ResourceCollection c = (ResourceCollection) it.next();
+ Iterator rit = c.iterator();
+ while (rit.hasNext()) {
+ Resource r = (Resource) rit.next();
+ doToken(r.toString());
+ }
+ }
+
+ it = hasIterators.iterator();
+ while (it.hasNext()) {
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f4/60dff0e1e8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/f4/60dff0e1e8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..2ea9bbb
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f4/60dff0e1e8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.URI;
+import org.apache.commons.httpclient.URIException;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.Property;
+import org.apache.tools.ant.util.FileUtils;
+
+public abstract class AbstractMethodTask
+ extends Task {
+
+ private HttpMethodBase method;
+ private File responseDataFile;
+ private String responseDataProperty;
+ private String statusCodeProperty;
+ private HttpClient httpClient;
+ private List responseHeaders = new ArrayList();
+
+ public static class ResponseHeader {
+ private String name;
+ private String property;
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getProperty() {
+ return property;
+ }
+ public void setProperty(String property) {
+ this.property = property;
+ }
+ }
+
+ protected abstract HttpMethodBase createNewMethod();
+ protected void configureMethod(HttpMethodBase method) {
+ }
+ protected void cleanupResources(HttpMethodBase method) {
+ }
+
+ public void addConfiguredResponseHeader(ResponseHeader responseHeader) {
+ this.responseHeaders.add(responseHeader);
+ }
+
+ public void addConfiguredHttpClient(HttpClientType httpClientType) {
+ this.httpClient = httpClientType.getClient();
+ }
+
+ protected HttpMethodBase createMethodIfNecessary() {
+ if (method == null) {
+ method = createNewMethod();
+ }
+ return method;
+ }
+
+ public void setResponseDataFile(File responseDataFile) {
+ this.responseDataFile = responseDataFile;
+ }
+
+ public void setResponseDataProperty(String responseDataProperty) {
+ this.responseDataProperty = responseDataProperty;
+ }
+
+ public void setStatusCodeProperty(String statusCodeProperty) {
+ this.statusCodeProperty = statusCodeProperty;
+ }
+
+ public void setClientRefId(String clientRefId) {
+ Object clientRef = getProject().getReference(clientRefId);
+ if (clientRef == null) {
+ throw new BuildException("Reference '" + clientRefId + "' does not exist.");
+ }
+ if (! (clientRef instanceof HttpClientType)) {
+ throw new BuildException("Reference '" + clientRefId + "' is of the wrong type.");
+ }
+ httpClient = ((HttpClientType) clientRef).getClient();
+ }
+
+ public void setDoAuthentication(boolean doAuthentication) {
+ createMethodIfNecessary().setDoAuthentication(doAuthentication);
+ }
+
+ public void setFollowRedirects(boolean doFollowRedirects) {
+ createMethodIfNecessary().setFollowRedirects(doFollowRedirects);
+ }
+
+ public void addConfiguredParams(MethodParams params) {
+ createMethodIfNecessary().setParams(params);
+ }
+
+ public void setPath(String path) {
+ createMethodIfNecessary().setPath(path);
+ }
+
+ public void setURL(String url) {
+ try {
+ createMethodIfNecessary().setURI(new URI(url, false));
+ }
+ catch (URIException e) {
+ throw new BuildException(e);
+ }
+ }
+
+ public void setQueryString(String queryString) {
+ createMethodIfNecessary().setQueryString(queryString);
+ }
+
+ public void addConfiguredHeader(Header header) {
+ createMethodIfNecessary().setRequestHeader(header);
+ }
+
+ public void execute() throws BuildException {
+ if (httpClient == null) {
+ httpClient = new HttpClient();
+ }
+
+ HttpMethodBase method = createMethodIfNecessary();
+ configureMethod(method);
+ try {
+ int statusCode = httpClient.executeMethod(method);
+ if (statusCodeProperty != null) {
+ Property p = (Property)getProject().createTask("property");
+ p.setName(statusCodeProperty);
+ p.setValue(String.valueOf(statusCode));
+ p.perform();
+ }
+
+ Iterator it = responseHeaders.iterator();
+ while (it.hasNext()) {
+ ResponseHeader header = (ResponseHeader)it.next();
+ Property p = (Property)getProject().createTask("property");
+ p.setName(header.getProperty());
+ Header h = method.getResponseHeader(header.getName());
+ if (h != null && h.getValue() != null) {
+ p.setValue(h.getValue());
+ p.perform();
+ }
+
+ }
+ if (responseDataProperty != null) {
+ Property p = (Property)getProject().createTask("property");
+ p.setName(responseDataProperty);
+ p.setValue(method.getResponseBodyAsString());
+ p.perform();
+ }
+ else if (responseDataFile != null) {
+ FileOutputStream fos = null;
+ InputStream is = null;
+ try {
+ is = method.getResponseBodyAsStream();
+ fos = new FileOutputStream(responseDataFile);
+ byte buf[] = new byte[10*1024];
+ int read = 0;
+ while ((read = is.read(buf, 0, 10*1024)) != -1) {
+ fos.write(buf, 0, read);
+ }
+ }
+ finally {
+ try {
+ if (fos != null) {
+ fos.close();
+ }
+ }
+ catch (IOException e) {
+ ;
+ }
+ try {
+ if (is != null) {
+ is.close();
+ }
+ }
+ catch (IOException e) {
+ ;
+ }
+ FileUtils.close(fos);
+ FileUtils.close(is);
+ }
+ }
+ }
+ catch (IOException e) {
+ throw new BuildException(e);
+ }
+ finally {
+ cleanupResources(method);
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f5/30f02c92e4cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/f5/30f02c92e4cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..9ad8ad8
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f5/30f02c92e4cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.condition;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.condition.Equals;
+
+/**
+ * Extends Equals condition to test if the first argument is less than the
+ * second argument. Will deal with base 10 integer and decimal numbers, otherwise,
+ * treats arguments as Strings.
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ *
+ * @author Dale Anson, [email protected]
+ * @version $Revision: 1.4 $
+ * @ant.type name="ispropertyfalse"
+ */
+public class IsLessThan extends Equals {
+
+ private String arg1, arg2;
+ private boolean trim = false;
+ private boolean caseSensitive = true;
+
+ public void setArg1(String a1) {
+ arg1 = a1;
+ }
+
+ public void setArg2(String a2) {
+ arg2 = a2;
+ }
+
+ /**
+ * Should we want to trim the arguments before comparing them?
+ *
+ * @since Revision: 1.3, Ant 1.5
+ */
+ public void setTrim(boolean b) {
+ trim = b;
+ }
+
+ /**
+ * Should the comparison be case sensitive?
+ *
+ * @since Revision: 1.3, Ant 1.5
+ */
+ public void setCasesensitive(boolean b) {
+ caseSensitive = b;
+ }
+
+ public boolean eval() throws BuildException {
+ if (arg1 == null || arg2 == null) {
+ throw new BuildException("both arg1 and arg2 are required in "
+ + "less than");
+ }
+
+ if (trim) {
+ arg1 = arg1.trim();
+ arg2 = arg2.trim();
+ }
+
+ // check if args are numbers
+ try {
+ double num1 = Double.parseDouble(arg1);
+ double num2 = Double.parseDouble(arg2);
+ return num1 < num2;
+ }
+ catch(NumberFormatException nfe) {
+ // ignored, fall thru to string comparision
+ }
+
+ return caseSensitive ? arg1.compareTo(arg2) < 0 : arg1.compareToIgnoreCase(arg2) < 0;
+ }
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f6/20dbe86ad4cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/f6/20dbe86ad4cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..4c38886
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f6/20dbe86ad4cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,3 @@
+<XDtClass:ifHasClassTag tagName="ant.task" paramName="name">
+ <XDtClass:classTagValue tagName="ant.task" paramName="name"/>=<XDtClass:classOf><XDtJavaBean:beanClass/></XDtClass>
+</XDtClass:ifHasClassTag>
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f6/b00cc017e9cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/f6/b00cc017e9cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..e428ba5
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f6/b00cc017e9cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.net.httpclient;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import net.sf.antcontrib.util.Utils;
+
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.NameValuePair;
+import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.apache.commons.httpclient.methods.multipart.FilePart;
+import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
+import org.apache.commons.httpclient.methods.multipart.Part;
+import org.apache.commons.httpclient.methods.multipart.StringPart;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.util.FileUtils;
+
+/***
+ *
+ * @author minger
+ * @ant.task name="postmethod" onerror="ignore"
+ *
+ */
+public class PostMethodTask
+ extends AbstractMethodTask {
+
+ private List parts = new ArrayList();
+ private boolean multipart;
+ private transient FileInputStream stream;
+
+
+ public static class FilePartType {
+ private File path;
+ private String contentType = FilePart.DEFAULT_CONTENT_TYPE;
+ private String charSet = FilePart.DEFAULT_CHARSET;
+
+ public File getPath() {
+ return path;
+ }
+
+ public void setPath(File path) {
+ this.path = path;
+ }
+
+ public String getContentType() {
+ return contentType;
+ }
+
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+
+ public String getCharSet() {
+ return charSet;
+ }
+
+ public void setCharSet(String charSet) {
+ this.charSet = charSet;
+ }
+ }
+
+ public static class TextPartType {
+ private String name = "";
+ private String value = "";
+ private String charSet = StringPart.DEFAULT_CHARSET;
+ private String contentType = StringPart.DEFAULT_CONTENT_TYPE;
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getCharSet() {
+ return charSet;
+ }
+
+ public void setCharSet(String charSet) {
+ this.charSet = charSet;
+ }
+
+ public String getContentType() {
+ return contentType;
+ }
+
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+
+ public void setText(String text) {
+ this.value = text;
+ }
+ }
+
+ public void addConfiguredFile(FilePartType file) {
+ this.parts.add(file);
+ }
+
+ public void setMultipart(boolean multipart) {
+ this.multipart = multipart;
+ }
+
+ public void addConfiguredText(TextPartType text) {
+ this.parts.add(text);
+ }
+
+ public void setParameters(File parameters) {
+ PostMethod post = getPostMethod();
+ Properties p = new Properties();
+ Iterator it = p.entrySet().iterator();
+ while (it.hasNext()) {
+ Map.Entry entry = (Map.Entry) it.next();
+ post.addParameter(entry.getKey().toString(),
+ entry.getValue().toString());
+ }
+ }
+
+ protected HttpMethodBase createNewMethod() {
+ return new PostMethod();
+ }
+
+ private PostMethod getPostMethod() {
+ return ((PostMethod)createMethodIfNecessary());
+ }
+
+ public void addConfiguredParameter(NameValuePair pair) {
+ getPostMethod().setParameter(pair.getName(), pair.getValue());
+ }
+
+ public void setContentChunked(boolean contentChunked) {
+ getPostMethod().setContentChunked(contentChunked);
+ }
+
+ protected void configureMethod(HttpMethodBase method) {
+ PostMethod post = (PostMethod) method;
+
+ if (parts.size() == 1 && ! multipart) {
+ Object part = parts.get(0);
+ if (part instanceof FilePartType) {
+ FilePartType filePart = (FilePartType)part;
+ try {
+ stream = new FileInputStream(
+ filePart.getPath().getAbsolutePath());
+ post.setRequestEntity(
+ new InputStreamRequestEntity(stream,
+ filePart.getPath().length(),
+ filePart.getContentType()));
+ }
+ catch (IOException e) {
+ throw new BuildException(e);
+ }
+ }
+ else if (part instanceof TextPartType) {
+ TextPartType textPart = (TextPartType)part;
+ try {
+ post.setRequestEntity(
+ new StringRequestEntity(textPart.getValue(),
+ textPart.getContentType(),
+ textPart.getCharSet()));
+ }
+ catch (UnsupportedEncodingException e) {
+ throw new BuildException(e);
+ }
+ }
+ }
+ else if (! parts.isEmpty()){
+ Part partArray[] = new Part[parts.size()];
+ for (int i=0;i<parts.size();i++) {
+ Object part = parts.get(i);
+ if (part instanceof FilePartType) {
+ FilePartType filePart = (FilePartType)part;
+ try {
+ partArray[i] = new FilePart(filePart.getPath().getName(),
+ filePart.getPath().getName(),
+ filePart.getPath(),
+ filePart.getContentType(),
+ filePart.getCharSet());
+ }
+ catch (FileNotFoundException e) {
+ throw new BuildException(e);
+ }
+ }
+ else if (part instanceof TextPartType) {
+ TextPartType textPart = (TextPartType)part;
+ partArray[i] = new StringPart(textPart.getName(),
+ textPart.getValue(),
+ textPart.getCharSet());
+ ((StringPart)partArray[i]).setContentType(textPart.getContentType());
+ }
+ }
+ MultipartRequestEntity entity = new MultipartRequestEntity(
+ partArray,
+ post.getParams());
+ post.setRequestEntity(entity);
+ }
+ }
+
+ protected void cleanupResources(HttpMethodBase method) {
+ Utils.close(stream);
+ }
+
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f8/50d897cbd8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/f8/50d897cbd8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..6bf6854
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f8/50d897cbd8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,7 @@
+<XDtClass:forAllClasses>
+<XDtClass:fullClassName />
+<XDtClass:ifHasClassTag tagName="task" paramName="name">
+<XDtClass:classTagValue tagName="task" paramName="name"/>=<XDtClass:fullClassName />
+</XDtClass:ifHasClassTag>
+</XDtClass:forAllClasses>
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f9/e035d9a3e5cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/f9/e035d9a3e5cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..e51c5f5
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f9/e035d9a3e5cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic;
+
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Ant;
+
+/**
+ * Subclass of CallTarget which allows us to fetch
+ * properties which are set in the scope of the called
+ * target, and set them in the scope of the calling target.
+ * Normally, these properties are thrown away as soon as the
+ * called target completes execution.
+ *
+ * @author inger
+ * @author Dale Anson, [email protected]
+ * @ant.task name="antfetch"
+ */
+public class AntFetch extends Ant {
+ /** the name of the property to fetch from the new project */
+ private String returnName = null;
+
+ private ProjectDelegate fakeProject = null;
+
+ public void setProject(Project realProject) {
+ fakeProject = new ProjectDelegate(realProject);
+ super.setProject(fakeProject);
+ }
+
+ /**
+ * Do the execution.
+ *
+ * @exception BuildException Description of the Exception
+ */
+ public void execute() throws BuildException {
+ super.execute();
+
+ // copy back the props if possible
+ if ( returnName != null ) {
+ StringTokenizer st = new StringTokenizer( returnName, "," );
+ while ( st.hasMoreTokens() ) {
+ String name = st.nextToken().trim();
+ String value = fakeProject.getSubproject().getUserProperty( name );
+ if ( value != null ) {
+ getProject().setUserProperty( name, value );
+ }
+ else {
+ value = fakeProject.getSubproject().getProperty( name );
+ if ( value != null ) {
+ getProject().setProperty( name, value );
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Set the property or properties that are set in the new project to be
+ * transfered back to the original project. As with all properties, if the
+ * property already exists in the original project, it will not be overridden
+ * by a different value from the new project.
+ *
+ * @param r the name of a property in the new project to set in the original
+ * project. This may be a comma separate list of properties.
+ */
+ public void setReturn( String r ) {
+ returnName = r;
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fa/a056b67fd8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/fa/a056b67fd8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..174ae4c
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/fa/a056b67fd8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,466 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.ant16;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ * @author Matt Inger
+ * @ant:task name=for
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private Path currPath;
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ private Path getOrCreatePath() {
+ if (currPath == null) {
+ currPath = new Path(getProject());
+ }
+ return currPath;
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfigured(Path path) {
+ getOrCreatePath().append(path);
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfiguredPath(Path path) {
+ addConfigured(path);
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && currPath == null && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or path or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ // Take Care of the path element
+ String[] pathElements = new String[0];
+ if (currPath != null) {
+ pathElements = currPath.list();
+ }
+ for (int i = 0; i < pathElements.length; i++) {
+ File nextFile = new File(pathElements[i]);
+ doToken(nextFile.getAbsolutePath());
+ }
+
+ // Take care of iterators
+ for (Iterator i = hasIterators.iterator(); i.hasNext();) {
+ Iterator it = ((HasIterator) i.next()).iterator();
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void add(FileSet fileset) {
+ getOrCreatePath().addFileset(fileset);
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void addFileSet(FileSet fileset) {
+ add(fileset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void add(DirSet dirset) {
+ getOrCreatePath().addDirset(dirset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void addDirSet(DirSet dirset) {
+ add(dirset);
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fb/5069911ed8cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/fb/5069911ed8cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..f044a7a
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/fb/5069911ed8cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,466 @@
+/*
+ * Copyright (c) 2003-2005 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.ant16;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.MacroDef;
+import org.apache.tools.ant.taskdefs.MacroInstance;
+import org.apache.tools.ant.taskdefs.Parallel;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+
+/***
+ * Task definition for the for task. This is based on
+ * the foreach task but takes a sequential element
+ * instead of a target and only works for ant >= 1.6Beta3
+ * @author Peter Reilly
+ * @author Matt Inger
+ * @ant.task name=for
+ */
+public class ForTask extends Task {
+
+ private String list;
+ private String param;
+ private String delimiter = ",";
+ private Path currPath;
+ private boolean trim;
+ private boolean keepgoing = false;
+ private MacroDef macroDef;
+ private List hasIterators = new ArrayList();
+ private boolean parallel = false;
+ private Integer threadCount;
+ private Parallel parallelTasks;
+ private int begin = 0;
+ private Integer end = null;
+ private int step = 1;
+
+ private int taskCount = 0;
+ private int errorCount = 0;
+
+ /**
+ * Creates a new <code>For</code> instance.
+ */
+ public ForTask() {
+ }
+
+ /**
+ * Attribute whether to execute the loop in parallel or in sequence.
+ * @param parallel if true execute the tasks in parallel. Default is false.
+ */
+ public void setParallel(boolean parallel) {
+ this.parallel = parallel;
+ }
+
+ /***
+ * Set the maximum amount of threads we're going to allow
+ * to execute in parallel
+ * @param threadCount the number of threads to use
+ */
+ public void setThreadCount(int threadCount) {
+ if (threadCount < 1) {
+ throw new BuildException("Illegal value for threadCount " + threadCount
+ + " it should be > 0");
+ }
+ this.threadCount = new Integer(threadCount);
+ }
+
+ /**
+ * Set the trim attribute.
+ *
+ * @param trim if true, trim the value for each iterator.
+ */
+ public void setTrim(boolean trim) {
+ this.trim = trim;
+ }
+
+ /**
+ * Set the keepgoing attribute, indicating whether we
+ * should stop on errors or continue heedlessly onward.
+ *
+ * @param keepgoing a boolean, if <code>true</code> then we act in
+ * the keepgoing manner described.
+ */
+ public void setKeepgoing(boolean keepgoing) {
+ this.keepgoing = keepgoing;
+ }
+
+ /**
+ * Set the list attribute.
+ *
+ * @param list a list of delimiter separated tokens.
+ */
+ public void setList(String list) {
+ this.list = list;
+ }
+
+ /**
+ * Set the delimiter attribute.
+ *
+ * @param delimiter the delimiter used to separate the tokens in
+ * the list attribute. The default is ",".
+ */
+ public void setDelimiter(String delimiter) {
+ this.delimiter = delimiter;
+ }
+
+ /**
+ * Set the param attribute.
+ * This is the name of the macrodef attribute that
+ * gets set for each iterator of the sequential element.
+ *
+ * @param param the name of the macrodef attribute.
+ */
+ public void setParam(String param) {
+ this.param = param;
+ }
+
+ private Path getOrCreatePath() {
+ if (currPath == null) {
+ currPath = new Path(getProject());
+ }
+ return currPath;
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfigured(Path path) {
+ getOrCreatePath().append(path);
+ }
+
+ /**
+ * This is a path that can be used instread of the list
+ * attribute to interate over. If this is set, each
+ * path element in the path is used for an interator of the
+ * sequential element.
+ *
+ * @param path the path to be set by the ant script.
+ */
+ public void addConfiguredPath(Path path) {
+ addConfigured(path);
+ }
+
+ /**
+ * @return a MacroDef#NestedSequential object to be configured
+ */
+ public Object createSequential() {
+ macroDef = new MacroDef();
+ macroDef.setProject(getProject());
+ return macroDef.createSequential();
+ }
+
+ /**
+ * Set begin attribute.
+ * @param begin the value to use.
+ */
+ public void setBegin(int begin) {
+ this.begin = begin;
+ }
+
+ /**
+ * Set end attribute.
+ * @param end the value to use.
+ */
+ public void setEnd(Integer end) {
+ this.end = end;
+ }
+
+ /**
+ * Set step attribute.
+ *
+ */
+ public void setStep(int step) {
+ this.step = step;
+ }
+
+
+ /**
+ * Run the for task.
+ * This checks the attributes and nested elements, and
+ * if there are ok, it calls doTheTasks()
+ * which constructes a macrodef task and a
+ * for each interation a macrodef instance.
+ */
+ public void execute() {
+ if (parallel) {
+ parallelTasks = (Parallel) getProject().createTask("parallel");
+ if (threadCount != null) {
+ parallelTasks.setThreadCount(threadCount.intValue());
+ }
+ }
+ if (list == null && currPath == null && hasIterators.size() == 0
+ && end == null) {
+ throw new BuildException(
+ "You must have a list or path or sequence to iterate through");
+ }
+ if (param == null) {
+ throw new BuildException(
+ "You must supply a property name to set on"
+ + " each iteration in param");
+ }
+ if (macroDef == null) {
+ throw new BuildException(
+ "You must supply an embedded sequential "
+ + "to perform");
+ }
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step == 0) {
+ throw new BuildException("step cannot be 0");
+ } else if (iEnd > begin && step < 0) {
+ throw new BuildException("end > begin, step needs to be > 0");
+ } else if (iEnd <= begin && step > 0) {
+ throw new BuildException("end <= begin, step needs to be < 0");
+ }
+ }
+ doTheTasks();
+ if (parallel) {
+ parallelTasks.perform();
+ }
+ }
+
+
+ private void doSequentialIteration(String val) {
+ MacroInstance instance = new MacroInstance();
+ instance.setProject(getProject());
+ instance.setOwningTarget(getOwningTarget());
+ instance.setMacroDef(macroDef);
+ instance.setDynamicAttribute(param.toLowerCase(),
+ val);
+ if (!parallel) {
+ instance.execute();
+ } else {
+ parallelTasks.addTask(instance);
+ }
+ }
+
+ private void doToken(String tok) {
+ try {
+ taskCount++;
+ doSequentialIteration(tok);
+ } catch (BuildException bx) {
+ if (keepgoing) {
+ log(tok + ": " + bx.getMessage(), Project.MSG_ERR);
+ errorCount++;
+ } else {
+ throw bx;
+ }
+ }
+ }
+
+ private void doTheTasks() {
+ errorCount = 0;
+ taskCount = 0;
+
+ // Create a macro attribute
+ if (macroDef.getAttributes().isEmpty()) {
+ MacroDef.Attribute attribute = new MacroDef.Attribute();
+ attribute.setName(param);
+ macroDef.addConfiguredAttribute(attribute);
+ }
+
+ // Take Care of the list attribute
+ if (list != null) {
+ StringTokenizer st = new StringTokenizer(list, delimiter);
+
+ while (st.hasMoreTokens()) {
+ String tok = st.nextToken();
+ if (trim) {
+ tok = tok.trim();
+ }
+ doToken(tok);
+ }
+ }
+
+ // Take care of the begin/end/step attributes
+ if (end != null) {
+ int iEnd = end.intValue();
+ if (step > 0) {
+ for (int i = begin; i < (iEnd + 1); i = i + step) {
+ doToken("" + i);
+ }
+ } else {
+ for (int i = begin; i > (iEnd - 1); i = i + step) {
+ doToken("" + i);
+ }
+ }
+ }
+
+ // Take Care of the path element
+ String[] pathElements = new String[0];
+ if (currPath != null) {
+ pathElements = currPath.list();
+ }
+ for (int i = 0; i < pathElements.length; i++) {
+ File nextFile = new File(pathElements[i]);
+ doToken(nextFile.getAbsolutePath());
+ }
+
+ // Take care of iterators
+ for (Iterator i = hasIterators.iterator(); i.hasNext();) {
+ Iterator it = ((HasIterator) i.next()).iterator();
+ while (it.hasNext()) {
+ doToken(it.next().toString());
+ }
+ }
+ if (keepgoing && (errorCount != 0)) {
+ throw new BuildException(
+ "Keepgoing execution: " + errorCount
+ + " of " + taskCount + " iterations failed.");
+ }
+ }
+
+ /**
+ * Add a Map, iterate over the values
+ *
+ * @param map a Map object - iterate over the values.
+ */
+ public void add(Map map) {
+ hasIterators.add(new MapIterator(map));
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void add(FileSet fileset) {
+ getOrCreatePath().addFileset(fileset);
+ }
+
+ /**
+ * Add a fileset to be iterated over.
+ *
+ * @param fileset a <code>FileSet</code> value
+ */
+ public void addFileSet(FileSet fileset) {
+ add(fileset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void add(DirSet dirset) {
+ getOrCreatePath().addDirset(dirset);
+ }
+
+ /**
+ * Add a dirset to be iterated over.
+ *
+ * @param dirset a <code>DirSet</code> value
+ */
+ public void addDirSet(DirSet dirset) {
+ add(dirset);
+ }
+
+ /**
+ * Add a collection that can be iterated over.
+ *
+ * @param collection a <code>Collection</code> value.
+ */
+ public void add(Collection collection) {
+ hasIterators.add(new ReflectIterator(collection));
+ }
+
+ /**
+ * Add an iterator to be iterated over.
+ *
+ * @param iterator an <code>Iterator</code> value
+ */
+ public void add(Iterator iterator) {
+ hasIterators.add(new IteratorIterator(iterator));
+ }
+
+ /**
+ * Add an object that has an Iterator iterator() method
+ * that can be iterated over.
+ *
+ * @param obj An object that can be iterated over.
+ */
+ public void add(Object obj) {
+ hasIterators.add(new ReflectIterator(obj));
+ }
+
+ /**
+ * Interface for the objects in the iterator collection.
+ */
+ private interface HasIterator {
+ Iterator iterator();
+ }
+
+ private static class IteratorIterator implements HasIterator {
+ private Iterator iterator;
+ public IteratorIterator(Iterator iterator) {
+ this.iterator = iterator;
+ }
+ public Iterator iterator() {
+ return this.iterator;
+ }
+ }
+
+ private static class MapIterator implements HasIterator {
+ private Map map;
+ public MapIterator(Map map) {
+ this.map = map;
+ }
+ public Iterator iterator() {
+ return map.values().iterator();
+ }
+ }
+
+ private static class ReflectIterator implements HasIterator {
+ private Object obj;
+ private Method method;
+ public ReflectIterator(Object obj) {
+ this.obj = obj;
+ try {
+ method = obj.getClass().getMethod(
+ "iterator", new Class[] {});
+ } catch (Throwable t) {
+ throw new BuildException(
+ "Invalid type " + obj.getClass() + " used in For task, it does"
+ + " not have a public iterator method");
+ }
+ }
+
+ public Iterator iterator() {
+ try {
+ return (Iterator) method.invoke(obj, new Object[] {});
+ } catch (Throwable t) {
+ throw new BuildException(t);
+ }
+ }
+ }
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fc/a0122896e4cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/fc/a0122896e4cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..d3d21c5
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/fc/a0122896e4cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.condition;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.condition.IsTrue;
+
+/**
+ * Extends IsTrue condition to check the value of a specified property.
+ * <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
+ *
+ * @author Dale Anson, [email protected]
+ * @version $Revision: 1.3 $
+ * @ant.type name="ispropertyfalse"
+ */
+public class IsPropertyTrue extends IsTrue {
+
+ private String name = null;
+
+ public void setProperty( String name ) {
+ this.name = name;
+ }
+
+ public boolean eval() throws BuildException {
+ if ( name == null )
+ throw new BuildException( "Property name must be set." );
+ String value = getProject().getProperty( name );
+ if ( value == null )
+ return false;
+ return getProject().toBoolean( value );
+ }
+
+}
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fc/a0fccaade5cc001b1cb5d1e6b2b8577e b/.metadata/.plugins/org.eclipse.core.resources/.history/fc/a0fccaade5cc001b1cb5d1e6b2b8577e
new file mode 100644
index 0000000..5dd6f76
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.history/fc/a0fccaade5cc001b1cb5d1e6b2b8577e
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.antcontrib.logic.ant16;
+
+import java.util.StringTokenizer;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.CallTarget;
+import org.apache.tools.ant.taskdefs.Property;
+
+/**
+ * Subclass of Ant which allows us to fetch
+ * properties which are set in the scope of the called
+ * target, and set them in the scope of the calling target.
+ * Normally, these properties are thrown away as soon as the
+ * called target completes execution.
+ *
+ * @author inger
+ * @author Dale Anson, [email protected]
+ * @ant.task name="antcallback"
+ */
+public class AntCallBack extends CallTarget {
+
+ /** the name of the property to fetch from the new project */
+ private String returnName = null;
+
+ private ProjectDelegate fakeProject = null;
+
+ public void setProject(Project realProject) {
+ fakeProject = new ProjectDelegate(realProject);
+ super.setProject(fakeProject);
+ }
+
+ /**
+ * Do the execution.
+ *
+ * @exception BuildException Description of the Exception
+ */
+ public void execute() throws BuildException {
+ super.execute();
+
+ // copy back the props if possible
+ if ( returnName != null ) {
+ StringTokenizer st = new StringTokenizer( returnName, "," );
+ while ( st.hasMoreTokens() ) {
+ String name = st.nextToken().trim();
+ String value = fakeProject.getSubproject().getUserProperty( name );
+ if ( value != null ) {
+ getProject().setUserProperty( name, value );
+ }
+ else {
+ value = fakeProject.getSubproject().getProperty( name );
+ if ( value != null ) {
+ getProject().setProperty( name, value );
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Set the property or properties that are set in the new project to be
+ * transfered back to the original project. As with all properties, if the
+ * property already exists in the original project, it will not be overridden
+ * by a different value from the new project.
+ *
+ * @param r the name of a property in the new project to set in the original
+ * project. This may be a comma separate list of properties.
+ */
+ public void setReturn( String r ) {
+ returnName = r;
+ }
+}
+
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/16/35/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/16/35/history.index
new file mode 100644
index 0000000..c3d9943
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/16/35/history.index
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/16/bd/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/16/bd/history.index
new file mode 100644
index 0000000..e8df3b7
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/16/bd/history.index
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/2/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/2/history.index
new file mode 100644
index 0000000..96a5d91
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/2/history.index
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/2b/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/2b/history.index
new file mode 100644
index 0000000..87db13a
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/2b/history.index
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/42/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/42/history.index
new file mode 100644
index 0000000..483b58b
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/42/history.index
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/49/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/49/history.index
new file mode 100644
index 0000000..edd3a2f
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/49/history.index
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/5e/e5/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/5e/e5/history.index
new file mode 100644
index 0000000..2c93363
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/5e/e5/history.index
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/5e/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/5e/history.index
new file mode 100644
index 0000000..70d7bed
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/5e/history.index
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/60/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/60/history.index
new file mode 100644
index 0000000..d192524
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/60/history.index
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/73/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/73/history.index
new file mode 100644
index 0000000..c6eb088
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/73/history.index
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/8/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/8/history.index
new file mode 100644
index 0000000..38678da
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/8/history.index
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/91/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/91/history.index
new file mode 100644
index 0000000..fe558e5
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/91/history.index
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/9d/53/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/9d/53/history.index
new file mode 100644
index 0000000..8ab5286
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/9d/53/history.index
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/9d/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/9d/history.index
new file mode 100644
index 0000000..8367074
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/9d/history.index
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/e9/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/e9/history.index
new file mode 100644
index 0000000..4cfa4ea
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.indexes/e4/22/9d/53/2e/e9/history.index
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.markers.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.markers.snap
new file mode 100644
index 0000000..be5bde3
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.markers.snap
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.syncinfo.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.syncinfo.snap
new file mode 100644
index 0000000..3c1c63d
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.5/.syncinfo.snap
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.indexes/e4/22/9d/53/2e/5e/4c/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.indexes/e4/22/9d/53/2e/5e/4c/history.index
new file mode 100644
index 0000000..71d1b03
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.indexes/e4/22/9d/53/2e/5e/4c/history.index
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.indexes/e4/22/9d/53/2e/5e/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.indexes/e4/22/9d/53/2e/5e/history.index
new file mode 100644
index 0000000..fbd8371
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.indexes/e4/22/9d/53/2e/5e/history.index
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.indexes/e4/22/9d/53/cc/9d/4c/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.indexes/e4/22/9d/53/cc/9d/4c/history.index
new file mode 100644
index 0000000..c953066
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.indexes/e4/22/9d/53/cc/9d/4c/history.index
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.location b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.location
new file mode 100644
index 0000000..aba455a
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.location
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.markers.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.markers.snap
new file mode 100644
index 0000000..267233d
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.markers.snap
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.syncinfo.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.syncinfo.snap
new file mode 100644
index 0000000..afb8eb0
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.6/.syncinfo.snap
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.7/.indexes/e4/22/9d/53/2e/5e/4d/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.7/.indexes/e4/22/9d/53/2e/5e/4d/history.index
new file mode 100644
index 0000000..295ce92
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.7/.indexes/e4/22/9d/53/2e/5e/4d/history.index
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.7/.indexes/e4/22/9d/53/2e/5e/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.7/.indexes/e4/22/9d/53/2e/5e/history.index
new file mode 100644
index 0000000..dc2bfa7
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.7/.indexes/e4/22/9d/53/2e/5e/history.index
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.7/.location b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.7/.location
new file mode 100644
index 0000000..facdd30
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.7/.location
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.7/.markers.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.7/.markers.snap
new file mode 100644
index 0000000..153b903
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.7/.markers.snap
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.7/.syncinfo.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.7/.syncinfo.snap
new file mode 100644
index 0000000..179f2fd
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/ant1.7/.syncinfo.snap
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/etc/.indexes/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/etc/.indexes/history.index
new file mode 100644
index 0000000..eb1c01a
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/etc/.indexes/history.index
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/etc/.markers.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/etc/.markers.snap
new file mode 100644
index 0000000..533f00e
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/etc/.markers.snap
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/etc/.syncinfo.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/etc/.syncinfo.snap
new file mode 100644
index 0000000..7de9ae3
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/etc/.syncinfo.snap
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/lib/.markers.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/lib/.markers.snap
new file mode 100644
index 0000000..0b368ce
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/lib/.markers.snap
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/lib/.syncinfo.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/lib/.syncinfo.snap
new file mode 100644
index 0000000..4a59534
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.projects/lib/.syncinfo.snap
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index b/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index
new file mode 100644
index 0000000..e37b7cd
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.root/.markers.snap b/.metadata/.plugins/org.eclipse.core.resources/.root/.markers.snap
new file mode 100644
index 0000000..08e6b18
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.root/.markers.snap
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources b/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources
new file mode 100644
index 0000000..d6e17fe
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources
Binary files differ
diff --git a/.metadata/.plugins/org.eclipse.core.resources/.snap b/.metadata/.plugins/org.eclipse.core.resources/.snap
new file mode 100644
index 0000000..6883bf4
--- /dev/null
+++ b/.metadata/.plugins/org.eclipse.core.resources/.snap
Binary files differ