use of org.gluu.service.document.store.provider.JcaDocumentStoreProvider 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;
}
use of org.gluu.service.document.store.provider.JcaDocumentStoreProvider in project oxTrust by GluuFederation.
the class JsonConfigurationAction method canConnectToJca.
private boolean canConnectToJca() {
try {
JcaDocumentStoreProvider provider = CdiUtil.bean(JcaDocumentStoreProvider.class);
provider.setJcaDocumentStoreConfiguration(storeConfiguration.getJcaConfiguration());
provider.create();
if (provider.isConnected()) {
provider.destroy();
return true;
}
return false;
} catch (Exception e) {
return false;
}
}
Aggregations