mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-18 15:33:09 +00:00
Update code changes from PR #970 to utilize PluginService and ConfigurationService
This commit is contained in:
@@ -34,8 +34,9 @@ import org.dspace.app.xmlui.wing.element.PageMeta;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.authorize.factory.AuthorizeServiceFactory;
|
||||
import org.dspace.authorize.service.AuthorizeService;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
import org.dspace.core.PluginManager;
|
||||
import org.dspace.core.factory.CoreServiceFactory;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
@@ -58,6 +59,7 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
private static final Message T_select_panel = message("xmlui.administrative.ControlPanel.select_panel");
|
||||
|
||||
protected AuthorizeService authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService();
|
||||
protected ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||
|
||||
/**
|
||||
* The service manager allows us to access the continuation's
|
||||
@@ -146,7 +148,7 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
// LIST: options
|
||||
List options = div.addList("options", List.TYPE_SIMPLE, "horizontal");
|
||||
|
||||
String tabs[] = ConfigurationManager.getProperty("controlpanel", "controlpanel.tabs").split(",");
|
||||
String tabs[] = configurationService.getArrayProperty("controlpanel.tabs");
|
||||
|
||||
for(String tab : tabs) {
|
||||
tab = tab.trim();
|
||||
@@ -161,7 +163,7 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
if(selected_tab.equals("")) {
|
||||
div.addPara(T_select_panel);
|
||||
} else {
|
||||
ControlPanelTab cpTab = (ControlPanelTab)PluginManager.getNamedPlugin("controlpanel", ControlPanelTab.class, selected_tab);
|
||||
ControlPanelTab cpTab = (ControlPanelTab)CoreServiceFactory.getInstance().getPluginService().getNamedPlugin(ControlPanelTab.class, selected_tab);
|
||||
if(cpTab instanceof AbstractControlPanelTab) {
|
||||
try {
|
||||
((AbstractControlPanelTab) cpTab).setup(null, objectModel, null, parameters);
|
||||
|
@@ -16,7 +16,6 @@ import org.apache.cocoon.environment.ObjectModelHelper;
|
||||
import org.apache.cocoon.environment.Redirector;
|
||||
import org.apache.cocoon.environment.Request;
|
||||
import org.apache.cocoon.environment.SourceResolver;
|
||||
import org.dspace.harvest.OAIHarvester;
|
||||
import org.dspace.harvest.factory.HarvestServiceFactory;
|
||||
import org.dspace.harvest.service.HarvestSchedulingService;
|
||||
|
||||
|
@@ -15,8 +15,9 @@ import org.dspace.app.xmlui.wing.Message;
|
||||
import org.dspace.app.xmlui.wing.WingException;
|
||||
import org.dspace.app.xmlui.wing.element.Division;
|
||||
import org.dspace.app.xmlui.wing.element.List;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
import org.dspace.storage.rdbms.DatabaseConfigVO;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
|
||||
/**
|
||||
* Control panel tab that displays important configuration.
|
||||
@@ -43,6 +44,7 @@ public class ControlPanelConfigurationTab extends AbstractControlPanelTab {
|
||||
|
||||
private static final String T_UNSET = "UNSET";
|
||||
|
||||
protected ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||
/**
|
||||
* Guarantee a non-null String.
|
||||
*
|
||||
@@ -61,17 +63,17 @@ public class ControlPanelConfigurationTab extends AbstractControlPanelTab {
|
||||
dspace.addItem(Util.getSourceVersion());
|
||||
|
||||
dspace.addLabel(T_DSPACE_DIR);
|
||||
dspace.addItem(notempty(ConfigurationManager.getProperty("dspace.dir")));
|
||||
dspace.addItem(notempty(configurationService.getProperty("dspace.dir")));
|
||||
|
||||
dspace.addLabel(T_DSPACE_URL);
|
||||
String base_url = notempty(ConfigurationManager.getProperty("dspace.url"));
|
||||
String base_url = notempty(configurationService.getProperty("dspace.url"));
|
||||
dspace.addItemXref(base_url, base_url);
|
||||
|
||||
dspace.addLabel(T_DSPACE_HOST_NAME);
|
||||
dspace.addItem(notempty(ConfigurationManager.getProperty("dspace.hostname")));
|
||||
dspace.addItem(notempty(configurationService.getProperty("dspace.hostname")));
|
||||
|
||||
dspace.addLabel(T_DSPACE_NAME);
|
||||
dspace.addItem(notempty(ConfigurationManager.getProperty("dspace.name")));
|
||||
dspace.addItem(notempty(configurationService.getProperty("dspace.name")));
|
||||
|
||||
dspace.addLabel(T_DB_NAME);
|
||||
dspace.addItem(notempty(context.getDbType()));
|
||||
@@ -87,16 +89,16 @@ public class ControlPanelConfigurationTab extends AbstractControlPanelTab {
|
||||
dspace.addItem(notempty(String.valueOf(dbConfig.getMaxConnections())));
|
||||
|
||||
dspace.addLabel(T_MAIL_SERVER);
|
||||
dspace.addItem(notempty(ConfigurationManager.getProperty("mail.server")));
|
||||
dspace.addItem(notempty(configurationService.getProperty("mail.server")));
|
||||
|
||||
dspace.addLabel(T_MAIL_FROM_ADDRESS);
|
||||
dspace.addItem(notempty(ConfigurationManager.getProperty("mail.from.address")));
|
||||
dspace.addItem(notempty(configurationService.getProperty("mail.from.address")));
|
||||
|
||||
dspace.addLabel(T_FEEDBACK_RECIPIENT);
|
||||
dspace.addItem(notempty(ConfigurationManager.getProperty("feedback.recipient")));
|
||||
dspace.addItem(notempty(configurationService.getProperty("feedback.recipient")));
|
||||
|
||||
dspace.addLabel(T_MAIL_ADMIN);
|
||||
dspace.addItem(notempty(ConfigurationManager.getProperty("mail.admin")));
|
||||
dspace.addItem(notempty(configurationService.getProperty("mail.admin")));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -8,7 +8,6 @@
|
||||
package org.dspace.app.xmlui.aspect.administrative.controlpanel;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -17,11 +16,12 @@ import org.dspace.app.xmlui.wing.WingException;
|
||||
import org.dspace.app.xmlui.wing.element.Division;
|
||||
import org.dspace.app.xmlui.wing.element.Item;
|
||||
import org.dspace.app.xmlui.wing.element.List;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
import org.dspace.harvest.HarvestScheduler;
|
||||
import org.dspace.harvest.HarvestedCollection;
|
||||
import org.dspace.harvest.factory.HarvestServiceFactory;
|
||||
import org.dspace.harvest.service.HarvestedCollectionService;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
|
||||
/**
|
||||
* Control panel tab that controls the OAI harvester.
|
||||
@@ -69,6 +69,8 @@ public class ControlPanelHarvestingTab extends AbstractControlPanelTab
|
||||
|
||||
protected HarvestedCollectionService harvestedCollectionService = HarvestServiceFactory.getInstance().getHarvestedCollectionService();
|
||||
|
||||
protected ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||
|
||||
@Override
|
||||
public void addBody(Map objectModel, Division div) throws WingException,
|
||||
SQLException
|
||||
@@ -165,16 +167,14 @@ public class ControlPanelHarvestingTab extends AbstractControlPanelTab
|
||||
generatorSettings.setHead(T_harvest_head_generator_settings);
|
||||
|
||||
generatorSettings.addLabel(T_harvest_label_oai_url);
|
||||
String oaiUrl = ConfigurationManager.getProperty("oai",
|
||||
"dspace.oai.url");
|
||||
String oaiUrl = configurationService.getProperty("oai.url");
|
||||
if (!StringUtils.isEmpty(oaiUrl))
|
||||
{
|
||||
generatorSettings.addItemXref(oaiUrl, oaiUrl);
|
||||
}
|
||||
|
||||
generatorSettings.addLabel(T_harvest_label_oai_source);
|
||||
String oaiAuthoritativeSource = ConfigurationManager.getProperty("oai",
|
||||
"ore.authoritative.source");
|
||||
String oaiAuthoritativeSource = configurationService.getProperty("oai.ore.authoritative.source");
|
||||
if (!StringUtils.isEmpty(oaiAuthoritativeSource))
|
||||
{
|
||||
generatorSettings.addItem(oaiAuthoritativeSource);
|
||||
@@ -189,18 +189,13 @@ public class ControlPanelHarvestingTab extends AbstractControlPanelTab
|
||||
List harvesterSettings = div.addList("oai-harvester-settings");
|
||||
harvesterSettings.setHead(T_harvest_head_harvester_settings);
|
||||
|
||||
String metaString = "harvester.";
|
||||
Enumeration pe = ConfigurationManager.propertyNames();
|
||||
while (pe.hasMoreElements())
|
||||
{
|
||||
String key = (String) pe.nextElement();
|
||||
if (key.startsWith(metaString))
|
||||
java.util.List<String> harvesterKeys = configurationService.getPropertyKeys("harvester");
|
||||
for(String key : harvesterKeys)
|
||||
{
|
||||
harvesterSettings.addLabel(key);
|
||||
harvesterSettings.addItem(ConfigurationManager.getProperty(key)
|
||||
harvesterSettings.addItem(configurationService.getProperty(key)
|
||||
+ " ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user