Package org.hibernate.util.xml

Examples of org.hibernate.util.xml.XmlDocument


        log.info( "Unable to resolve mapping file [{}]", xmlFile );
        continue;
      }
      final InputSource inputSource = new InputSource( fileInputStream );

      XmlDocument metadataXml = MappingReader.INSTANCE.readMappingDocument(
          cfg.getEntityResolver(),
          inputSource,
          new OriginImpl( "persistence-unit-info", xmlFile )
      );
      xmlDocuments.add( metadataXml );
      try {
        final Element rootElement = metadataXml.getDocumentTree().getRootElement();
        if ( rootElement != null && "entity-mappings".equals( rootElement.getName() ) ) {
          Element element = rootElement.element( "package" );
          String defaultPackage = element != null ? element.getTextTrim() : null;
          List<Element> elements = rootElement.elements( "entity" );
          for (Element subelement : elements ) {
View Full Code Here


  private XmlDocument add(InputSource inputSource, String originType, String originName) {
    return add( inputSource, new OriginImpl( originType, originName ) );
  }

  private XmlDocument add(InputSource inputSource, Origin origin) {
    XmlDocument metadataXml = MappingReader.INSTANCE.readMappingDocument( entityResolver, inputSource, origin );
    add( metadataXml );
    return metadataXml;
  }
View Full Code Here

      fileInputStream = new FileInputStream( xmlFile );
    }
    catch ( FileNotFoundException e ) {
      throw new MappingNotFoundException( "file", xmlFile.toString() );
    }
    final XmlDocument metadataXml;
    try {
      final InputSource inputSource = new InputSource( fileInputStream );
      log.info( "Reading mappings from file: " + xmlFile );
      metadataXml = add( inputSource, "file", name );
    }
    finally {
      try {
        fileInputStream.close();
      }
      catch ( IOException e ) {
        log.warn( "I/O exception while closing mapping file : " + cachedFile.getPath() + " : " + e );
      }
    }

    FileOutputStream fileOutputStream = null;
    try {
      fileOutputStream = new FileOutputStream( cachedFile );
    }
    catch ( FileNotFoundException e ) {
      log.warn( "I/O reported error writing cached file : " + cachedFile.getPath(), e );
    }
    if ( fileInputStream != null ) {
      try {
        if ( log.isDebugEnabled() ) {
          log.debug( "Writing cache file for: " + xmlFile + " to: " + cachedFile );
        }
        SerializationHelper.serialize( ( Serializable ) metadataXml.getDocumentTree(), fileOutputStream );
      }
      catch ( SerializationException e ) {
        log.warn( "Could not write cached file: " + cachedFile, e );
      }
      finally {
View Full Code Here

        log.info( "Unable to resolve mapping file [{}]", xmlFile );
        continue;
      }
      final InputSource inputSource = new InputSource( fileInputStream );

      XmlDocument metadataXml = MappingReader.INSTANCE.readMappingDocument(
          cfg.getEntityResolver(),
          inputSource,
          new OriginImpl( "persistence-unit-info", xmlFile )
      );
      xmlDocuments.add( metadataXml );
      try {
        final Element rootElement = metadataXml.getDocumentTree().getRootElement();
        if ( rootElement != null && "entity-mappings".equals( rootElement.getName() ) ) {
          Element element = rootElement.element( "package" );
          String defaultPackage = element != null ? element.getTextTrim() : null;
          List<Element> elements = rootElement.elements( "entity" );
          for (Element subelement : elements ) {
View Full Code Here

  private XmlDocument add(InputSource inputSource, String originType, String originName) {
    return add( inputSource, new OriginImpl( originType, originName ) );
  }

  private XmlDocument add(InputSource inputSource, Origin origin) {
    XmlDocument metadataXml = MappingReader.INSTANCE.readMappingDocument( entityResolver, inputSource, origin );
    add( metadataXml );
    return metadataXml;
  }
View Full Code Here

    catch ( FileNotFoundException e ) {
      throw new MappingNotFoundException( "file", xmlFile.toString() );
    }

    log.info( "Reading mappings from file: " + xmlFile );
    XmlDocument metadataXml = add( inputSource, "file", name );

    try {
      log.debug( "Writing cache file for: " + xmlFile + " to: " + cachedFile );
      SerializationHelper.serialize( ( Serializable ) metadataXml.getDocumentTree(), new FileOutputStream( cachedFile ) );
    }
    catch ( SerializationException e ) {
      log.warn( "Could not write cached file: " + cachedFile, e );
    }
    catch ( FileNotFoundException e ) {
View Full Code Here

        log.info( "Unable to resolve mapping file [{}]", xmlFile );
        continue;
      }
      final InputSource inputSource = new InputSource( fileInputStream );

      XmlDocument metadataXml = MappingReader.INSTANCE.readMappingDocument(
          cfg.getEntityResolver(),
          inputSource,
          new OriginImpl( "persistence-unit-info", xmlFile )
      );
      xmlDocuments.add( metadataXml );
      try {
        final Element rootElement = metadataXml.getDocumentTree().getRootElement();
        if ( rootElement != null && "entity-mappings".equals( rootElement.getName() ) ) {
          Element element = rootElement.element( "package" );
          String defaultPackage = element != null ? element.getTextTrim() : null;
          List<Element> elements = rootElement.elements( "entity" );
          for (Element subelement : elements ) {
View Full Code Here

  private XmlDocument add(InputSource inputSource, String originType, String originName) {
    return add( inputSource, new OriginImpl( originType, originName ) );
  }

  private XmlDocument add(InputSource inputSource, Origin origin) {
    XmlDocument metadataXml = MappingReader.INSTANCE.readMappingDocument( entityResolver, inputSource, origin );
    add( metadataXml );
    return metadataXml;
  }
View Full Code Here

    catch ( FileNotFoundException e ) {
      throw new MappingNotFoundException( "file", xmlFile.toString() );
    }

    log.info( "Reading mappings from file: " + xmlFile );
    XmlDocument metadataXml = add( inputSource, "file", name );

    try {
      log.debug( "Writing cache file for: " + xmlFile + " to: " + cachedFile );
      SerializationHelper.serialize( ( Serializable ) metadataXml.getDocumentTree(), new FileOutputStream( cachedFile ) );
    }
    catch ( SerializationException e ) {
      log.warn( "Could not write cached file: " + cachedFile, e );
    }
    catch ( FileNotFoundException e ) {
View Full Code Here

        log.info( "Unable to resolve mapping file [{}]", xmlFile );
        continue;
      }
      final InputSource inputSource = new InputSource( fileInputStream );

      XmlDocument metadataXml = MappingReader.INSTANCE.readMappingDocument(
          cfg.getEntityResolver(),
          inputSource,
          new OriginImpl( "persistence-unit-info", xmlFile )
      );
      xmlDocuments.add( metadataXml );
      try {
        final Element rootElement = metadataXml.getDocumentTree().getRootElement();
        if ( rootElement != null && "entity-mappings".equals( rootElement.getName() ) ) {
          Element element = rootElement.element( "package" );
          String defaultPackage = element != null ? element.getTextTrim() : null;
          List<Element> elements = rootElement.elements( "entity" );
          for (Element subelement : elements ) {
View Full Code Here

TOP

Related Classes of org.hibernate.util.xml.XmlDocument

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.