当前位置: 首页>>代码示例>>Java>>正文


Java ValidityException类代码示例

本文整理汇总了Java中nu.xom.ValidityException的典型用法代码示例。如果您正苦于以下问题:Java ValidityException类的具体用法?Java ValidityException怎么用?Java ValidityException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ValidityException类属于nu.xom包,在下文中一共展示了ValidityException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: update

import nu.xom.ValidityException; //导入依赖的package包/类
@Test
public void update()
    throws ValidityException, ParsingException, IOException, MojoExecutionException {
  Document pom = new Builder().build(new File(new File("src/it/reflector"), "pom.xml"));
  Artifact artifact = new DefaultArtifact(
      "net.stickycode",
      "sticky-coercion",
      "jar",
      "",
      "[3.1,4)");

  new StickyBoundsMojo().updateDependency(pom, artifact, "[3.6,4)");
  XPathContext context = new XPathContext("mvn", "http://maven.apache.org/POM/4.0.0");

  Nodes versions = pom.query("//mvn:version", context);
  assertThat(versions.size()).isEqualTo(3);
  Nodes nodes = pom.query("//mvn:version[text()='[3.6,4)']", context);
  assertThat(nodes.size()).isEqualTo(1);
  Node node = nodes.get(0);
  assertThat(node.getValue()).isEqualTo("[3.6,4)");
}
 
开发者ID:stickycode,项目名称:bounds-maven-plugin,代码行数:22,代码来源:StickyBoundsMojoIntegrationTest.java

示例2: updateWithClassifier

import nu.xom.ValidityException; //导入依赖的package包/类
@Test
public void updateWithClassifier()
    throws ValidityException, ParsingException, IOException, MojoExecutionException {
  Document pom = new Builder().build(new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("classifiers.xml"))));
  Artifact artifact = new DefaultArtifact(
      "net.stickycode",
      "sticky-coercion",
      "jar",
      "",
      "[2.1,4)");
  
  new StickyBoundsMojo().updateDependency(pom, artifact, "[2.6,3)");
  XPathContext context = new XPathContext("mvn", "http://maven.apache.org/POM/4.0.0");
  
  Nodes versions = pom.query("//mvn:version", context);
  assertThat(versions.size()).isEqualTo(4);
  Nodes nodes = pom.query("//mvn:version[text()='[2.6,3)']", context);
  assertThat(nodes.size()).isEqualTo(1);
  Node node = nodes.get(0);
  assertThat(node.getValue()).isEqualTo("[2.6,3)");
}
 
开发者ID:stickycode,项目名称:bounds-maven-plugin,代码行数:22,代码来源:StickyBoundsMojoIntegrationTest.java

示例3: loadXmlDefinition

import nu.xom.ValidityException; //导入依赖的package包/类
/**
 * Use the CacheXmlGenerator to create XML from the entity associated with
 * the current cache.
 * 
 * @param element Name of the XML element to search for.
 * @param attributes
 *          Attributes of the element that should match, for example "name" or
 *          "id" and the value they should equal.
 * 
 * @return XML string representation of the entity.
 */
private final String loadXmlDefinition(final String element, final Map<String, String> attributes) {
  final Cache cache = CacheFactory.getAnyInstance();
  Document document = null;

  try {
    final StringWriter stringWriter = new StringWriter();
    final PrintWriter printWriter = new PrintWriter(stringWriter);
    CacheXmlGenerator.generate(cache, printWriter, false, false, false);
    printWriter.close();

    // Remove the DOCTYPE line when getting the string to prevent
    // errors when trying to locate the DTD.
    String xml = stringWriter.toString().replaceFirst("<!DOCTYPE.*>", "");
    document = new Builder(false).build(xml, null);

  } catch (ValidityException vex) {
    cache.getLogger().error("Could not parse XML when creating XMLEntity", vex);

  } catch (ParsingException pex) {
    cache.getLogger().error("Could not parse XML when creating XMLEntity", pex);
    
  } catch (IOException ioex) {
    cache.getLogger().error("Could not parse XML when creating XMLEntity", ioex);
  }
  
  Nodes nodes = document.query(createQueryString(element, attributes));
  if (nodes.size() != 0) {
    return nodes.get(0).toXML();
  }
  
  cache.getLogger().warning("No XML definition could be found with name=" + element + " and attributes=" + attributes);
  return null;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:45,代码来源:XmlEntity.java

示例4: createReader

import nu.xom.ValidityException; //导入依赖的package包/类
public HierarchicalStreamReader createReader(File paramFile)
{
  try
  {
    XomReader localXomReader = new XomReader(this.builder.build(paramFile), getNameCoder());
    return localXomReader;
  }
  catch (ValidityException localValidityException)
  {
    throw new StreamException(localValidityException);
  }
  catch (ParsingException localParsingException)
  {
    throw new StreamException(localParsingException);
  }
  catch (IOException localIOException)
  {
    throw new StreamException(localIOException);
  }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:21,代码来源:XomDriver.java

示例5: updateTheClassifier

import nu.xom.ValidityException; //导入依赖的package包/类
@Test
public void updateTheClassifier()
    throws ValidityException, ParsingException, IOException, MojoExecutionException {
  Document pom = new Builder().build(new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("classifiers.xml"))));
  Artifact artifact = new DefaultArtifact(
      "net.stickycode",
      "sticky-coercion",
      "jar",
      "test-jar",
      "[2.1,4)");

  new StickyBoundsMojo().updateDependency(pom, artifact, "[2.6,3)");
  XPathContext context = new XPathContext("mvn", "http://maven.apache.org/POM/4.0.0");

  Nodes versions = pom.query("//mvn:version", context);
  assertThat(versions.size()).isEqualTo(4);
  Nodes nodes = pom.query("//mvn:version[text()='[2.6,3)']", context);
  assertThat(nodes.size()).isEqualTo(1);
  Node node = nodes.get(0);
  assertThat(node.getValue()).isEqualTo("[2.6,3)");
}
 
开发者ID:stickycode,项目名称:bounds-maven-plugin,代码行数:22,代码来源:StickyBoundsMojoIntegrationTest.java

示例6: readBrick

import nu.xom.ValidityException; //导入依赖的package包/类
private static GeometryWithMaterial readBrick(Element partElement, LIFReader dbLifReader, HashMap<Integer, Material> materials) throws IOException, ValidityException, ParsingException {
	int partID = Integer.parseInt(partElement.getAttributeValue("designID"));
	String materialName = partElement.getAttributeValue("materials");
	//no support for multiple materials.
	if(materialName.indexOf(',') != -1) {
		String[] parts = materialName.split(",");
		materialName = parts[0];
	}
	
	int materialID = Integer.parseInt(materialName);
	Material material = materials.get(materialID);
	
	VBOContents combo = BrickReader.readBrick(dbLifReader, partID);
	Elements boneElements = partElement.getChildElements("Bone");
	//Single bone element = non-flex brick
	if(boneElements.size() == 1) {
		String transformationString = boneElements.get(0).getAttributeValue("transformation");
		Matrix4f transformation = Bone.readBrickTransformation(transformationString);
		combo = combo.transform(transformation);
	} else {
		combo = FlexElement.transform(combo, boneElements, partID, dbLifReader);
	}
	return new GeometryWithMaterial(combo, material);
}
 
开发者ID:chipgw,项目名称:LibLDD,代码行数:25,代码来源:LXFMLReader.java

示例7: readCountSummaryFile

import nu.xom.ValidityException; //导入依赖的package包/类
/**
 * Reads the given sequence count summary file and creates a new
 * MultiGenomeAlignmentSummary object for the corresponding dataset.
 *
 * @param file
 * @throws ValidityException
 * @throws ParsingException
 * @throws IOException
 */
private void readCountSummaryFile(String file) throws ValidityException, ParsingException, IOException
{
    Document document = xmlParser.build(file);
    Element root = document.getRootElement();
    if (!root.getLocalName().equals("SequenceCountSummary"))
    {
        error("Sequence count summary file " + file + " does not contain root element with name SequenceCountSummary");
    }
    String datasetId = getValue(root, "DatasetId");
    long sequenceCount = getLongValue(root, "SequenceCount");
    MultiGenomeAlignmentSummary multiGenomeAlignmentSummary = new MultiGenomeAlignmentSummary();
    multiGenomeAlignmentSummary.setDatasetId(datasetId);
    multiGenomeAlignmentSummary.setSequenceCount(sequenceCount);
    multiGenomeAlignmentSummaries.put(datasetId, multiGenomeAlignmentSummary);
}
 
开发者ID:crukci-bioinformatics,项目名称:MGA,代码行数:25,代码来源:CreateReport.java

示例8: readSamplingSummaryFile

import nu.xom.ValidityException; //导入依赖的package包/类
/**
 * Reads the given sampling summary file.
 *
 * @param file
 * @throws ValidityException
 * @throws ParsingException
 * @throws IOException
 */
private void readSamplingSummaryFile(String file) throws ValidityException, ParsingException, IOException
{
    Document document = xmlParser.build(file);
    Element root = document.getRootElement();
    if (!root.getLocalName().equals("SamplingSummary"))
    {
        error("Sampling summary file " + file + " does not contain root element with name SamplingSummary");
    }
    String datasetId = getValue(root, "DatasetId");
    int sampledCount = getIntegerValue(root, "SampledCount");
    MultiGenomeAlignmentSummary multiGenomeAlignmentSummary = multiGenomeAlignmentSummaries.get(datasetId);
    if (multiGenomeAlignmentSummary == null)
    {
        error("Missing sequence count file for dataset " + datasetId + " corresponding to sampling summary file " + file);
    }
    multiGenomeAlignmentSummary.setSampledCount(sampledCount);
}
 
开发者ID:crukci-bioinformatics,项目名称:MGA,代码行数:26,代码来源:CreateReport.java

示例9: writeNamespacesUnchanged

import nu.xom.ValidityException; //导入依赖的package包/类
@Test
public void writeNamespacesUnchanged()
    throws ValidityException, ParsingException, IOException {
  Document pom = new Builder().build(new File(new File("src/it/reflector"), "pom.xml"));
  Serializer s = new StickySerializer(new FileOutputStream(new File("target/tmp.xml")), "UTF-8");
  s.write(pom);
}
 
开发者ID:stickycode,项目名称:bounds-maven-plugin,代码行数:8,代码来源:StickyBoundsMojoIntegrationTest.java

示例10: readBoneBoundaries

import nu.xom.ValidityException; //导入依赖的package包/类
private static Vector3f[] readBoneBoundaries(int partID, LIFReader dbLifReader) throws IOException, ValidityException, ParsingException {
	Vector3f[] boneLinkBoundaries = null;
	//Better to have a thread wait for another part to be parsed than to load the same part twice.
	synchronized(boneBoundaryCache) {
		if(boneBoundaryCache.containsKey(partID)) {
			boneLinkBoundaries = boneBoundaryCache.get(partID);
		} else {
			boneLinkBoundaries = Brick.readFlexBoneLinkBoundaries(partID, dbLifReader);
			boneBoundaryCache.put(partID, boneLinkBoundaries);
		}
	}
	return boneLinkBoundaries;
}
 
开发者ID:chipgw,项目名称:LibLDD,代码行数:14,代码来源:FlexElement.java

示例11: readFlexBoneLinkBoundaries

import nu.xom.ValidityException; //导入依赖的package包/类
public static Vector3f[] readFlexBoneLinkBoundaries(int partID, LIFReader dbLifReader) throws IOException, ValidityException, ParsingException {
	Builder builder = new Builder();
	byte[] propertyFile = dbLifReader.readInternalFile(dbLifReader.getFileAt(DBFilePaths.primitivePropertiesDirectory + "/" + partID + ".xml"));
	Document propertyDocument = builder.build(new ByteArrayInputStream(propertyFile));
	Element rootNode = propertyDocument.getRootElement();
	Element flexElement = rootNode.getFirstChildElement("Flex");
	Elements boneElements = flexElement.getChildElements("Bone");
	return readBoneBoundaries(boneElements);
}
 
开发者ID:chipgw,项目名称:LibLDD,代码行数:10,代码来源:Brick.java

示例12: parseLXFMLFile

import nu.xom.ValidityException; //导入依赖的package包/类
private static Mesh parseLXFMLFile(Element rootElement, LIFReader dbLifReader) throws IOException, ValidityException, ParsingException {
	HashMap<Material, GeometryWithMaterial> geometry = new HashMap<Material, GeometryWithMaterial>();
	LIFFile materialsFile = dbLifReader.getFileAt(DBFilePaths.materialsFile);
	HashMap<Integer, Material> materials = MaterialReader.loadMaterials(dbLifReader.readInternalFile(materialsFile));
	verifyFileVersion(rootElement);
	Element bricksElement = rootElement.getFirstChildElement("Bricks");
	Elements brickElements = bricksElement.getChildElements();
	
	for(int i = 0; i < brickElements.size(); i++) {
		Element brickElement = brickElements.get(i);
		Elements partElements = brickElement.getChildElements();
		for(int j = 0; j < partElements.size(); j++) {
			Element partElement = partElements.get(j);
			GeometryWithMaterial combo = readBrick(partElement, dbLifReader, materials);
			if(geometry.containsKey(combo.material)) {
				GeometryWithMaterial currentCombo = geometry.get(combo.material);
				combo = currentCombo.merge(combo);
				geometry.put(combo.material, combo);
			} else {
				geometry.put(combo.material, combo);
			}
		}
	}
	
	Collection<GeometryWithMaterial> entries = geometry.values();
	GeometryWithMaterial[] allGeometry = entries.toArray(new GeometryWithMaterial[entries.size()]);
	return new Mesh(allGeometry);
}
 
开发者ID:chipgw,项目名称:LibLDD,代码行数:29,代码来源:LXFMLReader.java

示例13: run

import nu.xom.ValidityException; //导入依赖的package包/类
@Override
protected void run() throws IOException, ValidityException, ParsingException, TransformerException
{
    readReferenceGenomeMapping();
    readCountSummaryFiles();
    readSamplingSummaryFiles();
    readAdapterAlignmentFiles();
    readAlignments();
    OrderedProperties runProperties = readSampleSheet();
    String imageFilename = outputPrefix + ".png";
    String htmlFilename = outputPrefix + ".html";
    createSummaryPlot(multiGenomeAlignmentSummaries.values(), imageFilename);
    writeReport(multiGenomeAlignmentSummaries.values(), runProperties, out, imageFilename, outputFilename, htmlFilename);

    if (separateDatasetReports)
    {
        Collection<MultiGenomeAlignmentSummary> summaries = new ArrayList<MultiGenomeAlignmentSummary>();
        for (MultiGenomeAlignmentSummary multiGenomeAlignmentSummary : multiGenomeAlignmentSummaries.values())
        {
            summaries.clear();
            summaries.add(multiGenomeAlignmentSummary);
            String datasetId = multiGenomeAlignmentSummary.getDatasetId();
            String prefix = datasetReportFilenamePrefix + datasetId;
            htmlFilename = prefix + ".html";
            imageFilename = prefix + ".png";
            String xmlFilename = prefix + ".xml";
            createSummaryPlot(summaries, imageFilename);
            PrintStream printStream = new PrintStream(new BufferedOutputStream(new FileOutputStream(xmlFilename)));
            writeReport(summaries, runProperties, printStream, imageFilename, xmlFilename, htmlFilename);
            printStream.close();
        }
    }
}
 
开发者ID:crukci-bioinformatics,项目名称:MGA,代码行数:34,代码来源:CreateReport.java

示例14: readCountSummaryFiles

import nu.xom.ValidityException; //导入依赖的package包/类
/**
 * Identifies and reads sequence count summary files among the input files provided.
 *
 * @throws ValidityException
 * @throws ParsingException
 * @throws IOException
 */
private void readCountSummaryFiles() throws ValidityException, ParsingException, IOException
{
    for (String file : resultsFiles)
    {
        if (file.endsWith(".count.xml"))
        {
            readCountSummaryFile(file);
        }
    }
}
 
开发者ID:crukci-bioinformatics,项目名称:MGA,代码行数:18,代码来源:CreateReport.java

示例15: readSamplingSummaryFiles

import nu.xom.ValidityException; //导入依赖的package包/类
/**
 * Identifies and reads sampling summary files among the input files provided.
 *
 * @throws ValidityException
 * @throws ParsingException
 * @throws IOException
 */
private void readSamplingSummaryFiles() throws ValidityException, ParsingException, IOException
{
    for (String file : resultsFiles)
    {
        if (file.endsWith(".sampled.xml"))
        {
            readSamplingSummaryFile(file);
        }
    }
}
 
开发者ID:crukci-bioinformatics,项目名称:MGA,代码行数:18,代码来源:CreateReport.java


注:本文中的nu.xom.ValidityException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。