Package edu.hawaii.ics.csdl.jupiter.file.property

Examples of edu.hawaii.ics.csdl.jupiter.file.property.Property


   * @param reader The reader used to read in the file.
   * @return Returns a <code>Property</code> representing the data in the file.
   * @throws XMLStreamException Thrown if there is an error reading the file.
   */
  public static Property parsePropertyFile(XMLStreamReader reader) throws XMLStreamException {
    Property property = null;
    Review review = null;

    int eventType = reader.getEventType();
    while (reader.hasNext()) {
      eventType = reader.next();

      if (eventType == XMLStreamConstants.START_ELEMENT) {
        QName elementQName = reader.getName();
        String elementName = elementQName.toString();

        if (PropertyConstraints.ELEMENT_PROPERTY.equals(elementName)) {
          // create a new property object, this is the root element
          property = new Property();
        }
        else if (PropertyConstraints.ELEMENT_REVIEW.equals(elementName)) {
          // create a new review and add it to the property object
          review = new Review();
          property.getReview().add(review);

          // get the attributes of review
          String id = reader.getAttributeValue(null, PropertyConstraints.ATTRIBUTE_ID);
          review.setId(id);
        }
View Full Code Here


   * @throws ReviewException if an error occurs during the new document creation.
   */
  public static Property newProperty(IProject project) throws ReviewException {
    IFile jupiterConfigIFile = project.getFile(PROPERTY_XML_FILE);
    File jupiterConfigFile = jupiterConfigIFile.getLocation().toFile();
    Property property = null;

    XMLInputFactory xmlif = XMLInputFactory.newInstance();
    xmlif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.TRUE);
    xmlif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE);
    xmlif.setProperty(XMLInputFactory.IS_COALESCING, Boolean.FALSE);
View Full Code Here

      URL xmlUrl = FileLocator.toFileURL(new URL(pluginUrl, DEFAULT_PROPERTY_XML_FILE));
     
      reader = xmlif.createXMLStreamReader(xmlUrl.getFile(), new FileInputStream(xmlUrl
          .getFile()));

      Property property = StaxPropertyXmlUtil.parsePropertyFile(reader);
      // there should only be the default review in the list
      return property.getReview().get(0);
    }
    catch (IOException e) {
      log.error(e);
    }
    catch (XMLStreamException e) {
View Full Code Here

TOP

Related Classes of edu.hawaii.ics.csdl.jupiter.file.property.Property

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.