Package ivory.core

Examples of ivory.core.ConfigurationException


    Preconditions.checkNotNull(model);

    // Get model type.
    String modelType = XMLTools.getAttributeValue(model, "type", null);
    if (modelType == null) {
      throw new ConfigurationException("Model type must be specified!");
    }

    // Dynamically construct importance model.
    ConceptImportanceModel importanceModel = null;
    try {
      Class<? extends ConceptImportanceModel> clz =
        (Class<? extends ConceptImportanceModel>) Class.forName(modelType);
      importanceModel = clz.newInstance();
      importanceModel.configure(model);
    } catch (Exception e) {
      throw new ConfigurationException("Error instantiating ConceptImportanceModel! " + e);
    }

    return importanceModel;
  }
View Full Code Here


    docNode = null;

    for (GraphNode node : nodes) {
      if (node.getType().equals(GraphNode.Type.DOCUMENT) && docNode != null) {
        throw new ConfigurationException("Only one document node allowed in DocumentPotential!");
      } else if (node.getType().equals(GraphNode.Type.DOCUMENT)) {
        docNode = (DocumentNode) node;
      } else if (node.getType().equals(GraphNode.Type.TERM)) {
        throw new ConfigurationException("TermNodes are not allowed in DocumentPotential!");
      }
    }
  }
View Full Code Here

    docNode = null;
    termNodes.clear();

    for (GraphNode node : nodes) {
      if (node.getType() == GraphNode.Type.DOCUMENT && docNode != null) {
        throw new ConfigurationException("Only one document node allowed in QueryPotential!");
      } else if (node.getType() == GraphNode.Type.DOCUMENT) {
        docNode = (DocumentNode) node;
      } else if (node.getType() == GraphNode.Type.TERM) {
        termNodes.add((TermNode) node);
      } else {
        throw new ConfigurationException(
            "Unrecognized node type in clique associated with QueryPotential!");
      }
    }

    String[] terms = new String[termNodes.size()];
View Full Code Here

                        try {
     
                          d = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(
                                                        fs.open(new Path(element)));
                        } catch (SAXException e) {
                                throw new ConfigurationException(e.getMessage());
                        } catch (IOException e) {
                                throw new ConfigurationException(e.getMessage());
                        } catch (ParserConfigurationException e) {
                                throw new ConfigurationException(e.getMessage());
                        }
               
                        parseModels(d);                       
                        parseIndexLocation(d);
                }
                               
                // Make sure we have some queries to run.
                if (queries.isEmpty()) {
                        throw new ConfigurationException("Must specify at least one query!");
                }
                       
                // Make sure there are models that need evaluated.
                if (models.isEmpty()) {
                        throw new ConfigurationException("Must specify at least one model!");
                }
                                               
                // Make sure we have an index to run against.
                if (indexPath == null) {
                        throw new ConfigurationException("Must specify an index!");
                }
        }      
View Full Code Here

      }
      internalOutputFiles[i] = internalOutputFile;


      if (modelID == null) {
        throw new ConfigurationException("Must specify a model id for every model!");
      }

      // Parse parent nodes.
      NodeList children = node.getChildNodes();
      for (int j = 0; j < children.getLength(); j++) {
        Node child = children.item(j);
        if ("expander".equals(child.getNodeName())) {
          if (expanders.containsKey(modelID)) {
            throw new ConfigurationException("Only one expander allowed per model!");
          }
          expanders.put(modelID, child);
        }
      }
View Full Code Here

    Document d = null;
    try {
      d = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(fs.open(new Path(element)));
    } catch (SAXException e) {
      throw new ConfigurationException(e.getMessage());
    } catch (IOException e) {
      throw new ConfigurationException(e.getMessage());
    } catch (ParserConfigurationException e) {
      throw new ConfigurationException(e.getMessage());
    }

    conf.set(Constants.QueriesPath, cmdline.getOptionValue(Constants.QueriesPath));

    NodeList list = d.getElementsByTagName(Constants.QueryType);
View Full Code Here

    Document d = null;

    try {
      d = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(fs.open(new Path(qfile)));
    } catch (SAXException e) {
      throw new ConfigurationException(e.getMessage());
    } catch (IOException e) {
      throw new ConfigurationException(e.getMessage());
    } catch (ParserConfigurationException e) {
      throw new ConfigurationException(e.getMessage());
    }

    Map<String, String> queries = Maps.newLinkedHashMap();
    NodeList queryNodes = d.getElementsByTagName("query");

    LOG.info("Parsing "+queryNodes.getLength()+" nodes...");
    for (int i = 0; i < queryNodes.getLength(); i++) {
      // Get query XML node.
      Node node = queryNodes.item(i);

      // Get query id.
      String qid = XMLTools.getAttributeValueOrThrowException(node, "id",
      "Must specify a query id attribute for every query!");

      // Get query text.
      String queryText = node.getTextContent();

      // Add query to internal map.
      if (queries.get(qid) != null) {
        throw new ConfigurationException(
            "Duplicate query ids not allowed! Already parsed query with id=" + qid);
      }
      queries.put(qid, queryText);
    }
  
View Full Code Here

    Document d = null;
    try {
      d = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(fs.open(new Path(element)));
    } catch (SAXException e) {
      throw new ConfigurationException(e.getMessage());
    } catch (IOException e) {
      throw new ConfigurationException(e.getMessage());
    } catch (ParserConfigurationException e) {
      throw new ConfigurationException(e.getMessage());
    }

    conf.set(Constants.QueriesPath, cmdline.getOptionValue(Constants.QueriesPath));

    NodeList list = d.getElementsByTagName(Constants.QueryType);
View Full Code Here

    Document d = null;
    try {
      d = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(fs.open(new Path(element)));
    } catch (SAXException e) {
      throw new ConfigurationException(e.getMessage());
    } catch (IOException e) {
      throw new ConfigurationException(e.getMessage());
    } catch (ParserConfigurationException e) {
      throw new ConfigurationException(e.getMessage());
    }

    if (cmdline.hasOption(Constants.QueriesPath)) {
      conf.set(Constants.QueriesPath, cmdline.getOptionValue(Constants.QueriesPath));
    }
View Full Code Here

    Document d = null;

    try {
      d = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(fs.open(new Path(qfile)));
    } catch (SAXException e) {
      throw new ConfigurationException(e.getMessage());
    } catch (IOException e) {
      throw new ConfigurationException(e.getMessage());
    } catch (ParserConfigurationException e) {
      throw new ConfigurationException(e.getMessage());
    }

    Map<String, String> queries = Maps.newLinkedHashMap();
    NodeList queryNodes = d.getElementsByTagName("query");

    System.out.println("Parsing "+queryNodes.getLength()+" nodes...");
    for (int i = 0; i < queryNodes.getLength(); i++) {
      // Get query XML node.
      Node node = queryNodes.item(i);

      // Get query id.
      String qid = XMLTools.getAttributeValueOrThrowException(node, "id",
      "Must specify a query id attribute for every query!");

      // Get query text.
      String queryText = node.getTextContent();

      // Add query to internal map.
      if (queries.get(qid) != null) {
        throw new ConfigurationException(
            "Duplicate query ids not allowed! Already parsed query with id=" + qid);
      }
      queries.put(qid, queryText);
    }
View Full Code Here

TOP

Related Classes of ivory.core.ConfigurationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.