Search in sources :

Example 1 with MyProxyServiceFacade

use of edu.uiuc.ncsa.myproxy.MyProxyServiceFacade in project OA4MP by ncsa.

the class MyProxyFacadeProvider method get.

@Override
public MyProxyServiceFacade get() {
    ServiceFacadeConfiguration sfc;
    HashMap<String, Integer> loas = new HashMap<String, Integer>();
    String localhostname = null;
    String serverDN = null;
    try {
        localhostname = java.net.InetAddress.getLocalHost().getCanonicalHostName();
    } catch (UnknownHostException e) {
        localhostname = "localhost";
    }
    // start with default port.
    int port = 7512;
    // start with default
    long socketTimeout = 0L;
    if (getConfig() == null) {
        // No configuration, so use the defaults.
        sfc = new ServiceFacadeConfiguration(localhostname, port, socketTimeout, loas, serverDN);
    // return new MyProxyServiceFacade(sfc);
    } else {
        serverDN = getAttribute(MYPROXY_SERVER_DN);
        if (serverDN == null && hasDefaultServerDN()) {
            serverDN = getDefaultServerDN();
        }
        try {
            port = getIntAttribute(MYPROXY_PORT);
        } catch (Throwable t) {
        // do nothing. If the port is not given, use the default
        }
        try {
            socketTimeout = getIntAttribute(MYPROXY_SOCKET_TIMEOUT);
        } catch (Throwable t) {
        // do nix.
        }
        if (getAttribute(MYPROXY_HOST) != null) {
            localhostname = getAttribute(MYPROXY_HOST);
        }
        sfc = new ServiceFacadeConfiguration(localhostname, port, socketTimeout, loas, serverDN);
        List list = getConfig().getChildren(MYPROXY_LOA);
        if (!list.isEmpty()) {
            for (Object obj : list) {
                ConfigurationNode cn = (ConfigurationNode) obj;
                loas.put(Configurations.getFirstAttribute(cn, MYPROXY_LOA_NAME), Integer.parseInt(Configurations.getFirstAttribute(cn, MYPROXY_LOA_PORT)));
            }
        }
    }
    // Unless there is something very exotic about your setup, a basic configuration that
    // points to the standard keystore available in java should be more than sufficient.
    SSLKeystoreConfiguration sslKeystoreConfiguration = SSLConfigurationUtil.getSSLConfiguration(null, getConfig());
    return new MyProxyServiceFacade(sfc, sslKeystoreConfiguration);
}
Also used : UnknownHostException(java.net.UnknownHostException) HashMap(java.util.HashMap) SSLKeystoreConfiguration(edu.uiuc.ncsa.security.util.ssl.SSLKeystoreConfiguration) ServiceFacadeConfiguration(edu.uiuc.ncsa.myproxy.ServiceFacadeConfiguration) ConfigurationNode(org.apache.commons.configuration.tree.ConfigurationNode) MyProxyServiceFacade(edu.uiuc.ncsa.myproxy.MyProxyServiceFacade) List(java.util.List)

Example 2 with MyProxyServiceFacade

use of edu.uiuc.ncsa.myproxy.MyProxyServiceFacade in project OA4MP by ncsa.

the class AbstractConfigurationLoader method load.

@Override
public T load() {
    info("loading configuration.");
    ServiceEnvironmentImpl se2 = createInstance();
    // now peel off the service address
    se2.setServiceAddress(getServiceAddress());
    se2.setDebugOn(Boolean.parseBoolean(Configurations.getFirstAttribute(cn, OA4MPConfigTags.DEBUG)));
    DebugUtil.setIsEnabled(se2.isDebugOn());
    se2.info("Debugging is " + (se2.isDebugOn() ? "on" : "off"));
    // part 2. This is done after main config load.
    Object[] polling = loadPolling();
    if (polling != null) {
        info("Loading polling for " + polling[0]);
        AbstractCLIApprover.ClientApprovalThread cat = new AbstractCLIApprover.ClientApprovalThread(myLogger, se2, (File) polling[0], (Long) polling[1]);
        se2.setClientApprovalThread(cat);
    }
    if (se2.isDebugOn()) {
        info("Debug mode enabled.");
        for (MyProxyServiceFacade x : se2.getMyProxyServices()) {
            debug("loaded myproxy configuration for " + x.getFacadeConfiguration().getHostname() + ":" + x.getFacadeConfiguration().getPort());
        }
    }
    return (T) se2;
}
Also used : AbstractCLIApprover(edu.uiuc.ncsa.myproxy.oa4mp.server.util.AbstractCLIApprover) ServiceEnvironmentImpl(edu.uiuc.ncsa.myproxy.oa4mp.server.ServiceEnvironmentImpl) MyProxyServiceFacade(edu.uiuc.ncsa.myproxy.MyProxyServiceFacade)

Aggregations

MyProxyServiceFacade (edu.uiuc.ncsa.myproxy.MyProxyServiceFacade)2 ServiceFacadeConfiguration (edu.uiuc.ncsa.myproxy.ServiceFacadeConfiguration)1 ServiceEnvironmentImpl (edu.uiuc.ncsa.myproxy.oa4mp.server.ServiceEnvironmentImpl)1 AbstractCLIApprover (edu.uiuc.ncsa.myproxy.oa4mp.server.util.AbstractCLIApprover)1 SSLKeystoreConfiguration (edu.uiuc.ncsa.security.util.ssl.SSLKeystoreConfiguration)1 UnknownHostException (java.net.UnknownHostException)1 HashMap (java.util.HashMap)1 List (java.util.List)1 ConfigurationNode (org.apache.commons.configuration.tree.ConfigurationNode)1