Source Code Cross Referenced for W3CEndpointReference.java in  » 6.0-JDK-Modules » jax-ws-api » javax » xml » ws » wsaddressing » 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 » jax ws api » javax.xml.ws.wsaddressing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
003:         * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
004:         */
005:
006:        package javax.xml.ws.wsaddressing;
007:
008:        import org.w3c.dom.Element;
009:
010:        import javax.xml.bind.JAXBContext;
011:        import javax.xml.bind.JAXBException;
012:        import javax.xml.bind.Marshaller;
013:        import javax.xml.bind.annotation.XmlAnyAttribute;
014:        import javax.xml.bind.annotation.XmlAnyElement;
015:        import javax.xml.bind.annotation.XmlElement;
016:        import javax.xml.bind.annotation.XmlRootElement;
017:        import javax.xml.bind.annotation.XmlType;
018:        import javax.xml.bind.annotation.XmlValue;
019:        import javax.xml.namespace.QName;
020:        import javax.xml.transform.Result;
021:        import javax.xml.transform.Source;
022:        import javax.xml.ws.EndpointReference;
023:        import javax.xml.ws.WebServiceException;
024:        import java.util.List;
025:        import java.util.Map;
026:
027:        /**
028:         * This class represents a W3C Addressing EndpointReferece which is
029:         * a remote reference to a web service endpoint that supports the
030:         * W3C WS-Addressing 1.0 - Core Recommendation.
031:         * <p>
032:         * Developers should use this class in their SEIs if they want to
033:         * pass/return endpoint references that represent the W3C WS-Addressing
034:         * recommendation.
035:         * <p>
036:         * JAXB will use the JAXB annotations and bind this class to XML infoset
037:         * that is consistent with that defined by WS-Addressing.  See
038:         * <a href="http://www.w3.org/TR/2006/REC-ws-addr-core-20060509/">
039:         * WS-Addressing</a> 
040:         * for more information on WS-Addressing EndpointReferences.
041:         *
042:         * @since JAX-WS 2.1
043:         */
044:
045:        // XmlRootElement allows this class to be marshalled on its own
046:        @XmlRootElement(name="EndpointReference",namespace=W3CEndpointReference.NS)
047:        @XmlType(name="EndpointReferenceType",namespace=W3CEndpointReference.NS)
048:        public final class W3CEndpointReference extends EndpointReference {
049:
050:            private final static JAXBContext w3cjc = getW3CJaxbContext();
051:
052:            protected W3CEndpointReference() {
053:            }
054:
055:            /**
056:             * Creates an EPR from infoset representation
057:             *
058:             * @param source A source object containing valid XmlInfoset
059:             * instance consistent with the W3C WS-Addressing Core
060:             * recommendation.
061:             *
062:             * @throws WebServiceException 
063:             *   If the source does NOT contain a valid W3C WS-Addressing
064:             *   EndpointReference.
065:             * @throws NullPointerException 
066:             *   If the <code>null</code> <code>source</code> value is given
067:             */
068:            public W3CEndpointReference(Source source) {
069:                try {
070:                    W3CEndpointReference epr = w3cjc.createUnmarshaller()
071:                            .unmarshal(source, W3CEndpointReference.class)
072:                            .getValue();
073:                    this .address = epr.address;
074:                    this .metadata = epr.metadata;
075:                    this .referenceParameters = epr.referenceParameters;
076:                } catch (JAXBException e) {
077:                    throw new WebServiceException(
078:                            "Error unmarshalling W3CEndpointReference ", e);
079:                } catch (ClassCastException e) {
080:                    throw new WebServiceException(
081:                            "Source did not contain W3CEndpointReference", e);
082:                }
083:            }
084:
085:            /**
086:             * {@inheritDoc}
087:             */
088:            public void writeTo(Result result) {
089:                try {
090:                    Marshaller marshaller = w3cjc.createMarshaller();
091:                    marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
092:                    marshaller.marshal(this , result);
093:                } catch (JAXBException e) {
094:                    throw new WebServiceException(
095:                            "Error marshalling W3CEndpointReference. ", e);
096:                }
097:            }
098:
099:            private static JAXBContext getW3CJaxbContext() {
100:                try {
101:                    return JAXBContext.newInstance(W3CEndpointReference.class);
102:                } catch (JAXBException e) {
103:                    throw new WebServiceException(
104:                            "Error creating JAXBContext for W3CEndpointReference. ",
105:                            e);
106:                }
107:            }
108:
109:            // private but necessary properties for databinding
110:            @XmlElement(name="Address",namespace=NS)
111:            private Address address;
112:            @XmlElement(name="ReferenceParameters",namespace=NS)
113:            private Elements referenceParameters;
114:            @XmlElement(name="Metadata",namespace=NS)
115:            private Elements metadata;
116:            @XmlAnyAttribute
117:            Map<QName, String> attributes;
118:            @XmlAnyElement
119:            List<Element> elements;
120:
121:            private static class Address {
122:                protected Address() {
123:                }
124:
125:                @XmlValue
126:                String uri;
127:                @XmlAnyAttribute
128:                Map<QName, String> attributes;
129:            }
130:
131:            private static class Elements {
132:                protected Elements() {
133:                }
134:
135:                @XmlAnyElement
136:                List<Element> elements;
137:                @XmlAnyAttribute
138:                Map<QName, String> attributes;
139:            }
140:
141:            protected static final String NS = "http://www.w3.org/2005/08/addressing";
142:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.