Tabnine Logo
Resource
Code IndexAdd Tabnine to your IDE (free)

How to use
Resource
in
org.jboss.modules

Best Java code snippets using org.jboss.modules.Resource (Showing top 20 results out of 315)

origin: wildfly/wildfly

private TldMetaData parseTLD(Resource tld)
    throws DeploymentUnitProcessingException {
  if (IMPLICIT_TLD.equals(tld.getName())) {
    // Implicit TLDs are different from regular TLDs
    return new TldMetaData();
  }
  InputStream is = null;
  try {
    is = tld.openStream();
    final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
    inputFactory.setXMLResolver(NoopXMLResolver.create());
    XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(is);
    return TldMetaDataParser.parse(xmlReader);
  } catch (XMLStreamException e) {
    throw new DeploymentUnitProcessingException(UndertowLogger.ROOT_LOGGER.failToParseXMLDescriptor(tld.getName(), e.getLocation().getLineNumber(),
        e.getLocation().getColumnNumber()), e);
  } catch (IOException e) {
    throw new DeploymentUnitProcessingException(UndertowLogger.ROOT_LOGGER.failToParseXMLDescriptor(tld.getName()), e);
  } finally {
    try {
      if (is != null) {
        is.close();
      }
    } catch (IOException e) {
      // Ignore
    }
  }
}
origin: wildfly/wildfly

if(resource.getURL().toString().contains("com/sun/jsf-impl/main")) {
  continue;
if(resource.getName().startsWith("META-INF/")) {
  if(tlds.containsKey(resource.getName())) {
    continue;
  if(resource.getURL().getProtocol().equals("vfs")) {
    continue;
  String key = "/" + resource.getName();
  if (!tlds.containsKey(key)) {
    tlds.put(key, value);
origin: org.wildfly.core/wildfly-server

private Index calculateModuleIndex(final Module module) throws ModuleLoadException, IOException {
  final Indexer indexer = new Indexer();
  final PathFilter filter = PathFilters.getDefaultImportFilter();
  final Iterator<Resource> iterator = module.iterateResources(filter);
  while (iterator.hasNext()) {
    Resource resource = iterator.next();
    if(resource.getName().endsWith(".class")) {
      try (InputStream in = resource.openStream()) {
        indexer.index(in);
      } catch (Exception e) {
        ServerLogger.DEPLOYMENT_LOGGER.cannotIndexClass(resource.getName(), resource.getURL().toExternalForm(), e);
      }
    }
  }
  return indexer.complete();
}
origin: org.jboss.modules/jboss-modules

public boolean hasNext() {
  Resource next;
  while (this.next == null && original.hasNext()) {
    next = original.next();
    if (filter.accept(next.getName())) {
      this.next = next;
    }
  }
  return this.next != null;
}
origin: org.jboss.modules/jboss-modules

  if (iterator.hasNext()) {
    final Resource resource = iterator.next();
    if (jaxpResource != null) log.jaxpResourceLoaded(resource.getURL(), this);
    return resource.openStream();
if (iterator.hasNext()) {
  final Resource resource = iterator.next();
  if (jaxpResource != null) log.jaxpResourceLoaded(resource.getURL(), this);
  return resource.openStream();
origin: org.projectodd/polyglot-core

public static ResourceLoaderSpec createLoaderSpec(Resource resource) throws IOException {
  try {
    
    return createLoaderSpec( VFS.getChild( resource.getURL().toURI() ) );
  } catch (URISyntaxException e) {
    //ffs
    e.printStackTrace();
    
    return null;
  }
}

origin: org.jboss.modules/jboss-modules

  /**
   * Attempt to guess the version of a resource loader.
   *
   * @param resourceLoader the resource loader to check (must not be {@code null})
   * @return the version, or {@code null} if no version could be determined
   * @throws IOException if necessary resource(s) failed to load
   */
  public static Version detectVersion(ResourceLoader resourceLoader) throws IOException {
    final Resource resource = resourceLoader.getResource("META-INF/MANIFEST.MF");
    if (resource != null) {
      Manifest manifest;
      try (InputStream is = resource.openStream()) {
        manifest = new Manifest(is);
      }
      final Attributes mainAttributes = manifest.getMainAttributes();
      final String versionString = mainAttributes.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
      if (versionString != null) try {
        return Version.parse(versionString);
      } catch (IllegalArgumentException ignored) {
      }
    }
    return null;
  }
}
origin: wildfly/wildfly-core

private Index calculateModuleIndex(final Module module) throws ModuleLoadException, IOException {
  final Indexer indexer = new Indexer();
  final PathFilter filter = PathFilters.getDefaultImportFilter();
  final Iterator<Resource> iterator = module.iterateResources(filter);
  while (iterator.hasNext()) {
    Resource resource = iterator.next();
    if(resource.getName().endsWith(".class")) {
      try (InputStream in = resource.openStream()) {
        indexer.index(in);
      } catch (Exception e) {
        ServerLogger.DEPLOYMENT_LOGGER.cannotIndexClass(resource.getName(), resource.getURL().toExternalForm(), e);
      }
    }
  }
  return indexer.complete();
}
origin: org.jboss.forge/jboss-modules

public boolean hasNext() {
  Resource next;
  while (this.next == null && original.hasNext()) {
    next = original.next();
    if (filter.accept(next.getName())) {
      this.next = next;
    }
  }
  return this.next != null;
}
origin: org.jboss.modules/jboss-modules

/**
 * Load a local exported resource from this class loader.
 *
 * @param name the resource name
 * @return the list of resources
 */
public List<Resource> loadResourceLocal(final String name) {
  final Map<String, List<ResourceLoader>> paths = this.paths.get().getAllPaths();
  final String path = Module.pathOf(name);
  final URLConnectionResource jaxpResource = jaxpImplResources.get(name);
  final List<ResourceLoader> loaders = paths.get(path);
  final List<Resource> list = new ArrayList<Resource>(loaders == null ? 1 : loaders.size());
  if (loaders != null) {
    for (ResourceLoader loader : loaders) {
      final Resource resource = loader.getResource(name);
      if (resource != null) {
        if (jaxpResource != null) Module.log.jaxpResourceLoaded(resource.getURL(), module);
        list.add(resource);
      }
    }
  }
  return list.isEmpty() ? Collections.emptyList() : list;
}
origin: org.jboss.modules/jboss-modules

void addPermissions(final ModuleSpec.Builder builder, final ResourceLoader resourceLoader, final ModuleLoader moduleLoader) {
  final Resource resource = resourceLoader.getResource("META-INF/permissions.xml");
  if (resource != null) {
    try {
      try (InputStream stream = resource.openStream()) {
        builder.setPermissionCollection(PermissionsXmlParser.parsePermissionsXml(stream, moduleLoader, builder.getName()));
      }
    } catch (XmlPullParserException | IOException ignored) {
    }
  }
}
origin: org.wildfly.swarm/container-runtime

private void resolveRuntimeIndex(Module module, List<Index> indexes) throws ModuleLoadException {
  Indexer indexer = new Indexer();
  Iterator<Resource> resources = module.iterateResources(PathFilters.acceptAll());
  while (resources.hasNext()) {
    Resource each = resources.next();
    if (each.getName().endsWith(".class")) {
      try {
        ClassInfo clsInfo = indexer.index(each.openStream());
      } catch (IOException e) {
        //System.err.println("error: " + each.getName() + ": " + e.getMessage());
      }
    }
  }
  indexes.add(indexer.complete());
}
origin: fakereplace/fakereplace

while (resources.hasNext()) {
  Resource res = resources.next();
  if (!res.getName().endsWith(".class")) {
    continue;
  String binaryName = res.getName().replace("/", ".").substring(0, res.getName().length() - 6);
  try {
    ret.add(new ZipJavaFileObject(org.fakereplace.util.FileReader.readFileBytes(res.openStream()), binaryName, res.getURL().toURI()));
  } catch (URISyntaxException e) {
    e.printStackTrace();
origin: io.thorntail/management-console

@Produces
public Archive managementConsoleWar() throws Exception {
  // Load the management-ui webjars.
  WARArchive war = ShrinkWrap.create(WARArchive.class, "management-console-ui.war");
  Module module = Module.getBootModuleLoader().loadModule("org.jboss.as.console");
  Iterator<Resource> resources = module.globResources("*");
  while (resources.hasNext()) {
    Resource each = resources.next();
    war.add(new UrlAsset(each.getURL()), each.getName());
  }
  war.setContextRoot(this.fraction.contextRoot());
  return war;
}
origin: org.wildfly/wildfly-testsuite-shared

/**
 * Lists resources in deployment using provided API for iterating resources
 *
 * @param classLoader the deployment class loader
 * @param rootDir     directory which should be considered as root
 * @param recursive   if true also a recursive resources are taken into account, otherwise only resources in rootDir are considered
 * @return list of resources returned by the API for iterating over deployment resources
 */
public static List<String> listResources(ModuleClassLoader classLoader, String rootDir, boolean recursive) {
  List<String> resourceList = new ArrayList<>();
  Iterator<Resource> it = classLoader.iterateResources(rootDir, recursive);
  while (it.hasNext()) {
    resourceList.add(it.next().getName());
  }
  return resourceList;
}
origin: org.hawkular.bus/hawkular-bus-broker-wf-extension

  Module module = Module.forClass(getClass());
  Resource r = module.getExportedResource("config", configFile);
  return r.getURL().toString();
} catch (Throwable t) {
origin: org.jboss.forge/jboss-modules

  final List<Resource> resourceList = loader.loadResourceLocal(canonPath);
  for (Resource resource : resourceList) {
    return resource.openStream();
final List<Resource> resourceList = fallbackLoader.loadResourceLocal(canonPath);
for (Resource resource : resourceList) {
  return resource.openStream();
origin: org.jboss.modules/jboss-modules

public ModuleSpec findModule(final String name, final ModuleLoader delegateLoader) throws ModuleLoadException {
  final ResourceLoader resourceLoader = this.resourceLoader;
  final String path = PathUtils.basicModuleNameToPath(name);
  if (path == null) {
    return null; // not valid, so not found
  }
  String basePath = modulesDirectory + "/" + path;
  Resource moduleXmlResource = resourceLoader.getResource(basePath + "/" + MODULE_FILE);
  if (moduleXmlResource == null) {
    return null;
  }
  ModuleSpec moduleSpec;
  try {
    try (final InputStream inputStream = moduleXmlResource.openStream()) {
      moduleSpec = ModuleXmlParser.parseModuleXml(factory, basePath, inputStream, moduleXmlResource.getName(), delegateLoader, name);
    }
  } catch (IOException e) {
    throw new ModuleLoadException("Failed to read " + MODULE_FILE + " file", e);
  }
  return moduleSpec;
}
origin: org.wildfly/wildfly-undertow

if(resource.getURL().toString().contains("com/sun/jsf-impl/main")) {
  continue;
if(resource.getName().startsWith("META-INF/")) {
  if(tlds.containsKey(resource.getName())) {
    continue;
  if(resource.getURL().getProtocol().equals("vfs")) {
    continue;
  String key = "/" + resource.getName();
  if (!tlds.containsKey(key)) {
    tlds.put(key, value);
origin: wildfly-extras/wildfly-camel

while (itres.hasNext()) {
  Resource resource = itres.next();
  String resname = resource.getName();
  if (resname.startsWith(packageName) && resname.endsWith(".class")) {
    String className = resname.substring(0, resname.length() - 6).replace('/', '.');
org.jboss.modulesResource

Javadoc

A single resource from a ResourceLoader.

Most used methods

  • getName
    Get the relative resource name.
  • openStream
    Open an input stream to this resource.
  • getURL
    Get the complete URL of this resource.

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • getSharedPreferences (Context)
  • putExtra (Intent)
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Permission (java.security)
    Legacy security code; do not use.
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Top 17 Free Sublime Text Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now