2
/*___INFO__MARK_BEGIN__*/
3
/*************************************************************************
5
* The Contents of this file are made available subject to the terms of
6
* the Sun Industry Standards Source License Version 1.2
8
* Sun Microsystems Inc., March, 2001
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
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.
25
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
27
* Copyright: 2001 by Sun Microsystems, Inc.
29
* All Rights Reserved.
31
************************************************************************/
32
/*___INFO__MARK_END__*/
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");
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;
55
public void genListMethod() {
57
String methodName = "Java_com_sun_grid_jgdi_jni_JGDIImpl_fill" + classname + "List";
60
* Class: com_sun_grid_jgdi_jni_JGDIImpl
61
* Method: get<%=classname%>List
63
JNIEXPORT void JNICALL <%=methodName%>WithAnswer(JNIEnv *env, jobject jgdi, jobject list, jobject filter, jobject answers) {
65
DENTER(TOP_LAYER, "<%=methodName%>");
66
jgdi_fill(env, jgdi, list, filter, "<%=fullClassname%>", <%=listname%>, <%=cullname%>, answers);
70
} // end of genListMethod
73
public void genAddMethod() {
74
String methodName = "Java_com_sun_grid_jgdi_jni_JGDIImpl_add" + classname;
76
/* -------------- ADD ------------------------------------------------------- */
78
* Class: com_sun_grid_jgdi_jni_JGDIImpl
79
* Method: add<%=classname%>
80
* Signature: (L<%=fullClassname%>;)V
82
JNIEXPORT void JNICALL <%=methodName%>(JNIEnv *env, jobject jgdi, jobject jobj)
84
DENTER(TOP_LAYER, "<%=methodName%>");
85
jgdi_add(env, jgdi, jobj, "<%=fullClassname%>", <%=listname%>, <%=cullname%>, NULL);
90
* Class: com_sun_grid_jgdi_jni_JGDIImpl
91
* Method: add<%=classname%>WithAnswer
92
* Signature: (L<%=fullClassname%>;L/java/util/List;)V
94
JNIEXPORT void JNICALL <%=methodName%>WithAnswer(JNIEnv *env, jobject jgdi, jobject jobj, jobject answers)
96
DENTER(TOP_LAYER, "<%=methodName%>WithAnswer");
97
jgdi_add(env, jgdi, jobj, "<%=fullClassname%>", <%=listname%>, <%=cullname%>, answers);
101
} // end of genAddMethod
103
public void genDeleteMethod() {
104
String methodName = "Java_com_sun_grid_jgdi_jni_JGDIImpl_delete" + classname;
106
/* -------------- Delete ------------------------------------------------------- */
108
* Class: com_sun_grid_jgdi_jni_JGDIImpl
109
* Method: delete<%=classname%>
110
* Signature: (L<%=fullClassname%>;)V
112
JNIEXPORT void JNICALL <%=methodName%>(JNIEnv *env, jobject jgdi, jobject jobj)
114
DENTER(TOP_LAYER, "<%=methodName%>");
115
jgdi_delete(env, jgdi, jobj, "<%=fullClassname%>", <%=listname%>, <%=cullname%>, false, NULL);
120
* Class: com_sun_grid_jgdi_jni_JGDIImpl
121
* Method: delete<%=classname%>WithAnswer
122
* Signature: (L<%=fullClassname%>;L/java/util/List;)V
124
JNIEXPORT void JNICALL <%=methodName%>WithAnswer(JNIEnv *env, jobject jgdi, jobject jobj, jobject answers)
126
DENTER(TOP_LAYER, "<%=methodName%>WithAnswer");
127
jgdi_delete(env, jgdi, jobj, "<%=fullClassname%>", <%=listname%>, <%=cullname%>, false, answers);
132
* Class: com_sun_grid_jgdi_jni_JGDIImpl
133
* Method: delete<%=classname%>sWithAnswer
134
* Signature: ([Ljava/lang/Object;ZL/java/util/List;)V
136
JNIEXPORT void JNICALL <%=methodName%>sWithAnswer(JNIEnv *env, jobject jgdi, jobjectArray jobj_array, jboolean forced, jobject options, jobject answers)
138
DENTER(TOP_LAYER, "<%=methodName%>sWithAnswer");
139
jgdi_delete_array(env, jgdi, jobj_array, "<%=fullClassname%>", <%=listname%>, <%=cullname%>, forced, options, answers);
144
} // end of genDeleteMethod
146
public void genUpdateMethod() {
148
String methodName = "Java_com_sun_grid_jgdi_jni_JGDIImpl_update" + classname;
150
/* -------------- Update ------------------------------------------------------- */
152
* Class: com_sun_grid_jgdi_jni_JGDIImpl
153
* Method: update<%=classname%>
154
* Signature: (L<%=fullClassname%>;)V
156
JNIEXPORT void JNICALL <%=methodName%>(JNIEnv *env, jobject jgdi, jobject jobj)
158
DENTER(TOP_LAYER, "<%=methodName%>");
159
jgdi_update(env, jgdi, jobj, "<%=fullClassname%>", <%=listname%>, <%=cullname%>, NULL);
164
* Class: com_sun_grid_jgdi_jni_JGDIImpl
165
* Method: update<%=classname%>WithAnswer
166
* Signature: (L<%=fullClassname%>;, L/java/util/List;)V
168
JNIEXPORT void JNICALL <%=methodName%>WithAnswer(JNIEnv *env, jobject jgdi, jobject jobj, jobject answers)
170
DENTER(TOP_LAYER, "<%=methodName%>");
171
jgdi_update(env, jgdi, jobj, "<%=fullClassname%>", <%=listname%>, <%=cullname%>, answers);
175
} // end of genUpdateMethod
176
} // end of class CGDIGenerator
178
// -------------------------------------------------------------------------
179
// Build the generators
180
// -------------------------------------------------------------------------
182
java.util.List<CGDIGenerator> generators = new java.util.ArrayList<CGDIGenerator>();
184
if (cullObj == null ) {
185
throw new IllegalStateException("param cullObj not found");
187
if (cullObj.getIdlName() == null ) {
188
throw new IllegalStateException("cullObj " + cullObj.getName() + " is has no idl name");
190
if (cullDef == null ) {
191
throw new IllegalStateException("param cullDef not found");
193
if (!cullObj.isRootObject()) {
196
String listname = cullObj.getListName();
198
if (listname == null) {
199
// we not a ILISTDEF, return
203
CGDIGenerator gen = null;
205
if (cullObj.getParentName() != null) {
206
gen = new CGDIGenerator(jh.getFullClassName(cullObj), cullObj.getIdlName(),
207
listname, cullObj.getParentName());
209
gen = new CGDIGenerator(jh.getFullClassName(cullObj), cullObj.getIdlName(),
210
listname, cullObj.getName());
216
boolean first = true;
217
for (CGDIGenerator gen : generators) {
221
/*___INFO__MARK_BEGIN__*/
222
/*************************************************************************
224
* The Contents of this file are made available subject to the terms of
225
* the Sun Industry Standards Source License Version 1.2
227
* Sun Microsystems Inc., March, 2001
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
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.
244
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
246
* Copyright: 2001 by Sun Microsystems, Inc.
248
* All Rights Reserved.
250
************************************************************************/
251
/*___INFO__MARK_END__*/
256
#include "basis_types.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"
267
#include "sge_error_class.h"
268
#include "jgdi_common.h"
276
gen.genDeleteMethod();
277
gen.genUpdateMethod();