Added component annotations.

Added comment.

Fixed import.
This commit is contained in:
Michael Spalti
2021-10-07 11:54:03 -07:00
parent f92592846d
commit f15a18254e
4 changed files with 6 additions and 2 deletions

View File

@@ -6,13 +6,16 @@
* http://www.dspace.org/license/ * http://www.dspace.org/license/
*/ */
package org.dspace.iiif; package org.dspace.iiif;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
/** /**
* Exposes the Spring web application's IIIF cache evict service to the DSpace event consumer. * Exposes the Spring web application's IIIF cache evict service to the DSpace event consumer.
*/ */
@Component
public class CacheEvictBeanLocator implements ApplicationContextAware { public class CacheEvictBeanLocator implements ApplicationContextAware {
private static ApplicationContext context; private static ApplicationContext context;

View File

@@ -9,10 +9,12 @@ package org.dspace.iiif;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.CacheManager; import org.springframework.cache.CacheManager;
import org.springframework.stereotype.Component;
/** /**
* Removes items from the iiif manifests cache. * Removes items from the iiif manifests cache.
*/ */
@Component
public class CacheEvictService { public class CacheEvictService {
// The cache that is managed by this service. // The cache that is managed by this service.

View File

@@ -45,6 +45,7 @@ public class IIIFCacheEventConsumer implements Consumer {
@Override @Override
public void consume(Context ctx, Event event) throws Exception { public void consume(Context ctx, Event event) throws Exception {
// The service null when the web application context is not provided (i.e. command line operations).
if (cacheEvictService == null) { if (cacheEvictService == null) {
return; return;
} }

View File

@@ -21,8 +21,6 @@ import org.dspace.app.rest.utils.DSpaceConfigurationInitializer;
import org.dspace.app.rest.utils.DSpaceKernelInitializer; import org.dspace.app.rest.utils.DSpaceKernelInitializer;
import org.dspace.app.sitemap.GenerateSitemaps; import org.dspace.app.sitemap.GenerateSitemaps;
import org.dspace.app.util.DSpaceContextListener; import org.dspace.app.util.DSpaceContextListener;
import org.dspace.iiif.CacheEvictBeanLocator;
import org.dspace.iiif.CacheEvictService;
import org.dspace.utils.servlet.DSpaceWebappServletFilter; import org.dspace.utils.servlet.DSpaceWebappServletFilter;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;