KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > continuent > sequoia > common > users > VirtualDatabaseUser


1 /**
2  * Sequoia: Database clustering technology.
3  * Copyright (C) 2002-2004 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Copyright (C) 2005 AmicoSoft, Inc. dba Emic Networks
6  * Copyright (C) 2005-2006 Continuent, Inc.
7  * Contact: sequoia@continuent.org
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  * Initial developer(s): Emmanuel Cecchet.
22  * Contributor(s): Mathieu Peltier.
23  */

24
25 package org.continuent.sequoia.common.users;
26
27 import org.continuent.sequoia.common.xml.DatabasesXmlTags;
28
29 /**
30  * A <code>VirtualDatabaseUser</code> is a login/password combination to
31  * represent a virtual database user.
32  *
33  * @author <a HREF="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet</a>
34  * @author <a HREF="mailto:Mathieu.Peltier@inrialpes.fr">Mathieu Peltier</a>
35  * @version 1.0
36  */

37 public class VirtualDatabaseUser extends AbstractDatabaseUser
38 {
39   private static final long serialVersionUID = 535330556687836840L;
40
41   /**
42    * Creates a new <code>VirtualDatabaseUser</code> instance. The caller must
43    * ensure that the parameters are not <code>null</code>.
44    *
45    * @param login the user name.
46    * @param password the password.
47    */

48   public VirtualDatabaseUser(String JavaDoc login, String JavaDoc password)
49   {
50     super(login, password);
51   }
52
53   /**
54    * @see org.continuent.sequoia.common.xml.XmlComponent#getXml()
55    */

56   public String JavaDoc getXml()
57   {
58     StringBuffer JavaDoc vUser = new StringBuffer JavaDoc("<"
59         + DatabasesXmlTags.ELT_VirtualUser + " " + DatabasesXmlTags.ATT_vLogin
60         + "=\"" + getLogin() + "\" " + DatabasesXmlTags.ATT_vPassword + "=\""
61         + getPassword() + "\"");
62     if (getAccessControl() == null)
63     {
64       vUser.append("/>");
65     }
66     else
67     {
68       vUser.append(">" + getAccessControl().getXml() + "</"
69           + DatabasesXmlTags.ELT_VirtualUser + ">");
70     }
71     return vUser.toString();
72   }
73 }
74
Popular Tags