String xqExpression = null;
try {
URL url = new URL(xqueryImplementation.getLocationURL());
xqExpression = loadXQExpression(url);
} catch (FileNotFoundException e) {
throw new ContributionResolveException(e);
} catch (IOException e) {
throw new ContributionResolveException(e);
}
if (xqExpression == null) {
return false;
}
xqueryImplementation.setXqExpression(xqExpression);
xqExpression += "\r\n<dummy></dummy>";
Configuration config = new Configuration();
StaticQueryContext sqc = new StaticQueryContext(config);
XQueryExpression exp = null;
try {
exp = sqc.compileQuery(xqExpression);
} catch (XPathException e) {
throw new ContributionResolveException(e);
}
if (exp == null) {
return false;
}
xqueryImplementation.getCompiledExpressionsCache().put(xqExpression, exp);
try {
introspectServicesAndReferences(xqueryImplementation, exp, resolver);
} catch (ClassNotFoundException e) {
throw new ContributionResolveException(e);
} catch (InvalidInterfaceException e) {
throw new ContributionResolveException(e);
}
fillExpressionExtensions(xqueryImplementation);
return true;