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

« back to all changes in this revision

Viewing changes to source/libs/jgdi/src/com/sun/grid/jgdi/rmi/JGDIRemoteCacheBase.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.rmi;
 
33
 
 
34
import com.sun.grid.jgdi.monitoring.ClusterQueueSummaryOptions;
 
35
import com.sun.grid.jgdi.monitoring.QHostOptions;
 
36
import com.sun.grid.jgdi.monitoring.QHostResult;
 
37
import com.sun.grid.jgdi.monitoring.QQuotaOptions;
 
38
import com.sun.grid.jgdi.monitoring.QQuotaResult;
 
39
import com.sun.grid.jgdi.monitoring.QueueInstanceSummaryOptions;
 
40
import com.sun.grid.jgdi.monitoring.QueueInstanceSummaryResult;
 
41
import java.io.File;
 
42
import java.rmi.RemoteException;
 
43
import java.util.ArrayList;
 
44
import java.util.Collections;
 
45
import java.util.List;
 
46
import java.util.logging.Logger;
 
47
 
 
48
 
 
49
/**
 
50
 *
 
51
 */
 
52
public class JGDIRemoteCacheBase implements JGDIRemoteBase {
 
53
    
 
54
    protected JGDIRemote jgdi;
 
55
    protected Logger logger = Logger.getLogger("com.sun.grid.jgdi.rmi");
 
56
    private List listeners = Collections.synchronizedList(new ArrayList());
 
57
    
 
58
    /** Creates a new instance of JGDIRemoteCacheBase */
 
59
    public JGDIRemoteCacheBase() {
 
60
    }
 
61
    
 
62
    public JGDIRemoteCacheBase(JGDIRemote jgdi) {
 
63
        this.jgdi = jgdi;
 
64
    }
 
65
    
 
66
    public void addJGDIRemoteCacheListener(JGDIRemoteCacheListener lis) {
 
67
        listeners.add(lis);
 
68
    }
 
69
    
 
70
    public void removeJGDIRemoteCacheListener(JGDIRemoteCacheListener lis) {
 
71
        listeners.remove(lis);
 
72
    }
 
73
    
 
74
    public void setJGDI(JGDIRemote jgdi) {
 
75
        this.jgdi = jgdi;
 
76
    }
 
77
    
 
78
    public JGDIRemote getJGDI() {
 
79
        return jgdi;
 
80
    }
 
81
    
 
82
    public void close() throws RemoteException {
 
83
        if( jgdi != null ) {
 
84
            jgdi.close();
 
85
            jgdi = null;
 
86
        }
 
87
    }
 
88
    
 
89
    private boolean actQMasterNotSet = true;
 
90
    private String  actQMaster;
 
91
    
 
92
    private RemoteException error;
 
93
    
 
94
    private RemoteException getError() {
 
95
        return error;
 
96
    }
 
97
    
 
98
    protected void handleError(RemoteException re) {
 
99
        try {
 
100
            close();
 
101
        } catch( RemoteException e) {
 
102
            
 
103
        } finally {
 
104
            Object [] lis = listeners.toArray();
 
105
            
 
106
            for(int i = 0; i < lis.length; i++ ) {
 
107
                ((JGDIRemoteCacheListener)lis[i]).errorOccured(this,re);
 
108
            }
 
109
            this.error = re;
 
110
        }
 
111
    }
 
112
    
 
113
    public void clearError() {
 
114
        this.error = null;
 
115
    }
 
116
    
 
117
    public String getActQMaster() {
 
118
        if(actQMasterNotSet) {
 
119
            if( jgdi != null ) {
 
120
                try {
 
121
                    actQMaster = jgdi.getActQMaster();
 
122
                } catch(RemoteException re) {
 
123
                    handleError(re);
 
124
                    return null;
 
125
                }
 
126
            }
 
127
            actQMasterNotSet = false;
 
128
        }
 
129
        return actQMaster;
 
130
    }
 
131
    
 
132
    private boolean actAdminUserNotSet = true;
 
133
    private String  adminUser;
 
134
    
 
135
    public String getAdminUser() {
 
136
        if(actAdminUserNotSet) {
 
137
            if( jgdi != null ) {
 
138
                try {
 
139
                    adminUser = jgdi.getAdminUser();
 
140
                } catch( RemoteException re ) {
 
141
                    handleError(re);
 
142
                    return null;
 
143
                }
 
144
            }
 
145
            actAdminUserNotSet = false;
 
146
        }
 
147
        return adminUser;
 
148
    }
 
149
    
 
150
    private boolean qhostResultNotSet = true;
 
151
    private QHostResult qhostResult;
 
152
    
 
153
    public QHostResult execQHost(QHostOptions options) throws RemoteException {
 
154
        if(qhostResultNotSet) {
 
155
            if( jgdi != null ) {
 
156
                try {
 
157
                    qhostResult = jgdi.execQHost(options);
 
158
                } catch( RemoteException re ) {
 
159
                    handleError(re);
 
160
                    return null;
 
161
                }
 
162
            }
 
163
            qhostResultNotSet = false;
 
164
        }
 
165
        return qhostResult;
 
166
    }
 
167
    
 
168
    private boolean SGERootNotSet = true;
 
169
    private File SGERoot;
 
170
    
 
171
    public File getSGERoot() throws RemoteException {
 
172
        if(SGERootNotSet) {
 
173
            if( jgdi != null ) {
 
174
                try {
 
175
                    SGERoot = jgdi.getSGERoot();
 
176
                } catch( RemoteException re ) {
 
177
                    handleError(re);
 
178
                    return null;
 
179
                }
 
180
            }
 
181
            SGERootNotSet = false;
 
182
        }
 
183
        return SGERoot;
 
184
    }
 
185
    
 
186
    private boolean SGECellNotSet = true;
 
187
    private String SGECell;
 
188
    
 
189
    public String getSGECell() throws RemoteException {
 
190
        if(SGECellNotSet) {
 
191
            if( jgdi != null ) {
 
192
                try {
 
193
                    SGECell = jgdi.getSGECell();
 
194
                } catch( RemoteException re ) {
 
195
                    handleError(re);
 
196
                    return null;
 
197
                }
 
198
            }
 
199
            SGECellNotSet = false;
 
200
        }
 
201
        return SGECell;
 
202
    }
 
203
    
 
204
    private boolean RealExecHostListNotSet = true;
 
205
    private List RealExecHostList;
 
206
    
 
207
    public List getRealExecHostList() throws RemoteException {
 
208
        if(RealExecHostListNotSet) {
 
209
            if( jgdi != null ) {
 
210
                try {
 
211
                    RealExecHostList = jgdi.getRealExecHostList();
 
212
                } catch( RemoteException re ) {
 
213
                    handleError(re);
 
214
                    return null;
 
215
                }
 
216
            }
 
217
            RealExecHostListNotSet = false;
 
218
        }
 
219
        return RealExecHostList;
 
220
    }
 
221
    
 
222
    public List getClusterQueueSummary(ClusterQueueSummaryOptions options) throws RemoteException {
 
223
        return null;
 
224
    }
 
225
    
 
226
    public QueueInstanceSummaryResult getQueueInstanceSummary(QueueInstanceSummaryOptions options) throws RemoteException {
 
227
        return null;
 
228
    }
 
229
    
 
230
    public QQuotaResult getQQuota(QQuotaOptions options) throws RemoteException {
 
231
        return null;
 
232
    }
 
233
    
 
234
    public void clearShareTreeUsage() throws RemoteException {
 
235
    }
 
236
    
 
237
    public void cleanQueues(String[] queues) throws RemoteException {
 
238
    }
 
239
    
 
240
    public void killMaster() throws RemoteException {
 
241
    }
 
242
    
 
243
    public void killScheduler() throws RemoteException {
 
244
    }
 
245
    
 
246
    public void killExecd(String[] hosts, boolean terminateJobs) throws RemoteException {
 
247
    }
 
248
    
 
249
    public void killAllExecds(boolean terminateJobs) throws RemoteException {
 
250
    }
 
251
    
 
252
    public void killEventClients(int[] ids) throws RemoteException {
 
253
    }
 
254
    
 
255
    public void killAllEventClients() throws RemoteException {
 
256
    }
 
257
    
 
258
    public void triggerSchedulerMonitoring() throws RemoteException {
 
259
    }
 
260
    
 
261
    public String getSchedulerHost() throws RemoteException {
 
262
        return null;
 
263
    }
 
264
    
 
265
    public void enableQueues(String[] queues, boolean force) throws RemoteException {
 
266
    }
 
267
    
 
268
    public void disableQueues(String[] queues, boolean force) throws RemoteException {
 
269
    }
 
270
    
 
271
    public void suspendQueues(String[] queues, boolean force) throws RemoteException {
 
272
    }
 
273
    
 
274
    public void suspendJobs(String[] jobs, boolean force) throws RemoteException {
 
275
    }
 
276
    
 
277
    public void unsuspendQueues(String[] queues, boolean force) throws RemoteException {
 
278
    }
 
279
    
 
280
    public void unsuspendJobs(String[] jobs, boolean force) throws RemoteException {
 
281
    }
 
282
    
 
283
    public void clearQueues(String[] queues, boolean force) throws RemoteException {
 
284
    }
 
285
    
 
286
    public void clearJobs(String[] jobs, boolean force) throws RemoteException {
 
287
    }
 
288
    
 
289
    public void rescheduleQueues(String[] queues, boolean force) throws RemoteException {
 
290
    }
 
291
    
 
292
    public void rescheduleJobs(String[] jobs, boolean force) throws RemoteException {
 
293
    }
 
294
    
 
295
}