[shrinkwrap-issues] [JBoss JIRA] Commented: (SHRINKWRAP-163) Make archive name optional in ShrinkWrap#create()

Andrew Lee Rubinger (JIRA) jira-events at lists.jboss.org
Tue May 11 09:54:07 EDT 2010


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

Andrew Lee Rubinger commented on SHRINKWRAP-163:
------------------------------------------------

I can see the benefit of:

ShrinkWrap.create(JavaArchive, "stocktrader", ExtensionType.WAR) 

...but this kind of thing I think could lead to confusion (or taking the wrong action):

ShrinkWrap.create(WebArchive.class, "stocktrader") 

In the second form, we'd have to do a String.lastIndexOf(".") thing to see if the user provided an extension, and then default it to ".war" if not present.  The problem here is if the user supplied a "." as part of the name, and we'd miss out on giving them the extension.

So IMO this actually means we'd be doing too much by inspecting the given name for an extension.  Is it really of much benefit to be defaulting the extension if a name is provided?  Seems we should do:

ShrinkWrap.create(WebArchive.class);  //  Makes an archive of unique name in form "name.war"
ShrinkWrap.create(WebArchive.class, String name); // Uses the supplied name explicitly
ShrinkWrap.create(WebArchive.class, String name, ExtensionType type); // Appends the extension name to the supplied name

WDYT?

> Make archive name optional in ShrinkWrap#create()
> -------------------------------------------------
>
>                 Key: SHRINKWRAP-163
>                 URL: https://jira.jboss.org/jira/browse/SHRINKWRAP-163
>             Project: ShrinkWrap
>          Issue Type: Feature Request
>          Components: api
>    Affects Versions: 1.0.0-alpha-9
>            Reporter: Dan Allen
>            Assignee: Andrew Lee Rubinger
>             Fix For: 1.0.0-alpha-10
>
>         Attachments: SHRINKWRAP-163-v1.txt
>
>
> Make the Archive type first in the API, as it allows us to introduce defaults for the name and even introduce an extension constant.
> ShrinkWrap.create(Class<T> type)
> ShrinkWrap.create(Class<T> type, String name)
> ShrinkWrap.create(Class<T> type, ExtensionType ext)  ***maybe
> ShrinkWrap.create(Class<T> type, String name, ExtensionType ext)  ***maybe
> For the simplest case (Weld SE Arquillian tests for instance), the name would be defaulted.
> ShrinkWrap.create(JavaArchive.class)
> The current usage would be flipped
> ShrinkWrap.create(JavaArchive.class, "test.jar")
> We could consider getting rid of the string-based extension classifier
> ShrinkWrap.create(JavaArchive.class, "test", JAR)
> Or, if you wanted to specify just an extension (for instance to create a WAR), you could do:
> ShrinkWrap.create(JavaArchive.class, WAR)
> To take another angle, maybe the extension can be implied based on the archive type:
> JavaArchive = ".jar"
> EnterpriseArchive = ".ear"
> WebArchive = ".war"
> In that case, we can just get back to:
> ShrinkWrap.create(WebArchive.class)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the shrinkwrap-issues mailing list