org.jboss.shrinkwrap.api.Archive.add()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(109)

本文整理了Java中org.jboss.shrinkwrap.api.Archive.add()方法的一些代码示例,展示了Archive.add()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Archive.add()方法的具体详情如下:
包路径:org.jboss.shrinkwrap.api.Archive
类名称:Archive
方法名:add

Archive.add介绍

[英]Add an archive under a specific context and maintain the archive name as context path.
[中]在特定上下文下添加存档,并将存档名称保留为上下文路径。

代码示例

代码示例来源:origin: thorntail/thorntail

@Override
  public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
    Path simple = classes.relativize(file);
    archive.add(new FileAsset(file.toFile()), convertSeparators(simple));
    return super.visitFile(file, attrs);
  }
});

代码示例来源:origin: org.wildfly.swarm/container

@Override
  public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
    Path simple = classes.relativize(file);
    archive.add(new FileAsset(file.toFile()), convertSeparators(simple));
    return super.visitFile(file, attrs);
  }
});

代码示例来源:origin: io.thorntail/container

@Override
  public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
    Path simple = classes.relativize(file);
    archive.add(new FileAsset(file.toFile()), convertSeparators(simple));
    return super.visitFile(file, attrs);
  }
});

代码示例来源:origin: org.wildfly.swarm/tools

private void addArtifactToArchiveMavenRepository(Archive archive, ArtifactSpec artifact) throws Exception {
  if (!artifact.isResolved()) {
    throw new IllegalArgumentException("Artifact should be resolved!");
  }
  StringBuilder artifactPath = new StringBuilder("m2repo/");
  artifactPath.append(artifact.repoPath(true));
  archive.add(new FileAsset(artifact.file), artifactPath.toString());
}

代码示例来源:origin: org.jboss.shrinkwrap/shrinkwrap-impl-base

/**
 * {@inheritDoc}
 *
 * @see org.jboss.shrinkwrap.api.Archive#add(org.jboss.shrinkwrap.api.Archive, java.lang.String, java.lang.Class)
 */
@Override
public T add(final Archive<?> archive, final String path, final Class<? extends StreamExporter> exporter) {
  this.getArchive().add(archive, path, exporter);
  return covarientReturn();
}

代码示例来源:origin: org.jboss.shrinkwrap/shrinkwrap-impl-base

/**
 * {@inheritDoc}
 *
 * @see org.jboss.shrinkwrap.api.Archive#add(org.jboss.shrinkwrap.api.asset.Asset,
 *      org.jboss.shrinkwrap.api.ArchivePath)
 */
@Override
public T add(Asset asset, ArchivePath target) throws IllegalArgumentException {
  this.getArchive().add(asset, target);
  return covarientReturn();
}

代码示例来源:origin: org.jboss.shrinkwrap/shrinkwrap-impl-base

/**
 * {@inheritDoc}
 *
 * @see org.jboss.shrinkwrap.api.Archive#add(org.jboss.shrinkwrap.api.asset.Asset, java.lang.String,
 *      java.lang.String)
 */
@Override
public T add(final Asset asset, final String target, final String name) throws IllegalArgumentException {
  this.getArchive().add(asset, target, name);
  return covarientReturn();
}

代码示例来源:origin: org.jboss.shrinkwrap/shrinkwrap-impl-base

/**
 * {@inheritDoc}
 *
 * @see org.jboss.shrinkwrap.api.Archive#add(org.jboss.shrinkwrap.api.asset.Asset, java.lang.String)
 */
@Override
public T add(Asset asset, String name) {
  this.getArchive().add(asset, name);
  return covarientReturn();
}

代码示例来源:origin: org.jboss.shrinkwrap/shrinkwrap-impl-base

/**
 * {@inheritDoc}
 *
 * @see org.jboss.shrinkwrap.api.Archive#add(org.jboss.shrinkwrap.api.Archive, org.jboss.shrinkwrap.api.ArchivePath,
 *      java.lang.Class)
 */
@Override
public T add(final Archive<?> archive, final ArchivePath path, final Class<? extends StreamExporter> exporter) {
  this.getArchive().add(archive, path, exporter);
  return covarientReturn();
}

代码示例来源:origin: org.jboss.shrinkwrap/shrinkwrap-impl-base

/**
 * {@inheritDoc}
 *
 * @see org.jboss.shrinkwrap.api.Archive#add(NamedAsset))
 */
@Override
public T add(NamedAsset namedAsset) {
  this.getArchive().add(namedAsset);
  return covarientReturn();
}

代码示例来源:origin: org.jboss.shrinkwrap/shrinkwrap-impl-base

/**
 * {@inheritDoc}
 *
 * @see org.jboss.shrinkwrap.api.Archive#add(org.jboss.shrinkwrap.api.asset.Asset,
 *      org.jboss.shrinkwrap.api.ArchivePath, java.lang.String)
 */
@Override
public T add(Asset asset, ArchivePath path, String name) {
  this.getArchive().add(asset, path, name);
  return covarientReturn();
}

代码示例来源:origin: thorntail/thorntail

@Override
  public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
    Path simple = path.relativize(file);
    archive.add(new FileAsset(file.toFile()), convertSeparators(simple));
    return super.visitFile(file, attrs);
  }
});

代码示例来源:origin: org.wildfly.swarm/resource-adapters

@Override
public RARArchive resourceAdapter(final File ironjacamarFile) {
  getArchive().add(new FileAsset(ironjacamarFile), "META-INF/ironjacamar.xml");
  return this;
}

代码示例来源:origin: org.arquillian.liferay/arquillian-processor-osgi-allin

@Override
public void replaceBundleActivatorsFile(
    Archive archive, String fileName, List<String> bundleActivators)
  throws IOException {
  ByteArrayOutputStream bundleActivatorAsOutputStream =
    _getBundleActivatorAsOutputStream(bundleActivators);
  ByteArrayAsset byteArrayAsset = new ByteArrayAsset(
    bundleActivatorAsOutputStream.toByteArray());
  archive.delete(fileName);
  archive.add(byteArrayAsset, fileName);
}

代码示例来源:origin: io.thorntail/arquillian-daemon

private void mergeAuxAsClasses(final Archive<?> archive, final TestDeployment testDeployment) {
  final Map<ArchivePath, List<Node>> serviceDescriptors = new HashMap<>();
  findServiceDescriptors(archive, serviceDescriptors);
  testDeployment.getAuxiliaryArchives().forEach(aux -> {
    findServiceDescriptors(aux, serviceDescriptors);
    archive.merge(aux);
  });
  mergeServiceDescriptors(serviceDescriptors)
      .forEach((path, asset) -> archive.add(asset, path));
}

代码示例来源:origin: arquillian/arquillian-core

@BeforeDeployment
  public static Archive addDeploymentContent(Archive archive) {
    archive.add(new StringAsset("Hello"), "hello.txt");
    return archive;
  }
}

代码示例来源:origin: org.jboss.arquillian.container/arquillian-container-test-impl-base

@BeforeDeployment
  public static Archive addDeploymentContent(Archive archive) {
    archive.add(new StringAsset("Hello"), "hello.txt");
    return archive;
  }
}

代码示例来源:origin: org.wildfly.swarm/datasources

@Override
public DatasourceArchive dataSource(DataSource ds) {
  if (ds.jndiName() == null) {
    ds.jndiName("java:jboss/datasources/" + ds.getKey());
  }
  String name = ds.getKey() + "-ds.xml";
  getArchive().add(new DSXmlAsset(ds), "META-INF/" + name);
  return this;
}

代码示例来源:origin: org.wildfly.swarm/arquillian

public void process() {
  if (archive.get("META-INF/arquillian-testable") == null) {
    return;
  }
  archive.add(new StringAsset(archive.getName()), "META-INF/arquillian-testable");
  archive.as(JARArchive.class)
      .addModule("org.wildfly.swarm.arquillian.adapter");
  archive.as(JARArchive.class)
      .addModule("org.wildfly.swarm.arquillian", "deployment");
  archive.as(ServiceActivatorArchive.class)
      .addServiceActivator("org.wildfly.swarm.arquillian.deployment.TestableArchiveServiceActivator");
}

代码示例来源:origin: io.thorntail/arquillian

public void process() {
  if (archive.get("META-INF/arquillian-testable") == null) {
    return;
  }
  archive.add(new StringAsset(archive.getName()), "META-INF/arquillian-testable");
  archive.as(JARArchive.class)
      .addModule("org.wildfly.swarm.arquillian.adapter");
  archive.as(JARArchive.class)
      .addModule("org.wildfly.swarm.arquillian", "deployment");
  archive.as(ServiceActivatorArchive.class)
      .addServiceActivator("org.wildfly.swarm.arquillian.deployment.TestableArchiveServiceActivator");
}

相关文章