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: BlockingParticipantDelegate.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.rep;
09:
10: import com.uwyn.rife.rep.exceptions.InitializationErrorException;
11:
12: /**
13: * This class implements a wrapper blocking participant that is able to delegate
14: * all the logic to another participant, while still being usable in a blocking
15: * repository.
16: *
17: * @author Geert Bevin (gbevin[remove] at uwyn dot com)
18: * @version $Revision: 3634 $
19: * @see Rep
20: * @since 1.0
21: */
22: class BlockingParticipantDelegate extends BlockingParticipant {
23: private Class<Participant> mDelegateClass = null;
24: private Participant mDelegate = null;
25:
26: BlockingParticipantDelegate(Class<Participant> delegateClass) {
27: mDelegateClass = delegateClass;
28: }
29:
30: protected void initialize() {
31: try {
32: mDelegate = mDelegateClass.newInstance();
33: } catch (InstantiationException e) {
34: throw new InitializationErrorException(e);
35: } catch (IllegalAccessException e) {
36: throw new InitializationErrorException(e);
37: }
38: }
39:
40: protected Object _getObject() {
41: return mDelegate.getObject();
42: }
43:
44: protected Object _getObject(Object key) {
45: return mDelegate.getObject(key);
46: }
47: }
|