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);
}
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;
}
Aggregations