KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > module > workflow > jcr > JCRPersistedEngine


1 /**
2  *
3  * Magnolia and its source-code is licensed under the LGPL.
4  * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5  * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6  * you are required to provide proper attribution to obinary.
7  * If you reproduce or distribute the document without making any substantive modifications to its content,
8  * please use the following attribution line:
9  *
10  * Copyright 2006 obinary Ltd. (http://www.obinary.com) All rights reserved.
11  *
12  */

13 package info.magnolia.module.workflow.jcr;
14
15 import info.magnolia.module.workflow.WorkflowConstants;
16 import openwfe.org.ServiceException;
17 import openwfe.org.embed.impl.engine.FsPersistedEngine;
18 import openwfe.org.embed.impl.engine.PersistedEngine;
19 import openwfe.org.engine.Definitions;
20 import openwfe.org.engine.expool.ExpressionPool;
21 import openwfe.org.engine.participants.Participant;
22 import openwfe.org.engine.participants.ParticipantMap;
23
24 import org.slf4j.Logger;
25 import org.slf4j.LoggerFactory;
26
27
28 /**
29  * Implement openwfe.org.embed.engine.Engine to use JCRWorkItemStore and JCRExpressionStore
30  * @author jackie_juju@hotmail.com
31  */

32 public class JCRPersistedEngine extends PersistedEngine {
33
34     private JCRExpressionStore eStore = null;
35
36     private final static Logger log = LoggerFactory.getLogger(FsPersistedEngine.class.getName());
37
38     public JCRPersistedEngine() throws ServiceException {
39         this(WorkflowConstants.ENGINE_NAME, true);
40
41     }
42
43     public Participant getParticipant(String JavaDoc name) {
44         ParticipantMap pm = Definitions.getParticipantMap(getContext());
45         if (pm == null) {
46             log.error("get participant failed, the map retrieved was null for:" + name);
47             return null;
48         }
49         return pm.get(name);
50     }
51
52     /**
53      * Instantiates a JCR persisted engine with the given name
54      */

55     public JCRPersistedEngine(final String JavaDoc engineName, final boolean cached) throws ServiceException {
56         super(engineName, cached);
57         super.setDaemon(true);
58
59         // create expression store and add it to context
60
final java.util.Map JavaDoc esParams = new java.util.HashMap JavaDoc(1);
61
62         this.eStore = new JCRExpressionStore();
63
64         this.eStore.init(Definitions.S_EXPRESSION_STORE, getContext(), esParams);
65
66         getContext().add(this.eStore);
67
68     }
69
70     public JCRExpressionStore getExpStore() {
71         return this.eStore;
72     }
73
74     public ExpressionPool getExpressionPool() {
75         return super.getExpressionPool();
76     }
77
78 }
79
Popular Tags