* @throws org.wso2.carbon.utils.ServerException ServerException
*/
public void init(String repoLocation, String weblocation) throws
ServerException {
if (repoLocation == null) {
throw new ServerException("Axis2 repository not specified!");
}
this.webLocation = weblocation;
// Check whether this is a URL
isUrlRepo = CarbonUtils.isURL(repoLocation);
if (isUrlRepo) { // Is repoLocation a URL Repo?
try {
new URL(repoLocation).openConnection().connect();
} catch (IOException e) {
throw new ServerException("Cannot connect to URL repository " + repoLocation, e);
}
this.repoLocation = repoLocation;
} else { // Is repoLocation a file repo?
File repo = new File(repoLocation);
if (repo.exists()) {
this.repoLocation = repo.getAbsolutePath();
} else {
this.repoLocation =
System.getProperty("wso2wsas.home") + File.separator +
repoLocation;
repo = new File(this.repoLocation);
if (!repo.exists()) {
this.repoLocation = null;
throw new ServerException("Repository location '" + repoLocation +
"' not found!");
}
}
}
axis2xml = CarbonUtils.getAxis2Xml();
isUrlAxis2Xml = CarbonUtils.isURL(axis2xml);
if (!isUrlAxis2Xml) { // Is axis2xml a URL to the axis2.xml file?
File configFile = new File(axis2xml);
if (!configFile.exists()) {
//This will fallback to default axis2.xml
this.axis2xml = null;
//Thus default
}
} else {
try {
URLConnection urlConnection = new URL(axis2xml).openConnection();
urlConnection.connect();
} catch (IOException e) {
throw new ServerException("Cannot connect to axis2.xml URL " + repoLocation, e);
}
isInitialized = true;
}
}