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

« back to all changes in this revision

Viewing changes to source/libs/jgdi/templates/c_jgdi.jsp

  • 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
<%
 
2
/*___INFO__MARK_BEGIN__*/
 
3
/*************************************************************************
 
4
 *
 
5
 *  The Contents of this file are made available subject to the terms of
 
6
 *  the Sun Industry Standards Source License Version 1.2
 
7
 *
 
8
 *  Sun Microsystems Inc., March, 2001
 
9
 *
 
10
 *
 
11
 *  Sun Industry Standards Source License Version 1.2
 
12
 *  =================================================
 
13
 *  The contents of this file are subject to the Sun Industry Standards
 
14
 *  Source License Version 1.2 (the "License"); You may not use this file
 
15
 *  except in compliance with the License. You may obtain a copy of the
 
16
 *  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
 
17
 *
 
18
 *  Software provided under this License is provided on an "AS IS" basis,
 
19
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 
20
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 
21
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 
22
 *  See the License for the specific provisions governing your rights and
 
23
 *  obligations concerning the Software.
 
24
 *
 
25
 *   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 
26
 *
 
27
 *   Copyright: 2001 by Sun Microsystems, Inc.
 
28
 *
 
29
 *   All Rights Reserved.
 
30
 *
 
31
 ************************************************************************/
 
32
/*___INFO__MARK_END__*/
 
33
%>
 
34
 
 
35
<%
 
36
   com.sun.grid.cull.JavaHelper jh = (com.sun.grid.cull.JavaHelper)params.get("javaHelper");
 
37
   com.sun.grid.cull.CullDefinition cullDef = (com.sun.grid.cull.CullDefinition)params.get("cullDef");
 
38
   com.sun.grid.cull.CullObject cullObj = (com.sun.grid.cull.CullObject)params.get("cullObj");
 
39
   
 
40
   class CGDIGenerator {
 
41
       
 
42
       String fullClassname;
 
43
       String classname;
 
44
       String listname;
 
45
       String cullname;
 
46
       
 
47
       public CGDIGenerator(String fullClassname, String classname, String listname, String cullname) {
 
48
           this.fullClassname = fullClassname.replace('.','/');
 
49
           this.classname = classname;
 
50
           this.listname = listname;
 
51
           this.cullname = cullname;
 
52
       } 
 
53
       
 
54
       
 
55
       public void genListMethod() {
 
56
           
 
57
           String methodName = "Java_com_sun_grid_jgdi_jni_JGDIImpl_fill" + classname + "List";
 
58
%>           
 
59
/*
 
60
 * Class:     com_sun_grid_jgdi_jni_JGDIImpl
 
61
 * Method:    get<%=classname%>List
 
62
 */
 
63
JNIEXPORT void JNICALL <%=methodName%>WithAnswer(JNIEnv *env, jobject jgdi, jobject list, jobject filter, jobject answers) {
 
64
   
 
65
   DENTER(TOP_LAYER, "<%=methodName%>");
 
66
   jgdi_fill(env, jgdi, list, filter, "<%=fullClassname%>", <%=listname%>, <%=cullname%>, answers);
 
67
   DEXIT;
 
68
}
 
69
<%           
 
70
       } // end of genListMethod
 
71
       
 
72
       
 
73
       public void genAddMethod() {
 
74
         String methodName = "Java_com_sun_grid_jgdi_jni_JGDIImpl_add" + classname;
 
75
%>
 
76
/* -------------- ADD ------------------------------------------------------- */
 
77
/*
 
78
 * Class:     com_sun_grid_jgdi_jni_JGDIImpl
 
79
 * Method:    add<%=classname%>
 
80
 * Signature: (L<%=fullClassname%>;)V
 
81
 */
 
82
JNIEXPORT void JNICALL <%=methodName%>(JNIEnv *env, jobject jgdi, jobject jobj)
 
83
{
 
84
   DENTER(TOP_LAYER, "<%=methodName%>");
 
85
   jgdi_add(env, jgdi, jobj, "<%=fullClassname%>", <%=listname%>, <%=cullname%>, NULL);
 
86
   DEXIT;
 
87
}
 
88
 
 
89
/*
 
90
 * Class:     com_sun_grid_jgdi_jni_JGDIImpl
 
91
 * Method:    add<%=classname%>WithAnswer
 
92
 * Signature: (L<%=fullClassname%>;L/java/util/List;)V
 
93
 */
 
94
JNIEXPORT void JNICALL <%=methodName%>WithAnswer(JNIEnv *env, jobject jgdi, jobject jobj, jobject answers)
 
95
{
 
96
   DENTER(TOP_LAYER, "<%=methodName%>WithAnswer");
 
97
   jgdi_add(env, jgdi, jobj, "<%=fullClassname%>", <%=listname%>, <%=cullname%>, answers);
 
98
   DEXIT;
 
99
}
 
100
<%
 
101
       } // end of genAddMethod     
 
102
 
 
103
       public void genDeleteMethod() {
 
104
         String methodName = "Java_com_sun_grid_jgdi_jni_JGDIImpl_delete" + classname;
 
105
%>
 
106
/* -------------- Delete ------------------------------------------------------- */           
 
107
/*
 
108
 * Class:     com_sun_grid_jgdi_jni_JGDIImpl
 
109
 * Method:    delete<%=classname%>
 
110
 * Signature: (L<%=fullClassname%>;)V
 
111
 */
 
112
JNIEXPORT void JNICALL <%=methodName%>(JNIEnv *env, jobject jgdi, jobject jobj)
 
113
{
 
114
   DENTER(TOP_LAYER, "<%=methodName%>");
 
115
   jgdi_delete(env, jgdi, jobj, "<%=fullClassname%>", <%=listname%>, <%=cullname%>, false, NULL);
 
116
   DEXIT;
 
117
}
 
118
 
 
119
/*
 
120
 * Class:     com_sun_grid_jgdi_jni_JGDIImpl
 
121
 * Method:    delete<%=classname%>WithAnswer
 
122
 * Signature: (L<%=fullClassname%>;L/java/util/List;)V
 
123
 */
 
124
JNIEXPORT void JNICALL <%=methodName%>WithAnswer(JNIEnv *env, jobject jgdi, jobject jobj, jobject answers)
 
125
{
 
126
   DENTER(TOP_LAYER, "<%=methodName%>WithAnswer");
 
127
   jgdi_delete(env, jgdi, jobj, "<%=fullClassname%>", <%=listname%>, <%=cullname%>, false, answers);
 
128
   DEXIT;
 
129
}
 
130
 
 
131
/*
 
132
 * Class:     com_sun_grid_jgdi_jni_JGDIImpl
 
133
 * Method:    delete<%=classname%>sWithAnswer
 
134
 * Signature: ([Ljava/lang/Object;ZL/java/util/List;)V
 
135
 */
 
136
JNIEXPORT void JNICALL <%=methodName%>sWithAnswer(JNIEnv *env, jobject jgdi, jobjectArray jobj_array, jboolean forced, jobject options, jobject answers)
 
137
{
 
138
   DENTER(TOP_LAYER, "<%=methodName%>sWithAnswer");
 
139
   jgdi_delete_array(env, jgdi, jobj_array, "<%=fullClassname%>", <%=listname%>, <%=cullname%>, forced, options, answers);
 
140
   DEXIT;
 
141
}
 
142
 
 
143
<%                      
 
144
       } // end of genDeleteMethod
 
145
       
 
146
       public void genUpdateMethod() {
 
147
           
 
148
          String methodName = "Java_com_sun_grid_jgdi_jni_JGDIImpl_update" + classname;
 
149
%>
 
150
/* -------------- Update ------------------------------------------------------- */
 
151
/*
 
152
 * Class:     com_sun_grid_jgdi_jni_JGDIImpl
 
153
 * Method:    update<%=classname%>
 
154
 * Signature: (L<%=fullClassname%>;)V
 
155
 */
 
156
JNIEXPORT void JNICALL <%=methodName%>(JNIEnv *env, jobject jgdi, jobject jobj)
 
157
{
 
158
   DENTER(TOP_LAYER, "<%=methodName%>");
 
159
   jgdi_update(env, jgdi, jobj, "<%=fullClassname%>", <%=listname%>, <%=cullname%>, NULL);
 
160
   DEXIT;
 
161
}
 
162
 
 
163
/*
 
164
 * Class:     com_sun_grid_jgdi_jni_JGDIImpl
 
165
 * Method:    update<%=classname%>WithAnswer
 
166
 * Signature: (L<%=fullClassname%>;, L/java/util/List;)V
 
167
 */
 
168
JNIEXPORT void JNICALL <%=methodName%>WithAnswer(JNIEnv *env, jobject jgdi, jobject jobj, jobject answers)
 
169
{
 
170
   DENTER(TOP_LAYER, "<%=methodName%>");
 
171
   jgdi_update(env, jgdi, jobj, "<%=fullClassname%>", <%=listname%>, <%=cullname%>, answers);
 
172
   DEXIT;
 
173
}
 
174
<%           
 
175
       } // end of genUpdateMethod
 
176
   } // end of class CGDIGenerator
 
177
   
 
178
   // -------------------------------------------------------------------------
 
179
   // Build the generators 
 
180
   // -------------------------------------------------------------------------
 
181
 
 
182
   java.util.List<CGDIGenerator> generators = new java.util.ArrayList<CGDIGenerator>();
 
183
   
 
184
   if (cullObj == null ) {
 
185
     throw new IllegalStateException("param cullObj not found");
 
186
   }
 
187
   if (cullObj.getIdlName() == null ) {
 
188
     throw new IllegalStateException("cullObj " + cullObj.getName() + " is has no idl name");
 
189
   }
 
190
   if (cullDef == null ) {
 
191
     throw new IllegalStateException("param cullDef not found");
 
192
   }
 
193
   if (!cullObj.isRootObject()) {
 
194
      return;
 
195
   }
 
196
   String listname = cullObj.getListName();
 
197
 
 
198
   if (listname == null) {
 
199
     // we not a ILISTDEF, return
 
200
     return;
 
201
   }
 
202
   {
 
203
   CGDIGenerator gen = null;
 
204
   
 
205
   if (cullObj.getParentName() != null) {      
 
206
      gen = new CGDIGenerator(jh.getFullClassName(cullObj), cullObj.getIdlName(), 
 
207
                              listname, cullObj.getParentName());
 
208
   } else {
 
209
      gen = new CGDIGenerator(jh.getFullClassName(cullObj), cullObj.getIdlName(), 
 
210
                              listname, cullObj.getName());
 
211
   }
 
212
   generators.add(gen);
 
213
   }
 
214
%>
 
215
<%
 
216
   boolean first = true;
 
217
   for (CGDIGenerator gen : generators) {
 
218
      if (first) {
 
219
         first = false;
 
220
%>
 
221
/*___INFO__MARK_BEGIN__*/
 
222
/*************************************************************************
 
223
 *
 
224
 *  The Contents of this file are made available subject to the terms of
 
225
 *  the Sun Industry Standards Source License Version 1.2
 
226
 *
 
227
 *  Sun Microsystems Inc., March, 2001
 
228
 *
 
229
 *
 
230
 *  Sun Industry Standards Source License Version 1.2
 
231
 *  =================================================
 
232
 *  The contents of this file are subject to the Sun Industry Standards
 
233
 *  Source License Version 1.2 (the "License"); You may not use this file
 
234
 *  except in compliance with the License. You may obtain a copy of the
 
235
 *  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
 
236
 *
 
237
 *  Software provided under this License is provided on an "AS IS" basis,
 
238
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 
239
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 
240
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 
241
 *  See the License for the specific provisions governing your rights and
 
242
 *  obligations concerning the Software.
 
243
 *
 
244
 *   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 
245
 *
 
246
 *   Copyright: 2001 by Sun Microsystems, Inc.
 
247
 *
 
248
 *   All Rights Reserved.
 
249
 *
 
250
 ************************************************************************/
 
251
/*___INFO__MARK_END__*/
 
252
 
 
253
#include <ctype.h>
 
254
#include <string.h>
 
255
#include <jni.h>
 
256
#include "basis_types.h"
 
257
#include "cull.h"
 
258
#include "commlib.h"
 
259
#include "sgermon.h"
 
260
#include "sge_all_listsL.h"
 
261
#include "sge_answer.h"
 
262
#include "sge_prog.h"
 
263
#include "sge_bootstrap.h"
 
264
#include "sge_gdi_ctx.h"
 
265
#include "cl_errors.h"
 
266
#include "sge_log.h"
 
267
#include "sge_error_class.h"
 
268
#include "jgdi_common.h"
 
269
#include "jgdi.h"
 
270
 
 
271
#define JGDI_DEBUG
 
272
 
 
273
<%}
 
274
      gen.genListMethod();
 
275
      gen.genAddMethod();
 
276
      gen.genDeleteMethod();
 
277
      gen.genUpdateMethod();
 
278
   }
 
279
   
 
280
%>
 
281
 
 
282