KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tomcat > jni > User


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 package org.apache.tomcat.jni;
19
20 /** User
21  *
22  * @author Mladen Turk
23  * @version $Revision: 467222 $, $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
24  */

25
26 public class User {
27
28     /**
29      * Get the userid (and groupid) of the calling process
30      * This function is available only if APR_HAS_USER is defined.
31      * @param p The pool from which to allocate working space
32      * @return Returns the user id
33      */

34      public static native long uidCurrent(long p)
35         throws Error JavaDoc;
36
37     /**
38      * Get the groupid of the calling process
39      * This function is available only if APR_HAS_USER is defined.
40      * @param p The pool from which to allocate working space
41      * @return Returns the group id
42      */

43      public static native long gidCurrent(long p)
44         throws Error JavaDoc;
45
46
47     /**
48      * Get the userid for the specified username
49      * This function is available only if APR_HAS_USER is defined.
50      * @param username The username to lookup
51      * @param p The pool from which to allocate working space
52      * @return Returns the user id
53      */

54      public static native long uid(String JavaDoc username, long p)
55         throws Error JavaDoc;
56
57     /**
58      * Get the groupid for the specified username
59      * This function is available only if APR_HAS_USER is defined.
60      * @param username The username to lookup
61      * @param p The pool from which to allocate working space
62      * @return Returns the user's group id
63      */

64      public static native long usergid(String JavaDoc username, long p)
65         throws Error JavaDoc;
66
67     /**
68      * Get the groupid for a specified group name
69      * This function is available only if APR_HAS_USER is defined.
70      * @param groupname The group name to look up
71      * @param p The pool from which to allocate working space
72      * @return Returns the user's group id
73      */

74      public static native long gid(String JavaDoc groupname, long p)
75         throws Error JavaDoc;
76
77     /**
78      * Get the user name for a specified userid
79      * This function is available only if APR_HAS_USER is defined.
80      * @param userid The userid
81      * @param p The pool from which to allocate the string
82      * @return New string containing user name
83      */

84      public static native String JavaDoc username(long userid, long p)
85         throws Error JavaDoc;
86
87     /**
88      * Get the group name for a specified groupid
89      * This function is available only if APR_HAS_USER is defined.
90      * @param groupid The groupid
91      * @param p The pool from which to allocate the string
92      * @return New string containing group name
93      */

94      public static native String JavaDoc groupname(long groupid, long p)
95         throws Error JavaDoc;
96
97     /**
98      * Compare two user identifiers for equality.
99      * This function is available only if APR_HAS_USER is defined.
100      * @param left One uid to test
101      * @param right Another uid to test
102      * @return APR_SUCCESS if the apr_uid_t strutures identify the same user,
103      * APR_EMISMATCH if not, APR_BADARG if an apr_uid_t is invalid.
104      */

105      public static native int uidcompare(long left, long right);
106
107     /**
108      * Compare two group identifiers for equality.
109      * This function is available only if APR_HAS_USER is defined.
110      * @param left One gid to test
111      * @param right Another gid to test
112      * @return APR_SUCCESS if the apr_gid_t strutures identify the same group,
113      * APR_EMISMATCH if not, APR_BADARG if an apr_gid_t is invalid.
114      */

115      public static native int gidcompare(long left, long right);
116
117     /**
118      * Get the home directory for the named user
119      * This function is available only if APR_HAS_USER is defined.
120      * @param username The named user
121      * @param p The pool from which to allocate the string
122      * @return New string containing directory name
123      */

124      public static native String JavaDoc homepath(String JavaDoc username, long p)
125         throws Error JavaDoc;
126
127 }
128
Popular Tags