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

How to use
openStream
method
in
org.jboss.modules.Resource

Best Java code snippets using org.jboss.modules.Resource.openStream (Showing top 17 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: 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: 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: 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: fakereplace/fakereplace

  ret.add(new ZipJavaFileObject(org.fakereplace.util.FileReader.readFileBytes(res.openStream()), binaryName, res.getURL().toURI()));
} catch (URISyntaxException e) {
  e.printStackTrace();
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

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/wildfly-osgi-service

  break;
InputStream input = res.openStream();
try {
  manifest = new Manifest(input);
origin: wildfly-swarm-archive/ARCHIVE-wildfly-swarm

protected List<Class<? extends ServerConfiguration>> findServerConfigurationImpls(Module module) throws ModuleLoadException, IOException, NoSuchFieldException, IllegalAccessException {
  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());
      }
    }
  }
  Index index = indexer.complete();
  Set<ClassInfo> infos = index.getAllKnownImplementors(DotName.createSimple(ServerConfiguration.class.getName()));
  List<Class<? extends ServerConfiguration>> impls = new ArrayList<>();
  for (ClassInfo info : infos) {
    try {
      Class<? extends ServerConfiguration> cls = (Class<? extends ServerConfiguration>) module.getClassLoader().loadClass(info.name().toString());
      if (!Modifier.isAbstract(cls.getModifiers())) {
        impls.add(cls);
      }
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    }
  }
  return impls;
  //List<AnnotationInstance> found = index.getAnnotations(DotName.createSimple(Configuration.class.getName()));
  //return found;
}
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

  final Resource resource = iterator.next();
  if (jaxpResource != null) log.jaxpResourceLoaded(resource.getURL(), this);
  return resource.openStream();
final Resource resource = iterator.next();
if (jaxpResource != null) log.jaxpResourceLoaded(resource.getURL(), this);
return resource.openStream();
origin: org.wildfly.swarm/container

private void initializeConfigFiltersFatJar() throws ModuleLoadException, IOException, ClassNotFoundException {
  Indexer indexer = new Indexer();
  Module appModule = Module.getBootModuleLoader().loadModule(APPLICATION_MODULE_NAME);
  Iterator<Resource> iter = appModule.iterateResources(PathFilters.acceptAll());
  while (iter.hasNext()) {
    Resource each = iter.next();
    if (each.getName().endsWith(".class")) {
      if (!each.getName().equals("module-info.class")) {
        try (InputStream is = each.openStream()) {
          indexer.index(is);
        } catch (IOException e) {
          // ignore
        }
      }
    }
  }
  Index index = indexer.complete();
  Set<ClassInfo> impls = index.getAllKnownImplementors(DotName.createSimple(ConfigurationFilter.class.getName()));
  for (ClassInfo each : impls) {
    String name = each.name().toString();
    Class<? extends ConfigurationFilter> cls = (Class<? extends ConfigurationFilter>) appModule.getClassLoader().loadClass(name);
    try {
      ConfigurationFilter filter = cls.newInstance();
      this.configView.withFilter(filter);
    } catch (InstantiationException | IllegalAccessException e) {
      e.printStackTrace();
    }
  }
}
origin: thorntail/thorntail

private void initializeConfigFiltersFatJar() throws ModuleLoadException, IOException, ClassNotFoundException {
  Indexer indexer = new Indexer();
  Module appModule = Module.getBootModuleLoader().loadModule(APPLICATION_MODULE_NAME);
  Iterator<Resource> iter = appModule.iterateResources(PathFilters.acceptAll());
  while (iter.hasNext()) {
    Resource each = iter.next();
    if (each.getName().endsWith(".class")) {
      if (!each.getName().equals("module-info.class")) {
        try (InputStream is = each.openStream()) {
          indexer.index(is);
        } catch (IOException e) {
          // ignore
        }
      }
    }
  }
  Index index = indexer.complete();
  Set<ClassInfo> impls = index.getAllKnownImplementors(DotName.createSimple(ConfigurationFilter.class.getName()));
  for (ClassInfo each : impls) {
    String name = each.name().toString();
    Class<? extends ConfigurationFilter> cls = (Class<? extends ConfigurationFilter>) appModule.getClassLoader().loadClass(name);
    try {
      ConfigurationFilter filter = cls.newInstance();
      this.configView.withFilter(filter);
    } catch (InstantiationException | IllegalAccessException e) {
      e.printStackTrace();
    }
  }
}
origin: io.thorntail/container

private void initializeConfigFiltersFatJar() throws ModuleLoadException, IOException, ClassNotFoundException {
  Indexer indexer = new Indexer();
  Module appModule = Module.getBootModuleLoader().loadModule(APPLICATION_MODULE_NAME);
  Iterator<Resource> iter = appModule.iterateResources(PathFilters.acceptAll());
  while (iter.hasNext()) {
    Resource each = iter.next();
    if (each.getName().endsWith(".class")) {
      if (!each.getName().equals("module-info.class")) {
        try (InputStream is = each.openStream()) {
          indexer.index(is);
        } catch (IOException e) {
          // ignore
        }
      }
    }
  }
  Index index = indexer.complete();
  Set<ClassInfo> impls = index.getAllKnownImplementors(DotName.createSimple(ConfigurationFilter.class.getName()));
  for (ClassInfo each : impls) {
    String name = each.name().toString();
    Class<? extends ConfigurationFilter> cls = (Class<? extends ConfigurationFilter>) appModule.getClassLoader().loadClass(name);
    try {
      ConfigurationFilter filter = cls.newInstance();
      this.configView.withFilter(filter);
    } catch (InstantiationException | IllegalAccessException e) {
      e.printStackTrace();
    }
  }
}
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.jboss.eap/wildfly-undertow

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: org.wildfly/wildfly-undertow

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
    }
  }
}
org.jboss.modulesResourceopenStream

Javadoc

Open an input stream to this resource.

Popular methods of Resource

  • getName
    Get the relative resource name.
  • getURL
    Get the complete URL of this resource.

Popular in Java

  • Finding current android device location
  • requestLocationUpdates (LocationManager)
  • addToBackStack (FragmentTransaction)
  • onRequestPermissionsResult (Fragment)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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