Package org.apache.uima.util

Examples of org.apache.uima.util.InvalidXMLException


            getCpeCasProcessors().setOutputQueueSize(cps.getOutputQueueSize());
          }
        }
      }
    } catch (Exception e) {
      throw new InvalidXMLException(e);
    }
  }
View Full Code Here


          throws InvalidXMLException {
    try {
      setDropCasOnException(Boolean.valueOf(aElement.getAttribute("dropCasOnException"))
              .booleanValue());
    } catch (Exception e) {
      throw new InvalidXMLException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
              "UIMA_CPM_EXP_missing_attribute_from_xml_element__WARNING", new Object[] {
                  Thread.currentThread().getName(), "casProcessors", "dropCasOnException",
                  "casProcessors" });

    }
    String cps = aElement.getAttribute("casPoolSize");
    if (cps != null && cps.trim().length() > 0) {
      try {
        setPoolSize(Integer.parseInt(cps));
      } catch (Exception e) {
        throw new InvalidXMLException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
                "UIMA_CPM_EXP_missing_attribute_from_xml_element__WARNING", new Object[] {
                    Thread.currentThread().getName(), "casProcessors", "casPoolSize",
                    "casProcessors" });

      }
    }
    if (aElement.getAttribute("processingUnitThreadCount") != null) {
      // String tc = aElement.getAttribute("processingUnitThreadCount");
      try {
        setConcurrentPUCount(Integer.parseInt(aElement.getAttribute("processingUnitThreadCount")));
      } catch (Exception e) {
        throw new InvalidXMLException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
                "UIMA_CPM_EXP_missing_attribute_from_xml_element__WARNING", new Object[] {
                    Thread.currentThread().getName(), "casProcessors", "processingUnitThreadCount",
                    "casProcessors" });

      }
    } else {
      throw new InvalidXMLException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
              "UIMA_CPM_EXP_missing_attribute_from_xml_element__WARNING", new Object[] {
                  Thread.currentThread().getName(), "casProcessors", "processingUnitThreadCount",
                  "casProcessors" });
    }
    // populate inputQueueSize and outputQueueSize ONLY if casPoolSize is not defined.
    // Both of these attributes have been deprecated and should not be used
    try {
      if (getPoolSize() == 0) {
        String iqs = aElement.getAttribute("inputQueueSize");
        if (iqs != null && iqs.length() > 0) {
          setInputQueueSize(Integer.parseInt(iqs));
        }
        String oqs = aElement.getAttribute("outputQueueSize");
        if (oqs != null && oqs.length() > 0) {
          setOutputQueueSize(Integer.parseInt(oqs));
        }
      }
    } catch (Exception e) {
      throw new InvalidXMLException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
              "UIMA_CPM_EXP_missing_attribute_from_xml_element__WARNING", new Object[] {
                  Thread.currentThread().getName(), "casProcessors", "field", "casProcessors" });

    }
View Full Code Here

        } catch (MalformedURLException e) {
          try {
            return new File(path).getAbsoluteFile().toURI().toURL();
          }
          catch(MalformedURLException e2) {
            throw new InvalidXMLException(InvalidXMLException.MALFORMED_IMPORT_URL, new Object[] {
                  path, getSourceUrlString() }, e);
          }
        }
      }
    } catch (InvalidXMLException e) {
View Full Code Here

      o = UIMAFramework.getXMLParser().parse(aInput);
      if (o instanceof CpeDescription) {
        return (CpeDescription) o;
      }
    } catch (Exception e) {
      throw new InvalidXMLException(e);
    }

    throw new InvalidXMLException(new Exception("Unexpected Object Type Produced By the XMLParser"));
  }
View Full Code Here

      TypePriorityList[] priLists = pri.getPriorityLists();
      assertEquals(1, priLists.length);

      // resolving imports without setting data path should fail
      InvalidXMLException ex = null;
      try {
        pri.resolveImports();
      } catch (InvalidXMLException e) {
        ex = e;
      }
View Full Code Here

      TypeDescription[] types = ts.getTypes();
      assertEquals(6, types.length);

      // resolving imports without setting data path should fail
      InvalidXMLException ex = null;
      try {
        ts.resolveImports();
      } catch (InvalidXMLException e) {
        ex = e;
      }
View Full Code Here

      FsIndexDescription[] indexes = ic.getFsIndexes();
      assertEquals(2, indexes.length);

      // resolving imports without setting data path should fail
      InvalidXMLException ex = null;
      try {
        ic.resolveImports();
      } catch (InvalidXMLException e) {
        ex = e;
      }
View Full Code Here

      // invalid - both location and name
      importXml = "<import name=\"this.is.a.test\" location=\"foo/bar/MyFile.xml\"/>";
      importDoc = docBuilder.parse(new ByteArrayInputStream(importXml.getBytes(encoding)));
      importObj = new Import_impl();
      InvalidXMLException ex = null;
      try {
        importObj.buildFromXMLElement(importDoc.getDocumentElement(), null);
      } catch (InvalidXMLException e) {
        ex = e;
      }
      assertNotNull(ex);

      // invalid - empty import
      importXml = "<import/>";
      importDoc = docBuilder.parse(new ByteArrayInputStream(importXml.getBytes(encoding)));
      importObj = new Import_impl();
      ex = null;
      try {
        importObj.buildFromXMLElement(importDoc.getDocumentElement(), null);
      } catch (InvalidXMLException e) {
        ex = e;
      }
      assertNotNull(ex);
      assertNotNull(ex.getMessage());

    } catch (Exception e) {
      JUnitExtension.handleException(e);
    }
  }
View Full Code Here

      assertEquals(expectedUrl, absUrl);

      // name not found
      importObj = new Import_impl();
      importObj.setName("this.should.not.be.found.at.least.i.hope.not");
      InvalidXMLException ex = null;
      try {
        importObj.findAbsoluteUrl(UIMAFramework.newDefaultResourceManager());
      } catch (InvalidXMLException e) {
        ex = e;
      }
      assertNotNull(ex);
      assertNotNull(ex.getMessage());
    } catch (Exception e) {
      JUnitExtension.handleException(e);
    }
  }
View Full Code Here

    try {
      setName(aElement.getAttribute("name"));
      field = "deployment";
      setDeployment(aElement.getAttribute("deployment"));
    } catch (Exception e) {
      throw new InvalidXMLException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
              "UIMA_CPM_EXP_missing_attribute_from_xml_element__WARNING", new Object[] {
                  Thread.currentThread().getName(), "casProcessor", field, "casProcessor" });

    }
  }
View Full Code Here

TOP

Related Classes of org.apache.uima.util.InvalidXMLException

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.