2 Replies Latest reply: Mar 21, 2012 3:32 PM by Christian Leclerc RSS

Ejb3 MBeans External Configuration ?

Christian Leclerc Newbie

Hello guy's, im kind of new here so first of all I want to thank you for the any support that you will give to me.

Here is my question now, iv'e bean searching since 2 day's on and off ..

 

I am an Jboss as 6 guy's and now im migrate to Jboss as 7.

I've got a MBeans that is called

 

something-service.xml

 

Here is the detail :

 

<?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="ca.s3s.identitygardens.config:service=identitygardens-config">

        <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="conf/x500Properties">

                    <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>Item A</java:key> <java:value>value A</java:value></java:property>

                        <java:property><java:key>Item b</java:key><java:value>Value b</java:value></java:property>

                        <java:property><java:key>Item C</java:key><java:value>Value C</java:value></java:property>           

                    </java:properties>

                </jndi:binding>

            </jndi:bindings>

        </attribute>

        <depends>jboss:service=Naming</depends>

    </mbean>

</server>

 

And in my ejb I inject the value with :

 

@Resource(mappedName = "conf/x500Properties")

 

Everything work's great and now I wonder how to do this in JBoss AS 7

It was very great because this way I was able to make the configuration out of my ear file.

The value is put in jndi at startup and the ejb go fetch this value by injection ..

 

I know that I can possibly put a string in JNDI this way :

 

https://community.jboss.org/message/615368

 

But did I can make a complete properties file object on this way ?

 

Thanks for any reply.

 

 

 

Christian Leclerc.