use of org.onebusaway.presentation.services.resources.Resource in project onebusaway-application-modules by camsys.
the class ResourceServiceImpl method getExternalUrlForResources.
@Override
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();
}
use of org.onebusaway.presentation.services.resources.Resource in project onebusaway-application-modules by camsys.
the class ResourceServiceImpl method getResourceForPath.
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;
}
return resource;
}
use of org.onebusaway.presentation.services.resources.Resource in project onebusaway-application-modules by camsys.
the class ResourceServiceImpl method getExternalUrlForResource.
/**
**
* {@link ResourceService} Interface
***
*/
@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();
}
Aggregations