Search in sources :

Example 1 with WorkManager

use of org.jboss.jca.common.api.metadata.resourceadapter.WorkManager in project wildfly by wildfly.

the class RaOperationUtil method buildResourceAdaptersObject.

public static ModifiableResourceAdapter buildResourceAdaptersObject(final String id, final OperationContext context, ModelNode operation, String archiveOrModule) throws OperationFailedException {
    Map<String, String> configProperties = new HashMap<>(0);
    List<ConnectionDefinition> connectionDefinitions = new ArrayList<>(0);
    List<AdminObject> adminObjects = new ArrayList<>(0);
    TransactionSupportEnum transactionSupport = operation.hasDefined(TRANSACTION_SUPPORT.getName()) ? TransactionSupportEnum.valueOf(operation.get(TRANSACTION_SUPPORT.getName()).asString()) : null;
    String bootstrapContext = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, operation, BOOTSTRAP_CONTEXT);
    List<String> beanValidationGroups = BEANVALIDATION_GROUPS.unwrap(context, operation);
    boolean wmSecurity = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, operation, WM_SECURITY);
    WorkManager workManager = null;
    if (wmSecurity) {
        final boolean mappingRequired = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, operation, WM_SECURITY_MAPPING_REQUIRED);
        String domain;
        final String elytronDomain = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, operation, WM_ELYTRON_SECURITY_DOMAIN);
        if (elytronDomain != null) {
            domain = elytronDomain;
        } else {
            domain = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, operation, WM_SECURITY_DOMAIN);
        }
        final String defaultPrincipal = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, operation, WM_SECURITY_DEFAULT_PRINCIPAL);
        final List<String> defaultGroups = WM_SECURITY_DEFAULT_GROUPS.unwrap(context, operation);
        final Map<String, String> groups = ModelNodeUtil.extractMap(operation, WM_SECURITY_MAPPING_GROUPS, WM_SECURITY_MAPPING_FROM, WM_SECURITY_MAPPING_TO);
        final Map<String, String> users = ModelNodeUtil.extractMap(operation, WM_SECURITY_MAPPING_USERS, WM_SECURITY_MAPPING_FROM, WM_SECURITY_MAPPING_TO);
        workManager = new WorkManagerImpl(new WorkManagerSecurityImpl(mappingRequired, domain, elytronDomain != null, defaultPrincipal, defaultGroups, users, groups));
    }
    ModifiableResourceAdapter ra;
    ra = new ModifiableResourceAdapter(id, archiveOrModule, transactionSupport, connectionDefinitions, adminObjects, configProperties, beanValidationGroups, bootstrapContext, workManager);
    return ra;
}
Also used : ConnectionDefinition(org.jboss.jca.common.api.metadata.resourceadapter.ConnectionDefinition) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) WorkManagerSecurityImpl(org.jboss.as.connector.metadata.resourceadapter.WorkManagerSecurityImpl) WorkManagerImpl(org.jboss.jca.common.metadata.resourceadapter.WorkManagerImpl) WorkManager(org.jboss.jca.common.api.metadata.resourceadapter.WorkManager) TransactionSupportEnum(org.jboss.jca.common.api.metadata.common.TransactionSupportEnum) AdminObject(org.jboss.jca.common.api.metadata.resourceadapter.AdminObject)

Aggregations

ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 WorkManagerSecurityImpl (org.jboss.as.connector.metadata.resourceadapter.WorkManagerSecurityImpl)1 TransactionSupportEnum (org.jboss.jca.common.api.metadata.common.TransactionSupportEnum)1 AdminObject (org.jboss.jca.common.api.metadata.resourceadapter.AdminObject)1 ConnectionDefinition (org.jboss.jca.common.api.metadata.resourceadapter.ConnectionDefinition)1 WorkManager (org.jboss.jca.common.api.metadata.resourceadapter.WorkManager)1 WorkManagerImpl (org.jboss.jca.common.metadata.resourceadapter.WorkManagerImpl)1