1 /* |
1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
62 |
62 |
63 @XmlRootElement(name = "EndpointReference", namespace = MemberSubmissionEndpointReference.MSNS) |
63 @XmlRootElement(name = "EndpointReference", namespace = MemberSubmissionEndpointReference.MSNS) |
64 @XmlType(name = "EndpointReferenceType", namespace = MemberSubmissionEndpointReference.MSNS) |
64 @XmlType(name = "EndpointReferenceType", namespace = MemberSubmissionEndpointReference.MSNS) |
65 public final class MemberSubmissionEndpointReference extends EndpointReference implements MemberSubmissionAddressingConstants { |
65 public final class MemberSubmissionEndpointReference extends EndpointReference implements MemberSubmissionAddressingConstants { |
66 |
66 |
67 private final static JAXBContext msjc = MemberSubmissionEndpointReference.getMSJaxbContext(); |
67 private final static ContextClassloaderLocal<JAXBContext> msjc = new ContextClassloaderLocal<JAXBContext>() { |
|
68 @Override |
|
69 protected JAXBContext initialValue() throws Exception { |
|
70 return MemberSubmissionEndpointReference.getMSJaxbContext(); |
|
71 } |
|
72 }; |
68 |
73 |
69 public MemberSubmissionEndpointReference() { |
74 public MemberSubmissionEndpointReference() { |
70 } |
75 } |
71 |
76 |
72 /** |
77 /** |
84 if (source == null) { |
89 if (source == null) { |
85 throw new WebServiceException("Source parameter can not be null on constructor"); |
90 throw new WebServiceException("Source parameter can not be null on constructor"); |
86 } |
91 } |
87 |
92 |
88 try { |
93 try { |
89 Unmarshaller unmarshaller = MemberSubmissionEndpointReference.msjc.createUnmarshaller(); |
94 Unmarshaller unmarshaller = MemberSubmissionEndpointReference.msjc.get().createUnmarshaller(); |
90 MemberSubmissionEndpointReference epr = unmarshaller.unmarshal(source,MemberSubmissionEndpointReference.class).getValue(); |
95 MemberSubmissionEndpointReference epr = unmarshaller.unmarshal(source,MemberSubmissionEndpointReference.class).getValue(); |
91 |
96 |
92 this.addr = epr.addr; |
97 this.addr = epr.addr; |
93 this.referenceProperties = epr.referenceProperties; |
98 this.referenceProperties = epr.referenceProperties; |
94 this.referenceParameters = epr.referenceParameters; |
99 this.referenceParameters = epr.referenceParameters; |
104 } |
109 } |
105 |
110 |
106 @Override |
111 @Override |
107 public void writeTo(Result result) { |
112 public void writeTo(Result result) { |
108 try { |
113 try { |
109 Marshaller marshaller = MemberSubmissionEndpointReference.msjc.createMarshaller(); |
114 Marshaller marshaller = MemberSubmissionEndpointReference.msjc.get().createMarshaller(); |
110 //marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); |
115 //marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); |
111 marshaller.marshal(this, result); |
116 marshaller.marshal(this, result); |
112 } catch (JAXBException e) { |
117 } catch (JAXBException e) { |
113 throw new WebServiceException("Error marshalling W3CEndpointReference. ", e); |
118 throw new WebServiceException("Error marshalling W3CEndpointReference. ", e); |
114 } |
119 } |