org.hibernate.boot.archive.spi.InputStreamAccess Java Examples

The following examples show how to use org.hibernate.boot.archive.spi.InputStreamAccess. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XmlMappingBinderAccess.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public Binding bind(InputStreamAccess xmlInputStreamAccess) {
	LOG.tracef( "reading mappings from InputStreamAccess : %s", xmlInputStreamAccess.getStreamName() );

	final Origin origin = new Origin( SourceType.INPUT_STREAM, xmlInputStreamAccess.getStreamName() );
	InputStream xmlInputStream = xmlInputStreamAccess.accessInputStream();
	try {
		return new InputStreamXmlSource( origin, xmlInputStream, false ).doBind( mappingBinder );
	}
	finally {
		try {
			xmlInputStream.close();
		}
		catch (IOException e) {
			LOG.debugf( "Unable to close InputStream obtained from InputStreamAccess : " + xmlInputStreamAccess.getStreamName() );
		}
	}
}
 
Example #2
Source File: HibernateSubstitutions.java    From micronaut-sql with Apache License 2.0 4 votes vote down vote up
@Substitute
public Binding bind(InputStreamAccess xmlInputStreamAccess) {
    return null;
}
 
Example #3
Source File: QuarkusScanner.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@Override
public InputStreamAccess getStreamAccess() {
    return new UrlInputStreamAccess(
            Thread.currentThread().getContextClassLoader().getResource(name.replace('.', '/') + ".class"));
}
 
Example #4
Source File: PackageDescriptorImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public PackageDescriptorImpl(String name, InputStreamAccess streamAccess) {
	this.name = name;
	this.streamAccess = streamAccess;
}
 
Example #5
Source File: PackageDescriptorImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public InputStreamAccess getStreamAccess() {
	return streamAccess;
}
 
Example #6
Source File: ClassDescriptorImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public ClassDescriptorImpl(String name, Categorization categorization, InputStreamAccess streamAccess) {
	this.name = name;
	this.categorization = categorization;
	this.streamAccess = streamAccess;
}
 
Example #7
Source File: ClassDescriptorImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public InputStreamAccess getStreamAccess() {
	return streamAccess;
}
 
Example #8
Source File: MappingFileDescriptorImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public MappingFileDescriptorImpl(String name, InputStreamAccess streamAccess) {
	this.name = name;
	this.streamAccess = streamAccess;
}
 
Example #9
Source File: MappingFileDescriptorImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public InputStreamAccess getStreamAccess() {
	return streamAccess;
}
 
Example #10
Source File: ExplodedArchiveDescriptor.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
private void processDirectory(
		File directory,
		String path,
		ArchiveContext context) {
	if ( directory == null ) {
		return;
	}

	final File[] files = directory.listFiles();
	if ( files == null ) {
		return;
	}

	path = path == null ? "" : path + "/";
	for ( final File localFile : files ) {
		if ( !localFile.exists() ) {
			// should never happen conceptually, but...
			continue;
		}

		if ( localFile.isDirectory() ) {
			processDirectory( localFile, path + localFile.getName(), context );
			continue;
		}

		final String name = localFile.getAbsolutePath();
		final String relativeName = path + localFile.getName();
		final InputStreamAccess inputStreamAccess = new FileInputStreamAccess( name, localFile );

		final ArchiveEntry entry = new ArchiveEntry() {
			@Override
			public String getName() {
				return name;
			}

			@Override
			public String getNameWithinArchive() {
				return relativeName;
			}

			@Override
			public InputStreamAccess getStreamAccess() {
				return inputStreamAccess;
			}
		};

		context.obtainArchiveEntryHandler( entry ).handleEntry( entry, context );
	}
}
 
Example #11
Source File: MetadataSources.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Read metadata from an {@link java.io.InputStream} access
 *
 * @param xmlInputStreamAccess Access to an input stream containing a DOM.
 *
 * @return this (for method chaining purposes)
 */
public MetadataSources addInputStream(InputStreamAccess xmlInputStreamAccess) {
	xmlBindings.add( getXmlMappingBinderAccess().bind( xmlInputStreamAccess ) );
	return this;
}
 
Example #12
Source File: ClassDescriptor.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Retrieves access to the InputStream for the class file.
 *
 * @return Access to the InputStream for the class file.
 */
InputStreamAccess getStreamAccess();
 
Example #13
Source File: PackageDescriptor.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Retrieves access to the InputStream for the {@code package-info.class} file.
 *
 * @return Access to the InputStream for the {@code package-info.class} file.
 */
public InputStreamAccess getStreamAccess();
 
Example #14
Source File: MappingFileDescriptor.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Retrieves access to the InputStream for the mapping file.
 *
 * @return Access to the InputStream for the mapping file.
 */
public InputStreamAccess getStreamAccess();