Source Code Cross Referenced for Admissions.java in  » Security » Bouncy-Castle » org » bouncycastle » asn1 » isismtt » x509 » 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 » Security » Bouncy Castle » org.bouncycastle.asn1.isismtt.x509 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.bouncycastle.asn1.isismtt.x509;
002:
003:        import org.bouncycastle.asn1.ASN1Encodable;
004:        import org.bouncycastle.asn1.ASN1EncodableVector;
005:        import org.bouncycastle.asn1.ASN1Sequence;
006:        import org.bouncycastle.asn1.ASN1TaggedObject;
007:        import org.bouncycastle.asn1.DEREncodable;
008:        import org.bouncycastle.asn1.DERObject;
009:        import org.bouncycastle.asn1.DERSequence;
010:        import org.bouncycastle.asn1.DERTaggedObject;
011:        import org.bouncycastle.asn1.x509.GeneralName;
012:
013:        import java.util.Enumeration;
014:
015:        /**
016:         * An Admissions structure.
017:         * <p/>
018:         * <pre>
019:         *            Admissions ::= SEQUENCE
020:         *            {
021:         *              admissionAuthority [0] EXPLICIT GeneralName OPTIONAL
022:         *              namingAuthority [1] EXPLICIT NamingAuthority OPTIONAL
023:         *              professionInfos SEQUENCE OF ProfessionInfo
024:         *            }
025:         * <p/>
026:         * </pre>
027:         *
028:         * @see org.bouncycastle.asn1.isismtt.x509.AdmissionSyntax
029:         * @see org.bouncycastle.asn1.isismtt.x509.ProfessionInfo
030:         * @see org.bouncycastle.asn1.isismtt.x509.NamingAuthority
031:         */
032:        public class Admissions extends ASN1Encodable {
033:
034:            private GeneralName admissionAuthority;
035:
036:            private NamingAuthority namingAuthority;
037:
038:            private ASN1Sequence professionInfos;
039:
040:            public static Admissions getInstance(Object obj) {
041:                if (obj == null || obj instanceof  Admissions) {
042:                    return (Admissions) obj;
043:                }
044:
045:                if (obj instanceof  ASN1Sequence) {
046:                    return new Admissions((ASN1Sequence) obj);
047:                }
048:
049:                throw new IllegalArgumentException(
050:                        "illegal object in getInstance: "
051:                                + obj.getClass().getName());
052:            }
053:
054:            /**
055:             * Constructor from ASN1Sequence.
056:             * <p/>
057:             * The sequence is of type ProcurationSyntax:
058:             * <p/>
059:             * <pre>
060:             *            Admissions ::= SEQUENCE
061:             *            {
062:             *              admissionAuthority [0] EXPLICIT GeneralName OPTIONAL
063:             *              namingAuthority [1] EXPLICIT NamingAuthority OPTIONAL
064:             *              professionInfos SEQUENCE OF ProfessionInfo
065:             *            }
066:             * </pre>
067:             *
068:             * @param seq The ASN.1 sequence.
069:             */
070:            private Admissions(ASN1Sequence seq) {
071:                if (seq.size() > 3) {
072:                    throw new IllegalArgumentException("Bad sequence size: "
073:                            + seq.size());
074:                }
075:                Enumeration e = seq.getObjects();
076:
077:                DEREncodable o = (DEREncodable) e.nextElement();
078:                if (o instanceof  ASN1TaggedObject) {
079:                    switch (((ASN1TaggedObject) o).getTagNo()) {
080:                    case 0:
081:                        admissionAuthority = GeneralName.getInstance(
082:                                (ASN1TaggedObject) o, true);
083:                        break;
084:                    case 1:
085:                        namingAuthority = NamingAuthority.getInstance(
086:                                (ASN1TaggedObject) o, true);
087:                        break;
088:                    default:
089:                        throw new IllegalArgumentException("Bad tag number: "
090:                                + ((ASN1TaggedObject) o).getTagNo());
091:                    }
092:                    o = (DEREncodable) e.nextElement();
093:                }
094:                if (o instanceof  ASN1TaggedObject) {
095:                    switch (((ASN1TaggedObject) o).getTagNo()) {
096:                    case 1:
097:                        namingAuthority = NamingAuthority.getInstance(
098:                                (ASN1TaggedObject) o, true);
099:                        break;
100:                    default:
101:                        throw new IllegalArgumentException("Bad tag number: "
102:                                + ((ASN1TaggedObject) o).getTagNo());
103:                    }
104:                    o = (DEREncodable) e.nextElement();
105:                }
106:                professionInfos = ASN1Sequence.getInstance(o);
107:                if (e.hasMoreElements()) {
108:                    throw new IllegalArgumentException(
109:                            "Bad object encountered: "
110:                                    + e.nextElement().getClass());
111:                }
112:            }
113:
114:            /**
115:             * Constructor from a given details.
116:             * <p/>
117:             * Parameter <code>professionInfos</code> is mandatory.
118:             *
119:             * @param admissionAuthority The admission authority.
120:             * @param namingAuthority    The naming authority.
121:             * @param professionInfos    The profession infos.
122:             */
123:            public Admissions(GeneralName admissionAuthority,
124:                    NamingAuthority namingAuthority,
125:                    ProfessionInfo[] professionInfos) {
126:                this .admissionAuthority = admissionAuthority;
127:                this .namingAuthority = namingAuthority;
128:                this .professionInfos = new DERSequence(professionInfos);
129:            }
130:
131:            public GeneralName getAdmissionAuthority() {
132:                return admissionAuthority;
133:            }
134:
135:            public NamingAuthority getNamingAuthority() {
136:                return namingAuthority;
137:            }
138:
139:            public ProfessionInfo[] getProfessionInfos() {
140:                ProfessionInfo[] infos = new ProfessionInfo[professionInfos
141:                        .size()];
142:                int count = 0;
143:                for (Enumeration e = professionInfos.getObjects(); e
144:                        .hasMoreElements();) {
145:                    infos[count++] = ProfessionInfo
146:                            .getInstance(e.nextElement());
147:                }
148:                return infos;
149:            }
150:
151:            /**
152:             * Produce an object suitable for an ASN1OutputStream.
153:             * <p/>
154:             * Returns:
155:             * <p/>
156:             * <pre>
157:             *       Admissions ::= SEQUENCE
158:             *       {
159:             *         admissionAuthority [0] EXPLICIT GeneralName OPTIONAL
160:             *         namingAuthority [1] EXPLICIT NamingAuthority OPTIONAL
161:             *         professionInfos SEQUENCE OF ProfessionInfo
162:             *       }
163:             * <p/>
164:             * </pre>
165:             *
166:             * @return a DERObject
167:             */
168:            public DERObject toASN1Object() {
169:                ASN1EncodableVector vec = new ASN1EncodableVector();
170:
171:                if (admissionAuthority != null) {
172:                    vec.add(new DERTaggedObject(true, 0, admissionAuthority));
173:                }
174:                if (namingAuthority != null) {
175:                    vec.add(new DERTaggedObject(true, 1, namingAuthority));
176:                }
177:                vec.add(professionInfos);
178:
179:                return new DERSequence(vec);
180:            }
181:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.