View Javadoc

    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  import org.huihoo.jfox.soaf.util.resource.ResourceHelper;
    18
    19  /***
    20   * InterceptorManager imlementation.
    21   *
    22   * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
    23   * @version $Revision: 1.4 $ $Date: 2004/10/28 05:12:04 $
    24   * @version Revision: 1.0
    25   */
    26
    27  public class InterceptorManagerImpl implements InterceptorManager {
    28
    29      private InterceptorChain interceptorChain = new InterceptorChainImpl();
    30
    31      private Collection interceptorList = new ArrayList();
    32
    33      /***
    34       * Process Interceptor.
    35       * @param interceptorColl
    36       * @param serviceModel
    37       *
    38       * @throws Throwable
    39       */
    40      public void processInterceptor(Collection interceptorColl,
    41              Collection serviceEntryColl)
    42              throws Throwable {
    43          instantiationInteceptor(interceptorColl);
    44          Iterator serviceEntryIter = serviceEntryColl.iterator();
    45          ServiceEntry serviceModel = null;
    46          while (serviceEntryIter.hasNext()) {
    47              serviceModel = (ServiceEntry) serviceEntryIter.next();
    48              interceptorChain.processInterceptor(interceptorList, serviceModel);
    49          }
    50      }
    51
    52      /***
    53       * Init interceptor instance.
    54       * @param coll
    55       *            Interceptor collection
    56       *
    57       * @throws Throwable
    58       */
    59      private void instantiationInteceptor(Collection coll) throws Throwable {
    60          Iterator iter = coll.iterator();
    61          while (iter.hasNext()) {
    62              interceptorList.add(ResourceHelper.instantiate((String) iter.next()));
    63          }
    64      }
    65
    66  }