LOG.log(Level.FINE, msg.toString());
if (NSFILEMAP.containsKey(namespaceURI)) {
return loadLSInput(namespaceURI);
}
LSInput lsin = null;
String resURL = null;
String localFile = null;
if (systemId != null) {
String schemaLocation = "";
if (baseURI != null) {
schemaLocation = baseURI.substring(0, baseURI.lastIndexOf("/") + 1);
}
if (systemId.indexOf("http://") < 0) {
resURL = schemaLocation + systemId;
} else {
resURL = systemId;
}
} else if (namespaceURI != null) {
resURL = namespaceURI;
}
if (resURL != null && resURL.startsWith("http://")) {
String filename = NSFILEMAP.get(resURL);
if (filename != null) {
localFile = ToolConstants.CXF_SCHEMAS_DIR_INJAR + filename;
} else {
URL url;
URLConnection urlCon = null;
try {
url = new URL(resURL);
urlCon = url.openConnection();
urlCon.setUseCaches(false);
lsin = new LSInputImpl();
lsin.setSystemId(resURL);
lsin.setByteStream(urlCon.getInputStream());
msg = new Message("RESOLVE_FROM_REMOTE", LOG, url);
LOG.log(Level.FINE, msg.toString());
return lsin;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
} else if (resURL != null && !resURL.startsWith("http:")) {
localFile = resURL;
} else {
return null;
}
URIResolver resolver;
try {
msg = new Message("RESOLVE_FROM_LOCAL", LOG, localFile);
LOG.log(Level.FINE, msg.toString());
resolver = new URIResolver(localFile);
if (resolver.isResolved()) {
lsin = new LSInputImpl();
lsin.setSystemId(localFile);
lsin.setByteStream(resolver.getInputStream());
}
} catch (IOException e) {
return null;
}
return lsin;