Chapter 30. JBoss AS 5 Deployment

Now, lets look at the second case, by deploying the idm into the JBoss AS 5. By doing this different services can share the identity component, instead of having its own seperate identity component.

The jobs that need to be done for the deployment in the container is quite simple:

Before we look at it further, lets see the configuration files that jboss idm needed typically. (Say using db back-end, hibernate impl combination)

With regard to the detail of jboss idm configuration file, you can refer to the configuration documentation.

So, if we want to deploy the idm into container with a specified JNDI name, we need to have a deployment file to define the JNDI and other neccessary properties.

For the integration with JBoss AS5, the AS5 has a great deployment feature, we've built our own deployer to extend it, so that the AS can listen on the -jboss-idm.xml suffix file to start the IdentitySessionFactory.

Basically, we had two deployer, one is: IDMConfigParsingDeployer class, which is taking responsible for parsing files that ends with the -jboss-idm.xml suffix into Java object. The other is: IDMDeployer class, this one is to do the real job, which means it might populate the schema, initial dataset into target db, and then start the IdentitySessionFactory, register it into the JNDI with the specified name at last.

We will see a very typical deployment file looks like. (default-jboss-idm.xml)

            
<?xml version="1.0" encoding="UTF-8"?>
<jboss-idm-deployer xmlns="urn:jboss:identity:idm:deployer:v1_0_alpha"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="urn:jboss:identity:idm:deployer:v1_0_alpha identity-deployer.xsd">
    <JNDIName>java:/IdentitySessionFactory</JNDIName>
    <idmConfigFile>jboss.idm.cfg.xml</idmConfigFile>
    <hibernateDeployer>
     <hibernateConfiguration>jboss.idm.hibernate.cfg.xml</hibernateConfiguration>
<hibernateSessionFactoryJNDIName>java:/IDMHibernateSessionFactory</hibernateSessionFactoryJNDIName>
    </hibernateDeployer>
    <initializers>
        <datasource>java:/jbossidmDS</datasource>
        <sqlInitializer>
            <sqlFile>idm-sql/jboss.idm.@database@.create.sql</sqlFile>
            <exitSQL>select * from jbid_io</exitSQL>
        </sqlInitializer>
    </initializers>
</jboss-idm-deployer>
            
         

detailed information about the deployment file is specified in the identity-deployer.xsd file.

Once you've deployed the idm into JBoss AS5, by using the distribution. It will copy the idm-deployer into the JBoss AS5/server/$config/deployers folder, and the idm folder into the JBoss AS5/server/$config/deploy folder, which contains the default configuration files, like the jboss.idm.cfg.xml, idm-ds.xml etc.