* provided configuration object. Throws ProjectException if there is no
* matching DataNode.
*/
public DataNode findDataNode(Configuration config)
throws ProjectException {
DataDomain domainObj = null;
// domain name is either explicit, or use default domain
if (domain != null) {
domainObj = config.getDomain(domain);
if (domainObj == null) {
throw new ProjectException("Can't find domain named " + domain);
}
} else {
try {
domainObj = config.getDomain();
} catch (Exception ex) {
throw new ProjectException("Project has no default domain.", ex);
}
if (domainObj == null) {
throw new ProjectException("Project has no domains configured.");
}
}
DataNode node = domainObj.getNode(name);
if (node == null) {
throw new ProjectException(
"Domain "
+ domainObj.getName()
+ " has no node named '"
+ name
+ "'.");
}
return node;