Source Code Cross Referenced for Conditions.java in  » 6.0-JDK-Modules-com.sun » xws-security » com » sun » xml » wss » saml » assertion » saml20 » jaxb20 » 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 » 6.0 JDK Modules com.sun » xws security » com.sun.xml.wss.saml.assertion.saml20.jaxb20 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: Conditions.java,v 1.3 2007/01/08 16:05:59 shyam_rao Exp $
003:         */
004:
005:        /*
006:         * The contents of this file are subject to the terms
007:         * of the Common Development and Distribution License
008:         * (the License).  You may not use this file except in
009:         * compliance with the License.
010:         * 
011:         * You can obtain a copy of the license at
012:         * https://glassfish.dev.java.net/public/CDDLv1.0.html.
013:         * See the License for the specific language governing
014:         * permissions and limitations under the License.
015:         * 
016:         * When distributing Covered Code, include this CDDL
017:         * Header Notice in each file and include the License file
018:         * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
019:         * If applicable, add the following below the CDDL Header,
020:         * with the fields enclosed by brackets [] replaced by
021:         * you own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         * 
024:         * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
025:         */
026:
027:        package com.sun.xml.wss.saml.assertion.saml20.jaxb20;
028:
029:        import com.sun.xml.wss.saml.SAMLException;
030:        import com.sun.xml.wss.logging.LogDomainConstants;
031:        import com.sun.xml.wss.saml.internal.saml20.jaxb20.ConditionsType;
032:        import com.sun.xml.wss.saml.util.SAML20JAXBUtil;
033:        import java.util.GregorianCalendar;
034:        import java.util.List;
035:        import java.util.logging.Logger;
036:
037:        import javax.xml.bind.JAXBContext;
038:        import javax.xml.datatype.DatatypeConfigurationException;
039:        import javax.xml.datatype.DatatypeFactory;
040:
041:        /**
042:         * The validity of an <code>Assertion</code> MAY be subject to a set of
043:         * <code>Conditions</code>. Each <code>Condition</code> evaluates to a value that
044:         * is Valid, Invalid or Indeterminate.
045:         */
046:        public class Conditions extends ConditionsType implements 
047:                com.sun.xml.wss.saml.Conditions {
048:
049:            protected static final Logger log = Logger.getLogger(
050:                    LogDomainConstants.WSS_API_DOMAIN,
051:                    LogDomainConstants.WSS_API_DOMAIN_BUNDLE);
052:
053:            /**
054:            Constructor taking in nothing (SAML spec allows it)
055:             */
056:            public Conditions() {
057:                super ();
058:            }
059:
060:            private void setConditionOrAudienceRestrictionOrOneTimeUse(
061:                    List condition) {
062:                this .conditionOrAudienceRestrictionOrOneTimeUse = condition;
063:            }
064:
065:            /**
066:             * Constructs an instance of <code>Conditions</code>.
067:             *
068:             * @param notBefore specifies the earliest time instant at which the
069:             *        assertion is valid.
070:             * @param notOnOrAfter specifies the time instant at which the assertion
071:             *        has expired.
072:             * @param condition
073:             * @param ar the <code>AudienceRestrictionCondition</code> to be
074:             *        added. Can be null, if no audience restriction.
075:             * @param doNotCacheCnd
076:             * @exception SAMLException if there is a problem in input data and it
077:             *            cannot be processed correctly.
078:             */
079:            public Conditions(GregorianCalendar notBefore,
080:                    GregorianCalendar notOnOrAfter, List condition, List ar,
081:                    List oneTimeUse, List proxyRestriction) {
082:
083:                DatatypeFactory factory = null;
084:                try {
085:                    factory = DatatypeFactory.newInstance();
086:                } catch (DatatypeConfigurationException e) {
087:                    factory = null;
088:                }
089:
090:                if (factory != null) {
091:                    setNotBefore(factory.newXMLGregorianCalendar(notBefore));
092:                    setNotOnOrAfter(factory
093:                            .newXMLGregorianCalendar(notOnOrAfter));
094:                }
095:
096:                if (condition != null) {
097:                    setConditionOrAudienceRestrictionOrOneTimeUse(condition);
098:                } else if (ar != null) {
099:                    setConditionOrAudienceRestrictionOrOneTimeUse(ar);
100:                } else if (oneTimeUse != null) {
101:                    setConditionOrAudienceRestrictionOrOneTimeUse(oneTimeUse);
102:                } else if (proxyRestriction != null) {
103:                    setConditionOrAudienceRestrictionOrOneTimeUse(proxyRestriction);
104:                }
105:            }
106:
107:            /**
108:             * Constructs a <code>Conditions</code> element from an existing XML block.
109:             *
110:             * @param conditionsElement A <code>org.w3c.dom.Element</code> representing
111:             *        DOM tree for <code>Conditions</code> object
112:             * @exception SAMLException if it could not process the Element properly,
113:             *            implying that there is an error in the sender or in the
114:             *            element definition.
115:             */
116:            public static ConditionsType fromElement(org.w3c.dom.Element element)
117:                    throws SAMLException {
118:                try {
119:                    JAXBContext jc = SAML20JAXBUtil.getJAXBContext();
120:
121:                    javax.xml.bind.Unmarshaller u = jc.createUnmarshaller();
122:                    return (ConditionsType) u.unmarshal(element);
123:                } catch (Exception ex) {
124:                    throw new SAMLException(ex.getMessage());
125:                }
126:            }
127:        }
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.