KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > console > util > ConfigurationData


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.geronimo.console.util;
18
19 import java.io.Serializable JavaDoc;
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 /**
26  * Standard metadata about a configuration
27  *
28  * @version $Rev: 476061 $ $Date: 2006-11-17 01:36:50 -0500 (Fri, 17 Nov 2006) $
29  */

30 public class ConfigurationData implements Serializable JavaDoc, Comparable JavaDoc {
31     private final Artifact configID;
32     private final State state;
33     private final AbstractName parentName;
34     private final String JavaDoc childName;
35     private final ConfigurationModuleType type;
36     private final AbstractName moduleBeanName;
37
38     public ConfigurationData(Artifact configID, AbstractName parentName, String JavaDoc 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 JavaDoc 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 JavaDoc 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