Package org.onebusaway.presentation.services.resources

Examples of org.onebusaway.presentation.services.resources.Resource


  @Override
  public String getExternalUrlForResource(String resourcePath, Locale locale) {

    LocaleProvider localeProvider = new LocaleProviderImpl(locale);

    Resource resource = getResourceForPath(resourcePath, localeProvider, null);

    if (resource == null) {
      _log.warn("resource not found: " + resourcePath);
      return null;
    }

    if (_debug)
      refreshResource(resource);

    return resource.getExternalUrl();
  }
View Full Code Here


  public String getExternalUrlForResources(String resourceId,
      List<String> resourcePaths, Locale locale) {

    LocaleProvider localeProvider = new LocaleProviderImpl(locale);

    Resource resource = getResourceForPaths(resourceId, resourcePaths,
        localeProvider);

    if (resource == null) {
      _log.warn("resource not found: " + resourceId);
      return null;
    }

    if (_debug)
      refreshResource(resource);

    return resource.getExternalUrl();
  }
View Full Code Here

  }

  @Override
  public Resource getLocalResourceForExternalId(String externalId, Locale locale) {

    Resource resource = _resourceEntriesByExternalId.get(externalId);

    if (resource == null) {

      /**
       * In case the resource has not been first requested as a resource(url)
View Full Code Here

  private Resource getResourceForPath(String resourcePath,
      LocaleProvider localeProvider, URL sourceUrl) {

    String resourcePathKey = getResourcePathAsKey(resourcePath, localeProvider);

    Resource resource = _resourceEntriesByResourcePath.get(resourcePathKey);

    if (resource == null) {

      resource = createResourceForPath(resourcePath, sourceUrl, localeProvider);

      if (resource == null)
        return null;

      Resource existingResource = _resourceEntriesByResourcePath.putIfAbsent(
          resourcePathKey, resource);

      if (existingResource != null)
        return existingResource;
    }
View Full Code Here

      org.springframework.core.io.Resource[] resources = resolver.getResources(collectionResourcePath);

      for (org.springframework.core.io.Resource resource : resources) {
        URL url = resource.getURL();
        String name = getLocalUrlAsResourceName(url);
        Resource r = getResourceForPath(name, localeProvider, url);
        if (r != null) {
          String path = url.getPath();
          int sepIndex = path.lastIndexOf(File.separator);
          if (sepIndex != -1)
            path = path.substring(sepIndex + 1);
          resourceMapping.put(path, r.getExternalUrl());

          String alternateId = PREFIX_COLLECTION_ENTRY + collectionPrefix + ":"
              + path;
          _resourceEntriesByResourcePath.put(alternateId, r);
        }
View Full Code Here

      _resourcePathsById.putIfAbsent(resourceId, resourcePaths);
    }

    String resourceIdKey = getResourcePathAsKey(resourceId, localeProvider);

    Resource resource = _resourceEntriesByResourcePath.get(resourceIdKey);

    if (resource == null) {

      resource = createResourceForPaths(resourceId, resourcePaths,
          localeProvider);

      if (resource == null)
        return null;

      Resource existingResource = _resourceEntriesByResourcePath.putIfAbsent(
          resourceIdKey, resource);

      if (existingResource != null)
        return existingResource;
    }
View Full Code Here

    String extension = null;

    for (String resourcePath : resourcePaths) {

      Resource resource = getResourceForPath(resourcePath, localeProvider, null);

      if (resource == null)
        return null;

      resources.add(resource);
View Full Code Here

TOP

Related Classes of org.onebusaway.presentation.services.resources.Resource

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.