01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: ParticipantSite.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.rep.participants;
09:
10: import com.uwyn.rife.engine.SiteBuilder;
11: import com.uwyn.rife.rep.BlockingParticipant;
12: import com.uwyn.rife.tools.ExceptionUtils;
13: import java.util.logging.Logger;
14:
15: public class ParticipantSite extends BlockingParticipant {
16: private Object mSite = null;
17: private Throwable mException = null;
18:
19: public ParticipantSite() {
20: setInitializationMessage("Creating web application's site structure ...");
21: setCleanupMessage("Cleaning up web application's site structure ...");
22: }
23:
24: public Throwable getException() {
25: return mException;
26: }
27:
28: protected void initialize() {
29: try {
30: SiteBuilder builder = new SiteBuilder(getParameter(),
31: getResourceFinder());
32: mSite = builder.getSite();
33: } catch (Throwable e) {
34: mException = e;
35: Logger.getLogger("com.uwyn.rife.rep").severe(
36: ExceptionUtils.getExceptionStackTrace(e));
37: }
38: }
39:
40: protected Object _getObject(Object key) {
41: if (null == mSite) {
42: initialize();
43: }
44:
45: return mSite;
46: }
47: }
|