use of org.mycore.common.config.MCRConfiguration in project mycore by MyCoRe-Org.
the class MCRTestCaseHelper method before.
public static void before(Map<String, String> testProperties) {
String mcrComp = MCRRuntimeComponentDetector.getMyCoReComponents().stream().map(MCRComponent::toString).collect(Collectors.joining(", "));
String appMod = MCRRuntimeComponentDetector.getApplicationModules().stream().map(MCRComponent::toString).collect(Collectors.joining(", "));
System.out.printf("MyCoRe components detected: %s\nApplications modules detected: %s\n", mcrComp.isEmpty() ? "'none'" : mcrComp, appMod.isEmpty() ? "'none'" : appMod);
MCRConfiguration config = MCRConfiguration.instance();
MCRConfigurationLoader configurationLoader = MCRConfigurationLoaderFactory.getConfigurationLoader();
HashMap<String, String> baseProperties = new HashMap<>(configurationLoader.load());
baseProperties.putAll(testProperties);
config.initialize(baseProperties, true);
}
use of org.mycore.common.config.MCRConfiguration in project mycore by MyCoRe-Org.
the class MCRCStoreIFS2 method init.
@Override
public void init(String storeID) {
super.init(storeID);
MCRConfiguration config = MCRConfiguration.instance();
baseDir = config.getString(storeConfigPrefix + "BaseDir");
LOGGER.info("Base directory for store {} is {}", storeID, baseDir);
String pattern = config.getString("MCR.Metadata.ObjectID.NumberPattern", "0000000000");
slotLayout = pattern.length() - 4 + "-2-2";
slotLayout = config.getString(storeConfigPrefix + "SlotLayout", slotLayout);
LOGGER.info("Default slot layout for store {} is {}", storeID, slotLayout);
ignoreOwnerBase = config.getBoolean(storeConfigPrefix + "IgnoreOwnerBase", false);
}
use of org.mycore.common.config.MCRConfiguration in project mycore by MyCoRe-Org.
the class MCRCASServlet method init.
@Override
public void init() throws ServletException {
super.init();
MCRConfiguration config = MCRConfiguration.instance();
clientURL = config.getString(MCRUser2Constants.CONFIG_PREFIX + "CAS.ClientURL");
serverURL = config.getString(MCRUser2Constants.CONFIG_PREFIX + "CAS.ServerURL");
realmID = config.getString(MCRUser2Constants.CONFIG_PREFIX + "CAS.RealmID");
// Set properties to enable SSL connection to CAS and accept certificates
String trustStore = config.getString(MCRUser2Constants.CONFIG_PREFIX + "CAS.SSL.TrustStore");
String trustStorePassword = config.getString(MCRUser2Constants.CONFIG_PREFIX + "CAS.SSL.TrustStore.Password");
System.setProperty("javax.net.ssl.trustStore", trustStore);
System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword);
}
use of org.mycore.common.config.MCRConfiguration in project mycore by MyCoRe-Org.
the class MCRRoleServlet method init.
/* (non-Javadoc)
* @see org.mycore.frontend.servlets.MCRServlet#init()
*/
@Override
public void init() throws ServletException {
super.init();
roleClassificationsDefined = false;
roleCategories = new ArrayList<>();
roleCategories.add(MCRUser2Constants.ROLE_CLASSID);
MCRConfiguration config = MCRConfiguration.instance();
String roleCategoriesValue = config.getString(MCRUser2Constants.CONFIG_PREFIX + "RoleCategories", null);
if (roleCategoriesValue == null) {
return;
}
String[] roleCategoriesSplitted = roleCategoriesValue.split(",");
for (String roleID : roleCategoriesSplitted) {
String categoryId = roleID.trim();
if (categoryId.length() > 0) {
roleCategories.add(MCRCategoryID.fromString(categoryId));
}
}
roleClassificationsDefined = roleCategories.size() > 1;
categoryDao = MCRCategoryDAOFactory.getInstance();
}
use of org.mycore.common.config.MCRConfiguration in project mycore by MyCoRe-Org.
the class MCRViewerMetsConfiguration method setup.
@Override
public MCRViewerConfiguration setup(HttpServletRequest request) {
super.setup(request);
// properties
setProperty("metsURL", MCRServlet.getServletBaseURL() + "MCRMETSServlet/" + getDerivate(request));
// Parameter can be used to provide multiple urls
String imageXmlPath = MCRConfiguration.instance().getString("MCR.Viewer.BaseURL", null);
if (imageXmlPath == null || imageXmlPath.isEmpty()) {
imageXmlPath = MCRServlet.getServletBaseURL() + "MCRTileServlet/";
}
setProperty("tileProviderPath", imageXmlPath);
if (imageXmlPath.contains(",")) {
imageXmlPath = imageXmlPath.split(",")[0];
}
setProperty("imageXmlPath", imageXmlPath);
setProperty("pdfCreatorStyle", MCRConfiguration.instance().getString("MCR.Viewer.PDFCreatorStyle", null));
setProperty("pdfCreatorURI", MCRConfiguration.instance().getString("MCR.Viewer.PDFCreatorURI", null));
setProperty("text.enabled", MCRConfiguration.instance().getString("MCR.Viewer.text.enabled", "false"));
MCRConfiguration configuration = MCRConfiguration.instance();
setProperty("pdfCreatorFormatString", configuration.getString("MCR.Viewer.PDFCreatorFormatString", null));
setProperty("pdfCreatorRestrictionFormatString", configuration.getString("MCR.Viewer.PDFCreatorRestrictionFormatString", null));
// script
addLocalScript("iview-client-mets.js", isDebugParameterSet(request));
return this;
}
Aggregations