this.requestUrl = requestUrl;
this.relativeUrls = relativeUrls;
this.ssl = ssl;
this.considerSslPolicies = considerSslPolicies;
ServiceSelector serviceSelector = null;
AccessControllerResolver acResolver = null;
try {
this.factory = DocumentUtil.createDocumentFactory(this.manager, session);
if (this.considerSslPolicies) {
serviceSelector = (ServiceSelector) this.manager
.lookup(AccessControllerResolver.ROLE + "Selector");
acResolver = (AccessControllerResolver) serviceSelector
.select(AccessControllerResolver.DEFAULT_RESOLVER);
AccessController accessController = acResolver.resolveAccessController(requestUrl);
if (accessController != null) {
this.accreditableManager = accessController.getAccreditableManager();
this.policyManager = accessController.getPolicyManager();
}
}
Publication[] pubs = this.factory.getPublications();
for (int i = 0; i < pubs.length; i++) {
this.publicationCache.put(pubs[i].getId(), pubs[i]);
}
} catch (final Exception e) {
throw new RuntimeException(e);
} finally {
if (serviceSelector != null) {
if (acResolver != null) {
serviceSelector.release(acResolver);
}
this.manager.release(serviceSelector);
}
}
}