import java.net.URL;
import java.util.Collection;
import java.util.Iterator;

import org.egso.common.context.EGSOContext;
import org.egso.consumer.EGSOLiterals;
import org.egso.consumer.api.Data;
import org.egso.consumer.api.Query;
import org.egso.consumer.api.async.Session;
import org.egso.consumer.wsclient.WSQuery;
import org.egso.consumer.wsclient.session.WSSessionFactory;


public class egso_factory {

    public Session create_egso() throws Exception {
	return create_egso("http://147.86.108.123:8080/egso-ws/query");
    }

    public Session create_egso(String url) throws Exception {
	URL endpoint;
	try {
	    endpoint = new URL(url);
	    return new WSSessionFactory(endpoint).login(null);
	} catch (RuntimeException t) {
	    System.out.println(t.getMessage());
	    t.printStackTrace();
	    throw t;
	} catch (Exception t){
	    System.out.println(t.getMessage());
	    t.printStackTrace();
	    throw t;
	}
	
    }
}
