use of org.mycore.common.config.MCRConfiguration in project mycore by MyCoRe-Org.
the class MCREventManager method getEventHandler.
public MCREventHandler getEventHandler(String mode, String propertyValue) {
MCRConfiguration configuration = MCRConfiguration.instance();
if ("Class".equals(mode)) {
return configuration.getSingleInstanceOf(propertyValue);
}
String className = CONFIG_PREFIX + "Mode." + mode;
MCREventHandlerInitializer configuredInitializer = configuration.getSingleInstanceOf(className);
return configuredInitializer.getInstance(propertyValue);
}
use of org.mycore.common.config.MCRConfiguration in project mycore by MyCoRe-Org.
the class MCRContentTransformerFactory method buildTransformer.
/**
* Creates and initializes the transformer with the given ID.
*/
private static synchronized MCRContentTransformer buildTransformer(String id) {
String property = "MCR.ContentTransformer." + id + ".Class";
MCRConfiguration config = MCRConfiguration.instance();
if (config.getString(property, null) == null) {
// check for reasonable default:
String stylesheets = config.getString("MCR.ContentTransformer." + id + ".Stylesheet", null);
if (stylesheets == null) {
return null;
}
}
MCRContentTransformer transformer = config.getInstanceOf(property, MCRXSLTransformer.class.getCanonicalName());
transformer.init(id);
transformers.put(id, transformer);
return transformer;
}
use of org.mycore.common.config.MCRConfiguration in project mycore by MyCoRe-Org.
the class MCRIView2XSLFunctionsAdapter method getOptions.
public String getOptions(String derivateID, String extensions) {
MCRConfiguration config = MCRConfiguration.instance();
final Collection<String> sources = LINK_TABLE_MANAGER.getSourceOf(derivateID, "derivate");
String objectID = (sources != null && !sources.isEmpty()) ? sources.iterator().next() : "";
StringBuilder options = new StringBuilder();
options.append('{');
options.append("\"derivateId\":").append('\"').append(derivateID).append("\",");
options.append("\"objectId\":").append('\"').append(objectID).append("\",");
options.append("\"webappBaseUri\":").append('\"').append(MCRFrontendUtil.getBaseURL()).append("\",");
String baseUris = config.getString("MCR.Module-iview2.BaseURL", "");
if (baseUris.length() < 10) {
baseUris = MCRServlet.getServletBaseURL() + "MCRTileServlet";
}
options.append("\"baseUri\":").append('\"').append(baseUris).append("\".split(\",\")");
if (MCRAccessManager.checkPermission(derivateID, "create-pdf")) {
options.append(",\"pdfCreatorURI\":").append('\"').append(config.getString("MCR.Module-iview2.PDFCreatorURI", "")).append("\",");
options.append("\"pdfCreatorStyle\":").append('\"').append(config.getString("MCR.Module-iview2.PDFCreatorStyle", "")).append("\"");
}
if (extensions != null && !extensions.equals("")) {
options.append(",");
options.append(extensions);
}
options.append('}');
LOGGER.debug(options.toString());
return options.toString();
}
use of org.mycore.common.config.MCRConfiguration in project mycore by MyCoRe-Org.
the class MCRIFS2Commands method getDerivatesOfProject.
private static ArrayList<String> getDerivatesOfProject(String content_store, String project_id) {
ArrayList<String> derivates = new ArrayList<>();
// get the IFS1.5
MCRConfiguration config = MCRConfiguration.instance();
String content_store_basepath = config.getString("MCR.IFS.ContentStore." + content_store + ".BaseDir", "");
if (content_store_basepath.length() == 0) {
LOGGER.error("Cant find base directory property in form MCR.IFS.ContentStore.{}.BaseDir", content_store);
return derivates;
}
String slot_layout = config.getString("MCR.IFS.ContentStore." + content_store + ".SlotLayout", "");
if (slot_layout.length() == 0) {
LOGGER.error("Cant find slot layout property in form MCR.IFS.ContentStore.{}.SlotLayout", content_store);
return derivates;
}
File project_dir = new File(content_store_basepath, project_id);
if (!project_dir.exists()) {
LOGGER.error("Wrong project ID; can't find directory {}", project_dir.getAbsolutePath());
return derivates;
}
File derivate_dir = new File(project_dir, "derivate");
int max_slot_deep = countCharacter(slot_layout, '-', 0) + 1;
searchRecurive(derivates, derivate_dir, max_slot_deep, 0, project_id);
return derivates;
}
use of org.mycore.common.config.MCRConfiguration in project mycore by MyCoRe-Org.
the class MCRIFS2Commands method getDerivatesOfObject.
private static ArrayList<String> getDerivatesOfObject(String content_store, String object_id) {
ArrayList<String> derivates = new ArrayList<>();
MCRConfiguration config = MCRConfiguration.instance();
String content_store_basepath = config.getString("MCR.IFS.ContentStore." + content_store + ".BaseDir", "");
if (content_store_basepath.length() == 0) {
LOGGER.error("Cant find base directory property in form MCR.IFS.ContentStore.{}.BaseDir", content_store);
return derivates;
}
derivates = (ArrayList<String>) MCRLinkTableManager.instance().getDestinationOf(object_id, "derivate");
return derivates;
}
Aggregations