~ubuntu-branches/ubuntu/utopic/gridengine/utopic

« back to all changes in this revision

Viewing changes to source/libs/jgdi/src/com/sun/grid/jgdi/monitoring/BasicQueueOptions.java

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2008-06-25 22:36:13 UTC
  • Revision ID: james.westby@ubuntu.com-20080625223613-tvd9xlhuoct9kyhm
Tags: upstream-6.2~beta2
ImportĀ upstreamĀ versionĀ 6.2~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*___INFO__MARK_BEGIN__*/
 
2
/*************************************************************************
 
3
 *
 
4
 *  The Contents of this file are made available subject to the terms of
 
5
 *  the Sun Industry Standards Source License Version 1.2
 
6
 *
 
7
 *  Sun Microsystems Inc., March, 2001
 
8
 *
 
9
 *
 
10
 *  Sun Industry Standards Source License Version 1.2
 
11
 *  =================================================
 
12
 *  The contents of this file are subject to the Sun Industry Standards
 
13
 *  Source License Version 1.2 (the "License"); You may not use this file
 
14
 *  except in compliance with the License. You may obtain a copy of the
 
15
 *  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
 
16
 *
 
17
 *  Software provided under this License is provided on an "AS IS" basis,
 
18
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 
19
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 
20
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 
21
 *  See the License for the specific provisions governing your rights and
 
22
 *  obligations concerning the Software.
 
23
 *
 
24
 *   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 
25
 *
 
26
 *   Copyright: 2001 by Sun Microsystems, Inc.
 
27
 *
 
28
 *   All Rights Reserved.
 
29
 *
 
30
 ************************************************************************/
 
31
/*___INFO__MARK_END__*/
 
32
package com.sun.grid.jgdi.monitoring;
 
33
 
 
34
import com.sun.grid.jgdi.monitoring.filter.*;
 
35
import java.io.Serializable;
 
36
 
 
37
/**
 
38
 * Base class for all classes which implements options for the qstat
 
39
 * algorithm.
 
40
 */
 
41
public abstract class BasicQueueOptions implements Serializable {
 
42
    
 
43
    /* qstat -ext */
 
44
    private boolean showAdditionalAttributes;
 
45
    /* qstat -q */
 
46
    private QueueFilter queueFilter;
 
47
    /* qstat -l */
 
48
    private ResourceFilter resourceFilter;
 
49
    /* qstat -qs */
 
50
    private QueueStateFilter queueStateFilter;
 
51
    /* qstat -U */
 
52
    private UserFilter queueUserFilter;
 
53
    
 
54
    
 
55
    /**
 
56
     * Creates a new instance of BaseQStatFilter
 
57
     */
 
58
    public BasicQueueOptions() {
 
59
    }
 
60
    
 
61
    /**
 
62
     *   Get the queue filter
 
63
     *
 
64
     *   The CLI qstat equivialent for queue filter is <code>qstat -q</code>
 
65
     *
 
66
     *   @return the queue filters
 
67
     */
 
68
    public QueueFilter getQueueFilter() {
 
69
        return queueFilter;
 
70
    }
 
71
    
 
72
    /**
 
73
     *  Set the queue filter
 
74
     *  @param queueFilter the new queue filter
 
75
     */
 
76
    public void setQueueFilter(QueueFilter queueFilter) {
 
77
        this.queueFilter = queueFilter;
 
78
    }
 
79
    
 
80
    /**
 
81
     *  Update the content of the queue user filter by adding values in vals
 
82
     *  @param vals values to be added to the filter
 
83
     */
 
84
    public void updateQueueFilter(String vals) {
 
85
        if (queueFilter == null) {
 
86
            queueFilter = QueueFilter.parse(vals);
 
87
        } else {
 
88
            queueFilter.fill(vals);
 
89
        }
 
90
    }
 
91
    
 
92
    /**
 
93
     * Get the the resource filter.
 
94
     *
 
95
     * The CLI equivialent for resource fitler is <code>qstat -l</code>
 
96
     */
 
97
    public ResourceFilter getResourceFilter() {
 
98
        return resourceFilter;
 
99
    }
 
100
    
 
101
    /**
 
102
     *  Set the resource filter
 
103
     *
 
104
     *  @param resourceFilter the new resource filter
 
105
     */
 
106
    public void setResourceFilter(ResourceFilter resourceFilter) {
 
107
        this.resourceFilter = resourceFilter;
 
108
    }
 
109
    
 
110
    /**
 
111
     *  Update the content of the resource filter by adding values in vals
 
112
     *  @param vals values to be added to the filter
 
113
     */
 
114
    public void updateResourceFilter(String vals) {
 
115
        if (resourceFilter == null) {
 
116
            resourceFilter = ResourceFilter.parse(vals);
 
117
        } else {
 
118
            resourceFilter.fill(vals);
 
119
        }
 
120
    }
 
121
    
 
122
    /**
 
123
     *  Get the queue state filter.
 
124
     *
 
125
     *  The CLI equivialent for queue state filter is <code>qstat -qs</code>
 
126
     *  @return the queue state filter
 
127
     */
 
128
    public QueueStateFilter getQueueStateFilter() {
 
129
        return queueStateFilter;
 
130
    }
 
131
    
 
132
    /**
 
133
     *  Set the queue state filter.
 
134
     *
 
135
     *  @param queueStateFilter the queue state filter
 
136
     */
 
137
    public void setQueueStateFilter(QueueStateFilter queueStateFilter) {
 
138
        this.queueStateFilter = queueStateFilter;
 
139
    }
 
140
    
 
141
    /**
 
142
     *  Update the content of the queue state filter by adding values in vals
 
143
     *  @param vals values to be added to the filter
 
144
     */
 
145
    public void updateQueueStateFilter(String vals) {
 
146
        if (queueStateFilter == null) {
 
147
            queueStateFilter = QueueStateFilter.parse(vals);
 
148
        } else {
 
149
            queueStateFilter.fill(vals);
 
150
        }
 
151
    }
 
152
    
 
153
    /**
 
154
     *  Get the queue user filter. The result of the qstat algorithm will only
 
155
     *  include those queue which are accessible by user of the queue user filter.
 
156
     *
 
157
     *  The CLI equivialent for the queue user filter is <code>qstat -U</code>
 
158
     *  @return the queue user filter
 
159
     */
 
160
    public UserFilter getQueueUserFilter() {
 
161
        return queueUserFilter;
 
162
    }
 
163
    
 
164
    /**
 
165
     *  Set a new queue user filter
 
166
     *
 
167
     *  @param queueUserFilter the new queue user filter
 
168
     */
 
169
    public void setQueueUserFilter(UserFilter queueUserFilter) {
 
170
        this.queueUserFilter = queueUserFilter;
 
171
    }
 
172
    
 
173
    /**
 
174
     *  Update the content of the queue user filter by adding values in vals
 
175
     *  @param vals values to be added to the filter
 
176
     */
 
177
    public void updateQueueUserFilter(String vals) {
 
178
        if (queueUserFilter == null) {
 
179
            queueUserFilter = UserFilter.parse(vals);
 
180
        } else {
 
181
            queueUserFilter.fill(vals);
 
182
        }
 
183
    }
 
184
    
 
185
    /**
 
186
     *  Should additional attributes be includes into the result
 
187
     *
 
188
     *  The CLI equivialent is <code>qstat -ext</code>
 
189
     *
 
190
     *  @return <code>true</code> of additional attributes should be included
 
191
     *          into the result
 
192
     */
 
193
    public boolean showAdditionalAttributes() {
 
194
        return showAdditionalAttributes;
 
195
    }
 
196
    
 
197
    /**
 
198
     *  Set the show additional attributes flag
 
199
     *  @param showAdditionalAttributes the show additional attributes flag
 
200
     */
 
201
    public void setShowAdditionalAttributes(boolean showAdditionalAttributes) {
 
202
        this.showAdditionalAttributes = showAdditionalAttributes;
 
203
    }
 
204
    
 
205
}