On 08/11/10 10:30, [email protected] wrote:
>> -----Original Message-----
>> From: Steve Loughran [mailto:[email protected]]
>> Sent: Monday, November 01, 2010 5:31 PM
>> To: Dmitry Epstein
>> Cc: [email protected]
>> Subject: Re: [Smartfrog-users] Deleting multiple files?
>>
>>
>>>
>>> Yes, I was aware of SelfDeletingFile. I was thinking of perhaps
>> adding deleteOnExit attribute to the Files component, or patching
>> together a new component, based on Files.
>>>
>>
>> OK. I'm just checking in a DeleteFile component that does the delete
>> operation but is more helpful on a failure, even security exceptions
>> are
>> caught and turned into errors.
>>
>> I also had a quick scan and cleanup of the test of that code, again
>> checking it in as we speak. Looking at that code, the target for
>> modification would be to subclass FilesCompoundImpl and have a child
>> DeleteFiles which would call FilesCompoundImpl.sfStart(), take that
>> list
>> of files and do a best effort attempt at deleting them, tracking which
>> ones couldn't be deleted and adding that up to some results which could
>> be reported or turned into an error.
>
> Speaking of files, a useful workflow component would be one that iterates 
> over a list of files, i.e. performs a parameterized execution of its action 
> sub-component, where the parameter is a path-name from a Files component.

I had an opportunity to sit with the IDE and the SF code in front of me 
yesterday, and now have an uncommitted change that makes the 
FilesCompoundImpl component a subclass of EventCompoundImpl, which makes 
it one very short distance away from having an action compound deploy. 
But that gets very confusing as to what contains files and what contains 
the action.

What that parent change does do is make the FilesCompound a workflow 
component that can read the attributes saying what to do after building 
the list, and it would be trivial to add a target attribute to specify 
which component to attach the list.

> Or perhaps a more general component that iterates over any given vector, with 
> a child component specifically for files.

Probably simplest to deploy the action once the files have been gathered.

>
> I know this would be useful for my test designs.

I think I understand. So, what is most usable/easy to test, document and 
understand?


1. -tweak FilesCompoundImpl, add a FilesActionCompoundImpl that deploys 
the action after building up the filelist, skipping that action until 
then, the actions would have to take a reference to something that can 
serve up the file list, either a simple attribute/list or a component 
that can return the list of files over RMI.

2. have FilesCompoundImpl support workflow attributes and a target 
attribute, add the ability to write its filelist to a destination (as 
both a list of strings and a single path.separator separated string.)

both of these would be backed by some FilesOperations which would be 
workflow components. I'd start with

DeleteFiles - delete any, do a best effort skip all missing files, log 
failures and continue.

ExistsFiles - check the files all exist (or don't exist, we'll use that 
for testing DeletesFiles)

Other actions: copy, scp, etc, are feature creep.

What do you think, (1) or (2)? I think (2) is more generic and would 
work in more places. Also trying to test and debug the workflow 
components is no fun, believe me, especially once you start encountering 
odd race conditions with termination events coming in while you are 
starting up:

http://jira.smartfrog.org/jira/browse/SFOS-1510
http://jira.smartfrog.org/jira/browse/SFOS-1526


-Steve



------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Smartfrog-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/smartfrog-users

Reply via email to