2 * Copyright (c) 2001-2002 International Business Machines Corp.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
9 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
10 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
11 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
12 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
13 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
14 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
15 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
16 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
17 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
18 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
19 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 // user class and fields //
32 jfieldID user_ptsField
= 0;
33 jfieldID user_kasField
= 0;
34 jfieldID user_nameField
= 0;
35 //jfieldID user_cellHandleField = 0;
36 jfieldID user_cachedInfoField
= 0;
38 jfieldID user_nameUidField
= 0;
39 jfieldID user_ownerUidField
= 0;
40 jfieldID user_creatorUidField
= 0;
41 jfieldID user_listStatusField
= 0;
42 jfieldID user_listGroupsOwnedField
= 0;
43 jfieldID user_listMembershipField
= 0;
44 jfieldID user_groupCreationQuotaField
= 0;
45 jfieldID user_groupMembershipCountField
= 0;
46 jfieldID user_ownerField
= 0;
47 jfieldID user_creatorField
= 0;
49 jfieldID user_adminSettingField
= 0;
50 jfieldID user_tgsSettingField
= 0;
51 jfieldID user_encSettingField
= 0;
52 jfieldID user_cpwSettingField
= 0;
53 jfieldID user_rpwSettingField
= 0;
54 jfieldID user_userExpirationField
= 0;
55 jfieldID user_lastModTimeField
= 0;
56 jfieldID user_lastModNameField
= 0;
57 jfieldID user_lastChangePasswordTimeField
= 0;
58 jfieldID user_maxTicketLifetimeField
= 0;
59 jfieldID user_keyVersionField
= 0;
60 jfieldID user_encryptionKeyField
= 0;
61 jfieldID user_keyCheckSumField
= 0;
62 jfieldID user_daysToPasswordExpireField
= 0;
63 jfieldID user_failLoginCountField
= 0;
64 jfieldID user_lockTimeField
= 0;
65 jfieldID user_lockedUntilField
= 0;
67 // group class and fields //
69 jfieldID group_nameField
= 0;
70 //jfieldID group_cellHandleField = 0;
71 jfieldID group_cachedInfoField
= 0;
72 jfieldID group_nameUidField
= 0;
73 jfieldID group_ownerUidField
= 0;
74 jfieldID group_creatorUidField
= 0;
75 jfieldID group_listStatusField
= 0;
76 jfieldID group_listGroupsOwnedField
= 0;
77 jfieldID group_listMembershipField
= 0;
78 jfieldID group_listAddField
= 0;
79 jfieldID group_listDeleteField
= 0;
80 jfieldID group_membershipCountField
= 0;
81 jfieldID group_ownerField
= 0;
82 jfieldID group_creatorField
= 0;
84 // server class and fields //
86 jfieldID server_nameField
= 0;
87 //jfieldID server_cellHandleField = 0;
88 jfieldID server_cachedInfoField
= 0;
89 jfieldID server_databaseField
= 0;
90 jfieldID server_fileServerField
= 0;
91 jfieldID server_badDatabaseField
= 0;
92 jfieldID server_badFileServerField
= 0;
93 jfieldID server_IPAddressField
= 0;
95 // executable time class and fields //
96 jclass exectimeCls
= 0;
97 jfieldID exectime_HourField
= 0;
98 jfieldID exectime_MinField
= 0;
99 jfieldID exectime_SecField
= 0;
100 jfieldID exectime_DayField
= 0;
101 jfieldID exectime_NowField
= 0;
102 jfieldID exectime_NeverField
= 0;
104 // partition class and fields //
105 jclass partitionCls
= 0;
106 jfieldID partition_nameField
= 0;
107 jfieldID partition_cachedInfoField
= 0;
108 jfieldID partition_idField
= 0;
109 jfieldID partition_deviceNameField
= 0;
110 jfieldID partition_lockFileDescriptorField
= 0;
111 jfieldID partition_totalSpaceField
= 0;
112 jfieldID partition_totalFreeSpaceField
= 0;
114 // volume class and fields //
115 jclass volumeCls
= 0;
116 jfieldID volume_nameField
= 0;
117 jfieldID volume_cachedInfoField
= 0;
118 jfieldID volume_idField
= 0;
119 jfieldID volume_readWriteIdField
= 0;
120 jfieldID volume_readOnlyIdField
= 0;
121 jfieldID volume_backupIdField
= 0;
122 jfieldID volume_creationDateField
= 0;
123 jfieldID volume_lastAccessDateField
= 0;
124 jfieldID volume_lastUpdateDateField
= 0;
125 jfieldID volume_lastBackupDateField
= 0;
126 jfieldID volume_copyCreationDateField
= 0;
127 jfieldID volume_accessesSinceMidnightField
= 0;
128 jfieldID volume_fileCountField
= 0;
129 jfieldID volume_maxQuotaField
= 0;
130 jfieldID volume_currentSizeField
= 0;
131 jfieldID volume_statusField
= 0;
132 jfieldID volume_dispositionField
= 0;
133 jfieldID volume_typeField
= 0;
135 // key class and fields //
137 jfieldID key_cachedInfoField
= 0;
138 jfieldID key_versionField
= 0;
139 jfieldID key_encryptionKeyField
= 0;
140 jfieldID key_lastModDateField
= 0;
141 jfieldID key_lastModMsField
= 0;
142 jfieldID key_checkSumField
= 0;
144 // process class and fields //
145 jclass processCls
= 0;
146 jfieldID process_cachedInfoField
= 0;
147 jfieldID process_nameField
= 0;
148 //jfieldID process_serverHandleField = 0;
149 jfieldID process_typeField
= 0;
150 jfieldID process_stateField
= 0;
151 jfieldID process_goalField
= 0;
152 jfieldID process_startTimeField
= 0;
153 jfieldID process_numberStartsField
= 0;
154 jfieldID process_exitTimeField
= 0;
155 jfieldID process_exitErrorTimeField
= 0;
156 jfieldID process_errorCodeField
= 0;
157 jfieldID process_errorSignalField
= 0;
158 jfieldID process_stateOkField
= 0;
159 jfieldID process_stateTooManyErrorsField
= 0;
160 jfieldID process_stateBadFileAccessField
= 0;
161 #endif /* !LIBJUAFS */
164 * Throws an exception up to the Java layer, using ast as the error code
165 * for the exception. See Exceptions.h for the available
169 (JNIEnv
*env
, jclass
*excCls
, char *excClsName
, jmethodID
*initID
, int code
)
173 *excCls
= (*env
)->NewGlobalRef(env
, (*env
)->FindClass(env
, excClsName
));
175 fprintf(stderr
, "ERROR: Internal::throwException()\n Cannot find class: %s\n", excClsName
);
178 *initID
= (*env
)->GetMethodID( env
, *excCls
, "<init>", "(I)V" );
180 fprintf(stderr
, "ERROR: Internal::throwException()\n Cannot find construction method: %s\n",
186 exc
= (*env
)->NewObject( env
, *excCls
, *initID
, code
);
188 fprintf(stderr
, "ERROR: Internal::throwException()\n Cannot construct new exception object: %s\n",
192 (*env
)->Throw(env
, exc
);
196 * Throws an exception up to the Java layer, constructing it with msg.
197 * This function should only be used when a valid AFS error number/code
198 * is unavailable and it is necessary to interrupt the Java call with an
199 * exception. See Exceptions.h for the available exceptions.
201 void throwMessageException( JNIEnv
*env
, char *msg
)
203 jclass excCls
= (*env
)->FindClass(env
, afsExceptionName
);
205 fprintf(stderr
, "ERROR: Internal::throwMessageException()\n Cannot find class: %s\n", afsExceptionName
);
208 (*env
)->ThrowNew(env
, excCls
, msg
);
212 * Throws an exception up to the Java layer, using ast as the error code
213 * for the exception. See Exceptions.h for the available
216 void throwAFSException( JNIEnv
*env
, int code
)
218 jclass afsExceptionCls
;
219 jmethodID afsExceptionInit
;
222 afsExceptionCls
= (*env
)->FindClass(env
, afsExceptionName
);
223 if( !afsExceptionCls
) {
224 fprintf(stderr
, "ERROR: Internal::throwAFSException()\n Cannot find class: %s\n", afsExceptionName
);
228 afsExceptionInit
= (*env
)->GetMethodID( env
, afsExceptionCls
,
230 if( !afsExceptionInit
) {
231 fprintf(stderr
, "ERROR: Internal::throwAFSException()\n Cannot find construction method: %s\n",
236 exc
= (*env
)->NewObject( env
, afsExceptionCls
, afsExceptionInit
, code
);
239 fprintf(stderr
, "ERROR: Internal::throwAFSException()\n Cannot construct new exception object: %s\n",
243 (*env
)->Throw(env
, exc
);
247 * Throws an exception up to the Java layer, using ast as the error code
248 * for the exception. See Exceptions.h for the available
251 void throwAFSFileException( JNIEnv
*env
, int code
, char *msg
)
253 jclass afsFileExceptionCls
;
254 jmethodID afsFileExceptionInit
;
257 afsFileExceptionCls
= (*env
)->FindClass(env
, afsFileExceptionName
);
258 if( !afsFileExceptionCls
) {
259 fprintf(stderr
, "ERROR: Internal::throwAFSFileException()\n Cannot find class: %s\n", afsFileExceptionName
);
263 afsFileExceptionInit
= (*env
)->GetMethodID( env
, afsFileExceptionCls
,
264 "<init>", "(Ljava/lang/String;I)V" );
265 if( !afsFileExceptionInit
) {
266 fprintf(stderr
, "ERROR: Internal::throwAFSFileException()\n Cannot find construction method: %s\n",
267 afsFileExceptionName
);
271 exc
= (*env
)->NewObject( env
, afsFileExceptionCls
,
272 afsFileExceptionInit
, msg
, code
);
274 fprintf(stderr
, "ERROR: Internal::throwAFSFileException()\n Cannot construct new exception object: %s\n",
275 afsFileExceptionName
);
278 (*env
)->Throw(env
, exc
);
282 * Throws an exception up to the Java layer, using ast as the error code
283 * for the exception. See Exceptions.h for the available
286 void throwAFSSecurityException( JNIEnv
*env
, int code
)
288 jclass afsSecurityExceptionCls
;
289 jmethodID afsSecurityExceptionInit
;
292 afsSecurityExceptionCls
= (*env
)->FindClass(env
, afsSecurityExceptionName
);
293 if( !afsSecurityExceptionCls
) {
294 fprintf(stderr
, "ERROR: Internal::throwAFSSecurityException()\n Cannot find class: %s\n", afsSecurityExceptionName
);
298 afsSecurityExceptionInit
= (*env
)->GetMethodID( env
, afsSecurityExceptionCls
,
300 if( !afsSecurityExceptionInit
) {
301 fprintf(stderr
, "ERROR: Internal::throwAFSSecurityException()\n Cannot find construction method: %s\n",
302 afsSecurityExceptionName
);
306 exc
= (*env
)->NewObject( env
, afsSecurityExceptionCls
,
307 afsSecurityExceptionInit
, code
);
309 fprintf(stderr
, "ERROR: Internal::throwAFSSecurityException()\n Cannot construct new exception object: %s\n",
310 afsSecurityExceptionName
);
313 (*env
)->Throw(env
, exc
);
316 int setError(JNIEnv
*env
, jobject
*obj
, int code
)
319 jclass cls
= (*env
)->GetObjectClass(env
, *obj
);
321 fid
= (*env
)->GetFieldID(env
, cls
, "errno", "I");
324 (*env
)->SetIntField(env
, *obj
, fid
, code
);
334 * Opens an AFS file, with the specified name, using the specified flags
335 * with in the specified mode (permission mode).
337 * env the Java environment
338 * fileNameUTF name of file to be opened
339 * flags open mode: O_CREAT, O_APPEND
340 * mode UNIX permission mode mask
343 * @returns file descriptor
346 (JNIEnv
*env
, jstring fileNameUTF
, int flags
, int mode
, int *err
)
353 fileName
=(char*) (*env
)->GetStringUTFChars(env
, fileNameUTF
, 0);
354 if(fileName
== NULL
) {
355 fprintf(stderr
, "Internal::openAFSFile(): failed to get fileName\n");
359 fd
= uafs_open(fileName
, flags
, mode
);
362 fprintf(stderr
, "Internal::openAFSFile(): errno=%d\n", errno
);
363 fprintf(stderr
, "Internal::openAFSFile(): fd=%d\n", fd
);
365 (*env
)->ReleaseStringUTFChars(env
, fileNameUTF
, fileName
);
367 fprintf(stderr
, "Internal::openAFSFile(): failed to open fileName\n");
368 fprintf(stderr
, "Internal::openAFSFile(): fd=%d\n", fd
);
374 int readCacheParms(char *afsMountPoint
, char *afsConfDir
, char *afsCacheDir
,
375 int *cacheBlocks
, int *cacheFiles
, int *cacheStatEntries
,
376 int *dCacheSize
, int *vCacheSize
, int *chunkSize
,
377 int *closeSynch
, int *debug
, int *nDaemons
, int *cacheFlags
,
384 char cacheConfigFile
[100];
386 p
= (char *)getenv("LIBJAFS_CACHE_CONFIG");
388 strcpy(cacheConfigFile
, p
);
390 strcpy(cacheConfigFile
, "/usr/afswsp/etc/CacheConfig");
393 f
= fopen(cacheConfigFile
, "r");
395 fprintf(stderr
, "Could not open cache config file: %s\n",
403 p
= (char *)strchr(line
, '\n');
405 if (strncmp(line
, "#", 1) == 0) continue; /* comment */
407 p
= (char *)strchr(line
, ' ');
410 p
++; len2
= strlen(p
);
412 if (strncmp(line
, "MountPoint", len1
) == 0)
413 strcpy(afsMountPoint
, p
);
414 else if (strncmp(line
, "ConfDir", len1
) == 0)
415 strcpy(afsConfDir
, p
);
416 else if (strncmp(line
, "CacheDir", len1
) == 0)
417 strcpy(afsCacheDir
, p
);
418 else if (strncmp(line
, "CacheBlocks", len1
) == 0)
419 *cacheBlocks
= atoi(p
);
420 else if (strncmp(line
, "CacheFiles", len1
) == 0)
421 *cacheFiles
= atoi(p
);
422 else if (strncmp(line
, "CacheStatEntries", len1
) == 0)
423 *cacheStatEntries
= atoi(p
);
424 else if (strncmp(line
, "DCacheSize", len1
) == 0)
425 *dCacheSize
= atoi(p
);
426 else if (strncmp(line
, "VCacheSize", len1
) == 0)
427 *vCacheSize
= atoi(p
);
428 else if (strncmp(line
, "ChunkSize", len1
) == 0)
429 *chunkSize
= atoi(p
);
430 else if (strncmp(line
, "CloseSynch", len1
) == 0)
431 *closeSynch
= atoi(p
);
432 else if (strncmp(line
, "Debug", len1
) == 0)
434 else if (strncmp(line
, "NDaemons", len1
) == 0)
436 else if (strncmp(line
, "CacheFlags", len1
) == 0)
437 *cacheFlags
= atoi(p
);
438 else if (strncmp(line
, "LogFile", len1
) == 0)
444 int setString(JNIEnv
*env
, jobject
*obj
, char *field
, char *string
)
450 cls
= (*env
)->GetObjectClass(env
, *obj
);
451 /*fprintf(stderr, "setString: env=0x%x, obj=0x%x, cls=0x%x\n", env, obj, cls);*/
453 fid
= (*env
)->GetFieldID(env
, cls
, field
, "Ljava/lang/String;");
454 /*fprintf(stderr, "setString: field=%s, fid=0x%x\n", field, fid);*/
456 jstr
= (*env
)->NewStringUTF(env
, (string
));
457 /*fprintf(stderr, "jstr = 0x%x\n", jstr);*/
458 (*env
)->SetObjectField(env
, *obj
, fid
, jstr
);
468 * Makes a kas identity given the full name of a kas user. If the
469 * name contains a period, everything after the first period is
470 * considered to be the instance of that name, otherwise
471 * the instance is the empty string. The memory for who
472 * that's passed in should be fully allocated in advance.
474 void internal_makeKasIdentity( const char *fullName
,
475 kas_identity_p who
) {
479 if( (period
= (char *) strchr( fullName
, '.' )) != NULL
) {
480 strncpy( who
->principal
, fullName
, period
- fullName
);
481 who
->principal
[period
- fullName
] = '\0';
482 strncpy( who
->instance
, period
+ 1,
483 strlen(fullName
) - (period
- fullName
) );
485 strcpy( who
->principal
, fullName
);
486 strcpy( who
->instance
, "" );
492 * Given a Java environment and an instance of a user, gets the object and
493 * field information for the user object from the Java environment.
495 void internal_getUserClass( JNIEnv
*env
, jobject user
) {
497 userCls
= (*env
)->NewGlobalRef( env
, (*env
)->GetObjectClass(env
, user
) );
499 throwAFSException( env
, JAFSADMCLASSNOTFOUND
);
502 user_ptsField
= (*env
)->GetFieldID( env
, userCls
, "pts", "Z" );
503 user_kasField
= (*env
)->GetFieldID( env
, userCls
, "kas", "Z" );
504 user_nameField
= (*env
)->GetFieldID( env
, userCls
, "name",
505 "Ljava/lang/String;" );
506 user_cachedInfoField
= (*env
)->GetFieldID( env
, userCls
, "cachedInfo",
509 user_nameUidField
= (*env
)->GetFieldID( env
, userCls
, "nameUID", "I" );
510 user_ownerUidField
= (*env
)->GetFieldID( env
, userCls
, "ownerUID", "I" );
511 user_creatorUidField
= (*env
)->GetFieldID( env
, userCls
, "creatorUID",
513 user_listStatusField
= (*env
)->GetFieldID( env
, userCls
, "listStatus",
515 user_listGroupsOwnedField
= (*env
)->GetFieldID( env
, userCls
,
516 "listGroupsOwned", "I" );
517 user_listMembershipField
= (*env
)->GetFieldID( env
, userCls
,
518 "listMembership", "I" );
519 user_groupCreationQuotaField
= (*env
)->GetFieldID( env
, userCls
,
520 "groupCreationQuota",
522 user_groupMembershipCountField
= (*env
)->GetFieldID( env
, userCls
,
523 "groupMembershipCount",
525 user_ownerField
= (*env
)->GetFieldID( env
, userCls
, "owner",
526 "Ljava/lang/String;" );
527 user_creatorField
= (*env
)->GetFieldID( env
, userCls
, "creator",
528 "Ljava/lang/String;" );
530 user_adminSettingField
= (*env
)->GetFieldID( env
, userCls
, "adminSetting",
532 user_tgsSettingField
= (*env
)->GetFieldID( env
, userCls
, "tgsSetting",
534 user_encSettingField
= (*env
)->GetFieldID( env
, userCls
, "encSetting",
536 user_cpwSettingField
= (*env
)->GetFieldID( env
, userCls
, "cpwSetting",
538 user_rpwSettingField
= (*env
)->GetFieldID( env
, userCls
, "rpwSetting",
540 user_userExpirationField
= (*env
)->GetFieldID( env
, userCls
,
541 "userExpiration", "I" );
542 user_lastModTimeField
= (*env
)->GetFieldID( env
, userCls
, "lastModTime",
544 user_lastModNameField
= (*env
)->GetFieldID( env
, userCls
, "lastModName",
545 "Ljava/lang/String;" );
546 user_lastChangePasswordTimeField
= (*env
)->GetFieldID( env
, userCls
,
547 "lastChangePasswordTime",
549 user_maxTicketLifetimeField
= (*env
)->GetFieldID( env
, userCls
,
552 user_keyVersionField
= (*env
)->GetFieldID( env
, userCls
, "keyVersion",
554 user_encryptionKeyField
= (*env
)->GetFieldID( env
, userCls
,
556 "Ljava/lang/String;" );
557 user_keyCheckSumField
= (*env
)->GetFieldID( env
, userCls
, "keyCheckSum",
559 user_daysToPasswordExpireField
= (*env
)->GetFieldID( env
, userCls
,
560 "daysToPasswordExpire",
562 user_failLoginCountField
= (*env
)->GetFieldID( env
, userCls
,
563 "failLoginCount", "I" );
564 user_lockTimeField
= (*env
)->GetFieldID( env
, userCls
, "lockTime", "I" );
565 user_lockedUntilField
= (*env
)->GetFieldID( env
, userCls
, "lockedUntil",
567 if( !user_ptsField
|| !user_kasField
|| !user_nameField
||
568 !user_cachedInfoField
|| !user_nameUidField
|| !user_ownerUidField
||
569 !user_creatorUidField
|| !user_listStatusField
||
570 !user_listGroupsOwnedField
|| !user_listMembershipField
||
571 !user_groupCreationQuotaField
|| !user_groupMembershipCountField
||
572 !user_ownerField
|| !user_creatorField
|| !user_adminSettingField
||
573 !user_tgsSettingField
|| !user_encSettingField
||
574 !user_cpwSettingField
|| !user_rpwSettingField
||
575 !user_userExpirationField
|| !user_lastModTimeField
||
576 !user_lastModNameField
|| !user_lastChangePasswordTimeField
||
577 !user_maxTicketLifetimeField
|| !user_keyVersionField
||
578 !user_encryptionKeyField
|| !user_keyCheckSumField
||
579 !user_daysToPasswordExpireField
|| !user_failLoginCountField
||
580 !user_lockTimeField
|| !user_lockedUntilField
) {
582 throwAFSException( env
, JAFSADMFIELDNOTFOUND
);
590 * Given a Java environment and an instance of a group, gets the object and
591 * field information for the group object from the Java environment.
593 void internal_getGroupClass( JNIEnv
*env
, jobject group
) {
594 if( groupCls
== 0 ) {
595 groupCls
= (*env
)->NewGlobalRef( env
, (*env
)->GetObjectClass(env
, group
) );
597 throwAFSException( env
, JAFSADMCLASSNOTFOUND
);
600 group_nameField
= (*env
)->GetFieldID( env
, groupCls
, "name",
601 "Ljava/lang/String;" );
602 group_cachedInfoField
= (*env
)->GetFieldID( env
, groupCls
, "cachedInfo",
604 group_nameUidField
= (*env
)->GetFieldID( env
, groupCls
, "nameUID", "I" );
605 group_ownerUidField
= (*env
)->GetFieldID( env
, groupCls
, "ownerUID", "I" );
606 group_creatorUidField
= (*env
)->GetFieldID( env
, groupCls
, "creatorUID",
608 group_listStatusField
= (*env
)->GetFieldID( env
, groupCls
, "listStatus",
610 group_listGroupsOwnedField
= (*env
)->GetFieldID( env
, groupCls
,
611 "listGroupsOwned", "I" );
612 group_listMembershipField
= (*env
)->GetFieldID( env
, groupCls
,
613 "listMembership", "I" );
614 group_listAddField
= (*env
)->GetFieldID( env
, groupCls
, "listAdd", "I" );
615 group_listDeleteField
= (*env
)->GetFieldID( env
, groupCls
, "listDelete",
617 group_membershipCountField
= (*env
)->GetFieldID( env
, groupCls
,
618 "membershipCount", "I" );
619 group_ownerField
= (*env
)->GetFieldID( env
, groupCls
, "owner",
620 "Ljava/lang/String;" );
621 group_creatorField
= (*env
)->GetFieldID( env
, groupCls
, "creator",
622 "Ljava/lang/String;" );
623 if( !group_nameField
|| !group_cachedInfoField
|| !group_nameUidField
||
624 !group_ownerUidField
|| !group_creatorUidField
||
625 !group_listStatusField
|| !group_listGroupsOwnedField
||
626 !group_listMembershipField
|| !group_listAddField
||
627 !group_listDeleteField
|| !group_membershipCountField
||
628 !group_ownerField
|| !group_creatorField
) {
630 throwAFSException( env
, JAFSADMFIELDNOTFOUND
);
638 * Given a Java environment and an instance of a server, gets the object and
639 * field information for the server object from the Java environment.
641 void internal_getServerClass( JNIEnv
*env
, jobject server
) {
642 if( serverCls
== 0 ) {
643 serverCls
= (*env
)->NewGlobalRef( env
,
644 (*env
)->GetObjectClass(env
, server
) );
646 throwAFSException( env
, JAFSADMCLASSNOTFOUND
);
649 server_nameField
= (*env
)->GetFieldID( env
, serverCls
, "name",
650 "Ljava/lang/String;" );
651 server_cachedInfoField
= (*env
)->GetFieldID( env
, serverCls
, "cachedInfo",
653 server_databaseField
= (*env
)->GetFieldID( env
, serverCls
, "database",
655 server_fileServerField
= (*env
)->GetFieldID( env
, serverCls
, "fileServer",
657 server_badDatabaseField
= (*env
)->GetFieldID( env
, serverCls
,
658 "badDatabase", "Z" );
659 server_badFileServerField
= (*env
)->GetFieldID( env
, serverCls
,
660 "badFileServer", "Z" );
661 server_IPAddressField
= (*env
)->GetFieldID( env
, serverCls
, "ipAddresses",
662 "[Ljava/lang/String;" );
663 if( !server_nameField
|| !server_cachedInfoField
|| !server_databaseField
664 || !server_fileServerField
|| !server_badDatabaseField
||
665 !server_badFileServerField
|| !server_IPAddressField
) {
667 throwAFSException( env
, JAFSADMFIELDNOTFOUND
);
675 * Given a Java environment and an instance of an executableTime, gets the
676 * object and field information for the executableTime object from the
679 void internal_getExecTimeClass( JNIEnv
*env
, jobject exectime
) {
680 if( exectimeCls
== 0 ) {
681 exectimeCls
= (*env
)->NewGlobalRef( env
,
682 (*env
)->GetObjectClass(env
, exectime
) );
684 throwAFSException( env
, JAFSADMCLASSNOTFOUND
);
687 exectime_HourField
= (*env
)->GetFieldID( env
, exectimeCls
, "hour", "S" );
688 exectime_MinField
= (*env
)->GetFieldID( env
, exectimeCls
, "minute",
690 exectime_SecField
= (*env
)->GetFieldID( env
, exectimeCls
, "second",
692 exectime_DayField
= (*env
)->GetFieldID( env
, exectimeCls
, "day", "S" );
693 exectime_NowField
= (*env
)->GetFieldID( env
, exectimeCls
, "now", "Z" );
694 exectime_NeverField
= (*env
)->GetFieldID( env
, exectimeCls
, "never", "Z" );
695 if( !exectime_HourField
|| !exectime_MinField
|| !exectime_SecField
||
696 !exectime_DayField
|| !exectime_NowField
|| !exectime_NeverField
) {
698 throwAFSException( env
, JAFSADMFIELDNOTFOUND
);
706 * Given a Java environment and an instance of a partition, gets the object and
707 * field information for the partition object from the Java environment.
709 void internal_getPartitionClass( JNIEnv
*env
, jobject partition
) {
710 if( partitionCls
== 0 ) {
711 partitionCls
= (*env
)->NewGlobalRef( env
,
712 (*env
)->GetObjectClass(env
, partition
) );
713 if( !partitionCls
) {
714 throwAFSException( env
, JAFSADMCLASSNOTFOUND
);
717 partition_nameField
= (*env
)->GetFieldID( env
, partitionCls
, "name",
718 "Ljava/lang/String;" );
719 partition_deviceNameField
= (*env
)->GetFieldID( env
, partitionCls
,
721 "Ljava/lang/String;" );
722 partition_idField
= (*env
)->GetFieldID( env
, partitionCls
, "id", "I" );
723 partition_cachedInfoField
= (*env
)->GetFieldID( env
, partitionCls
,
725 partition_lockFileDescriptorField
= (*env
)->GetFieldID( env
, partitionCls
,
726 "lockFileDescriptor",
728 partition_totalSpaceField
= (*env
)->GetFieldID( env
, partitionCls
,
730 partition_totalFreeSpaceField
= (*env
)->GetFieldID( env
, partitionCls
,
731 "totalFreeSpace", "I");
732 if( !partition_nameField
|| !partition_cachedInfoField
||
733 !partition_idField
|| !partition_deviceNameField
||
734 !partition_lockFileDescriptorField
|| !partition_totalSpaceField
||
735 !partition_totalFreeSpaceField
) {
737 throwAFSException( env
, JAFSADMFIELDNOTFOUND
);
745 * Given a Java environment and an instance of a volume, gets the object and
746 * field information for the volume object from the Java environment.
748 void internal_getVolumeClass( JNIEnv
*env
, jobject volume
) {
749 if( volumeCls
== 0 ) {
750 volumeCls
= (*env
)->NewGlobalRef( env
,
751 (*env
)->GetObjectClass(env
, volume
) );
753 throwAFSException( env
, JAFSADMCLASSNOTFOUND
);
756 volume_nameField
= (*env
)->GetFieldID( env
, volumeCls
, "name",
757 "Ljava/lang/String;" );
758 volume_cachedInfoField
= (*env
)->GetFieldID( env
, volumeCls
, "cachedInfo",
760 volume_idField
= (*env
)->GetFieldID( env
, volumeCls
, "id", "I" );
761 volume_readWriteIdField
= (*env
)->GetFieldID( env
, volumeCls
,
762 "readWriteID", "I" );
763 volume_readOnlyIdField
= (*env
)->GetFieldID( env
, volumeCls
, "readOnlyID",
765 volume_backupIdField
= (*env
)->GetFieldID( env
, volumeCls
, "backupID",
767 volume_creationDateField
= (*env
)->GetFieldID( env
, volumeCls
,
768 "creationDate", "J" );
769 volume_lastAccessDateField
= (*env
)->GetFieldID( env
, volumeCls
,
770 "lastAccessDate", "J" );
771 volume_lastUpdateDateField
= (*env
)->GetFieldID( env
, volumeCls
,
772 "lastUpdateDate", "J" );
773 volume_lastBackupDateField
= (*env
)->GetFieldID( env
, volumeCls
,
774 "lastBackupDate", "J" );
775 volume_copyCreationDateField
= (*env
)->GetFieldID( env
, volumeCls
,
778 volume_accessesSinceMidnightField
= (*env
)->GetFieldID( env
, volumeCls
,
779 "accessesSinceMidnight",
781 volume_fileCountField
= (*env
)->GetFieldID( env
, volumeCls
, "fileCount",
783 volume_maxQuotaField
= (*env
)->GetFieldID( env
, volumeCls
, "maxQuota",
785 volume_currentSizeField
= (*env
)->GetFieldID( env
, volumeCls
,
786 "currentSize", "I" );
787 volume_statusField
= (*env
)->GetFieldID( env
, volumeCls
, "status", "I" );
788 volume_dispositionField
= (*env
)->GetFieldID( env
, volumeCls
,
789 "disposition", "I" );
790 volume_typeField
= (*env
)->GetFieldID( env
, volumeCls
, "type", "I" );
791 if( !volume_nameField
|| !volume_cachedInfoField
|| !volume_idField
||
792 !volume_readWriteIdField
|| !volume_readOnlyIdField
||
793 !volume_backupIdField
|| !volume_creationDateField
||
794 !volume_lastAccessDateField
|| !volume_lastUpdateDateField
||
795 !volume_lastBackupDateField
|| !volume_copyCreationDateField
||
796 !volume_accessesSinceMidnightField
|| !volume_fileCountField
||
797 !volume_maxQuotaField
|| !volume_currentSizeField
||
798 !volume_statusField
|| !volume_dispositionField
||
799 !volume_typeField
) {
801 throwAFSException( env
, JAFSADMFIELDNOTFOUND
);
809 * Given a Java environment and an instance of a key, gets the object and
810 * field information for the key object from the Java environment.
812 void internal_getKeyClass( JNIEnv
*env
, jobject key
) {
814 keyCls
= (*env
)->NewGlobalRef( env
, (*env
)->GetObjectClass(env
, key
) );
816 throwAFSException( env
, JAFSADMCLASSNOTFOUND
);
819 key_encryptionKeyField
= (*env
)->GetFieldID( env
, keyCls
,
821 "Ljava/lang/String;" );
822 key_cachedInfoField
= (*env
)->GetFieldID( env
, keyCls
, "cachedInfo", "Z" );
823 key_versionField
= (*env
)->GetFieldID( env
, keyCls
, "version", "I" );
824 key_lastModDateField
= (*env
)->GetFieldID( env
, keyCls
, "lastModDate",
826 key_lastModMsField
= (*env
)->GetFieldID( env
, keyCls
, "lastModMs", "I" );
827 key_checkSumField
= (*env
)->GetFieldID( env
, keyCls
, "checkSum", "J" );
828 if( !key_cachedInfoField
|| !key_versionField
|| !key_encryptionKeyField
829 || !key_lastModDateField
|| !key_lastModMsField
||
830 !key_checkSumField
) {
832 throwAFSException( env
, JAFSADMFIELDNOTFOUND
);
840 * Given a Java environment and an instance of a process, gets the object and
841 * field information for the process object from the Java environment.
843 void internal_getProcessClass( JNIEnv
*env
, jobject process
) {
844 if( processCls
== 0 ) {
845 processCls
= (*env
)->NewGlobalRef( env
,
846 (*env
)->GetObjectClass(env
, process
) );
848 throwAFSException( env
, JAFSADMCLASSNOTFOUND
);
851 process_cachedInfoField
= (*env
)->GetFieldID( env
, processCls
,
853 process_nameField
= (*env
)->GetFieldID( env
, processCls
, "name",
854 "Ljava/lang/String;" );
855 process_typeField
= (*env
)->GetFieldID( env
, processCls
, "type", "I" );
856 process_stateField
= (*env
)->GetFieldID( env
, processCls
, "state", "I" );
857 process_goalField
= (*env
)->GetFieldID( env
, processCls
, "goal", "I" );
858 process_startTimeField
= (*env
)->GetFieldID( env
, processCls
, "startTime",
860 process_numberStartsField
= (*env
)->GetFieldID( env
, processCls
,
861 "numberStarts", "J" );
862 process_exitTimeField
= (*env
)->GetFieldID( env
, processCls
, "exitTime",
864 process_exitErrorTimeField
= (*env
)->GetFieldID( env
, processCls
,
865 "exitErrorTime", "J" );
866 process_errorCodeField
= (*env
)->GetFieldID( env
, processCls
, "errorCode",
868 process_errorSignalField
= (*env
)->GetFieldID( env
, processCls
,
869 "errorSignal", "J" );
870 process_stateOkField
= (*env
)->GetFieldID( env
, processCls
, "stateOk",
872 process_stateTooManyErrorsField
= (*env
)->GetFieldID( env
, processCls
,
873 "stateTooManyErrors",
875 process_stateBadFileAccessField
= (*env
)->GetFieldID( env
, processCls
,
876 "stateBadFileAccess",
878 if( !process_cachedInfoField
|| !process_nameField
|| !process_typeField
879 || !process_stateField
|| !process_goalField
||
880 !process_startTimeField
|| !process_numberStartsField
||
881 !process_exitTimeField
|| !process_exitErrorTimeField
||
882 !process_errorCodeField
|| !process_errorSignalField
||
883 !process_stateOkField
|| !process_stateTooManyErrorsField
||
884 !process_stateBadFileAccessField
) {
886 throwAFSException( env
, JAFSADMFIELDNOTFOUND
);
893 #endif /* LIBJUAFS */