I wanted to add that towards the end of the in-depth simple blog
tutorial (http://rifers.org/rife_indepth_simple_blog) there's an
explanation for this.
cheers,
-- eokyere
On 12/19/05, Emmanuel Okyere <[EMAIL PROTECTED]> wrote:
> 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.getExceptionStackTraceMessages(e));
> } catch (SessionManagerException e) {
>
> logger.warning(ExceptionUtils.getExceptionStackTraceMessages(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