[
https://jira.jboss.org/jira/browse/SHRINKWRAP-163?page=com.atlassian.jira...
]
Dan Allen commented on SHRINKWRAP-163:
--------------------------------------
Cool to remove this from the Archive API and as a field member, and
instead only honor ExtensionType as an input param?
Sure. The only reason I added that was as a way to push that information into the
ContainerBase. I couldn't think of a way off the top of my head to pass on this
information from the archive impl.
I don't see any references / use case where
archive.getExtension() is required, aside from in assigning the name.
I know that application servers look at the archive extension to decide what to do when it
is passed to deploy() (or put in the hot deploy directory), but since that logic is likely
low level, I doubt the container would consume this information from the archive itself
(instead merely reflecting on the name).
While I can see extension as an input (ie. we don't care about
the name of the archive, only the extension), I guess we don't need to carry this
around as a separate property. ie. I think when users supply "my.jar" as a name,
they're explicitly giving the extension. If they want to give no name, but only an
extension, we can construct a name for them and then suffix the extension.
Right, the idea is to let them think in terms of artifact name (the way that Maven talks
about artifacts) and not have them worry about the extension.
ShrinkWrap.create(WebArchive.class, "stocktrader")
We just do the right thing (in this case stocktrader.war).
Of course, we honor an existing extension in the name for:
a) backwards compatibility
b) it's an easy way to override it if needed
ShrinkWrap.create(JavaArchive.class, "stocks.par") // par would be persistence
archive, though no one uses that extension, user has special case perhaps
I'd like to have ExtensionType, but for that we are going to need an interface/class
to allow for extensibility (not an enum)
ShrinkWrap.create(JavaArchive, "stocktrader", ExtensionType.WAR)
public class ExtensionType
{
static final ExtensionType WAR = new ExtensionType("war");
static final ExtensionType JAR = new ExtensionType("jar");
static final ExtensionType EAR = new ExtensionType("ear");
static final ExtensionType RAR = new ExtensionType("rar");
private final String extension;
public ExtensionType(String extension)
{
this.extension = extension;
}
String getExtension() {
return extension;
}
}
Then, anyone could introduce their own constant:
static final ExtensionType PAR = new ExtensionType("par");
Is that headed in the right direction?
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