/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package sikd.sikd5.sikd5bean.util;

import java.io.Serializable;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;

/**
 *
 * @author agus
 */
public class ServiceServerUtil implements Serializable{
    public static Context getLoginContext() throws Exception {
        Properties pr = PropertiesLoader.loadProperties("sikd.properties");
        Properties prop = new Properties();
        if (pr.getProperty("aasurl") != null && !pr.getProperty("aasurl").trim().equals("")) {
            prop.put(InitialContext.PROVIDER_URL, pr.getProperty("aasurl"));
        }

        Context ctx = new InitialContext(prop);
        return ctx;
    }
    public static Context getOfficeContext() throws Exception {
        Properties pr = PropertiesLoader.loadProperties("sikd.properties");
        Properties prop = new Properties();
        if (pr.getProperty("officeurl") != null && !pr.getProperty("officeurl").trim().equals("")) {
            prop.put(InitialContext.PROVIDER_URL, pr.getProperty("officeurl"));
        }

        Context ctx = new InitialContext(prop);
        return ctx;
    }
//       put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
//        put(Context.PROVIDER_URL, "http-remoting://localhost:8080");
}

