Package ch.uzh.ifi.ddis.ifp.esper

Examples of ch.uzh.ifi.ddis.ifp.esper.EsperStatementBeanFactory


        _log.warn("No Esper statements file provided!");
        return;
      }
      _log.info("Started adding statements from {} ...", statementsFile);

      final EsperStatementBeanFactory esperStatementsBeanFactory = (EsperStatementBeanFactory) Class
          .forName(statementBeansFactory).newInstance();

      final DocumentBuilder builder = DocumentBuilderFactory
          .newInstance().newDocumentBuilder();

      // Trying to load statements from file or resource.
      InputStream xmlStatementsFileStream = null;
      {
        final File xmlStatementsFileTest = new File(statementsFile);
        if (xmlStatementsFileTest.exists()) {
          xmlStatementsFileStream = new FileInputStream(
              xmlStatementsFileTest);
          _log.info("Loading statements from file {}", statementsFile);
        } else {
          xmlStatementsFileStream = getClass().getResourceAsStream(
              statementsFile);
          if (xmlStatementsFileStream == null) {
            xmlStatementsFileStream = getClass()
                .getResourceAsStream("/" + statementsFile);
            _log.info("Loading statements from resource {}", "/"
                + statementsFile);
          } else {
            _log.info("Loading statements from resource {}",
                statementsFile);
          }
        }

      }
      _log.info("Started parsing statements from {} ...", statementsFile);
      final org.w3c.dom.Document document = builder
          .parse(xmlStatementsFileStream);
      final NodeList statementNodesList = document
          .getElementsByTagName("statement");
      final int statementNodesListSize = statementNodesList.getLength();
      for (int i = 0; i < statementNodesListSize; ++i) {
        final org.w3c.dom.Node statementNode = statementNodesList
            .item(i);
        final EsperStatementBean esperStatementBean = esperStatementsBeanFactory
            .createEsperStatementBean(statementNode);
        _esperStatementBeansList.add(esperStatementBean);
      }

      for (EsperStatementBean esperStatementBean : _esperStatementBeansList) {
View Full Code Here

TOP

Related Classes of ch.uzh.ifi.ddis.ifp.esper.EsperStatementBeanFactory

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.