package clients;

import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;

import aufgabe8.HelloWorldRemote;

public class HelloClient {

	public static void main(String[] args) {
		Properties properties = new Properties();
		properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
		properties.setProperty(Context.PROVIDER_URL, "http-remoting://127.0.0.1:8080");

		try {
			InitialContext context = new InitialContext(properties);
			HelloWorldRemote hello = (HelloWorldRemote)context.lookup("ejb:/Componentware_Kapitel6_Transaktionen_Uebung/HelloWorld!aufgabe8.HelloWorldRemote?stateful");

			try{
				System.out.println("vor sayHello1()");
				hello.sayHello1();
				System.out.println("nach sayHello1()");
			}
			catch(Exception e){
				e.printStackTrace();
			}

			try{
				System.out.println("vor sayHello2()");
				hello.sayHello2();
				System.out.println("nach sayHello2()");
			}
			catch(Exception e){
				e.printStackTrace();
			}

			try{
				System.out.println("vor sayHello3()");
				hello.sayHello3();
				System.out.println("nach sayHello3()");
			}
			catch(Exception e){
				e.printStackTrace();
			}

			try{
				System.out.println("vor sayHello4()");
				hello.sayHello4();
				System.out.println("nach sayHello4()");
			}
			catch(Exception e){
				e.printStackTrace();
			}
			
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

