KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > wsif > WSIFService


1 /*
2  * The Apache Software License, Version 1.1
3  *
4  *
5  * Copyright (c) 2002 The Apache Software Foundation. All rights
6  * reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  *
20  * 3. The end-user documentation included with the redistribution,
21  * if any, must include the following acknowledgment:
22  * "This product includes software developed by the
23  * Apache Software Foundation (http://www.apache.org/)."
24  * Alternately, this acknowledgment may appear in the software itself,
25  * if and wherever such third-party acknowledgments normally appear.
26  *
27  * 4. The names "WSIF" and "Apache Software Foundation" must
28  * not be used to endorse or promote products derived from this
29  * software without prior written permission. For written
30  * permission, please contact apache@apache.org.
31  *
32  * 5. Products derived from this software may not be called "Apache",
33  * nor may "Apache" appear in their name, without prior written
34  * permission of the Apache Software Foundation.
35  *
36  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39  * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
40  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47  * SUCH DAMAGE.
48  * ====================================================================
49  *
50  * This software consists of voluntary contributions made by many
51  * individuals on behalf of the Apache Software Foundation and was
52  * originally based on software copyright (c) 2001, 2002, International
53  * Business Machines, Inc., http://www.apache.org. For more
54  * information on the Apache Software Foundation, please see
55  * <http://www.apache.org/>.
56  */

57
58 package org.apache.wsif;
59
60 import java.util.Iterator JavaDoc;
61
62 import javax.wsdl.Definition;
63 import javax.xml.namespace.QName JavaDoc;
64
65 /**
66  * A WSIFService is a factory via which WSIFPorts
67  * are retrieved. This follows the J2EE design pattern of accessing
68  * resources (WSIFPorts, in this case) via a factory which
69  * is retrieved from the context in which the application is running.
70  * When WSIF is hosted in an app server, the container can manage
71  * service invocation details by providing a factory implementation
72  * that follows the app servers wishes and guidelines.
73  *
74  * The factory is assumed to be for a specific portType; i.e.,
75  * the factory knows how to factor WSIFPorts for a given portType.
76  * As such the getPort() methods do not take portType arguments.
77  *
78  * @author Paul Fremantle
79  * @author Michael Beisiegel
80  * @author Sanjiva Weerawarana
81  * @author Aleksander Slominski
82  */

83 public interface WSIFService {
84     /**
85      * Returns an appropriate WSIFPort for the portType that this factory
86      * supports. If the service had multiple ports, which one is returned
87      * depends on the specific factory - the factory implementation may
88      * use whatever heuristic it feels like to select an "appropriate" one.
89      *
90      * @return the new WSIFPort
91      * @exception WSIFException if a suitable port cannot be located.
92      */

93     public WSIFPort getPort() throws WSIFException;
94
95     /**
96      * Returns a WSIFPort for the indicated port.
97      *
98      * @param portName name of the port (local part of the name).
99      * @return the new WSIFPort
100      * @exception WSIFException if the named port is not known or available
101      */

102     public WSIFPort getPort(String JavaDoc portName) throws WSIFException;
103
104     /**
105      * Get the dynamic proxy that will implement an interface for a port
106      *
107      * @param portName the name of the port
108      * @param iface the interface that the stub will implement
109      * @return a stub (a dynamic proxy)
110      * @exception WSIFException if something goes wrong
111      */

112     public Object JavaDoc getStub(String JavaDoc portName, Class JavaDoc iface) throws WSIFException;
113
114     /**
115      * Get the dynamic proxy that will implement an interface for a port
116      * This method will attempt to use the preferred port if set otherwise
117      * it will use the first available port.
118      *
119      * @param portName the name of the port
120      * @return a stub (a dynamic proxy)
121      * @exception WSIFException if something goes wrong
122      */

123     public Object JavaDoc getStub(Class JavaDoc iface) throws WSIFException;
124
125     /**
126      * Inform WSIF that a particular XML type (referred to in the WSDL)
127      * actually maps to a particular Java class. Use this method when there
128      * is no schema definition for this type, or when the mapping is
129      * sufficiently complicated that WSIF does not understand the schema
130      * definition. Calling this method overrides whatever schema is present
131      * in the WSDL for this type.
132      * @param xmlType the fully qualified XML type name
133      * @param javaType the java class that this type maps to
134      * @exception WSIFException if something goes wrong
135      */

136     public void mapType(QName JavaDoc xmlType, Class JavaDoc javaType) throws WSIFException;
137
138     /**
139      * Add an association between a namespace URI and and a Java package.
140      * This enables WSIF to map schema definitions to real java classes.
141      * @param namespace The namespace URI
142      * @param packageName The full package name
143      * @exception WSIFException if something goes wrong
144      */

145     public void mapPackage(String JavaDoc namespace, String JavaDoc packageName)
146         throws WSIFException;
147
148     /**
149      * Set the preferred port
150      * @param portName The name of the port to use
151      * @exception WSIFException if something goes wrong
152      */

153     public void setPreferredPort(String JavaDoc portName) throws WSIFException;
154
155     /**
156      * Get the names of the available ports
157      * @return Iterator for list of available port names.
158      * @exception WSIFException if something goes wrong
159      */

160     public Iterator JavaDoc getAvailablePortNames() throws WSIFException;
161
162     /**
163      * Get the Definition object representing the wsdl document
164      * @return The Definition object
165      */

166     public Definition getDefinition();
167     
168     /**
169      * Gets the context information for this WSIFService.
170      * @return context
171      */

172     public WSIFMessage getContext() throws WSIFException ;
173
174     /**
175      * Sets the context information for this WSIFService.
176      * @param WSIFMessage the new context information
177      */

178     public void setContext(WSIFMessage context);
179
180 }
181
Popular Tags