Source Code Cross Referenced for Administration.java in  » Web-Mail » Jwma » dtw » webmail » util » config » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Mail » Jwma » dtw.webmail.util.config 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /***
002:         * jwma Java WebMail
003:         * Copyright (c) 2000-2003 jwma team
004:         *
005:         * jwma is free software; you can distribute and use this source
006:         * under the terms of the BSD-style license received along with
007:         * the distribution.
008:         ***/package dtw.webmail.util.config;
009:
010:        import dtw.webmail.util.StringUtil;
011:
012:        import java.util.Set;
013:        import java.util.TreeSet;
014:        import java.util.Collections;
015:        import java.io.Serializable;
016:
017:        /** 
018:         * This class...
019:         * <p>
020:         * @author Dieter Wimberger (wimpi)
021:         * @version (created Feb 24, 2003)
022:         */
023:        public class Administration implements  Serializable {
024:
025:            private Set m_Admins;
026:            private boolean m_Enabled = false;
027:
028:            public Administration() {
029:                m_Admins = Collections.synchronizedSet(new TreeSet());
030:            }//constructor
031:
032:            /**
033:             * Tests if the administration part is enabled.
034:             *
035:             * @return true if enabled, false otherwise.
036:             */
037:            public boolean isEnabled() {
038:                return m_Enabled;
039:            }//isEnabled
040:
041:            /**
042:             * Sets the flag that controls if the adminstration part
043:             * is enabled.
044:             *
045:             * @param b true if enabled, false otherwise.
046:             */
047:            public void setEnabled(boolean b) {
048:                m_Enabled = b;
049:            }//setEnabled
050:
051:            /**
052:             * Convenience method for obtaining the admin users
053:             * (by username) as a simple comma seperated list.
054:             * <p>
055:             * Note that this is supposed to be helpful for simplifying
056:             * the persistency mechanism.
057:             *
058:             * @return the list as <tt>String</tt>.
059:             */
060:            public String getAdminList() {
061:                return StringUtil.join(listAdmins(), ",");
062:            }//getAdminList
063:
064:            /**
065:             * Convenience method for setting the admin users
066:             * (by username) as a simple comma seperated list.
067:             * <p>
068:             * Note that this is supposed to be helpful for simplifying
069:             * the persistency mechanism.
070:             *
071:             * @return the list as <tt>String</tt>.
072:             */
073:            public void setAdminList(String list) {
074:                String[] admins = StringUtil.split(list, ",");
075:                m_Admins.clear();
076:                for (int i = 0; i < admins.length; i++) {
077:                    addAdmin(admins[i]);
078:                }
079:            }//setAdminList
080:
081:            /**
082:             * Returns the list of users (by username) with
083:             * administrative rights.
084:             *
085:             * @return the list as <tt>String[]</tt>.
086:             */
087:            public String[] listAdmins() {
088:                String[] admins = new String[m_Admins.size()];
089:                return (String[]) m_Admins.toArray(admins);
090:            }//getAdminUsernames
091:
092:            /**
093:             * Adds an administrator (by username).
094:             *
095:             * @param username the username as <tt>String</tt>.
096:             */
097:            public void addAdmin(String username) {
098:                //check if contains
099:                m_Admins.add(username);
100:            }//addAdmin
101:
102:            /**
103:             * Removes an administrator (by username).
104:             *
105:             * @param username the username as <tt>String</tt>.
106:             */
107:            public void removeAdmin(String username) {
108:                m_Admins.remove(username);
109:            }//removeAdmin
110:
111:            /**
112:             * Tests if a given user (by username) has
113:             * administrative rights.
114:             *
115:             * @return true if admin rights, false otherwise.
116:             */
117:            public boolean isAdmin(String username) {
118:                return m_Admins.contains(username);
119:            }//isAdmin
120:
121:        }//class Administration
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.