Hi Romen,

I just have sent an email to www.orionsupport.com with an example how to use the 
EJBUserManager, when I read your
message. The EJBUserManager is -not- the DataSourceUserManager by the way, but does 
store your user info in a database.

The example desribes step by step how to configure the ATM example to use the 
EJBUserManager.

If you have any trouble (I might have overlooked something) please let me know and 
I'll update the example.

Good luck,
FE 




------------------------
Setting up the EJBUserManager for the ATM example

This example describes how to make use of the EJBUserManager with the atm example. I 
guess after that it's pretty easy to
use it in your own applications. 



Unjar the atm.ear file
The biggest part of the job is already done for you: creating the deployment 
information for the EJBUserManager. To copy the
deployment information go to the '<orion-dir>/applications' directory, create a 
directory 'atm' and unjar the atm.ear file into this
new directory. This will create atm-ejb.jar, atm-web.jar and more.



Copy the usermanager module from the demo directory
If you browse to the '<orion-dir>/demo/ejb/' you will find a directory called 
usermanager. The next step is to copy this directory
to your '<orion-dir>/applications/atm/' directory. So you'll get something like 
'\orion\applications\atm\usermanager' whith in that
directory a sub-directory containing a ejb-jar.xml file. This is the module descriptor 
for the EJBUserManager. Have a look!



Edit three files
After this you will have to edit two files:
1. application.xml
2. orion-application.xml
3. server.xml


application.xml
First add the usermanager module to your atm application by adding the following lines 
to the application.xml file:
        <module>
                <ejb>usermanager</ejb>
        </module>


orion-application.xml
Next add the following lines to the orion-application.xml in the 
<orion-dir>\application-deployments\atm directory:
        <user-manager class="com.evermind.ejb.EJBUserManager">
                <property name="defaultGroups" value="users" />
                <property name="home" value="com.evermind.ejb.EJBUser" />
        </user-manager>

Remove the reference to principals from the orion-applications.xml file.

[To understand the definition for the defaultGroups read the orion documentation (the 
EJBUserManager API doc)]


server.xml
Change the server.xml to load the atm application. If you deployed the atm.ear file 
previously, just remove the '.ear' extension
from the value of the path. You 'll get something like:
        <application name="atm" path="../applications/atm" />


When you start you server now, you probably find out that the server deploys the user 
manager and creates the necessary
table(s). If you already did deploy the demos you'll miss these reassuring create 
table messages. To check whether things
are running smoothly start the ATM and register a new user. (If you use hsql as a 
datastore you can check the bottom part
of the *.script file with you favorite text editor to see if the user is indeed added).



Keeping things tidy
The orion-application file is under normal circumstances generated by the orion 
server. To prevent the necessity of hacking
this file after each deployment, you can create a orion-application.xml in the same 
directory as the application.xml file. This
file only needs to contain the user-manager definition: the four lines described above.

After adding the orion-application.xml file you could opt to recreate the atm.ear 
file, which would include now your
EJBUserManager module and the orion-application.xml file.

Note: orion copies the orion-application.xml file to the deployment directory only 
once when you deploy the application for the
very first time. After that changes to the original copy (in the same directory as the 
application.xml file) have no effect whatsoever
on your configuration. Only edits direct on the orion-application.xml file in the 
deployment directory have effect on the server
behavior.




Kind regards,
Frank Eggink
Swift Applications
[EMAIL PROTECTED]
+31 6 28847325 (voice)
+31 33 4532464 (fax)


Reply via email to