Package org.springframework.core.io

Examples of org.springframework.core.io.ResourceLoader


     * @return the {@link org.springframework.test.web.servlet.request.RequestPostProcessor} to use.
     * @throws IOException
     * @throws CertificateException
     */
    public static RequestPostProcessor x509(String resourceName) throws IOException, CertificateException {
        ResourceLoader loader = new DefaultResourceLoader();
        Resource resource = loader.getResource(resourceName);
        InputStream inputStream = resource.getInputStream();
        CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
        X509Certificate certificate = (X509Certificate) certFactory.generateCertificate(inputStream);
        return x509(certificate);
    }
View Full Code Here


  }

  public RutaWordList getWordList(String list) {
    RutaWordList result = wordLists.get(list);
    if (result == null) {
      ResourceLoader resourceLoader = new RutaResourceLoader(getResourcePaths());
      Resource resource = resourceLoader.getResource(list);
      if (resource.exists()) {
        try {
          if (list.endsWith("mtwl")) {
            wordLists.put(list, new MultiTreeWordList(resource));
          } else {
View Full Code Here

  }

  public RutaTable getWordTable(String table) {
    RutaTable result = tables.get(table);
    if (result == null) {
      ResourceLoader resourceLoader = new RutaResourceLoader(getResourcePaths());
      Resource resource = resourceLoader.getResource(table);
      if (resource.exists()) {
        try {
          tables.put(table, new CSVTable(resource));
        } catch (IOException e) {
          Logger.getLogger(this.getClass().getName()).log(Level.SEVERE,
View Full Code Here

    // Set bean properties from init parameters.
    try {
      PropertyValues pvs = new ServletConfigPropertyValues(getServletConfig(), this.requiredProperties);
      BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(this);
      ResourceLoader resourceLoader = new ServletContextResourceLoader(getServletContext());
      bw.registerCustomEditor(Resource.class, new ResourceEditor(resourceLoader));
      initBeanWrapper(bw);
      bw.setPropertyValues(pvs, true);
    }
    catch (BeansException ex) {
View Full Code Here

  }

  public RutaWordList getWordList(String list) {
    RutaWordList result = wordLists.get(list);
    if (result == null) {
      ResourceLoader resourceLoader = new RutaResourceLoader(getResourcePaths());
      Resource resource = resourceLoader.getResource(list);
      if (resource.exists()) {
        try {
          if (list.endsWith("mtwl")) {
            wordLists.put(list, new MultiTreeWordList(resource));
          } else {
View Full Code Here

  }

  public RutaTable getWordTable(String table) {
    RutaTable result = tables.get(table);
    if (result == null) {
      ResourceLoader resourceLoader = new RutaResourceLoader(getResourcePaths());
      Resource resource = resourceLoader.getResource(table);
      if (resource.exists()) {
        try {
          tables.put(table, new CSVTable(resource));
        } catch (IOException e) {
          Logger.getLogger(this.getClass().getName()).log(Level.SEVERE,
View Full Code Here

      }
    } else if (type == ComponentDeclaration.UIMAFIT_ENGINE) {
      List<String> engines = new ArrayList<String>();
      ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(
              true);
      ResourceLoader resourceLoader = new DefaultResourceLoader(classloader);
      provider.setResourceLoader(resourceLoader);
      provider.addIncludeFilter(new AssignableTypeFilter(AnalysisComponent.class));

      String pack = complString.replaceAll("[.]", "/");
      if (pack.endsWith("/")) {
View Full Code Here

    }
    return counter;
  }

  public int loadBeanDefinitions(String location) throws BeanDefinitionStoreException {
    ResourceLoader resourceLoader = getResourceLoader();
    if (resourceLoader == null) {
      throw new BeanDefinitionStoreException(
          "Cannot import bean definitions from location [" + location + "]: no ResourceLoader available");
    }

    if (resourceLoader instanceof ResourcePatternResolver) {
      // Resource pattern matching available.
      try {
        Resource[] resources = ((ResourcePatternResolver) resourceLoader).getResources(location);
        int loadCount = loadBeanDefinitions(resources);
        if (logger.isDebugEnabled()) {
          logger.debug("Loaded " + loadCount + " bean definitions from location pattern [" + location + "]");
        }
        return loadCount;
      }
      catch (IOException ex) {
        throw new BeanDefinitionStoreException(
            "Could not resolve bean definition resource pattern [" + location + "]", ex);
      }
    }
    else {
      // Can only load single resources by absolute URL.
      Resource resource = resourceLoader.getResource(location);
      int loadCount = loadBeanDefinitions(resource);
      if (logger.isDebugEnabled()) {
        logger.debug("Loaded " + loadCount + " bean definitions from location [" + location + "]");
      }
      return loadCount;
View Full Code Here

    if (locationsResourceName == null) {
      locationsResourceName = defaultModuleResourceName;
    }

    ResourceLoader resourceLoader = getResourceLoader();
    Resource resource = resourceLoader.getResource(locationsResourceName);

    if (!resource.exists()) {
      throw new ConfigurationException("Module definition XML resource '" + resource.getDescription()
          + "' does not exist");
    }
View Full Code Here

 
  protected Properties getProperties() {
   
    String bootstrapLocationsResource = getResourceName();

    ResourceLoader resourceLoader = getResourceLoader();
    Resource bootStrapResource = null;
   
    if (bootstrapLocationsResource == null) {
      bootStrapResource = resourceLoader.getResource(defaultBootstrapResource);
    }
    else {
      // figure out which resource loader to use
      bootStrapResource = resourceLoader.getResource(bootstrapLocationsResource);
    }
    Properties properties = null;
    if (bootStrapResource == null || !bootStrapResource.exists()) {
      logger.info("Unable to load locations resource from " + bootstrapLocationsResource + ".");
      properties = new Properties();
View Full Code Here

TOP

Related Classes of org.springframework.core.io.ResourceLoader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.