KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jivesoftware > messenger > vcard > VCardProvider


1 /**
2  * $RCSfile: VCardProvider.java,v $
3  * $Revision: 1.1 $
4  * $Date: 2005/07/20 03:20:39 $
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.vcard;
13
14 import org.dom4j.Element;
15 import org.jivesoftware.util.AlreadyExistsException;
16 import org.jivesoftware.util.NotFoundException;
17
18 /**
19  * Provider interface for users vcards.
20  *
21  * @author Gaston Dombiak
22  */

23 public interface VCardProvider {
24
25     /**
26      * Loads the specified user vcard by username. Returns <tt>null</tt> if no
27      * vCard was found for the specified username.
28      *
29      * @param username the username
30      * @return the vCard as an DOM element or <tt>null</tt> if none was found.
31      */

32     Element loadVCard(String JavaDoc username);
33
34     /**
35      * Creates and saves the new user vcard. This method should throw an
36      * UnsupportedOperationException if this operation is not supported by
37      * the backend vcard store.
38      *
39      * @param username the username.
40      * @param vCardElement the vCard to save.
41      * @throws AlreadyExistsException if the user already has a vCard.
42      * @throws UnsupportedOperationException if the provider does not support the
43      * operation.
44      */

45     void createVCard(String JavaDoc username, Element vCardElement) throws AlreadyExistsException;
46
47     /**
48      * Updates the user vcard in the backend store. This method should throw an
49      * UnsupportedOperationException if this operation is not supported by
50      * the backend vcard store.
51      *
52      * @param username the username.
53      * @param vCardElement the vCard to save.
54      * @throws NotFoundException if the vCard to update does not exist.
55      * @throws UnsupportedOperationException if the provider does not support the
56      * operation.
57      */

58     void updateVCard(String JavaDoc username, Element vCardElement) throws NotFoundException;
59
60     /**
61      * Delets a user vcard. This method should throw an UnsupportedOperationException
62      * if this operation is not supported by the backend vcard store.
63      *
64      * @param username the username to delete.
65      * @throws UnsupportedOperationException if the provider does not support the
66      * operation.
67      */

68     void deleteVCard(String JavaDoc username);
69
70     /**
71      * Returns true if this VCardProvider is read-only. When read-only,
72      * vcards can not be created, deleted, or modified.
73      *
74      * @return true if the vcard provider is read-only.
75      */

76     boolean isReadOnly();
77 }
78
Popular Tags