org.springframework.boot.loader.archive.ExplodedArchive Java Examples

The following examples show how to use org.springframework.boot.loader.archive.ExplodedArchive. 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: LancherTest.java    From tac with MIT License 6 votes vote down vote up
protected final Archive createArchive() throws Exception {
    ProtectionDomain protectionDomain = getClass().getProtectionDomain();
    CodeSource codeSource = protectionDomain.getCodeSource();
    URI location = (codeSource == null ? null : codeSource.getLocation().toURI());
    String path = (location == null ? null : location.getSchemeSpecificPart());
    if (path == null) {
        throw new IllegalStateException("Unable to determine code source archive");
    }
    File root = new File(path);
    if (!root.exists()) {
        throw new IllegalStateException(
            "Unable to determine code source archive from " + root);
    }
    return (root.isDirectory() ? new ExplodedArchive(root)
        : new JarFileArchive(root));
}
 
Example #2
Source File: WebApplication.java    From TrackRay with GNU General Public License v3.0 6 votes vote down vote up
protected static Archive createArchive(Class clazz) throws Exception {
	ProtectionDomain protectionDomain = clazz.getProtectionDomain();
	CodeSource codeSource = protectionDomain.getCodeSource();
	URI location = codeSource != null ? codeSource.getLocation().toURI() : null;
	String path = location != null ? location.getSchemeSpecificPart() : null;
	if (path == null) {
		throw new IllegalStateException("Unable to determine code source archive");
	} else {
		File root = new File(path);
		if (!root.exists()) {
			throw new IllegalStateException("Unable to determine code source archive from " + root);
		} else {
			return (Archive)(root.isDirectory() ? new ExplodedArchive(root) : new JarFileArchive(root));
		}
	}
}
 
Example #3
Source File: ConfigurationMetadataDocumentationMojo.java    From spring-cloud-stream-app-starters with Apache License 2.0 5 votes vote down vote up
@Override
public List<Archive> getNestedArchives(EntryFilter ignored) throws IOException {
	try {
		List<Archive> archives = new ArrayList<>(mavenProject.getRuntimeClasspathElements().size());
		for (String dep : mavenProject.getRuntimeClasspathElements()) {
			File file = new File(dep);
			archives.add(file.isDirectory() ? new ExplodedArchive(file) : new JarFileArchive(file));
		}
		return archives;
	}
	catch (DependencyResolutionRequiredException e) {
		throw new IOException("Could not create boot archive", e);
	}

}
 
Example #4
Source File: BootApplicationConfigurationMetadataResolver.java    From spring-cloud-dashboard with Apache License 2.0 4 votes vote down vote up
private Archive resolveAsArchive(Resource app) throws IOException {
		File moduleFile = app.getFile();
		return moduleFile.isDirectory() ? new ExplodedArchive(moduleFile) : new JarFileArchive(moduleFile);
}
 
Example #5
Source File: BootApplicationConfigurationMetadataResolver.java    From spring-cloud-dataflow with Apache License 2.0 4 votes vote down vote up
private Archive resolveAsArchive(Resource app) throws IOException {
	File moduleFile = app.getFile();
	return moduleFile.isDirectory() ? new ExplodedArchive(moduleFile) : new JarFileArchive(moduleFile);
}
 
Example #6
Source File: DefaultValidationService.java    From spring-cloud-dataflow with Apache License 2.0 4 votes vote down vote up
private static Archive resolveAsArchive(Resource app) throws IOException {
	Assert.notNull(app, "The resource specified for the app must not be null");
	File moduleFile = app.getFile();
	return moduleFile.isDirectory() ? new ExplodedArchive(moduleFile) : new JarFileArchive(moduleFile);
}