« Return to Thread: [Idea] Customization

RE: [Idea] Customization

by Artamonov, Juri :: Rate this Message:

| View in Thread

I tested and commited the patch that does updating of the war or zip file.

You can use TestCustomization file for testing. The variables required to be passed are zip file required to be updated and HashMap where keys are internal files for updating and value is also HashMap with stringToReplace as a key and replacementString as a value. Result file will be with the same as zip but in temp directory.

http://jira.codehaus.org/browse/CARGO-300

I tried several way to implement the updating of the zip file and current that here is represented is based on reading all files and writing it to new zip file.

This way works but this is not effective.

Actually I was suprized (first time wrote something for zip using java.util.zip) that java.util.zip API doesn't support updating the file in already existing zip file.

Also here is duscussion about this on sun page.

http://bugs.sun.com/bugdatabase/view_bug.do;:WuuT?bug_id=4129445

Another way is to update only the files directly in the existing zip file using third party library:

https://truezip.dev.java.net/

Don't know if this is possibly due license rules.

Please let me know what do you think.

Also, I apologize, probably quality of the code is not like production, please let me know what do you think required to be changed and I will do changes.

Best regards,
                           Juri.



-----Original Message-----
From: Vincent Massol [mailto:vmassol@...]
Sent: Monday, March 13, 2006 3:47 PM
To: dev@...
Subject: [cargo-dev] [Idea] Customization


Hi,

I've sent 2 proposals recently:

* one about supporting configuration customization through the use of regexp. See http://tinyurl.com/77aa9

* another about generating J2EE archives for different environments and more generally a proposal to support modifying any type of zip file using regexps. See http://tinyurl.com/le5mq

I've just had the idea of merging the two proposals in one. Imagine the
following:

* Ability to take a dir or a zip file as input
* Generate a new zip/dir or the same zip/dir but updated
* Customizations brought on files/input streams.

This would allow all sort of use cases and would solve our issue of custom configurations + the issue of customizing J2EE archives for any environment.

Technical ideas:

* Define a Customization interface
  - takes an input stream source
  - generate an output stream destination
  - apply a set of transformations to the input stream
* Several Customization implementations possible
  - AntTokenCustomization
  - RegexpCustomization
* A CustomizationPack to regroup several Customization together and to work on zips or directories. Several implementations:
  - ZipCustomizationPack
  - DirectoryCustomizationPack
* Modify the LocalConfiguration interface to add a new API:
  - LocalConfiguration.addCustomizationPack(...)
* Refactor current Ant token filters in configuration code to use the AntTokenCustomization class and define a default pack for each container's configuration. Users customization packs could be added after the default pack.

WDYT?

Thanks
-Vincent


       

       
               
___________________________________________________________________________
Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international. Téléchargez sur http://fr.messenger.yahoo.com

 « Return to Thread: [Idea] Customization