01: /*
02: * The contents of this file are subject to the Sapient Public License
03: * Version 1.0 (the "License"); you may not use this file except in compliance
04: * with the License. You may obtain a copy of the License at
05: * http://carbon.sf.net/License.html.
06: *
07: * Software distributed under the License is distributed on an "AS IS" basis,
08: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
09: * the specific language governing rights and limitations under the License.
10: *
11: * The Original Code is The Carbon Component Framework.
12: *
13: * The Initial Developer of the Original Code is Sapient Corporation
14: *
15: * Copyright (C) 2003 Sapient Corporation. All Rights Reserved.
16: */
17:
18: package org.sape.carbon.core.component.lifecycle;
19:
20: import org.sape.carbon.core.component.ComponentConfiguration;
21: import org.sape.carbon.core.component.FunctionalInterface;
22: import org.sape.carbon.core.component.proxy.ComponentProxyInvocationHandler;
23: import org.sape.carbon.core.component.proxy.Decorator;
24: import org.sape.carbon.core.component.proxy.DecoratorFactory;
25: import org.sape.carbon.core.config.Configuration;
26:
27: /**
28: * LifecycleInterceptor defines the operations that should be provided by some
29: * entity that manages the lifecycle of a component.
30: *
31: * Copyright Sapient 2003
32: * @since carbon 2.0
33: * @author Greg Hinkle, March 2003
34: * @version $Revision: 1.5 $($Author: dvoet $ / $Date: 2003/05/05 21:21:13 $)
35: */
36: public class LifecycleInterceptorFactory implements DecoratorFactory {
37:
38: /**
39: * default constructor
40: */
41: public LifecycleInterceptorFactory() {
42: }
43:
44: /**
45: * <p>Constructs Lifecycle Interceptor. The parameters of this method
46: * encompass all the information known about a component at the time
47: * it is constructed.</p>
48: * @param functionalImplementation The functional implementation of the
49:
50: * component. This is supplied for cases where the interceptor needs to
51: * access the functional implementation object directly.
52: * @param componentConfiguration configuartion of the component which being
53: * built
54: * @param proxyInvocationHandler the invocation handler object that backs
55: * the component that this interceptor is being built for
56: * @param decoratorConfiguration a custom configuration object for the
57: * interceptor
58: * @return The <CODE>Decorator</CODE> that was built by this factory
59: */
60: public Decorator getInstance(
61: FunctionalInterface functionalImplementation,
62: ComponentConfiguration componentConfiguration,
63: ComponentProxyInvocationHandler proxyInvocationHandler,
64: Configuration decoratorConfiguration) {
65:
66: return new DefaultLifecycleInterceptor(
67: functionalImplementation,
68: proxyInvocationHandler,
69: (DefaultLifecycleInterceptorConfiguration) decoratorConfiguration);
70:
71: }
72: }
|