use of org.gluu.service.document.store.provider.LocalDocumentStoreProvider in project oxCore by GluuFederation.
the class StandaloneDocumentStoreProviderFactory method getDocumentStoreProvider.
public DocumentStoreProvider getDocumentStoreProvider(DocumentStoreConfiguration documentStoreConfiguration) {
DocumentStoreType documentStoreType = documentStoreConfiguration.getDocumentStoreType();
if (documentStoreType == null) {
LOG.error("Failed to initialize documentStoreProvider, documentStoreProviderType is null. Fallback to LOCAL type.");
documentStoreType = DocumentStoreType.LOCAL;
}
// Create bean
DocumentStoreProvider documentStoreProvider = null;
switch(documentStoreType) {
case LOCAL:
LocalDocumentStoreProvider localDocumentStoreProvider = new LocalDocumentStoreProvider();
localDocumentStoreProvider.configure(documentStoreConfiguration);
localDocumentStoreProvider.init();
documentStoreProvider = localDocumentStoreProvider;
break;
case JCA:
if (stringEncrypter == null) {
throw new RuntimeException("Factory is not initialized properly. stringEncrypter is not specified");
}
JcaDocumentStoreProvider jcaDocumentStoreProvider = new JcaDocumentStoreProvider();
jcaDocumentStoreProvider.configure(documentStoreConfiguration, stringEncrypter);
jcaDocumentStoreProvider.init();
documentStoreProvider = jcaDocumentStoreProvider;
break;
case WEB_DAV:
if (stringEncrypter == null) {
throw new RuntimeException("Factory is not initialized properly. stringEncrypter is not specified");
}
WebDavDocumentStoreProvider webDavDocumentStoreProvider = new WebDavDocumentStoreProvider();
webDavDocumentStoreProvider.configure(documentStoreConfiguration, stringEncrypter);
webDavDocumentStoreProvider.init();
documentStoreProvider = webDavDocumentStoreProvider;
break;
}
if (documentStoreProvider == null) {
throw new RuntimeException("Failed to initialize documentStoreProvider, documentStoreProviderType is unsupported: " + documentStoreType);
}
documentStoreProvider.create();
return documentStoreProvider;
}
Aggregations