KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > repo > webdav > auth > WebDAVUser


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17
18 package org.alfresco.repo.webdav.auth;
19
20 import org.alfresco.service.cmr.repository.NodeRef;
21
22 /**
23  * WebDAV User Class
24  *
25  * <p>Contains the details of an authenticated WebDAV user
26  *
27  * @author GKSpencer
28  */

29 public class WebDAVUser
30 {
31     // User name
32

33     private String JavaDoc m_userName;
34     
35     // Authentication ticket
36

37     private String JavaDoc m_ticket;
38     
39     // User home node
40

41     private NodeRef m_homeNode;
42     
43     /**
44      * Class constructor
45      *
46      * @param user String
47      * @param ticket String
48      * @param homeNode NodeRef
49      */

50     public WebDAVUser(String JavaDoc user, String JavaDoc ticket, NodeRef homeNode)
51     {
52         m_userName = user;
53         m_ticket = ticket;
54         m_homeNode = homeNode;
55     }
56     
57     /**
58      * Return the user name
59      *
60      * @return String
61      */

62     public final String JavaDoc getUserName()
63     {
64         return m_userName;
65     }
66     
67     /**
68      * Return the ticket
69      *
70      * @return String
71      */

72     public final String JavaDoc getTicket()
73     {
74         return m_ticket;
75     }
76     
77     /**
78      * Check if the user has a home node
79      *
80      * @return boolean
81      */

82     public final boolean hasHomeNode()
83     {
84         return m_homeNode != null ? true : false;
85     }
86
87     /**
88      * Return the user home node
89      *
90      * @return NodeRef
91      */

92     public final NodeRef getHomeNode()
93     {
94         return m_homeNode;
95     }
96     
97     /**
98      * Set the home folder node for this user
99      *
100      * @param homeNode NodeRef
101      */

102     protected final void setHomeNode(NodeRef homeNode)
103     {
104         m_homeNode = homeNode;
105     }
106     
107     /**
108      * Return the user details as a string
109      *
110      * @return String
111      */

112     public String JavaDoc toString()
113     {
114         StringBuilder JavaDoc str = new StringBuilder JavaDoc();
115         
116         str.append("[");
117         str.append(getUserName());
118         str.append(":");
119         str.append(getTicket());
120         
121         if ( hasHomeNode())
122         {
123             str.append(",Home=");
124             str.append(getHomeNode());
125         }
126         str.append("]");
127         
128         return str.toString();
129     }
130 }
131
Popular Tags