Hi Lars,
no, not using RIFE. You could write db-specific jdbc statements for
that and introspect the meta data. E usually just detect an exception
and log it.
On 20-dec-05, at 12:17, Lars Grupe wrote:
Hi Geert,
That's working now. Thanks!
Sadly, I have another question:
Is it possible to check if the the user and session tables has been
created in the userdatabase without getting an exception if they are
missing?
I couldn't find an easy way to do that with a DatabaseUsers object.
Cheers,
Lars
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Geert Bevin
Sent: 20 December 2005 10:54
To: RIFE users list : questions, bug reports and suggestions.
Subject: Re: [Rife-users] run java code directly after
starting the web server
Hi Lars,
you've got it the wrong way 'round. The syntax is:
<participant param="someoptionalvalue">com.pakkage.your.Participant</
participant>
you can leave the param attribute out.
You an either extends BlockingParticipant or implement Participant,
RIFE should properly wrap the latter for the use with the standard
BlockingRepository implementation. You can find examples
here:
http://rifers.org:8088/viewrep/rifers/rife/trunk/src/framework/com/
uwyn/rife/rep/participants
Best regards,
Geert
Thanks for your answer. But I have an additional question.
I like your alternative with the BlockingParticipant.
Could you tell me more about the implementation of this.
I added a new participant before the site file in the
participants.xml:
<!-- create the database structure -->
<participant param="com.acrolinx.portal.generic.Setup"
blocking="true">CreateDatabaseStructureParticipant</participant>
Must the class that is given in 'param' be an implementation of the
Participant interface? Do you have a sample implementation for me?
What's the function of the value? e.g.:
'CreateDatabaseStructureParticipant'
Cheers,
Lars
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Emmanuel Okyere
Sent: 19 December 2005 23:12
To: RIFE users list : questions, bug reports and suggestions.
Subject: Re: [Rife-users] run java code directly after
starting the
web server
Look at the ~.engine.ElementDeployer class. A typical
implementation
(this an earlier version of something I had for my Account
element)
looks like the one i've pasted below.
Alternatively, you could create a BlockingParticipant (maybe called
Setup) and put all the setup-specific code there, and add
it to the
repository configuration.
hth,
-- eokyere
public static class Deployer extends ElementDeployer {
public void deploy() throws EngineException {
Datasource ds = (Datasource)
getElementInfo().getProperty(DATASOURCE);
try {
DatabaseContentFactory.getInstance(ds).install();
} catch (InstallContentErrorException e) {
logger.warning(ExceptionUtils.getExceptionStackTraceMessages(e));
}
ContentQueryManager<Account> accounts =
new ContentQueryManager<Account>(ds, Account.class);
try {
accounts.install();
} catch (DatabaseException e) {
logger.warning(ExceptionUtils.getExceptionStackTraceMessages(e));
}
try {
//DatabaseUsersFactory.getInstance(ds).install();
DatabaseUsers users =
DatabaseUsersFactory.getInstance(ds);
users.install();
users.addRole("admin");
users.addRole("user");
DatabaseSessionsFactory.getInstance(ds).install();
//DatabaseSessionsFactory.getInstance(ds).
logger.info("---------- user
tbls created ---------- ");
} catch (DatabaseException e) {
logger.warning(ExceptionUtils.getExceptionStackTraceMessag
es(e));
} catch (SessionManagerException e) {
logger.warning(ExceptionUtils.getExceptionStackTraceMessag
es(e));
}
}
private Logger logger =
Logger.getLogger(Deployer.class.getPackage().getName());
}
On 12/19/05, Lars Grupe <[EMAIL PROTECTED]> wrote:
Hi,
I would like to know if I can run java code directly
after starting
the web application. I would like to install the users
table and the
sessions table in the database, directly after starting the web
application the first time. Earlier I have no simple
access to the
config to get the datasource. And my arrival element inherits an
authentication element.
If there is no easy way to do it, I will generate the
database earlier
and copy them into my project. But maybe there is an easy
way, that
you can tell me?
Cheers,
Lars
_______________________________________________
Rife-users mailing list
[email protected]
http://www.uwyn.com/mailman/listinfo/rife-> users
_______________________________________________
Rife-users mailing list
[email protected] http://www.uwyn.com/mailman/listinfo/rife-users
_______________________________________________
Rife-users mailing list
[email protected] http://www.uwyn.com/mailman/listinfo/rife-users
--
Geert Bevin Uwyn bvba
"Use what you need" Avenue de Scailmont 34
http://www.uwyn.com 7170 Manage, Belgium
gbevin[remove] at uwyn dot com Tel +32 64 84 80 03
PGP Fingerprint : 4E21 6399 CD9E A384 6619 719A C8F4 D40D
309F D6A9 Public PGP key : available at servers pgp.mit.edu,
wwwkeys.pgp.net
_______________________________________________
Rife-users mailing list
[email protected] http://www.uwyn.com/mailman/listinfo/rife-users
_______________________________________________
Rife-users mailing list
[email protected]
http://www.uwyn.com/mailman/listinfo/rife-users
--
Geert Bevin Uwyn bvba
"Use what you need" Avenue de Scailmont 34
http://www.uwyn.com 7170 Manage, Belgium
gbevin[remove] at uwyn dot com Tel +32 64 84 80 03
PGP Fingerprint : 4E21 6399 CD9E A384 6619 719A C8F4 D40D 309F D6A9
Public PGP key : available at servers pgp.mit.edu, wwwkeys.pgp.net
_______________________________________________
Rife-users mailing list
[email protected]
http://www.uwyn.com/mailman/listinfo/rife-users