I am starting to integrate openfire jabber server with my user engine. I use EJBs version 3 with JBoss 4 (JEE5) and need to make a JNDI remote lookup of the user manager which is a stateless session bean running in a JBoss server.
My solution is working great but I have a couple of issues to solve. Maybe somebody here can help me…
Can I overload AuthProvider and UserProvider basic constructor? I’d like to do this to insert there the JNDI lookup and preventing that way to performing the remote lookups for every user or auth request. That means storing the remote user reference in the provider and not looking it up every time. Does OpenFire just keeps one instance of providers or creates a pool of them?
I’ve tried to get global variable values using JiveGlobals.getProperty() but always get a null value. I am placing the properties in conf/openfire.xml but can’t read them. Am I doing something wrong?
thanks for any help,
- You can make your CustomAuthProvider and CustomUserProvider with implementing AuthProvider and UserProvider Interface respectively but You must set entry corresponding your custom class in provider tag with clasName tag…
If there is CustomAuthProvider class which implement AuthProvider
then correspong entry in openfire.xml is like that
Another for prevent to perform the remote lookups for every user or auth request,U can make a central Class to lookup using Remote Interface of EJB.
- You can get global variable using JiveGlobals.getProperty() but You always set corresponding property in openfire.xml file.
If there is an entry in yr class like
String customJndiUrl = JiveGlobals.getXMLProperty(“mycustom.jndiurl”);
Then correspong entry in openfire.xml is like that<!–custom Ejb JNDI URL -->
I did not look at the source code but I guess that “JiveGlobals.getProperty()” is used to query “Openfire System Properties” which are stored in the database.
Yes, We can access openfire.xml entry from JiveGlobals.getXMLProperty() method as bhupendra suggested. I also using it in my customization.
Thanks for your replies… I was using getProperty() and not getXMLProperty().
Anyway, I still have to solve my main “performance” issue. Do Providers have any “init” method, something similar to init method in servlets or session EJBs, to make initial lookups there and avoid making a lookup every time a method in the provider is invoked?
You make a class where you can put all JNDI lookup stuff. Authprovider and UserProvider use this class for JNDI lookup. We are also doing this to make JNDI lookup. So you needn’t init like methods in Provider classes.