File tempFile = new File(propertyFile.getFile());
if (tempFile.exists()) {
webinfDir = tempFile.getParentFile().getParentFile();
}
} else {
throw new GfacException(
" Not able to locate gfac.properties",FaultCode.InitalizationError);
}
InputStream propertyStream = classLoader
.getResourceAsStream(GFAC_PROPERTY);
properties = new Properties();
if(credentials == null){
this.credentials = new MyProxyCredentials();
}
if (propertyStream != null) {
properties.load(propertyStream);
rewriteValues(webinfDir);
String factoryUrlTmp = properties
.getProperty(GFacOptions.FACTORY_URL_NAME);
if (factoryUrlTmp != null) {
this.gfacFactoryUrl = factoryUrlTmp;
}
String registryUrlTmp = properties
.getProperty(GFacOptions.REGISTRY_URL_NAME);
if (registryUrlTmp != null) {
this.registryUrl = registryUrlTmp;
}
String myproxyServerTmp = properties
.getProperty(GFacOptions.MYPROXY_SERVER);
if (myproxyServerTmp != null) {
this.credentials.setMyproxyHostname(myproxyServerTmp.trim());
}
String myproxyPortTemp = properties.getProperty("myproxyPort");
if (myproxyPortTemp != null
&& myproxyPortTemp.trim().length() > 0) {
this.credentials.setMyproxyPortNumber(Integer.parseInt(myproxyPortTemp.trim()));
} else {
this.credentials.setMyproxyPortNumber(MyProxy.DEFAULT_PORT);
}
String myproxyUserTemp = properties
.getProperty(GFacOptions.MYPROXY_USERNAME);
if (myproxyUserTemp != null) {
this.credentials.setMyproxyUserName(myproxyUserTemp.trim());
}
String myproxyPassTemp = properties
.getProperty(GFacOptions.MYPROXY_PASSWD);
if (myproxyPassTemp != null) {
this.credentials.setMyproxyPassword(myproxyPassTemp.trim());
}
this.credentials.setTrustedCertsFile(properties.getProperty("ssl.trustedCertsFile"));
}
}
} catch (GfacException e) {
logger.severe(e.getLocalizedMessage());
throw e;
} catch (Exception e) {
logger.severe(e.getLocalizedMessage());
throw new GfacException(e,FaultCode.InitalizationError);
}
}