01: /*****************************************************************************
02: * Copyright (C) PicoContainer Organization. All rights reserved. *
03: * ------------------------------------------------------------------------- *
04: * The software in this package is published under the terms of the BSD *
05: * style license a copy of which has been included with this distribution in *
06: * the LICENSE.txt file. *
07: * *
08: * Original code by *
09: *****************************************************************************/package org.picocontainer.gems.behaviors;
10:
11: import org.picocontainer.behaviors.AbstractBehaviorFactory;
12: import org.picocontainer.ComponentAdapter;
13: import org.picocontainer.ComponentMonitor;
14: import org.picocontainer.LifecycleStrategy;
15: import org.picocontainer.Parameter;
16: import org.picocontainer.PicoCompositionException;
17:
18: import java.util.Properties;
19:
20: public class Pooling extends AbstractBehaviorFactory {
21:
22: private final Pooled.Context poolContext;
23:
24: public Pooling(Pooled.Context poolContext) {
25: this .poolContext = poolContext;
26: }
27:
28: public Pooling() {
29: poolContext = new Pooled.DefaultContext();
30: }
31:
32: public ComponentAdapter createComponentAdapter(
33: ComponentMonitor componentMonitor,
34: LifecycleStrategy lifecycleStrategy,
35: Properties componentProperties, Object componentKey,
36: Class componentImplementation, Parameter... parameters)
37: throws PicoCompositionException {
38: ComponentAdapter componentAdapter = super
39: .createComponentAdapter(componentMonitor,
40: lifecycleStrategy, componentProperties,
41: componentKey, componentImplementation,
42: parameters);
43: Pooled behavior = new Pooled(componentAdapter, poolContext);
44: //TODO
45: //Characteristics.HIDE.setProcessedIn(componentCharacteristics);
46: return behavior;
47: }
48:
49: public ComponentAdapter addComponentAdapter(
50: ComponentMonitor componentMonitor,
51: LifecycleStrategy lifecycleStrategy,
52: Properties componentProperties, ComponentAdapter adapter) {
53: return new Pooled(super.addComponentAdapter(componentMonitor,
54: lifecycleStrategy, componentProperties, adapter),
55: poolContext);
56: }
57: }
|