use of com.xpn.xwiki.web.XWikiURLFactoryServiceImpl in project xwiki-platform by xwiki.
the class XWiki method getURLFactoryService.
public XWikiURLFactoryService getURLFactoryService() {
if (this.urlFactoryService == null) {
synchronized (this.URLFACTORY_SERVICE_LOCK) {
if (this.urlFactoryService == null) {
LOGGER.info("Initializing URLFactory Service...");
XWikiURLFactoryService factoryService = null;
String urlFactoryServiceClass = getConfiguration().getProperty("xwiki.urlfactory.serviceclass");
if (urlFactoryServiceClass != null) {
try {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Using custom URLFactory Service Class [" + urlFactoryServiceClass + "]");
}
factoryService = (XWikiURLFactoryService) Class.forName(urlFactoryServiceClass).getConstructor(new Class<?>[] { XWiki.class }).newInstance(new Object[] { this });
} catch (Exception e) {
factoryService = null;
LOGGER.warn("Failed to initialize URLFactory Service [" + urlFactoryServiceClass + "]", e);
}
}
if (factoryService == null) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Using default URLFactory Service Class [" + urlFactoryServiceClass + "]");
}
factoryService = new XWikiURLFactoryServiceImpl(this);
}
// Set the urlFactoryService object in one assignment to prevent threading
// issues when checking for
// null above.
this.urlFactoryService = factoryService;
}
}
}
return this.urlFactoryService;
}
Aggregations