KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jivesoftware > messenger > handler > IQRegisterInfo


1 /**
2  * $RCSfile: IQRegisterInfo.java,v $
3  * $Revision: 1.2 $
4  * $Date: 2004/10/25 23:41:58 $
5  *
6  * Copyright (C) 2004 Jive Software. All rights reserved.
7  *
8  * This software is published under the terms of the GNU Public License (GPL),
9  * a copy of which is included in this distribution.
10  */

11
12 package org.jivesoftware.messenger.handler;
13
14 import org.jivesoftware.messenger.auth.UnauthorizedException;
15
16 /**
17  * Handle the various user registration settings that are
18  * valid under XMPP. Although user registration is a fairly
19  * flexible beast in XMPP, much of registration is redundant to
20  * vCard and no mainstream clients support registration fields
21  * with much fidelity anyhow. So registration is kept simple,
22  * and we defer to vCard for user information gathering.
23  *
24  * @author Iain Shigeoka
25  */

26 public interface IQRegisterInfo {
27
28     /**
29      * An unknown type
30      */

31     int UNKNOWN = -1;
32     /**
33      * The user's email
34      */

35     int EMAIL = 0;
36     /**
37      * The user's full name
38      */

39     int NAME = 1;
40     /**
41      * The user's first name
42      */

43     int FIRST_NAME = 2;
44     /**
45      * The user's last name
46      */

47     int LAST_NAME = 3;
48     /**
49      * The user's address
50      */

51     int ADDRESS = 4;
52     /**
53      * The user's city
54      */

55     int CITY = 5;
56     /**
57      * The user's state
58      */

59     int STATE = 6;
60     /**
61      * The user's zip code
62      */

63     int ZIP = 7;
64     /**
65      * The user's phone
66      */

67     int PHONE = 8;
68     /**
69      * The user's url
70      */

71     int URL = 9;
72     /**
73      * The date of registration
74      */

75     int DATE = 10;
76     /**
77      * Misc data to associate with the account
78      */

79     int MISC = 11;
80     /**
81      * Misc text to associate with the account
82      */

83     int TEXT = 12;
84
85     /**
86      * Element names of the fields, array index matches type
87      */

88     String JavaDoc[] FIELD_NAMES = {
89         "email",
90         "name",
91         "first",
92         "last",
93         "address",
94         "city",
95         "state",
96         "zip",
97         "phone",
98         "url",
99         "date",
100         "misc",
101         "text"
102     };
103
104     /**
105      * Fields should be stored in user properties
106      */

107     int FIELD_IN_USER_PROPS = 0;
108     /**
109      * Fields should be stored in vCard
110      */

111     int FIELD_IN_VCARD = 0;
112
113     /**
114      * Determines where field information is stored.
115      *
116      * @return the location type.
117      */

118     public int getFieldStoreLocation();
119
120     /**
121      * Sets the location for storing field information.
122      *
123      * @param location The location type
124      * @throws org.jivesoftware.messenger.auth.UnauthorizedException
125      * If you don't have permission to adjust this setting
126      */

127     public void setFieldStoreLocation(int location) throws UnauthorizedException;
128
129     /**
130      * Determines if users can automatically register user accounts
131      * without system administrator intervention.
132      *
133      * @return True if open registration is supported
134      */

135     public boolean isOpenRegistrationSupported();
136
137     /**
138      * Tells the server whether to support open registration or not.
139      *
140      * @param isSupported True if open registration is supported
141      * @throws org.jivesoftware.messenger.auth.UnauthorizedException
142      * If you don't have permission to change this setting
143      */

144     public void setOpenRegistrationSupported(boolean isSupported) throws UnauthorizedException;
145
146     /**
147      * Determines if a given field is required for registration.
148      *
149      * @param fieldType The field to check
150      * @return True if the field is required
151      */

152     public boolean isFieldRequired(int fieldType);
153
154     /**
155      * Tells the server whether to require a registration field or not.
156      *
157      * @param fieldType The field to require.
158      * @param isRequired True if the field should be required
159      * @throws org.jivesoftware.messenger.auth.UnauthorizedException
160      * If you don't have permission to change this setting
161      */

162     public void setFieldRequired(int fieldType, boolean isRequired) throws UnauthorizedException;
163
164     /**
165      * Get the setting type from a field's element name. This is a convenience
166      * for looking up the correct field type from an element name.
167      *
168      * @param fieldElementName The known element name
169      * @return The field type, one of the static int types defined in this class
170      */

171     public int getFieldType(String JavaDoc fieldElementName);
172
173     /**
174      * Obtain the element name from a field type. This is a convience for
175      * looking up the correct field element name from it's field type.
176      *
177      * @param fieldType The known field type
178      * @return The field element name
179      */

180     public String JavaDoc getFieldElementName(int fieldType);
181 }
182
Popular Tags