KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > transport > local > LocalTransport


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.axis.transport.local;
18
19 import org.apache.axis.AxisEngine;
20 import org.apache.axis.MessageContext;
21 import org.apache.axis.client.Call;
22 import org.apache.axis.client.Transport;
23 import org.apache.axis.server.AxisServer;
24
25 /**
26  * A Transport which will cause an invocation via a "local" AxisServer.
27  *
28  * Serialization will still be tested, as the requests and responses
29  * pass through a String conversion (see LocalSender.java) - this is
30  * primarily for testing and debugging.
31  *
32  * This transport will either allow the LocalSender to create its own
33  * AxisServer, or if you have one you've configured and wish to use,
34  * you may pass it in to the constructor here.
35  *
36  * @author Rob Jellinghaus (robj@unrealities.com)
37  * @author Doug Davis (dug@us.ibm.com)
38  * @author Glen Daniels (gdaniels@allaire.com)
39  */

40 public class LocalTransport extends Transport
41 {
42     public static final String JavaDoc LOCAL_SERVER = "LocalTransport.AxisServer";
43     public static final String JavaDoc REMOTE_SERVICE = "LocalTransport.RemoteService";
44
45     private AxisServer server;
46
47     /** The name of a particular remote service to invoke. */
48     private String JavaDoc remoteServiceName;
49
50     /** No-arg constructor, which will use an AxisServer constructed
51      * by the LocalSender (see LocalSender.java).
52      *
53      */

54     public LocalTransport()
55     {
56         transportName = "local";
57     }
58     
59     /** Use this constructor if you have a particular server kicking
60      * around (perhaps which you've already deployed useful stuff into)
61      * which you'd like to use.
62      *
63      * @param server an AxisServer which will bubble down to the LocalSender
64      */

65     public LocalTransport(AxisServer server)
66     {
67         transportName = "local";
68         this.server = server;
69     }
70
71     /**
72      * Use this to indicate a particular "remote" service which should be
73      * invoked on the target AxisServer. This can be used programatically
74      * in place of a service-specific URL.
75      *
76      * @param remoteServiceName the name of the remote service to invoke
77      */

78     public void setRemoteService(String JavaDoc remoteServiceName) {
79         this.remoteServiceName = remoteServiceName;
80     }
81
82     /**
83      * Set up any transport-specific derived properties in the message context.
84      * @param context the context to set up
85      * @param message the client service instance
86      * @param engine the engine containing the registries
87      */

88     public void setupMessageContextImpl(MessageContext mc,
89                                         Call call,
90                                         AxisEngine engine)
91     {
92         if (server != null)
93             mc.setProperty(LOCAL_SERVER, server);
94         if (remoteServiceName != null)
95             mc.setProperty(REMOTE_SERVICE, remoteServiceName);
96     }
97 }
98
99
Popular Tags