use of org.gluu.service.document.store.conf.DocumentStoreType 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.conf.DocumentStoreType in project oxTrust by GluuFederation.
the class JsonConfigurationAction method saveStoreConfigJson.
public String saveStoreConfigJson() {
// Update JSON configurations
try {
log.debug("Saving store-config.json:" + this.storeConfigurationJson);
if (this.storeConfigurationJson != null) {
this.storeConfiguration = convertToStoreConfiguration(this.storeConfigurationJson);
DocumentStoreType type = this.storeConfiguration.getDocumentStoreType();
if (type.equals(DocumentStoreType.JCA) && !canConnectToJca()) {
facesMessages.add(FacesMessage.SEVERITY_ERROR, "Error connecting to JCA with provided configuration");
return OxTrustConstants.RESULT_FAILURE;
}
jsonConfigurationService.saveDocumentStoreConfiguration(this.storeConfiguration);
}
facesMessages.add(FacesMessage.SEVERITY_INFO, "Document store configuration is updated.");
return OxTrustConstants.RESULT_SUCCESS;
} catch (Exception ex) {
log.error("Failed to update store-config.json", ex);
facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to update document store configuration in DB");
}
return OxTrustConstants.RESULT_FAILURE;
}
use of org.gluu.service.document.store.conf.DocumentStoreType in project oxCore by GluuFederation.
the class DocumentStoreProviderFactory method getLocalDocumentStoreProvider.
@Produces
@ApplicationScoped
@LocalDocumentStore
public DocumentStoreProvider getLocalDocumentStoreProvider() {
log.debug("Started to create local document store provider");
DocumentStoreType documentStoreType = DocumentStoreType.LOCAL;
DocumentStoreProvider documentStoreProvider = instance.select(LocalDocumentStoreProvider.class).get();
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.conf.DocumentStoreType in project oxCore by GluuFederation.
the class DocumentStoreProviderFactory 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 proxied bean
DocumentStoreProvider documentStoreProvider = null;
switch(documentStoreType) {
case LOCAL:
documentStoreProvider = instance.select(LocalDocumentStoreProvider.class).get();
break;
case JCA:
documentStoreProvider = instance.select(JcaDocumentStoreProvider.class).get();
break;
case WEB_DAV:
documentStoreProvider = instance.select(WebDavDocumentStoreProvider.class).get();
break;
}
if (documentStoreProvider == null) {
throw new RuntimeException("Failed to initialize DocumentStoreProvider, DocumentStoreProviderType is unsupported: " + documentStoreType);
}
documentStoreProvider.create();
return documentStoreProvider;
}
Aggregations