if (watchedResource.exists()) { resourceExist = true; lastModification = watchedResource.getLastModifiedTime();
/** * Constructor. * * @param resource resource from which to read the metadata file. * @param timer task timer used to schedule metadata refresh tasks * * @throws MetadataProviderException thrown if there is a problem retrieving information about the resource */ public ResourceBackedMetadataProvider(Timer timer, Resource resource) throws MetadataProviderException { super(timer); try { if (!resource.exists()) { throw new MetadataProviderException("Resource " + resource.getLocation() + " does not exist."); } metadataResource = resource; } catch (ResourceException e) { throw new MetadataProviderException("Unable to read resource", e); } }
/** * Constructor. * * @param resource resource from which to read the metadata file. * @param timer task timer used to schedule metadata refresh tasks * @param maxMetadataCacheDuration maximum amount of time, in milliseconds, that metadata may be cached before being * re-read * * @throws MetadataProviderException thrown if there is a problem retrieving information about the resource * * @deprecated */ public ResourceBackedMetadataProvider(Resource resource, Timer timer, long maxMetadataCacheDuration) throws MetadataProviderException { super(timer); try { if (!resource.exists()) { throw new MetadataProviderException("Resource " + resource.getLocation() + " does not exist."); } metadataResource = resource; } catch (ResourceException e) { throw new MetadataProviderException("Unable to read resource", e); } }
for (int i = 0; i < numOfResources; i++) { configurationResource = configurationResources.get(i); if (configurationResource != null && configurationResource.exists()) { configSources[i] = new InputStreamResource(configurationResources.get(i).getInputStream(), configurationResource.getLocation());
try { log.trace("Checking resource for changes: {}", watchedResource.getLocation()); if (watchedResource.exists()) { if (!resourceExist) { resourceExist = true;