本文整理了Java中org.jboss.shrinkwrap.api.importer.ZipImporter.importFrom()
方法的一些代码示例,展示了ZipImporter.importFrom()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipImporter.importFrom()
方法的具体详情如下:
包路径:org.jboss.shrinkwrap.api.importer.ZipImporter
类名称:ZipImporter
方法名:importFrom
[英]Imports provided ZipFile as a Archive.
[中]导入将ZipFile作为存档提供。
代码示例来源:origin: thorntail/thorntail
protected boolean setupUsingAppArtifact(Archive<?> archive) throws IOException {
final String appArtifact = System.getProperty(APP_ARTIFACT);
if (appArtifact != null) {
try (InputStream in = ClassLoader.getSystemClassLoader().getResourceAsStream("_bootstrap/" + appArtifact)) {
archive.as(ZipImporter.class)
.importFrom(in);
}
return true;
}
return false;
}
代码示例来源:origin: org.wildfly.swarm/spi
protected boolean setupUsingAppArtifact(Archive<?> archive) throws IOException {
final String appArtifact = System.getProperty(APP_ARTIFACT);
if (appArtifact != null) {
try (InputStream in = ClassLoader.getSystemClassLoader().getResourceAsStream("_bootstrap/" + appArtifact)) {
archive.as(ZipImporter.class)
.importFrom(in);
}
return true;
}
return false;
}
代码示例来源:origin: io.thorntail/container
protected static Stream<Archive> archives(Collection<Path> paths) {
return paths.stream()
.map(path -> {
String simpleName = path.getFileName().toString();
Archive archive = ShrinkWrap.create(JavaArchive.class, simpleName);
archive.as(ZipImporter.class).importFrom(path.toFile());
return archive;
});
}
代码示例来源:origin: javaee/security-soteria
public static WebArchive mavenWar() {
return
create(ZipImporter.class, getProperty("finalName") + ".war")
.importFrom(new File("target/" + getProperty("finalName") + ".war"))
.as(WebArchive.class);
}
代码示例来源:origin: org.glassfish.soteria.test/common
public static WebArchive mavenWar() {
return
create(ZipImporter.class, getProperty("finalName") + ".war")
.importFrom(new File("target/" + getProperty("finalName") + ".war"))
.as(WebArchive.class);
}
代码示例来源:origin: thorntail/thorntail
protected static Stream<Archive> archives(Collection<Path> paths) {
return paths.stream()
.map(path -> {
String simpleName = path.getFileName().toString();
Archive archive = ShrinkWrap.create(JavaArchive.class, simpleName);
archive.as(ZipImporter.class).importFrom(path.toFile());
return archive;
});
}
代码示例来源:origin: org.wildfly.swarm/container
protected static Stream<Archive> archives(Collection<Path> paths) {
return paths.stream()
.map(path -> {
String simpleName = path.getFileName().toString();
Archive archive = ShrinkWrap.create(JavaArchive.class, simpleName);
archive.as(ZipImporter.class).importFrom(path.toFile());
return archive;
});
}
代码示例来源:origin: wildfly-swarm-archive/ARCHIVE-wildfly-swarm
protected boolean setupUsingAppArtifact(Archive<?> archive) throws IOException {
final String appArtifact = System.getProperty(BootstrapProperties.APP_ARTIFACT);
if (appArtifact != null) {
try (InputStream in = ClassLoader.getSystemClassLoader().getResourceAsStream("_bootstrap/" + appArtifact)) {
archive.as(ZipImporter.class)
.importFrom(in);
}
return true;
}
return false;
}
代码示例来源:origin: org.wildfly.swarm/container-api
public JavaArchive artifact(String gav, String asName) throws IOException, ModuleLoadException {
final File file = findFile(gav);
if (file == null) {
throw new RuntimeException("Artifact '" + gav + "' not found.");
}
return ShrinkWrap.create(ZipImporter.class, asName == null ? file.getName() : asName)
.importFrom(file)
.as(JavaArchive.class);
}
代码示例来源:origin: thorntail/thorntail
public JavaArchive artifact(String gav, String asName) throws IOException, ModuleLoadException {
final File file = findFile(gav);
if (file == null) {
throw SwarmMessages.MESSAGES.artifactNotFound(gav);
}
return ShrinkWrap.create(ZipImporter.class, asName == null ? file.getName() : asName)
.importFrom(file)
.as(JavaArchive.class);
}
代码示例来源:origin: io.thorntail/container
public JavaArchive artifact(String gav, String asName) throws IOException, ModuleLoadException {
final File file = findFile(gav);
if (file == null) {
throw SwarmMessages.MESSAGES.artifactNotFound(gav);
}
return ShrinkWrap.create(ZipImporter.class, asName == null ? file.getName() : asName)
.importFrom(file)
.as(JavaArchive.class);
}
代码示例来源:origin: org.wildfly.swarm/container
public JavaArchive artifact(String gav, String asName) throws IOException, ModuleLoadException {
final File file = findFile(gav);
if (file == null) {
throw SwarmMessages.MESSAGES.artifactNotFound(gav);
}
return ShrinkWrap.create(ZipImporter.class, asName == null ? file.getName() : asName)
.importFrom(file)
.as(JavaArchive.class);
}
代码示例来源:origin: org.jboss.shrinkwrap.resolver/shrinkwrap-resolver-impl-gradle-embedded-archive
@Override
public <TYPE extends Assignable> TYPE as(final Class<TYPE> clazz) {
final File result;
if (buildResult == null) {
result = importFromDefaultLibsDirectory();
} else {
result = importFromConfiguredPath();
}
return ShrinkWrap.create(ZipImporter.class, archive.getName()).importFrom(result).as(clazz);
}
代码示例来源:origin: shrinkwrap/resolver
@Override
public <TYPE extends Assignable> TYPE as(final Class<TYPE> clazz) {
final File result;
if (buildResult == null) {
result = importFromDefaultLibsDirectory();
} else {
result = importFromConfiguredPath();
}
return ShrinkWrap.create(ZipImporter.class, archive.getName()).importFrom(result).as(clazz);
}
代码示例来源:origin: org.kie/kie-wb-monitoring-webapp
@Deployment(testable = false)
public static WebArchive create() {
final String warFile = System.getProperty(ARCHIVE_NAME);
return ShrinkWrap.create(ZipImporter.class,
warFile)
.importFrom(new File("target/" + warFile))
.as(WebArchive.class);
}
代码示例来源:origin: org.jbpm/jbpm-wb-case-mgmt-showcase
@Deployment(testable = false)
public static WebArchive create() {
final String warFile = System.getProperty(ARCHIVE_NAME);
return ShrinkWrap.create(ZipImporter.class,
warFile)
.importFrom(new File("target/" + warFile))
.as(WebArchive.class);
}
代码示例来源:origin: juzu/juzu
private void assertJar(URL url) throws IOException {
URLConnection conn = url.openConnection();
conn.connect();
InputStream in = conn.getInputStream();
JavaArchive archive = ShrinkWrap.create(ZipImporter.class).importFrom(in).as(JavaArchive.class);
Node node = archive.get("/" + ReadFileSystemTestCase.class.getName().replace('.', '/') + ".class");
assertNotNull(node);
}
代码示例来源:origin: org.wildfly.swarm/tools
public void repackageWar(File file) throws IOException {
this.log.info("Repackaging .war: " + file);
Path backupPath = get(file);
move(file, backupPath, this.log);
Archive original = ShrinkWrap.create(JavaArchive.class);
try (InputStream inputStream = Files.newInputStream(backupPath)) {
original.as(ZipImporter.class).importFrom(inputStream);
}
WebInfLibFilteringArchive repackaged = new WebInfLibFilteringArchive(original, this.dependencyManager);
repackaged.as(ZipExporter.class).exportTo(file, true);
this.log.info("Repackaged .war: " + file);
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-server-ui-backend
public static WebArchive createKieServerWar() {
try {
final File kieServerFile = Maven.configureResolver().workOffline().loadPomFromFile("pom.xml")
.resolve("org.kie.server:kie-server:war:ee7:?").withoutTransitivity().asSingleFile();
return ShrinkWrap.create(ZipImporter.class,
"kie-server.war").importFrom(kieServerFile)
.as(WebArchive.class);
} catch (Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-server-ui-backend
public static WebArchive createKieServerControllerWar() {
try {
final File kieServerControllerFile = Maven.configureResolver().workOffline().loadPomFromFile("pom.xml")
.resolve("org.kie.server:kie-server-controller-standalone:war:ee7:?").withoutTransitivity().asSingleFile();
return ShrinkWrap.create(ZipImporter.class,
"kie-server-controller.war").importFrom(kieServerControllerFile)
.as(WebArchive.class);
} catch (Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
内容来源于网络,如有侵权,请联系作者删除!