Version 9

    JNDIBindingServiceMgr

    The org.jboss.naming.JNDIBindingServiceMgr is a service which allows one to bind arbitrary values into JNDI. It supports a single BindingsConfig attribute which conforms to the jndi-binding-service_1_0.xsd. The content of the BindingsConfig is unmarshalled using the JBossXB framework.

     

    • jndi:bindings - The root of the BindingsConfig attribute.

      • jndi:binding - A single binding into JNDI. Its name attribute is the JNDI name  for the binding.

        • jndi:value - The inherently supported mechanism for specifying the binding value. The value is given by the text of the element. The interpretation of the text can be qualified by the following attributes:

          • type : the fully qualified java type. This is used to determine which java.beans.PropertyEditor to use to convert the text to an object value.

          • editor : The fully qualified name of the java.beans.PropertyEditor to use.

          • trim : Whether the text should be trimmed before using/converting the value.

        • ## other - This is an extension point that allows for an arbitrary value that is represented by an xml fragment from an external namespace. See the "maps/testProps" binding which specifies a java.util.Properties value.

     

    jndi-binding-service_1_0.xsd

     

    An example jboss-service.xml deployment is:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE server PUBLIC "-//JBoss//DTD MBean Service 4.0//EN"
              "http://www.jboss.org/j2ee/dtd/jboss-service_4_0.dtd">
    <server>
       <mbean code="org.jboss.naming.JNDIBindingServiceMgr"
             name="jboss.tests:service=JNDIBindingServiceMgr">
          <attribute name="BindingsConfig" serialDataType="jbxb">
             <jndi:bindings
                xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
                xmlns:jndi="urn:jboss:jndi-binding-service:1.0"
                xs:schemaLocation="urn:jboss:jndi-binding-service:1.0 resource:jndi-binding-service_1_0.xsd"
                >
                <jndi:binding name="urls/jboss-home">
                   <jndi:value type="java.net.URL">http://www.jboss.org</jndi:value>
                </jndi:binding>
    
                <jndi:binding name="hosts/localhost">
                   <jndi:value editor="org.jboss.util.propertyeditor.InetAddressEditor">
                      127.0.0.1
                   </jndi:value>
                </jndi:binding>
    
                <jndi:binding name="maps/testProps">
                   <java:properties xmlns:java="urn:jboss:java-properties"
                      xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
                      xs:schemaLocation="urn:jboss:java-properties resource:java-properties_1_0.xsd">
                      <java:property>
                         <java:key>key1</java:key>
                         <java:value>value1</java:value>
                      </java:property>
                      <java:property>
                         <java:key>key2</java:key>
                         <java:value>value2</java:value>
                      </java:property>
                   </java:properties>               
                </jndi:binding>
             </jndi:bindings>
          </attribute>
          <depends>jboss:service=Naming</depends>
       </mbean>
    
    </server>