Package org.hibernate.metamodel.source

Examples of org.hibernate.metamodel.source.XsdException


  }

  private Schema resolveLocalSchema(String schemaName, String schemaLanguage) {
    URL url = classLoaderService.locateResource( schemaName );
    if ( url == null ) {
      throw new XsdException( "Unable to locate schema [" + schemaName + "] via classpath", schemaName );
    }
    try {
      InputStream schemaStream = url.openStream();
      try {
        StreamSource source = new StreamSource( url.openStream() );
        SchemaFactory schemaFactory = SchemaFactory.newInstance( schemaLanguage );
        return schemaFactory.newSchema( source );
      }
      catch ( SAXException e ) {
        throw new XsdException( "Unable to load schema [" + schemaName + "]", e, schemaName );
      }
      catch ( IOException e ) {
        throw new XsdException( "Unable to load schema [" + schemaName + "]", e, schemaName );
      }
      finally {
        try {
          schemaStream.close();
        }
        catch ( IOException e ) {
          log.debugf( "Problem closing schema stream [%s]", e.toString() );
        }
      }
    }
    catch ( IOException e ) {
      throw new XsdException( "Stream error handling schema url [" + url.toExternalForm() + "]", schemaName );
    }
  }
View Full Code Here


  private Schema resolveLocalSchema(String schemaName) {
    // These XSD resources should be available on the Hibernate ClassLoader
    final URL url = classLoaderService.locateResource( schemaName );
    if ( url == null ) {
      throw new XsdException( "Unable to locate schema [" + schemaName + "] via classpath", schemaName );
    }
    try {
      InputStream schemaStream = url.openStream();
      try {
        StreamSource source = new StreamSource( url.openStream() );
        SchemaFactory schemaFactory = SchemaFactory.newInstance( XMLConstants.W3C_XML_SCHEMA_NS_URI );
        return schemaFactory.newSchema( source );
      }
      catch ( SAXException e ) {
        throw new XsdException( "Unable to load schema [" + schemaName + "]", e, schemaName );
      }
      catch ( IOException e ) {
        throw new XsdException( "Unable to load schema [" + schemaName + "]", e, schemaName );
      }
      finally {
        try {
          schemaStream.close();
        }
        catch ( IOException e ) {
          LOG.debugf( "Problem closing schema stream [%s]", e.toString() );
        }
      }
    }
    catch ( IOException e ) {
      throw new XsdException( "Stream error handling schema url [" + url.toExternalForm() + "]", schemaName );
    }
  }
View Full Code Here

  private Schema resolveLocalSchema(String schemaName, String schemaLanguage) {
    URL url = metadataSources.getServiceRegistry()
        .getService( ClassLoaderService.class )
        .locateResource( schemaName );
    if ( url == null ) {
      throw new XsdException( "Unable to locate schema [" + schemaName + "] via classpath", schemaName );
    }
    try {
      InputStream schemaStream = url.openStream();
      try {
        StreamSource source = new StreamSource( url.openStream() );
        SchemaFactory schemaFactory = SchemaFactory.newInstance( schemaLanguage );
        return schemaFactory.newSchema( source );
      }
      catch ( SAXException e ) {
        throw new XsdException( "Unable to load schema [" + schemaName + "]", e, schemaName );
      }
      catch ( IOException e ) {
        throw new XsdException( "Unable to load schema [" + schemaName + "]", e, schemaName );
      }
      finally {
        try {
          schemaStream.close();
        }
        catch ( IOException e ) {
          log.debugf( "Problem closing schema stream [%s]", e.toString() );
        }
      }
    }
    catch ( IOException e ) {
      throw new XsdException( "Stream error handling schema url [" + url.toExternalForm() + "]", schemaName );
    }
  }
View Full Code Here

  private Schema resolveLocalSchema(String schemaName, String schemaLanguage) {
    URL url = metadataSources.getServiceRegistry()
        .getService( ClassLoaderService.class )
        .locateResource( schemaName );
    if ( url == null ) {
      throw new XsdException( "Unable to locate schema [" + schemaName + "] via classpath", schemaName );
    }
    try {
      InputStream schemaStream = url.openStream();
      try {
        StreamSource source = new StreamSource( url.openStream() );
        SchemaFactory schemaFactory = SchemaFactory.newInstance( schemaLanguage );
        return schemaFactory.newSchema( source );
      }
      catch ( SAXException e ) {
        throw new XsdException( "Unable to load schema [" + schemaName + "]", e, schemaName );
      }
      catch ( IOException e ) {
        throw new XsdException( "Unable to load schema [" + schemaName + "]", e, schemaName );
      }
      finally {
        try {
          schemaStream.close();
        }
        catch ( IOException e ) {
          log.debugf( "Problem closing schema stream [%s]", e.toString() );
        }
      }
    }
    catch ( IOException e ) {
      throw new XsdException( "Stream error handling schema url [" + url.toExternalForm() + "]", schemaName );
    }
  }
View Full Code Here

  }

  private Schema resolveLocalSchema(String schemaName, String schemaLanguage) {
    URL url = classLoaderService.locateResource( schemaName );
    if ( url == null ) {
      throw new XsdException( "Unable to locate schema [" + schemaName + "] via classpath", schemaName );
    }
    try {
      InputStream schemaStream = url.openStream();
      try {
        StreamSource source = new StreamSource( url.openStream() );
        SchemaFactory schemaFactory = SchemaFactory.newInstance( schemaLanguage );
        return schemaFactory.newSchema( source );
      }
      catch ( SAXException e ) {
        throw new XsdException( "Unable to load schema [" + schemaName + "]", e, schemaName );
      }
      catch ( IOException e ) {
        throw new XsdException( "Unable to load schema [" + schemaName + "]", e, schemaName );
      }
      finally {
        try {
          schemaStream.close();
        }
        catch ( IOException e ) {
          log.debugf( "Problem closing schema stream [%s]", e.toString() );
        }
      }
    }
    catch ( IOException e ) {
      throw new XsdException( "Stream error handling schema url [" + url.toExternalForm() + "]", schemaName );
    }
  }
View Full Code Here

  private Schema resolveLocalSchema(String schemaName, String schemaLanguage) {
    URL url = metadataSources.getServiceRegistry()
        .getService( ClassLoaderService.class )
        .locateResource( schemaName );
    if ( url == null ) {
      throw new XsdException( "Unable to locate schema [" + schemaName + "] via classpath", schemaName );
    }
    try {
      InputStream schemaStream = url.openStream();
      try {
        StreamSource source = new StreamSource( url.openStream() );
        SchemaFactory schemaFactory = SchemaFactory.newInstance( schemaLanguage );
        return schemaFactory.newSchema( source );
      }
      catch ( SAXException e ) {
        throw new XsdException( "Unable to load schema [" + schemaName + "]", e, schemaName );
      }
      catch ( IOException e ) {
        throw new XsdException( "Unable to load schema [" + schemaName + "]", e, schemaName );
      }
      finally {
        try {
          schemaStream.close();
        }
        catch ( IOException e ) {
          log.debugf( "Problem closing schema stream [%s]", e.toString() );
        }
      }
    }
    catch ( IOException e ) {
      throw new XsdException( "Stream error handling schema url [" + url.toExternalForm() + "]", schemaName );
    }
  }
View Full Code Here

  }

  private Schema resolveLocalSchema(String schemaName, String schemaLanguage) {
    URL url = classLoaderService.locateResource( schemaName );
    if ( url == null ) {
      throw new XsdException( "Unable to locate schema [" + schemaName + "] via classpath", schemaName );
    }
    try {
      InputStream schemaStream = url.openStream();
      try {
        StreamSource source = new StreamSource( url.openStream() );
        SchemaFactory schemaFactory = SchemaFactory.newInstance( schemaLanguage );
        return schemaFactory.newSchema( source );
      }
      catch ( SAXException e ) {
        throw new XsdException( "Unable to load schema [" + schemaName + "]", e, schemaName );
      }
      catch ( IOException e ) {
        throw new XsdException( "Unable to load schema [" + schemaName + "]", e, schemaName );
      }
      finally {
        try {
          schemaStream.close();
        }
        catch ( IOException e ) {
          log.debugf( "Problem closing schema stream [%s]", e.toString() );
        }
      }
    }
    catch ( IOException e ) {
      throw new XsdException( "Stream error handling schema url [" + url.toExternalForm() + "]", schemaName );
    }
  }
View Full Code Here

  private Schema resolveLocalSchema(String schemaName, String schemaLanguage) {
    URL url = metadataSources.getServiceRegistry()
        .getService( ClassLoaderService.class )
        .locateResource( schemaName );
    if ( url == null ) {
      throw new XsdException( "Unable to locate schema [" + schemaName + "] via classpath", schemaName );
    }
    try {
      InputStream schemaStream = url.openStream();
      try {
        StreamSource source = new StreamSource( url.openStream() );
        SchemaFactory schemaFactory = SchemaFactory.newInstance( schemaLanguage );
        return schemaFactory.newSchema( source );
      }
      catch ( SAXException e ) {
        throw new XsdException( "Unable to load schema [" + schemaName + "]", e, schemaName );
      }
      catch ( IOException e ) {
        throw new XsdException( "Unable to load schema [" + schemaName + "]", e, schemaName );
      }
      finally {
        try {
          schemaStream.close();
        }
        catch ( IOException e ) {
          log.debugf( "Problem closing schema stream [%s]", e.toString() );
        }
      }
    }
    catch ( IOException e ) {
      throw new XsdException( "Stream error handling schema url [" + url.toExternalForm() + "]", schemaName );
    }
  }
View Full Code Here

  private Schema resolveLocalSchema(String schemaName) {
    // These XSD resources should be available on the Hibernate ClassLoader
    final URL url = classLoaderService.locateResource( schemaName );
    if ( url == null ) {
      throw new XsdException( "Unable to locate schema [" + schemaName + "] via classpath", schemaName );
    }
    try {
      InputStream schemaStream = url.openStream();
      try {
        StreamSource source = new StreamSource( url.openStream() );
        SchemaFactory schemaFactory = SchemaFactory.newInstance( XMLConstants.W3C_XML_SCHEMA_NS_URI );
        return schemaFactory.newSchema( source );
      }
      catch ( SAXException e ) {
        throw new XsdException( "Unable to load schema [" + schemaName + "]", e, schemaName );
      }
      catch ( IOException e ) {
        throw new XsdException( "Unable to load schema [" + schemaName + "]", e, schemaName );
      }
      finally {
        try {
          schemaStream.close();
        }
        catch ( IOException e ) {
          LOG.debugf( "Problem closing schema stream [%s]", e.toString() );
        }
      }
    }
    catch ( IOException e ) {
      throw new XsdException( "Stream error handling schema url [" + url.toExternalForm() + "]", schemaName );
    }
  }
View Full Code Here

  private Schema resolveLocalSchema(String schemaName, String schemaLanguage) {
    URL url = metadataSources.getServiceRegistry()
        .getService( ClassLoaderService.class )
        .locateResource( schemaName );
    if ( url == null ) {
      throw new XsdException( "Unable to locate schema [" + schemaName + "] via classpath", schemaName );
    }
    try {
      InputStream schemaStream = url.openStream();
      try {
        StreamSource source = new StreamSource( url.openStream() );
        SchemaFactory schemaFactory = SchemaFactory.newInstance( schemaLanguage );
        return schemaFactory.newSchema( source );
      }
      catch ( SAXException e ) {
        throw new XsdException( "Unable to load schema [" + schemaName + "]", e, schemaName );
      }
      catch ( IOException e ) {
        throw new XsdException( "Unable to load schema [" + schemaName + "]", e, schemaName );
      }
      finally {
        try {
          schemaStream.close();
        }
        catch ( IOException e ) {
          log.debugf( "Problem closing schema stream [%s]", e.toString() );
        }
      }
    }
    catch ( IOException e ) {
      throw new XsdException( "Stream error handling schema url [" + url.toExternalForm() + "]", schemaName );
    }
  }
View Full Code Here

TOP

Related Classes of org.hibernate.metamodel.source.XsdException

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.