OSDN Git Service

initial commit
[xdf/git-repos.git] / xdf / src / main / java / jp / ac / aiit / xdf / application / interceptors / UIDesignInterceptingManager.java
1 package jp.ac.aiit.xdf.application.interceptors;
2
3 import java.util.ArrayList;
4 import java.util.List;
5
6 /**
7  * XMLParseInterceptorやStyleParaseInterceptorなど、XDFをどうささせるために必要なインターセプターの
8  * 関係(実行順など)を管理するクラスである。
9  * 
10  * @author Shunichi Takagi
11  */
12 public class UIDesignInterceptingManager {
13         private List<UIDesignInterceptor> interceptors;
14         
15         /**
16          * コンストラクター
17          * @param interceptors
18          */
19         public UIDesignInterceptingManager(List<UIDesignInterceptor> interceptors) {
20                 this.interceptors = interceptors;
21         }
22         
23         /**
24          * デフォルトのインターセプタマネージャを取得する。
25          * デフォルトのマネージャはXMLParseInterceptr -> StyleParseInterceptro -> ActionInterceptorの順にインターセプト処理を動作させる。
26          * 
27          * @return デフォルトのインターセプタ管理インスタンス
28          */
29         public static UIDesignInterceptingManager getDefaultManager() {
30                 List<UIDesignInterceptor> list = new ArrayList<UIDesignInterceptor>();
31                 list.add(new XMLParseInterceptor());
32                 list.add(new StyleParseInterceptor());
33                 list.add(new ActionInterceptor());
34                 
35                 return new UIDesignInterceptingManager(list);
36         }
37         
38         /**
39          * 管理しているインターセプタの処理を実行する。
40          * 
41          * @param resource インターセプターの入出力インタフェース
42          */
43         public void invoke(UIDesignResource resource) {
44                 for(UIDesignInterceptor interceptor : interceptors) {
45                         interceptor.intercept(resource);
46                 }
47         }
48 }