コード例 #1
0
  private void scanResourcesRoot(VirtualFile file) {
    if (file == null) {
      return;
    }

    Collection<VirtualFile> children = file.getChildren();
    for (VirtualFile child : children) {
      if (child.isFile()) {
        resources.add(ResourceKey.create(child.getName()));
      } else {
        String libraryName = child.getName();
        VirtualFile libraryDir = ResourceUtil.getLatestVersion(child, true);
        if (libraryDir != null) {
          scanLibrary(libraryName, libraryDir);
        }
      }
    }
  }
コード例 #2
0
  /*
   * (non-Javadoc)
   *
   * @see org.richfaces.application.Initializable#init()
   */
  @Override
  public void init() {
    final Map<ResourceKey, ExternalMapping> result = Maps.newHashMap();

    final List<String> mappingFiles = ResourceMappingFeature.getMappingFiles();
    for (String mappingFile : mappingFiles) {
      if (classpathResourceExistsForLocation(mappingFile)) {
        for (Entry<String, String> entry : PropertiesUtil.loadProperties(mappingFile).entrySet()) {
          final ResourceKey resourceKey = ResourceKey.create(entry.getKey());
          final String resourceLocation = entry.getValue();
          result.put(resourceKey, new ExternalMapping(resourceKey, resourceLocation));
        }
      } else {
        if (!isDefaultStaticResourceMappingLocation(mappingFile)) {
          LOGGER.warn(
              "Resource mapping is configured to load non-existent resource: '"
                  + mappingFile
                  + "'");
        }
      }
    }

    externalStaticResources = result;
  }