1 /***
2 * JFoxSOAF, Service-Oriented Application Framework
3 *
4 * Copyright (C) www.huihoo.org
5 *
6 * Distributable under GNU LGPL For more information, please visit:
7 * http://www.huihoo.org/jfox/jfoxsoaf
8 */
9
10 package org.huihoo.jfox.soaf.container;
11
12 import java.util.ArrayList;
13 import java.util.Collection;
14 import java.util.Iterator;
15
16 import org.huihoo.jfox.soaf.schema.service.ServiceEntry;
17
18 /***
19 * InterceptorManager imlementation.
20 *
21 * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
22 * @version $Revision: 1.3 $ $Date: 2004/10/18 10:12:24 $
23 * @version Revision: 1.0
24 */
25
26 public class InterceptorManagerImpl implements InterceptorManager {
27
28 private InterceptorChain interceptorChain = new InterceptorChainImpl();
29
30 private Collection interceptorList = new ArrayList();
31
32 /***
33 * Process Interceptor.
34 *
35 * @param interceptorColl
36 * @param serviceModel
37 * @throws Throwable
38 */
39 public void processInterceptor(Collection interceptorColl,
40 Collection serviceEntryColl, ClassLoader classLoader)
41 throws Throwable {
42 instantiationInteceptor(interceptorColl, classLoader);
43 Iterator serviceEntryIter = serviceEntryColl.iterator();
44 ServiceEntry serviceModel = null;
45 while (serviceEntryIter.hasNext()) {
46 serviceModel = (ServiceEntry) serviceEntryIter.next();
47 interceptorChain.processInterceptor(interceptorList, serviceModel,
48 classLoader);
49 }
50 }
51
52 /***
53 * Init interceptor instance.
54 *
55 * @param coll
56 * Interceptor collection
57 * @param classLoader
58 * @throws Throwable
59 */
60 private void instantiationInteceptor(Collection coll,
61 ClassLoader classLoader) throws Throwable {
62 Iterator iter = coll.iterator();
63 while (iter.hasNext()) {
64 interceptorList.add(classLoader.loadClass((String) iter.next())
65 .newInstance());
66 }
67 }
68
69 }