mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-14 05:23:14 +00:00
DS-3190: Refactor org.dspace.rdf.* to use spring.
dspace-rdf was developed as standalone module. At the end of the development most of it was moved to be included into dspace-api. Instead of using Spring it used its own class that instantiated all necessary classes. This PR solves the problem described in DS-3190 by refactoring org.dspace.rdf to adapt patterns used in DSpace 6. It introduces [dspace]/config/spring/api/rdf.xml to configure spring to instantiate all necessary classes. org.dspace.rdf.RDFConfiguration was removed completely, the configuration keys are centralised in org.dspace.rdf.RDFUtil. Instead of org.dspace.rdf.RDFConfiguration and DSpace's old ConfigurationManager the new ConfigurationService is now used everywhere. Configuration properties shouldn't be hold in variables anymore so that RDF profits from the new autoreload function from DS-2654.
This commit is contained in:
@@ -39,6 +39,8 @@ import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.handle.factory.HandleServiceFactory;
|
||||
import org.dspace.handle.service.HandleService;
|
||||
import org.dspace.rdf.factory.RDFFactory;
|
||||
import org.dspace.rdf.storage.RDFStorage;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
|
||||
@@ -53,17 +55,19 @@ public class RDFizer {
|
||||
|
||||
private static final Logger log = Logger.getLogger(RDFizer.class);
|
||||
|
||||
protected ConfigurationService configurationService;
|
||||
|
||||
protected boolean stdout;
|
||||
protected boolean verbose;
|
||||
protected boolean dryrun;
|
||||
protected String lang;
|
||||
protected Context context;
|
||||
|
||||
protected final ConfigurationService configurationService;
|
||||
protected final ContentServiceFactory contentServiceFactory;
|
||||
protected final CommunityService communityService;
|
||||
protected final ItemService itemService;
|
||||
protected final HandleService handleService;
|
||||
protected final RDFStorage storage;
|
||||
|
||||
|
||||
/**
|
||||
* Set to remember with DSpaceObject were converted or deleted from the
|
||||
@@ -75,17 +79,19 @@ public class RDFizer {
|
||||
|
||||
public RDFizer()
|
||||
{
|
||||
this.configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||
this.stdout = false;
|
||||
this.verbose = false;
|
||||
this.dryrun = false;
|
||||
this.lang = "TURTLE";
|
||||
this.processed = new CopyOnWriteArraySet<UUID>();
|
||||
this.context = new Context(Context.READ_ONLY);
|
||||
|
||||
this.configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||
this.contentServiceFactory = ContentServiceFactory.getInstance();
|
||||
this.communityService = contentServiceFactory.getCommunityService();
|
||||
this.itemService = contentServiceFactory.getItemService();
|
||||
this.handleService = HandleServiceFactory.getInstance().getHandleService();
|
||||
this.storage = RDFFactory.getInstance().getRDFStorage();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,7 +176,7 @@ public class RDFizer {
|
||||
public void deleteAll()
|
||||
{
|
||||
report("Sending delete command to the triple store.");
|
||||
if (!this.dryrun) RDFConfiguration.getRDFStorage().deleteAll();
|
||||
if (!this.dryrun) storage.deleteAll();
|
||||
report("Deleted all data from the triplestore.");
|
||||
}
|
||||
|
||||
@@ -218,7 +224,7 @@ public class RDFizer {
|
||||
report("Deleting Named Graph" + identifier);
|
||||
if (!dryrun)
|
||||
{
|
||||
RDFConfiguration.getRDFStorage().delete(identifier);
|
||||
storage.delete(identifier);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -412,9 +418,11 @@ public class RDFizer {
|
||||
}
|
||||
|
||||
// Currently Bundles and Bitsreams aren't supported as independent entities.
|
||||
// The should be converted as part of an item. So we do not need to make
|
||||
// They should be converted as part of an item. So we do not need to make
|
||||
// the recursive call for them. An item itself will be converted as part
|
||||
// of the callback call below.
|
||||
// The following code is left here for the day, we decide to also convert
|
||||
// bundles and/or bitstreams.
|
||||
//
|
||||
// if (dso instanceof Item)
|
||||
// {
|
||||
@@ -563,7 +571,7 @@ public class RDFizer {
|
||||
{
|
||||
if (!this.dryrun)
|
||||
{
|
||||
RDFConfiguration.getRDFStorage().delete(identifier);
|
||||
storage.delete(identifier);
|
||||
}
|
||||
if (this.verbose)
|
||||
{
|
||||
|
Reference in New Issue
Block a user