KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > samples > transport > tcp > AdminClient


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 samples.transport.tcp ;
18
19 import org.apache.axis.EngineConfiguration;
20 import org.apache.axis.SimpleTargetedChain;
21 import org.apache.axis.client.Call;
22 import org.apache.axis.configuration.DefaultEngineConfigurationFactory;
23 import org.apache.axis.configuration.SimpleProvider;
24
25 /**
26  * An admin client object, which will work with the TCP transport.
27  *
28  * @author Rob Jellinghaus (robj@unrealities.com)
29  * @author Doug Davis (dug@us.ibm.com)
30  * @author Glen Daniels (gdaniels@apache.org)
31  */

32
33 public class AdminClient extends org.apache.axis.client.AdminClient {
34     public static void main(String JavaDoc args[]) {
35
36         Call.addTransportPackage("samples.transport");
37         Call.setTransportForProtocol("tcp", TCPTransport.class);
38
39         // Deploy the transport on top of the default client configuration.
40
EngineConfiguration defaultConfig =
41             (new DefaultEngineConfigurationFactory()).
42             getClientEngineConfig();
43         SimpleProvider config = new SimpleProvider(defaultConfig);
44         SimpleTargetedChain c = new SimpleTargetedChain(new TCPSender());
45         config.deployTransport("tcp", c);
46
47         AdminClient.setDefaultConfiguration(config);
48
49         try {
50             org.apache.axis.client.AdminClient client =
51                 new org.apache.axis.client.AdminClient(true);
52
53             System.out.println(client.process(args));
54         }
55         catch( Exception JavaDoc e ) {
56             System.err.println( e );
57             e.printStackTrace( System.err );
58         }
59     }
60 }
61
62
Popular Tags