Title: RE: [JBoss-user] How to use application specific properties - an example

1. I attached all the classes for my MBean:
        - TeamSpaceConfigMBean.java:    This is the MBean interface
        - TeamSpaceConfig.java:         This is the MBean implementation
        - TeamSpaceConfigProxy.java:    This is a Proxy class to access the MBean. This class hide all the ugly JMX method/attribute calls. This is the class that is actually used in the EJB


2. In jboss.jcml, I add the following block to load my MBean at boot time:
<mbean code="tspace.jmx.config.TeamSpaceConfig" 
        name="DefaultDomain:service=TeamSpaceConfig">
    <constructor>
      <arg type="java.lang.String" value="/home/tspace" />
    </constructor>
</mbean>

3. In any EJB, I do this to call my MBean:
TeamSpaceConfigMBean conf = new TeamSpaceConfigProxy();
_filesDir = conf.XXX()

thats it :-)



-----Original Message-----
From: Brian Towles [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 12, 2002 10:54 AM
To: [EMAIL PROTECTED]
Subject: RE: [JBoss-user] How to use application specific properties


Do you have a sample of this type of MBean....
or actually more importantly a sample of how to access the MBean from
and EJB?

Thanks
-=Brian


On Thu, 2002-09-12 at 08:13, Herve Tchepannou wrote:
> In my application, I also have some application properties store in a
> property file.
> I prefer creating a MBean that loads all thoses properties when JBoss boot,
> an in my EJB, I can nicely access those properties.
> The other advantage of MBean is that you can connect at
> http://localhost:8082 and change
> the system configuration without redeploying or stopping JBoss.
> And also, JMX is more and more a standard in J2ee world
>
> -----Original Message-----
> From: Kim, Yong [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 12, 2002 9:12 AM
> To: '[EMAIL PROTECTED]'
> Subject: RE: [JBoss-user] How to use application specific properties
>
>
> I use external configuration file just because of the reason you mentioned,
> "I am not sure I like this because different machines/servers need different
> properties".  And I created a static class that reads in the key=value pairs
> from the file and store in memory as long as the contains stays running.
>
> Mitchell
>
> -----Original Message-----
> From: Jon Haugsand [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 12, 2002 7:15 AM
> To: [EMAIL PROTECTED]
> Subject: [JBoss-user] How to use application specific properties
>
>
> We have a local property file containg such things like name of
> machines, files, ip-addresses and such for legacy interfaces.  I found
> out (the hard way) that I could place this file in the
> ${JBOSS_HOME}/bin directory, presumably because it is from there we
> run the server.  It shouldn't stay there of course, and further we
> need it within the client too.
>
> I know we could use some property mechanism within ejb-jar.xml, but I
> cannot figure out how to get this with XDoclet and I am not sure I
> like this because different machines/servers need different
> properties.
>
> Is there a Right (tm) way to do this?
>
> --
>   Jon Haugsand, <[EMAIL PROTECTED]>
>   Norges Bank, <http://www.norges-bank.no>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

 

Attachment: BaseMBeanProxy.java
Description: Binary data

Attachment: TeamSpaceConfig.java
Description: Binary data

Attachment: TeamSpaceConfigMBean.java
Description: Binary data

Attachment: TeamSpaceConfigProxy.java
Description: Binary data

Reply via email to