1 17 package org.apache.geronimo.console.util; 18 19 import java.io.Serializable ; 20 import org.apache.geronimo.kernel.management.State; 21 import org.apache.geronimo.kernel.config.ConfigurationModuleType; 22 import org.apache.geronimo.kernel.repository.Artifact; 23 import org.apache.geronimo.gbean.AbstractName; 24 25 30 public class ConfigurationData implements Serializable , Comparable { 31 private final Artifact configID; 32 private final State state; 33 private final AbstractName parentName; 34 private final String childName; 35 private final ConfigurationModuleType type; 36 private final AbstractName moduleBeanName; 37 38 public ConfigurationData(Artifact configID, AbstractName parentName, String childName, State state, ConfigurationModuleType type, AbstractName moduleBeanName) { 39 this.configID = configID; 40 this.childName = childName; 41 this.parentName = parentName; 42 this.state = state; 43 this.type = type; 44 this.moduleBeanName = moduleBeanName; 45 } 46 47 public boolean isChild() { 48 return childName != null; 49 } 50 51 public String getChildName() { 52 return childName; 53 } 54 55 public AbstractName getModuleBeanName() { 56 return moduleBeanName; 57 } 58 59 public AbstractName getParentName() { 60 return parentName; 61 } 62 63 public State getState() { 64 return state; 65 } 66 67 public ConfigurationModuleType getType() { 68 return type; 69 } 70 71 public Artifact getConfigID() { 72 return configID; 73 } 74 75 public boolean isRunning() { 76 return state.toInt() == State.RUNNING_INDEX; 77 } 78 79 public int compareTo(Object o) { 80 ConfigurationData other = (ConfigurationData) o; 81 int test = getParentName().toString().compareTo(other.getParentName().toString()); 82 if(test == 0) { 83 if(getChildName() != null && other.getChildName() != null) { 84 return getChildName().compareTo(other.getChildName()); 85 } else if(getChildName() == null && other.getChildName() == null) { 86 return 0; 87 } else return getChildName() == null ? 1 : -1; 88 } else return test; 89 } 90 } 91 | Popular Tags |