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