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

x33g5p2x  于2022-01-24 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(62)

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

Node.getAsset介绍

暂无

代码示例

代码示例来源:origin: oracle/helidon

Node n = entry.getValue();
Path f = subpath(deployDir, path.get());
if (n.getAsset() == null) {
  Files.copy(n.getAsset().openStream(), f, StandardCopyOption.REPLACE_EXISTING);

代码示例来源:origin: crashub/crash

assertTrue(tmp.delete());
war.as(ZipExporter.class).exportTo(tmp);
final byte[] bytes = Utils.readAsBytes(jar.get("foo/A.class").getAsset().openStream());
return new ClassLoader(Thread.currentThread().getContextClassLoader()) {
 Class<?> aClass = null;

代码示例来源:origin: org.agiso.tempel/tempel-support-test

@Override
  public InputStream getInputStream() throws Exception {
    return jarEntry.getAsset().openStream();
  }
}

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

public static Manifest getManifest(Archive<?> archive) {
  try {
    Node node = archive.get(JarFile.MANIFEST_NAME);
    if (node != null && node.getAsset() != null) {
      return new Manifest(node.getAsset().openStream());
    }
  } catch (Exception ex) {
    throw new IllegalStateException("Cannot obtain manifest", ex);
  }
  return null;
}

代码示例来源:origin: org.jboss.as/jboss-as-arquillian-common

public static Manifest getManifest(Archive<?> archive) {
  try {
    Node node = archive.get(JarFile.MANIFEST_NAME);
    if (node != null && node.getAsset() != null) {
      return new Manifest(node.getAsset().openStream());
    }
  } catch (Exception ex) {
    throw new IllegalStateException("Cannot obtain manifest", ex);
  }
  return null;
}

代码示例来源:origin: org.jboss.arquillian.osgi/arquillian-osgi-common

private Manifest getBundleManifest(Archive<?> archive) {
  try {
    Node node = archive.get(JarFile.MANIFEST_NAME);
    if (node == null)
      return null;
    Manifest manifest = new Manifest(node.getAsset().openStream());
    return manifest;
  } catch (Exception ex) {
    return null;
  }
}

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

@Override
public Manifest getManifest(JavaArchive javaArchive) throws IOException {
  Node manifestNode = javaArchive.get(JarFile.MANIFEST_NAME);
  Asset manifestAsset = manifestNode.getAsset();
  return new Manifest(manifestAsset.openStream());
}

代码示例来源:origin: org.jboss.arquillian.extension/arquillian-jacoco

public void removeManifestDigests(Archive<?> archive) {
  Map<ArchivePath, Node> manifests = getManifestFiles(archive);
  for (Entry<ArchivePath, Node> entry : manifests.entrySet()) {
    Asset original = entry.getValue().getAsset();
    archive.delete(entry.getKey());
    archive.add(new ManifestAsset(original), entry.getKey());
  }
}

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

private static boolean hasApplicationPathAnnotation(Archive<?> archive) {
  Map<ArchivePath, Node> content = archive.getContent();
  for (Map.Entry<ArchivePath, Node> entry : content.entrySet()) {
    Node node = entry.getValue();
    Asset asset = node.getAsset();
    if (hasApplicationPathAnnotation(node.getPath(), asset)) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.apache.tomee/arquillian-openejb-embedded

private static void addOpenEJbJarXml(final Archive<?> archive, final String prefix, final EjbModule ejbModule) {
  final Node openejbJarXml = archive.get(prefix.concat(OPENEJB_JAR_XML));
  if (openejbJarXml != null) {
    ejbModule.getAltDDs().put(OPENEJB_JAR_XML, new AssetSource(openejbJarXml.getAsset(), null));
  }
}

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

@Override
public List<String> getBundleActivators(Archive archive, String fileName)
  throws IOException {
  Node node = archive.get(fileName);
  List<String> bundleActivators = new ArrayList<>();
  if (node != null) {
    Asset asset = node.getAsset();
    bundleActivators.addAll(_getBundleActivators(asset.openStream()));
  }
  return bundleActivators;
}

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

private void format(StringBuilder sb, Node node) {
  sb.append(node.getPath().get());
  if (node.getAsset() == null) {
    sb.append(FormattingConstants.SLASH);
  }
  sb.append(FormattingConstants.NEWLINE);
  for (Node child : node.getChildren()) {
    format(sb, child);
  }
}

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

private void format(StringBuilder sb, Node node) {
  sb.append(node.getPath().get());
  if (node.getAsset() == null) {
    sb.append(FormattingConstants.SLASH);
  }
  sb.append(FormattingConstants.NEWLINE);
  for (Node child : node.getChildren()) {
    format(sb, child);
  }
}

代码示例来源:origin: org.jboss.arquillian.osgi/arquillian-osgi-protocol

private void validateBundleArchive(Archive<?> archive) throws Exception {
    Manifest manifest = null;
    Node node = archive.get(JarFile.MANIFEST_NAME);
    if (node != null) {
      manifest = new Manifest(node.getAsset().openStream());
    }
    OSGiManifestBuilder.validateBundleManifest(manifest);
  }
}

代码示例来源:origin: org.arquillian.algeron/arquillian-algeron-provider-maven-retriever

private void unpack(File destination, JavaArchive file) throws IOException {
  final Node rootDir = file.get("/");
  final Set<Node> contractFiles = rootDir.getChildren();
  for (Node contractFile : contractFiles) {
    final String filename = contractFile.getPath().get().substring(1);
    final Asset asset = contractFile.getAsset();
    try (final InputStream in = asset.openStream()) {
      Files.copy(in, new File(destination, filename).toPath());
    }
  }
}

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

/**
 * {@inheritDoc}
 *
 * @see java.nio.file.attribute.BasicFileAttributes#isDirectory()
 */
@Override
public boolean isDirectory() {
  final ArchivePath archivePath = ArchivePaths.create(path.toString());
  Node node = archive.get(archivePath);
  return node.getAsset() == null;
}

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

protected void assertServiceProviderContent(Node node, String[] impls) throws IOException {
  BufferedReader reader = createReader(node.getAsset());
  try {
    for (String impl : impls) {
      Assert.assertEquals("Wrong entry in service provider: " + impl, impl, reader.readLine());
    }
  } finally {
    reader.close();
  }
}

代码示例来源:origin: org.jboss.shrinkwrap/shrinkwrap-extension-glassfish

@Override
public Manifest getManifest() throws IOException
{
 ArchivePath manifestPath = ArchivePaths.create("META-INF/MANIFEST.MF");
 final Archive<?> archive = this.getArchive();
 if (archive.contains(manifestPath))
 {
   return new Manifest(archive.get(manifestPath).getAsset().openStream());
 }
 return null;
}

代码示例来源:origin: org.jboss.arquillian.container/arquillian-container-osgi

@Override
public void undeploy(Archive<?> archive) throws DeploymentException {
  try {
    Manifest manifest = new Manifest(archive.get("/META-INF/MANIFEST.MF").getAsset().openStream());
    OSGiMetaData metadata = OSGiMetaDataBuilder.load(manifest);
    undeploy(metadata.getBundleSymbolicName());
  }
  catch (IOException e) {
    throw new DeploymentException("Cannot undeploy: " + archive.getName(), e);
  }
}

代码示例来源:origin: org.juzu/juzu-core

public static WebArchive createDeployment(String packageName) throws IOException {
 WebArchive war = createPortletDeployment(packageName);
 Node node = war.get("WEB-INF/portlet.xml");
 ArchivePath path = node.getPath();
 String s = Tools.read(node.getAsset().openStream(), Tools.UTF_8);
 s = s.replace("<portlet-info>", "<resource-bundle>bundle</resource-bundle>" + "<portlet-info>");
 war.delete(path);
 war.add(new StringAsset(s), path);
 war.addAsResource(new StringAsset("abc=def"), "bundle_fr_FR.properties");
 return war;
}

相关文章

微信公众号

最新文章

更多