Source Code Cross Referenced for PrincipalTypeEnum.java in  » Inversion-of-Control » carbon » org » sape » carbon » services » security » management » rdbms » 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 » Inversion of Control » carbon » org.sape.carbon.services.security.management.rdbms 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:/*
002: * The contents of this  file are subject to the Sapient Public License
003: * Version 1.0 (the "License"); you may not use this  file except in compliance
004: * with the License. You may obtain a copy of the License at
005: * http://carbon.sf.net/License.html.
006: *
007: * Software distributed under the License is distributed on an "AS IS" basis,
008: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
009: * the specific language governing rights and limitations under the License.
010: *
011: * The Original Code is The Carbon Component Framework.
012: *
013: * The Initial Developer of the Original Code is Sapient Corporation
014: *
015: * Copyright (C) 2003 Sapient Corporation. All Rights Reserved.
016: */
017:
018:package org.sape.carbon.services.security.management.rdbms;
019:
020:
021:
022:import java.io.ObjectStreamException;
023:import java.io.Serializable;
024:
025:import org.sape.carbon.core.util.enum.BaseEnum;
026:import org.sape.carbon.core.util.enum.EnumNotFoundException;
027:
028:/**
029: * Enumeration object for the two main types of principals.
030: *
031: * <p>
032: * Principals are unique indentifiers for entities.  The two major types
033: * of entities in a system are users and groups.  In the java
034: * environment, checking to see if objects implement the Group interface
035: * is an easy way to check.  In the default database implementation an
036: * enumeration is needed in the mapping table.
037: * </p>
038: *
039: * @author $Author: dvoet $ $Date: 2003/05/05 21:21:35 $
040: * @version $Revision: 1.6 $
041: *
042: * @since carbon 1.2
043: */
044:public final class PrincipalTypeEnum extends BaseEnum
045:    implements  Serializable {
046:    /** User. */
047:    public static final PrincipalTypeEnum USER =
048:        new PrincipalTypeEnum("user", 1);
049:
050:    /** Group. */
051:    public static final PrincipalTypeEnum GROUP =
052:        new PrincipalTypeEnum("group", 2);
053:
054:    /**
055:     * Constructs a enumeration of type <code>PrincipalTypeEnum</code>.
056:     *
057:     * @param name the string name of the enumeration type
058:     * @param ordinal the ordinal number for the enumeration type
059:     */
060:    private PrincipalTypeEnum(String name, int ordinal) {
061:        super (PrincipalTypeEnum.class, name, ordinal);
062:    }
063:
064:    /**
065:     * Strongly typed enum retriever.
066:     *
067:     * @param name string name of the enumeration to retreive
068:     *
069:     * @return the enumeration for the name
070:     *
071:     * @throws PrincipalTypeEnumNotFoundException indicates there is no
072:     *         enumeration represented by the given name
073:     */
074:    public static final PrincipalTypeEnum getByName(String name)
075:        throws PrincipalTypeEnumNotFoundException {
076:        PrincipalTypeEnum scope =
077:            (PrincipalTypeEnum) BaseEnum.getByName(
078:                name, PrincipalTypeEnum.class);
079:
080:        if (scope == null) {
081:            throw new PrincipalTypeEnumNotFoundException(
082:                PrincipalTypeEnum.class, name);
083:        }
084:
085:        return scope;
086:    }
087:
088:    /**
089:     * Strongly typed enum retriever.
090:     *
091:     * @param ordinal ordinal of the enumeration to retreive
092:     *
093:     * @return the enumeration for the ordinal
094:     *
095:     * @throws PrincipalTypeEnumNotFoundException indicates there is no
096:     *         enumeration represented by the given ordinal
097:     */
098:    public static final PrincipalTypeEnum getByOrdinal(int ordinal)
099:        throws PrincipalTypeEnumNotFoundException {
100:        PrincipalTypeEnum scope =
101:            (PrincipalTypeEnum) BaseEnum.getByOrdinal(
102:                ordinal, PrincipalTypeEnum.class);
103:
104:        if (scope == null) {
105:            throw new PrincipalTypeEnumNotFoundException(
106:                PrincipalTypeEnum.class,
107:                new Integer(ordinal).toString());
108:        }
109:
110:        return scope;
111:    }
112:
113:    /**
114:     * Overrides part of serialization to return a reference to an
115:     * enumeration instance that is managed by the Enumeration Subsystem.
116:     * This will always return the SAME object instance for any single
117:     * enum instance and is what allows the "==" operator to be used for
118:     * comparisons.
119:     *
120:     * @return the object instance that should be resolved by this class
121:     *
122:     * @throws ObjectStreamException when there is a failure to resolve
123:     *         the streamed object due to a format or read io exception
124:     */
125:    final Object readResolve() throws ObjectStreamException {
126:        return super .getByOrdinal(this .ordinal, this .getClass());
127:    }
128:
129:    /**
130:     * This class is a typesafe retriever exception for an enumeration.
131:     */
132:    public static class PrincipalTypeEnumNotFoundException
133:        extends EnumNotFoundException {
134:        /**
135:         * Constructor for LifecycleStateEnumNotFoundException.
136:         *
137:         * @param sourceClass the source object generating the exception
138:         * @param name the name/ordinal being searched for
139:         */
140:        public PrincipalTypeEnumNotFoundException(
141:            Class sourceClass, String name) {
142:            super(sourceClass, name);
143:        }
144:    }
145:}
w_w__w_.___j__a___v__a_2__s___.___c_o_m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.