wangting
2024-09-27 a3e87f78ee262ca9bb7d9b0c997639d5f3295890
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package com.vci.client.omd.lifecycle.ui;
 
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import com.vci.corba.omd.lcm.LifeCycle;
import com.vci.corba.omd.stm.StatePool;
import com.vci.client.omd.lifecycle.LifeCycleStart;
import com.vci.client.omd.statepool.StatePoolStart;
import com.vci.corba.common.VCIError;
 
public class LifeCycleReadXml {
    private String imagePath = null;
    Map<String,String> map = new HashMap<String,String>();
    public Map<String,String> lifecycle(){
        try {
            StatePool[] statePools = StatePoolStart.getService().getStatePools();
            for(int i = 0;i<statePools.length;i++){
                String name = statePools[i].name;
                if(!statePools[i].imagePath.startsWith("http://")){
                     imagePath = statePools[i].imagePath;
                }
                
                else {
                    imagePath = statePools[i].imagePath;
                }
//                String imagePath = "../StatePool/" + statePools[i].imagePath;
                
                map.put(name, imagePath);
            }
            return map;
            
        } catch (Exception e1) {
            e1.printStackTrace();
        }
        return null;
    }
    
    public static String[] getStateNames(){
        List<String> stateNames = new ArrayList<String>();
        try {
            StatePool[] statePools = StatePoolStart.getService().getStatePools();
            for(int i = 0;i<statePools.length;i++){
                stateNames.add(statePools[i].name);
            }
        } catch (VCIError e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return stateNames.toArray(new String[0]);
    }
    
    public  List<String> parserXML() {
        List<String> list = new ArrayList<String>();
        try {
            LifeCycle[] lifeCyles = LifeCycleStart.getService().getLifeCycles();
            for(int i=0;i<lifeCyles.length;i++){
                String name = lifeCyles[i].name;
                list.add(name);
            }
            return list;
        
        } catch (Exception e1) {
            e1.printStackTrace();
        }
        return null;
    }
}