1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
24 */
25
26 package com.oracle.webservices.internal.api.message;
27
28 import java.io.IOException;
29 import java.io.InputStream;
30
31 import com.oracle.webservices.internal.api.EnvelopeStyle;
32 import com.sun.xml.internal.ws.api.SOAPVersion; // TODO leaking RI APIs
33 import com.sun.xml.internal.ws.util.ServiceFinder;
34
35 import javax.xml.soap.MimeHeaders;
36 import javax.xml.soap.SOAPMessage;
37 import javax.xml.transform.Source;
38 import javax.xml.ws.WebServiceFeature;
39
40 public abstract class MessageContextFactory
41 {
42 private static final MessageContextFactory DEFAULT = new com.sun.xml.internal.ws.api.message.MessageContextFactory(new WebServiceFeature[0]);
43
44 protected abstract MessageContextFactory newFactory(WebServiceFeature ... f);
45
46 public abstract MessageContext createContext();
47
48 public abstract MessageContext createContext(SOAPMessage m);
49
50 public abstract MessageContext createContext(Source m);
51
52 public abstract MessageContext createContext(Source m, EnvelopeStyle.Style envelopeStyle);
53
54 public abstract MessageContext createContext(InputStream in, String contentType) throws IOException;
55
56 /**
57 * @deprecated http://java.net/jira/browse/JAX_WS-1077
58 */
59 @Deprecated
60 public abstract MessageContext createContext(InputStream in, MimeHeaders headers) throws IOException;
61
62 static public MessageContextFactory createFactory(WebServiceFeature ... f) {
63 return createFactory(null, f);
110 return f.doCreate(m, v);
111 }
112 });
113 }
114
115 @Deprecated
116 private static MessageContext serviceFinder(final ClassLoader[] classLoader, final Creator creator) {
117 final ClassLoader cl = classLoader.length == 0 ? null : classLoader[0];
118 for (MessageContextFactory factory : ServiceFinder.find(MessageContextFactory.class, cl)) {
119 final MessageContext messageContext = creator.create(factory);
120 if (messageContext != null)
121 return messageContext;
122 }
123 return creator.create(DEFAULT);
124 }
125
126 @Deprecated
127 private static interface Creator {
128 public MessageContext create(MessageContextFactory f);
129 }
130 }
|
1 /*
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
24 */
25
26 package com.oracle.webservices.internal.api.message;
27
28 import java.io.IOException;
29 import java.io.InputStream;
30
31 import com.oracle.webservices.internal.api.EnvelopeStyle;
32 import com.sun.xml.internal.ws.api.SOAPVersion; // TODO leaking RI APIs
33 import com.sun.xml.internal.ws.util.ServiceFinder;
34
35 import javax.xml.soap.MimeHeaders;
36 import javax.xml.soap.SOAPMessage;
37 import javax.xml.transform.Source;
38 import javax.xml.ws.WebServiceFeature;
39
40 public abstract class MessageContextFactory
41 {
42 private static final MessageContextFactory DEFAULT = new com.sun.xml.internal.ws.api.message.MessageContextFactory(new WebServiceFeature[0]);
43
44 protected com.sun.xml.internal.ws.api.message.saaj.SAAJFactory saajFactory = null;
45
46 protected abstract MessageContextFactory newFactory(WebServiceFeature ... f);
47
48 public abstract MessageContext createContext();
49
50 public abstract MessageContext createContext(SOAPMessage m);
51
52 public abstract MessageContext createContext(Source m);
53
54 public abstract MessageContext createContext(Source m, EnvelopeStyle.Style envelopeStyle);
55
56 public abstract MessageContext createContext(InputStream in, String contentType) throws IOException;
57
58 /**
59 * @deprecated http://java.net/jira/browse/JAX_WS-1077
60 */
61 @Deprecated
62 public abstract MessageContext createContext(InputStream in, MimeHeaders headers) throws IOException;
63
64 static public MessageContextFactory createFactory(WebServiceFeature ... f) {
65 return createFactory(null, f);
112 return f.doCreate(m, v);
113 }
114 });
115 }
116
117 @Deprecated
118 private static MessageContext serviceFinder(final ClassLoader[] classLoader, final Creator creator) {
119 final ClassLoader cl = classLoader.length == 0 ? null : classLoader[0];
120 for (MessageContextFactory factory : ServiceFinder.find(MessageContextFactory.class, cl)) {
121 final MessageContext messageContext = creator.create(factory);
122 if (messageContext != null)
123 return messageContext;
124 }
125 return creator.create(DEFAULT);
126 }
127
128 @Deprecated
129 private static interface Creator {
130 public MessageContext create(MessageContextFactory f);
131 }
132
133 public void setSAAJFactory(com.sun.xml.internal.ws.api.message.saaj.SAAJFactory saajFactory) {
134 this.saajFactory = saajFactory;
135 }
136 }
|