[shrinkwrap-issues] [JBoss JIRA] Commented: (SHRINKWRAP-304) Add option for omitting archive extension from exploded directory name

Aslak Knutsen (JIRA) jira-events at lists.jboss.org
Sat Jul 16 03:40:23 EDT 2011


    [ https://issues.jboss.org/browse/SHRINKWRAP-304?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12614613#comment-12614613 ] 

Aslak Knutsen commented on SHRINKWRAP-304:
------------------------------------------

Maybe explodedExporter could hvae

* exportTo(Directory parent)
-> creates "parent/[archive.name]/xxx"

* exportIn(Directory parent)
-> creates "parent/xxx"


In your use case you would still need to create a Parent directory your self based on the archive.name without the extension, but.. Having archive.name with convenience method like getArchiveExtension() -> substring end of getName and getArchiveName() -> substring start of getName

{code}
war.as(ExplodedExporter.class).exportIn(new File(parent, war.getArchiveName()))
{code}

> Add option for omitting archive extension from exploded directory name
> ----------------------------------------------------------------------
>
>                 Key: SHRINKWRAP-304
>                 URL: https://issues.jboss.org/browse/SHRINKWRAP-304
>             Project: ShrinkWrap
>          Issue Type: Enhancement
>          Components: api
>    Affects Versions: 1.0.0-beta-2
>            Reporter: Ian Brandt
>
> It would be nice if ExplodedExporter offered the option of omitting the archive extension from the exploded directory name.  
> h5. Current Method:
> {code:java}
> /**
>  * Exports provided archive as an exploded directory structure.
>  * 
>  * @param archive
>  * @param parentDirectory Must be a folder
>  * @return File for exploded archive contents
>  * @throws IllegalArgumentException if the archive or parent directory not valid
>  * @throws ArchiveExportException if the export process fails
>  */
> File exportExploded(File parentDirectory);
> {code}
> h5. Current Example:
> {code:java}
> Archive webArchive = ShrinkWrap.create(WebArchive.class, "test.war");
> File explodedDirectory = webArchive.as(ExplodedExporter.class).exportExploded(tmpDirectory);
> System.out.println(explodedDirectory.getName()) // "test.war"
> {code}
> h5. Proposed Method Overload:
> {code:java}
> /**
>  * Exports provided archive as an exploded directory structure.
>  * 
>  * @param archive
>  * @param parentDirectory Must be a folder
>  * @param omitExtension Whether to omit the archive extension from the exploded directory name
>  * @return File for exploded archive contents
>  * @throws IllegalArgumentException if the archive or parent directory not valid
>  * @throws ArchiveExportException if the export process fails
>  */
> File exportExploded(File parentDirectory, boolean omitExtension);
> {code}
> h5. Proposed Example
> {code:java}
> Archive webArchive = ShrinkWrap.create(WebArchive.class, "test.war");
> File explodedDirectory = webArchive.as(ExplodedExporter.class).exportExploded(tmpDirectory, true);
> System.out.println(explodedDirectory.getName()) // "test"
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the shrinkwrap-issues mailing list