JBossMCProfileServiceBootstrap

The JBoss5 Bootstrap Logic

The JBoss5 bootstrap is similar to the JBoss4.x and earlier versions in that the org.jboss.Main entry point loads an org.jboss.system.server.Server implementation. In JBoss4.x this was a JMX based microkernel. In JBoss5 this is a JBoss Microcontainer.

 

JBoss5 ServerImpl

The default JBoss5 org.jboss.system.server.Server implementation is org.jboss.bootstrap.microcontainer.ServerImpl. This implementation is an extension of the kernel basic bootstrap that boots the MC from the bootstrap beans declared in {jboss.server.config.url}/bootstrap.xml descriptors using a BasicXMLDeployer.

 

The bootstrap.xml

The server bootstrap.xml provides a list of urls to mc beans descriptors that should be loaded by the BasicXMLDeployer to bootstrap the server:

<bootstrap xmlns="urn:jboss:bootstrap:1.0">

   <url>classloader.xml</url>
   <url>aop.xml</url>
   <url>jmx.xml</url>
   <url>deployers.xml</url>
   <url>bindings.xml</url>
   <url>profile.xml</url>

</bootstrap>
  • classloader.xml - the core classloading system and classpath

  • aop.xml - the JBossAOP AspectManager bean and @JMX advice beans, and jars

    • AOPJBossIntegration

    • AspectManager

    • AspectManagerJMXRegistrar - bean for making sure that the underlying AspectManagerService gets registered in JMX

  • jmx.xml - the JMXKernel beans

    • JMXKernel : this bean manages the instantiation of a JMX kernel and MBeanServer in the jboss domain. It is used by the SARDeployer. It will be used by other management deployment aspects in the future to expose kernel beans via JMX.

  • deployers.xml - the MainDeployer, structure deployers, and bootstrap MC, JMX deployers

    • MainDeployer : this bean is an update of the JMX based MainDeployer from earlier versions to a one based on the Microcontainer, JBoss5VirtualFileSystem, and Virtual Deployment Framework(VDF). Deployer aspects are registered with the MainDeployer as an ordered list via inject of the deployers property.

    • ManagedDeploymentCreator : The ManagedDeploymentCreator implementation that supports mapping attachment types to ManagedDeploymentgetTypes for the ManagedDeployment view of a deployment

    • ServiceClassLoaderDeployer : this bean manages the class loading aspect of deployment.

    • DeclaredStructure : a structural deployer which handles looks for a deployment jboss-structure.xml metadata descriptor for explicit structure

    • JARStructure : a structural deployer which handles the legacy nested deployment behavior of adding non-deployable jars to the current deployment classpath.

    • FileStructure : a structural deployer which recognizes well know deployment file types specified by suffix.

    • AspectDeployer : handles aop descriptor deployments.

    • BeanDeployer : this bean translates deployer-beans.xml into KernelDeployment for the descriptor beans.

    • KernelDeploymentDeployer : translates a KernelDeployment into the constituent BeanMetaData instances for the kernel beans.

    • BeanMetaDataDeployer : creates the kernel beans from the deployment BeanMetaData.

    • SARDeployer : this bean is a port of the legacy JMX SARDeployer to the VDF. It handles the legacy jboss-service.xml style of mbean deployment descriptors and maps this into a ServiceDeployment pojo.

    • ServiceDeploymentDeployer : translates ServiceDeployment pojo into the constituent ServiceMetaData that represent the various mbeans.

    • ServiceDeployer : creates the mbean services from deployment ServiceMetaData instances.

    • ClassLoadingMetaDataParser : Parse jboss-classloading.xml to produce a ClassLoadingMetaData attachment.

    • ClassLoadingDefaultDeployer : ensures every deployment has at least a default ClassLoadingMetaData attachment

    • InMemoryClassesDeployer : creates a unique vfsmemory classpath location for dynamic classes

    • ClassLoaderClassPathDeployer : sets deployment VFS_CLASS_PATH, VFS_EXCLUDES attachments

    • ClassLoaderDescribeDeployer : creates a VFSDeploymentClassLoaderPolicyModule for non-top-level deployment units with ClassLoadingMetaData

    • ClassLoaderDeployer : creates the deployment ClassLoader based on its ClassLoaderPolicyModule attachment

  • bindings.xml - the ServiceBindingManager bean and configuration

  • profile.xml - the basic ProfileService beans. This uses the legacy filesystem structure and has no support for management of the profile.

  • profile-repository.xml - the full featured ProfileService beans which include management and deployment support.

 

In addition, the ServerImpl registers install callbacks for any beans that implement the org.jboss.bootstrap.spi.Bootstrap interface. The profile.xml configurations include a ProfileServiceBootstrap bean that implements the Bootstrap interface.

 

Basic ProfileService profile.xml

The profile.xml for the basic profile service version:

<?xml version="1.0" encoding="UTF-8"?>

<!--
   The profile service
-->
<deployment xmlns="urn:jboss:bean-deployer:2.0">

   <classloader><inject bean="profile-classloader:0.0.0"></inject></classloader>

   <classloader name="profile-classloader" xmlns="urn:jboss:classloader:1.0" export-all="NON_EMPTY" import-all="true"></classloader>

   <!-- The basic profile service which relies on vfs scanners
   to determine the profile deployments. This version does not
   support the full ProfileService spi.
   -->
   <bean name="ProfileService" class="org.jboss.system.server.profileservice.basic.MetaDataAwareProfileService">
      <constructor>
         <parameter>${jboss.server.name}</parameter>
      </constructor>
      <property name="profileRoot">${jboss.server.home.dir}</property>
      <property name="mainDeployer"><inject bean="MainDeployer"></inject></property>
   </bean>

   <bean name="ProfileServiceBootstrap" class="org.jboss.system.server.profileservice.ProfileServiceBootstrap">
      <property name="kernel"><inject bean="jboss.kernel:service=Kernel"></inject></property>
      <property name="mainDeployer"><inject bean="MainDeployer"></inject></property>
      <property name="profileService"><inject bean="ProfileService"></inject></property>
   </bean>

   <!-- A filter for excluding files from the scanner -->
   <bean name="DeploymentFilter" class="org.jboss.virtual.plugins.vfs.helpers.ExtensibleFilter">
      <!-- Files starting with theses strings are ignored -->
      <property name="prefixes">#,%,\,,.,_$</property>
      <!-- Files ending with theses strings are ignored -->
      <property name="suffixes">#,$,%,~,\,v,.BAK,.bak,.old,.orig,.tmp,.rej,.sh</property>
      <!-- Files matching with theses strings are ignored -->
      <property name="matches">.make.state,.nse_depinfo,CVS,CVS.admin,RCS,RCSLOG,SCCS,TAGS,core,tags</property>
   </bean>

   <!-- Scan for bootstraps -->
   <bean name="VFSBootstrapScanner" class="org.jboss.system.server.profileservice.VFSBootstrapScannerImpl">
      <property name="profileService"><inject bean="ProfileService"></inject></property>
      <property name="filterInstance"><inject bean="DeploymentFilter"></inject></property>
      <property name="URIList">
         <list elementClass="java.net.URI">
            <!-- Legacy static conf/jboss-service.xml -->
            <value>${jboss.server.home.url}conf/jboss-service.xml</value>
         </list>
      </property>
   </bean>

   <!-- Scan for deployers -->
   <bean name="VFSDeployerScanner" class="org.jboss.system.server.profileservice.VFSDeployerScannerImpl">
      <property name="profileService"><inject bean="ProfileService"></inject></property>
      <property name="filterInstance"><inject bean="DeploymentFilter"></inject></property>
      <property name="URIList">
         <list elementClass="java.net.URI">
            <!-- Directory for deployers -->
            <value>${jboss.server.home.url}deployers/</value>
         </list>
      </property>
   </bean>

   <!-- Scan for applications -->
   <bean name="VFSDeploymentScanner" class="org.jboss.system.server.profileservice.VFSDeploymentScannerImpl">
      <property name="profileService"><inject bean="ProfileService"></inject></property>
      <property name="filterInstance"><inject bean="DeploymentFilter"></inject></property>
      <property name="URIList">
         <list elementClass="java.net.URI">
            <!-- Standard hot deployment directory -->
            <value>${jboss.server.home.url}deploy/</value>
         </list>
      </property>
   </bean>

   <!-- Hotdeployment of applications -->
   <bean name="HDScanner"
      class="org.jboss.system.server.profileservice.hotdeploy.HDScanner">
      <property name="mainDeployer"><inject bean="MainDeployer"></inject></property>
      <!-- Workaround for JBMICROCONT-176
      -->
      <property name="controller"><inject bean="jboss.kernel:service=KernelController"></inject></property>
      <!-- Broken due to JBMICROCONT-176
         <property name="controller"><inject bean="jboss.kernel:service=Kernel" property="controller"></inject></property>
      -->
      <property name="profileService"><inject bean="ProfileService"></inject></property>
      <property name="scanPeriod">5000</property>
      <property name="scanThreadName">HDScanner</property>
   </bean>
   
</deployment>

 

The main beans are:

  • ProfileService : this bean loads the deployments associated with the named server profile, "default", "all" or whatever name is passed in as the -c option to the server. Its an extension of the jboss-4.0.x and earlier notion of always looking to the filesystem server/name/conf/jboss-service.xml and server/name/deploy to load deployments.

  • ProfileServiceBootstrap : the Bootstrap implementation that uses the ProfileService to load the profile deployments

  • DeploymentFilter : a filter bean used to restrict what the deployment scanners recgonize

  • VFSBootstrapScanner : a scanner that loads the profile bootstrap deployments

  • VFSDeployerScanner : a scanner bean that loads the profile deployers into the basic profile service.

  • VFSDeploymentScanner : a scanner bean that loads the deploy directory contents into the basic profile service.

  • HDScanner : a bean that queries the profile service for changes in deploy directory contents and  redeploys updated content, undeploys removed content, and add new deployment content to the profile service.

 

Extended ProfileService profile-repository.xml

The repository based profile service profile-repository.xml:

<?xml version="1.0" encoding="UTF-8"?>

<!--
   The profile service
-->
<deployment xmlns="urn:jboss:bean-deployer:2.0">

   <classloader><inject bean="profile-classloader:0.0.0"></inject></classloader>

   <classloader name="profile-classloader" xmlns="urn:jboss:classloader:1.0" export-all="NON_EMPTY" import-all="true"></classloader>
    
    <!-- The file repository profile service which provides full
        support ProfileService spi.
    -->
    <bean name="ProfileService" class="org.jboss.system.server.profileservice.repository.ProfileServiceImpl">
        <constructor>
            <parameter>${jboss.server.name}</parameter>
        </constructor>
        <property name="profileRepository"><inject bean="FileProfileRepository"></inject></property>
    </bean>
    <bean name="FileProfileRepository" class="org.jboss.system.server.profileservice.repository.FileProfileRepository">
        <property name="storeRoot">${jboss.server.base.dir}</property>
        <property name="repositoryFactory"><inject bean="SerializableDeploymentRepositoryFactory"></inject></property>
    </bean>
   <bean name="SerializableDeploymentRepositoryFactory" class="org.jboss.system.server.profileservice.repository.SerializableDeploymentRepositoryFactory">
      <property name="storeRoot">${jboss.server.base.dir}</property>
      <property name="applicationURIs">
         <array elementClass="java.net.URI">
            <value>${jboss.server.home.url}/deploy</value>
         </array>
      </property>
      <property name="serializer"><inject bean="AttachmentsSerializer"></inject></property>
   </bean>
   <bean name="AttachmentsSerializer" class="org.jboss.system.server.profileservice.repository.JavaBeanXmlAttachmentsSerializer">
        <property name="attachmentsStoreDir">${jboss.server.home.dir}/attachments</property>
    </bean>

   <bean name="ProfileServiceBootstrap" class="org.jboss.system.server.profileservice.ProfileServiceBootstrap">
      <property name="kernel"><inject bean="jboss.kernel:service=Kernel"></inject></property>
      <property name="mainDeployer"><inject bean="MainDeployer"></inject></property>
      <property name="profileService"><inject bean="ProfileService"></inject></property>
   </bean>

   <!-- A filter for excluding files from the scanner -->
   <bean name="DeploymentFilter" class="org.jboss.virtual.plugins.vfs.helpers.ExtensibleFilter">
      <!-- Files starting with theses strings are ignored -->
      <property name="prefixes">#,%,\,,.,_$</property>
      <!-- Files ending with theses strings are ignored -->
      <property name="suffixes">#,$,%,~,\,v,.BAK,.bak,.old,.orig,.tmp,.rej,.sh</property>
      <!-- Files matching with theses strings are ignored -->
      <property name="matches">.make.state,.nse_depinfo,CVS,CVS.admin,RCS,RCSLOG,SCCS,TAGS,core,tags</property>
   </bean>
   
</deployment>

 

This configures the repository based ProfileService, additional aspects for intercepting deployer methods, the same set of bootstrap deployers, but no VFS scanners. The repository based ProfileService manages the deployments available based on a repository plugin. The current FileProfileRepository does rely on the VFS conf, deployers, deploy content as does the basic ProfileService. This is a detail that can be changed to pull deployments from central store, non-filesystem, etc. The repository also stores admin edits as overrides to the deployment metadata.

 

The main beans are:

  • ProfileService : this bean loads the deployments associated with the named server profile, "default", "all" or whatever name is passed in as the -c option to the server. Its an extension of the jboss-4.0.x and earlier notion of always looking to the filesystem server/name/conf/jboss-service.xml and server/name/deploy to load deployments.

  • FileProfileRepository : A profile repository implementation that uses the legacy file system server//{conf,deployers,deploy} structure to identify deployments.

  • SerializableDeploymentRepositoryFactory : a factory for creating the profile repository plugin implementation used by FileProfileRepository.

  • AttachmentsSerializer : the plugin for serializing/deserializing the managed metadata attachment overrides.

  • ProfileServiceBootstrap : the Bootstrap implementation that uses the ProfileService to load the profile deployments

  • DeploymentFilter : a filter bean used to restrict what the deployment scanners recgonize

  • HDScanner : a bean that queries the profile service for changes in deploy directory contents and  redeploys updated content, undeploys removed content, and add new deployment content to the profile service.

 

ProfileServiceBootstrap

The org.jboss.system.server.profileservice.ProfileServiceBootstrap is an implementation of the org.jboss.bootstrap.spi.Bootstrap interface that loads the deployments associated with the current profile. The {profile-name} is the name of the profile being loaded and corresponds to the server -c command line argument. The default {profile-name} is "default".

 

See Also

 

Referenced by: