Subversion Repositories DevTools

Rev

Rev 6914 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6914 dpurdie 1
package com.erggroup.buildtool.ripple;
2
 
3
import java.util.ArrayList;
4
import java.util.HashMap;
5
 
6
public class ReleaseConfigData
7
{
8
 
9
    /** A Collection of available ReleaseConfig items
10
     *  Contains information on:
11
     *      Hostname
12
     *      MachType
13
     *      MachClass
14
     *      BuildFilter
15
     *      Master/Slave
16
     *      Rtag_Id
17
     *      RCon_Id
18
     */
19
    public ArrayList<ReleaseConfig> mReleaseConfig = new ArrayList<ReleaseConfig>();
20
 
21
    /** An array of known Machine Types
22
     *  ie: win32, sparc, solaris10_sparc, solaris10_x86, linux_i386
23
     */
24
    public ArrayList<String>   mMachineTypes = new ArrayList<String>();
25
 
26
    /** An array of known Machine Families
27
     *  ie: Win32, Solaris, Linux
28
     */
29
    public ArrayList<String>   mMachineClasses = new ArrayList<String>();
30
 
31
    /** A HashMap between MachineClass and Machine Types
32
     *  ie: Solaris -> sparc, solaris10_sparc, solaris10_x86
33
     *      Win32   -> win32
34
     *      Linux   -> linux_i386, linux_x64
35
     * 
36
     */
37
    public HashMap<String, ArrayList<String> > mMachineHash = new HashMap<String, ArrayList<String>>();
38
 
39
    /** Constructor
40
     * 
41
     */
42
 
43
    public ReleaseConfigData()
44
    {
45
    }
46
 
47
    /** Refresh the data
48
     *  Needed to allow the program to keep in sync with the database
49
     */
50
    public void resetData()
51
    {
52
        mReleaseConfig.clear();
53
        mMachineTypes.clear();
54
        mMachineClasses.clear();
55
        mMachineHash.clear();
56
    }
57
 
58
    /** Add a new ReleaseConfig item to the known information
59
     *      No attempt is made to prevent the same items being added multiple times
60
     */
61
    public void add(ReleaseConfig item)
62
    {
63
        mReleaseConfig.add(item);
64
        if (!mMachineTypes.contains(item.getmMachtype()))
65
        {
66
            mMachineTypes.add(item.getmMachtype());
67
        }
68
 
69
        if (!mMachineClasses.contains(item.getmMachclass()))
70
        {
71
            mMachineClasses.add(item.getmMachclass());
72
            mMachineHash.put(item.getmMachclass(), new ArrayList<String>());
73
        }
74
 
75
        //  Add the machType to the machClass
76
        ArrayList<String> typeList = mMachineHash.get(item.getmMachclass());
77
        if (!typeList.contains(item.getmMachtype()))
78
        {
79
            typeList.add(item.getmMachtype());
80
        }
81
 
82
    }
83
}