001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018 package org.apache.camel.loanbroker.webservice.version.bank;
019
020 import javax.xml.ws.Endpoint;
021
022 import org.apache.camel.loanbroker.webservice.version.Constants;
023
024
025
026 public class BankServer {
027
028 Endpoint endpoint1;
029 Endpoint endpoint2;
030 Endpoint endpoint3;
031
032 public void start() throws Exception {
033 System.out.println("Starting Bank Server");
034 Object bank1 = new Bank("bank1");
035 Object bank2 = new Bank("bank2");
036 Object bank3 = new Bank("bank3");
037
038 endpoint1 = Endpoint.publish(Constants.BANK1_ADDRESS, bank1);
039 endpoint2 = Endpoint.publish(Constants.BANK2_ADDRESS, bank2);
040 endpoint3 = Endpoint.publish(Constants.BANK3_ADDRESS, bank3);
041
042
043 }
044
045 public void stop() {
046 if (endpoint1 != null) {
047 endpoint1.stop();
048 }
049 if (endpoint2 != null) {
050 endpoint2.stop();
051 }
052 if (endpoint3 != null) {
053 endpoint3.stop();
054 }
055 }
056
057
058 public static void main(String args[]) throws Exception {
059 BankServer server = new BankServer();
060 System.out.println("Server ready...");
061 server.start();
062 Thread.sleep(5 * 60 * 1000);
063 System.out.println("Server exiting");
064 server.stop();
065 System.exit(0);
066 }
067
068 }