JBoss Community

Currently Being Moderated

JBoss5 custom metadata files

VERSION 4

Created on: Nov 27, 2008 6:05 AM by Ales Justin - Last Modified:  Nov 28, 2008 11:05 AM by Ales Justin

With new Microcontainer, its Deployers and JBossXB,

it's super easy to write some custom metadata along with its matching/handling deployer.

We use different files to add to deployment information, ranging from performance benefits to easily customizable classloading metadata.

 

This wiki page should contain the list of them, its metadata class and the most inmportant, their usage / purpose.

 

File name
Usage
MetaDataDeployer
jboss-scanning.xmlFilter annotation scanningAbstractScanningMetaDataScanningMetaDataDeployer
jboss-classloading.xmlClassloader metadataClassLoadingMetaDataSchemaResolverDeployer
jboss-structure.xmlDeployment structureStructureMetaDataObjectFactory / ContextInfoImplDeclaredStructure
aliases.txtDeployment unit aliasesDeploymentAliasesMetaDataDeploymentAliasesDeployer
jboss-dependency.xmlGeneric dependencyDependenciesMetaDataDeploymentDependenciesDeployer

 

jboss-scanning.xml:

 

Current JEE specs reduced the number of configuration files,

but they now require the container to do most of the job based on @annotations.

In order to get @annotation info, containers must scan classes.

This is often performance penalty.

 

In order to minimize what/where we scan, we can provide this info in this file.

 

<scanning xmlns="urn:jboss:scanning:1.0">
  <path name="myejbs.jar">
    <include name="com.acme.foo"/>
    <exclude name="com.acme.foo.bar"/>
  </path>
  <path name="my.war/WEB-INF/classes">
    <include name="com.acme.foo"/>
  </path>
</scanning>

 

jboss-classloading.xml:

 

Simple version.

I'll let Adrian provide more complex example. ;-)

 

<classloading xmlns="urn:jboss:classloading:1.0" export-all="NON_EMPTY">
   <capabilities>
      <module name="test5"/>
   </capabilities>

   <requirements>
      <module name="test2"/>
   </requirements>
</classloading>

 

jboss-structure.xml:

 

This is where we describe our deployment's structure.

e.g. what is the context's path, its metadata path, classpath, comparator, modifications

You would use this in case your deployment does not comply to the usual/spec deployments,

 

<structure>
    <context comparator="org.jboss.test.deployment.test.SomeDeploymentComparatorTop">
        <path name=""/>
        <metaDataPath>
         <path name="META-INF"/>
      </metaDataPath>
      <classpath>
            <path name="jar1.jar"/>
            <path name="lib-dir" suffixes=".jar"/>
        </classpath>
    </context>
    <context modification="unpack">
        <path name="sub.jar"/>
      <metaDataPath>
         <path name="META-INF"/>
      </metaDataPath>
    </context>
    <context comparator="org.jboss.test.deployment.test.SomeDeploymentComparatorX">
        <path name="x.war"/>
      <metaDataPath>
         <path name="WEB-INF"/>
      </metaDataPath>
        <classpath>
            <path name="x.war/WEB-INF/classes"/>
            <path name="x.war/WEB-INF/lib" suffixes=".jar"/>
        </classpath>
    </context>
</structure>

 

aliases.txt:

 

It's a plain txt file, each line containing new alias.

(see jboss-dependency.xml for the usage)

 

e.g.

my-human-readable-deployment-alias

 

Note: this only works on top level deployment

 

jboss-dependency.xml:

 

You can define generic dependencies of your deployment wrt other deployments or even services.

e.g. my x-app.ear should start after x-util.jar is installed

e.g. my z-app.war depends on TransactionManager bean

 

<dependency xmlns="urn:jboss:dependency:1.0">
  <item whenRequired="Real" dependentState="Create">TM</item>
  <item>my-human-readable-deployment-alias</item>
</dependency>

 

Note: module/deployment dependency can be described in jboss-classloading.xml as well

Note2: this can be also added to sub-deployments

Average User Rating
(2 ratings)




Nathan Ciliberto Nathan Ciliberto  says:

Seriously... where is the documentation for these custom xml files?

Nathan Ciliberto Nathan Ciliberto  says in response to Nathan Ciliberto:

So, I see the dtd's for the "standard" xml files here:

  http://www.jboss.org/community/wiki/JBossDTDs

 

But what about these custom xml files?

 

I like the comment for "aliases.txt" which says "see jboss-dependency.xml for the usage", but that documentation doesn't even mention this text file.

Ales Justin Ales Justin  says in response to Nathan Ciliberto:

This wiki is supposed to be temp docs, until we properly finish real VDF docs.

As you can see, it's currently in bare minimium state, hence user feedback is more than welcome.

 

If you currently have any questions, post them on our MC user forum.

And I'll then port the info back to this wiki page.

 

ps: good way to learn is to check the tests that use these features

More Like This

  • Retrieving data ...