View Javadoc

1   /*
2    * Copyright (c) 2005-2007 Creative Sphere Limited.
3    * All rights reserved. This program and the accompanying materials
4    * are made available under the terms of the Eclipse Public License v1.0
5    * which accompanies this distribution, and is available at
6    * http://www.eclipse.org/legal/epl-v10.html
7    *
8    * Contributors:
9    *
10   *   Creative Sphere - initial API and implementation
11   *
12   */
13  package org.abstracthorizon.extend.server.deployment;
14  
15  import java.util.Collections;
16  import java.util.Set;
17  
18  /**
19   * Utility class for common {@link Module} functions.
20   *
21   * @author Daniel Sendula
22   */
23  public class ModuleUtil {
24  
25      /**
26       * Empty set
27       */
28      public static final Set<Module> EMPTY_SET = Collections.emptySet();
29  
30      /**
31       * Converts a state to a string
32       * @param state state
33       * @return state as a string
34       */
35      public static String stateAsString(int state) {
36          if (state == Module.UNDEFINED) {
37              return "UNDEFINED";
38          } else if (state == Module.DEFINED) {
39              return "DEFINED";
40          } else if (state == Module.WAITING_ON_CREATE) {
41              return "WAITING ON DEPENDENCY CREATE";
42          } else if (state == Module.WAITING_ON_CREATE_TO_START) {
43              return "WAITING ON DEPENDENCY CREATE AND START";
44          } else if (state == Module.CREATED) {
45              return "CREATED";
46          } else if (state == Module.WAITING_ON_START) {
47              return "WAITING ON DEPENDENCY START";
48          } else if (state == Module.STARTED) {
49              return "STARTED";
50          } else {
51              return "UNLKNOWN";
52          }
53      }
54  
55  }