Package org.hibernate.internal.jaxb

Examples of org.hibernate.internal.jaxb.Origin


   * @return this (for method chaining purposes)
   */
  public MetadataSources addResource(String name) {
    LOG.tracef( "reading mappings from resource : %s", name );

    final Origin origin = new Origin( SourceType.RESOURCE, name );
    InputStream resourceInputStream = classLoaderService().locateResourceStream( name );
    if ( resourceInputStream == null ) {
      throw new MappingNotFoundException( origin );
    }
    add( resourceInputStream, origin, true );
View Full Code Here


   * @return this (for method chaining purposes)
   */
  public MetadataSources addFile(File file) {
    final String name = file.getAbsolutePath();
    LOG.tracef( "reading mappings from file : %s", name );
    final Origin origin = new Origin( SourceType.FILE, name );
    try {
      add( new FileInputStream( file ), origin, true );
    }
    catch ( FileNotFoundException e ) {
      throw new MappingNotFoundException( e, origin );
View Full Code Here

   * @param xmlInputStream The input stream containing a DOM.
   *
   * @return this (for method chaining purposes)
   */
  public MetadataSources addInputStream(InputStream xmlInputStream) {
    add( xmlInputStream, new Origin( SourceType.INPUT_STREAM, "<unknown>" ), false );
    return this;
  }
View Full Code Here

   */
  public MetadataSources addURL(URL url) {
    final String urlExternalForm = url.toExternalForm();
    LOG.debugf( "Reading mapping document from URL : %s", urlExternalForm );

    final Origin origin = new Origin( SourceType.URL, urlExternalForm );
    try {
      add( url.openStream(), origin, true );
    }
    catch ( IOException e ) {
      throw new MappingNotFoundException( "Unable to open url stream [" + urlExternalForm + "]", e, origin );
View Full Code Here

   * @param document The DOM document
   *
   * @return this (for method chaining purposes)
   */
  public MetadataSources addDocument(Document document) {
    final Origin origin = new Origin( SourceType.DOM, "<unknown>" );
    JaxbRoot jaxbRoot = jaxbHelper.unmarshal( document, origin );
    jaxbRootList.add( jaxbRoot );
    return this;
  }
View Full Code Here

   *
   * @return this (for method chaining purposes)
   */
  public MetadataSources addJar(File jar) {
    LOG.debugf( "Seeking mapping documents in jar file : %s", jar.getName() );
    final Origin origin = new Origin( SourceType.JAR, jar.getAbsolutePath() );
    try {
      JarFile jarFile = new JarFile( jar );
      try {
        Enumeration jarEntries = jarFile.entries();
        while ( jarEntries.hasMoreElements() ) {
View Full Code Here

  @SuppressWarnings( {"unchecked"})
  public ServiceRegistryBuilder configure(String resourceName) {
    InputStream stream = bootstrapServiceRegistry.getService( ClassLoaderService.class ).locateResourceStream( resourceName );
    JaxbHibernateConfiguration configurationElement = jaxbProcessorHolder.getValue().unmarshal(
        stream,
        new Origin( SourceType.RESOURCE, resourceName )
    );
    for ( JaxbHibernateConfiguration.JaxbSessionFactory.JaxbProperty xmlProperty : configurationElement.getSessionFactory().getProperty() ) {
      settings.put( xmlProperty.getName(), xmlProperty.getValue() );
    }
View Full Code Here

   * @return this (for method chaining purposes)
   */
  public MetadataSources addResource(String name) {
    LOG.tracef( "reading mappings from resource : %s", name );

    final Origin origin = new Origin( SourceType.RESOURCE, name );
    InputStream resourceInputStream = classLoaderService().locateResourceStream( name );
    if ( resourceInputStream == null ) {
      throw new MappingNotFoundException( origin );
    }
    add( resourceInputStream, origin, true );
View Full Code Here

   * @return this (for method chaining purposes)
   */
  public MetadataSources addFile(File file) {
    final String name = file.getAbsolutePath();
    LOG.tracef( "reading mappings from file : %s", name );
    final Origin origin = new Origin( SourceType.FILE, name );
    try {
      add( new FileInputStream( file ), origin, true );
    }
    catch ( FileNotFoundException e ) {
      throw new MappingNotFoundException( e, origin );
View Full Code Here

   * @param xmlInputStream The input stream containing a DOM.
   *
   * @return this (for method chaining purposes)
   */
  public MetadataSources addInputStream(InputStream xmlInputStream) {
    add( xmlInputStream, new Origin( SourceType.INPUT_STREAM, "<unknown>" ), false );
    return this;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.internal.jaxb.Origin

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.