See the "Remoting in domain.xml" thread at http://community.jboss.org/thread/153974?start=15&tstart=0 for some thoughts that bear on this discussion. Derived from that, David and I were chatting in #jboss-as7 today:
dmlloyd: bstansberry: maybe the containers configuration should go right under the subsystem declaration in the profile.
[11:55am] dmlloyd: at least, they seem related.
[11:55am] bstansberry: under == child?
[11:55am] dmlloyd: yeah
[11:56am] bstansberry: i like that too, except the same subsystem can appear in multiple profiles
[11:56am] dmlloyd: the pro (and con) is that you can use different configs for different profiles
[11:56am] bstansberry: but not the same config for different profiles
[11:56am] dmlloyd: unless we do some kind of profile inheritance scheme or something
[11:56am] bstansberry: it is nice though that the whole mapping to server group issue disappears
[12:03pm] dmlloyd: yeah, I didn't even think of that
I then posted this (bogus) content to pastebin:
<extension prefix="xx" module="org.foo:blah"/>
<subsystem name="webserver" extends="web">
<web:container name="jboss.web">
.....
</virtual-server>
</web:container>
</subsystem>
<profile name="something">
<subsystem name="ejb"/>
<subsystem name="webserver"/>
<subsystem name="jms"/>
<subsystem name="xx:fancy"/>
</profile>
[12:04pm] dmlloyd: didn't we have, at one point, an extends="" for profiles?
[12:05pm] bstansberry: yes, and we stiil do
[12:05pm] bstansberry: lots of stuff got dropped from slides today
[12:05pm] bstansberry: space
[12:05pm] dmlloyd: right
[12:05pm] bstansberry: anyway, that pastebin isn't right; just starting to noodle
[12:06pm] dmlloyd: yeah I see that you have subsystem outside of profile, and extends on subsystem
[12:06pm] bstansberry: that's the vague part
[12:06pm] bstansberry: extends on profile just lets you add another subsystem without having to redeclare
[12:06pm] dmlloyd: right
[12:07pm] bstansberry: extends on subsystem is.... vague
[12:07pm] dmlloyd: so I'm thinking you put the container config inside <subsystem> inside <profile>
[12:07pm] dmlloyd: then use profile extension to avoid redeclaring all the stuff
[12:07pm] dmlloyd: or to explicitly redeclare all the stuff, if that's what you want
[12:07pm] dmlloyd: then a server group gets a profile, and that's it
[12:08pm] dmlloyd: all container configs come with it
[12:08pm] bstansberry: yeah, you could do that; if you wanted to reuse something a lot you create a fake profile with one subsystem
[12:08pm] bstansberry: extends="web ejb jms" ?
[12:08pm] bstansberry: valid?
[12:08pm] bstansberry: multiple inheritance
[12:09pm] • bstansberry feels a bit like he's solving a problem that doesn't exist
[12:10pm] dmlloyd: no reason not to support MI, later overrides earlier
[12:10pm] dmlloyd: that makes it easy to say "this profile is that one plus that one"
[12:10pm] dmlloyd: I can see people wanting to express that
[12:10pm] bstansberry: yeah
[12:11pm] bstansberry: now, reason for extends on subsystem was...
[12:11pm] dmlloyd: vague?
[12:11pm] bstansberry: there's some sort of mapping from a subsystem name to a module
[12:11pm] dmlloyd: right, <extension>
[12:11pm] dmlloyd: somehow
[12:12pm] bstansberry: well, that's for extension modules
[12:12pm] bstansberry: i'm thinking about our standard ones
[12:12pm] dmlloyd: our standard ones should be available without mapping them to modules in the domain.xml
[12:12pm] bstansberry: <subsystem name="random_name_for_this_webserver_config" extends="war">
[12:13pm] bstansberry: is a way to bring in that mapping since random_name_for_this_webserver_config isn't going to be unknown
[12:13pm] dmlloyd: I'm thinking that the named configs would be profiles. "subsystem" means "bring in this subsystem to this profile, configured thusly"
[12:15pm] bstansberry: emuckenhuber: yes
[12:15pm] bstansberry: dmlloyd: good point; the name is pointless
[12:15pm] bstansberry: it's really more of a type
[12:16pm] bstansberry: <subsystem type="web"> <subsystem type="xx:fancy">
So, from this discussion we end up with something like:
<!-- The ee6-web1 profile extends the stock 'web' profile that ships with as 7 -->
<profile name="ee6-web1" extends="web">
<subsystem type="web">
<web:container name="jboss.web">
....
</web:container>
</subsystem>
<subsystem type="ejb">
<ejb:container .... />
</subsystem>
</profile>
<profile name="messaging">
<subsystem type="messaging">
<messaging:kerfluffle .../>
</subsystem>
</profile>
<profile name="custom" extends="ee6-web1 messaging"/>
.....
<server-groups>
<server-group group-name="main-server-group" profile="custom">
<!-- No need to map subsystem configs onto the server group;
they come via the profile attribute -->
</server-group>
</server-groups>
There is still a not-quite-right feel about the extends="web" on the ee6-web1 profile. The idea there is we have a stock "web" profile that lists all the subsystems for an EE 6 web profile. But it would not include the configuration elements; the user would have to supply the configurations as is done in ee6-web1 above. So what the "extends" attribute does is save the user having to list other subsystems that don't require any configuration. Some of those could come in without being listed because it's known, for example, that "ejb" depends on "jndi". But what if a web profile includes a subsystem that takes no config *and* isn't depended on by any other subsystem.
Perhaps a stock "web" profile doesn't belong in the domain model itself. Maybe it's something that belongs in a management tool, CLI etc. That is, user executes a command asking for a domain.xml to be created based on a "web" profile; tool generates one with a set of default subsystem configs. The magic defaults aren't in the domain model, they are in the tool, and what is generated can change from release to release.