View Javadoc

1   /*
2    * Copyright 2004-2008 the Seasar Foundation and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.seasar.uruma.rcp.core;
17  
18  /**
19   * RCP 環境における Uruma バンドルおよび Uruma アプリケーションの状態を保持するクラスです。<br />
20   * 
21   * @author y-komori
22   */
23  public final class UrumaBundleState {
24      private static UrumaBundleState instance;
25  
26      private Throwable urumaAppInitializingException;
27  
28      private BundleState urumaBundleState = BundleState.NOT_AVAILABLE;
29  
30      private BundleState appBundleState = BundleState.NOT_AVAILABLE;
31  
32      private UrumaBundleState() {
33  
34      }
35  
36      /**
37       * Uruma アプリケーションバンドルの初期化中に発生した例外を取得します。<br />
38       * 
39       * @return 例外オブジェクト
40       */
41      public Throwable getUrumaAppInitializingException() {
42          return urumaAppInitializingException;
43      }
44  
45      /**
46       * Uruma アプリケーションバンドルの初期化中に発生した例外を設定します。<br />
47       * 
48       * @param urumaAppInitializingException
49       *            例外オブジェクト
50       */
51      void setUrumaAppInitializingException(
52              final Throwable urumaAppInitializingException) {
53          this.urumaAppInitializingException = urumaAppInitializingException;
54      }
55  
56      /**
57       * Uruma バンドルの状態を取得します。<br />
58       * 
59       * @return Uruma バンドルの状態
60       */
61      public BundleState getUrumaBundleState() {
62          return urumaBundleState;
63      }
64  
65      /**
66       * Uruma バンドルの状態を設定します。<br />
67       * 
68       * @param urumaBundleState
69       *            Uruma バンドルの状態
70       */
71      void setUrumaBundleState(final BundleState urumaBundleState) {
72          this.urumaBundleState = urumaBundleState;
73      }
74  
75      /**
76       * Uruma アプリケーションの状態を取得します。<br />
77       * 
78       * @return Uruma アプリケーションの状態
79       */
80      public BundleState getAppBundleState() {
81          return appBundleState;
82      }
83  
84      /**
85       * Uruma アプリケーションの状態を設定します。<br />
86       * 
87       * @param appBundleState
88       *            Uruma アプリケーションの状態
89       */
90      void setAppBundleState(final BundleState appBundleState) {
91          this.appBundleState = appBundleState;
92      }
93  
94      /**
95       * インスタンスを取得します。<br />
96       * 
97       * @return 本クラスのインスタンス
98       */
99      public static UrumaBundleState getInstance() {
100         if (instance == null) {
101             instance = new UrumaBundleState();
102         }
103         return instance;
104     }
105 
106     /**
107      * バンドルの状態を表す列挙型です。<br />
108      * 
109      * @author y-komori
110      */
111     public enum BundleState {
112         /**
113          * バンドルは利用できません。<br />
114          */
115         NOT_AVAILABLE,
116         /**
117          * バンドルは利用可能です。<br />
118          */
119         AVAILABLE;
120     }
121 }