public static boolean isLegacySecurityRequired(SecurityMetadata security) { // no security config if (security == null) return false; // security uses elytron if (security instanceof org.jboss.as.connector.metadata.api.common.SecurityMetadata && ((org.jboss.as.connector.metadata.api.common.SecurityMetadata) security).isElytronEnabled()) return false; // check if legacy domain is non-null final String domain = security.resolveSecurityDomain(); return domain != null && domain.trim().length() > 0; }
setAttribute(model, MAX_POOL_SIZE, pool.getMaxPoolSize()); setAttribute(model, MIN_POOL_SIZE, pool.getMinPoolSize()); setAttribute(model, INITIAL_POOL_SIZE, pool.getInitialPoolSize()); if (pool.getCapacity() != null) { if (pool.getCapacity().getIncrementer() != null) { setAttribute(model, CAPACITY_INCREMENTER_CLASS, pool.getCapacity().getIncrementer().getClassName()); if (pool.getCapacity().getIncrementer().getConfigPropertiesMap() != null) { for (Map.Entry<String, String> config : pool.getCapacity().getIncrementer().getConfigPropertiesMap().entrySet()) { model.get(CAPACITY_INCREMENTER_PROPERTIES.getName(), config.getKey()).set(config.getValue()); if (pool.getCapacity().getDecrementer() != null) { setAttribute(model, CAPACITY_DECREMENTER_CLASS, pool.getCapacity().getDecrementer().getClassName()); if (pool.getCapacity().getDecrementer().getConfigPropertiesMap() != null) { for (Map.Entry<String, String> config : pool.getCapacity().getDecrementer().getConfigPropertiesMap().entrySet()) { model.get(CAPACITY_DECREMENTER_PROPERTIES.getName(), config.getKey()).set(config.getValue()); setAttribute(model, POOL_USE_STRICT_MIN, pool.isUseStrictMin()); if (pool.getFlushStrategy() != null) setAttribute(model, POOL_FLUSH_STRATEGY, pool.getFlushStrategy().name()); setAttribute(model, POOL_PREFILL, pool.isPrefill()); setAttribute(model, POOL_FAIR, pool.isFair()); setAttribute(model, WRAP_XA_RESOURCE, xaPool.isWrapXaResource()); setAttribute(model, SAME_RM_OVERRIDE, xaPool.isSameRmOverride()); setAttribute(model, PAD_XID, xaPool.isPadXid());
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((className == null) ? 0 : className.hashCode()); result = prime * result + ((configProperties == null) ? 0 : configProperties.hashCode()); result = prime * result + ((enabled == null) ? 0 : enabled.hashCode()); result = prime * result + ((jndiName == null) ? 0 : jndiName.hashCode()); result = prime * result + ((pool == null) ? 0 : pool.hashCode()); result = prime * result + ((poolName == null) ? 0 : poolName.hashCode()); result = prime * result + ((recovery == null) ? 0 : recovery.hashCode()); result = prime * result + ((security == null) ? 0 : security.hashCode()); result = prime * result + ((timeOut == null) ? 0 : timeOut.hashCode()); result = prime * result + ((useJavaContext == null) ? 0 : useJavaContext.hashCode()); result = prime * result + ((useCcm == null) ? 0 : useCcm.hashCode()); result = prime * result + ((validation == null) ? 0 : validation.hashCode()); result = prime * result + ((isXa() == null) ? 0 : isXa().hashCode()); result = prime * result + ((sharable == null) ? 0 : sharable.hashCode()); result = prime * result + ((enlistment == null) ? 0 : enlistment.hashCode()); result = prime * result + ((connectable == null) ? 0 : connectable.hashCode()); result = prime * result + ((tracking == null) ? 0 : tracking.hashCode()); result = prime * result + ((mcp == null) ? 0 : mcp.hashCode()); result = prime * result + ((enlistmentTrace == null) ? 0 : enlistmentTrace.hashCode()); return result; }
for (Recovery.Attribute attribute : Recovery.Attribute.values()) { switch (attribute) { case NO_RECOVERY: { return; } else { if (Recovery.Tag.forName(reader.getLocalName()) == Recovery.Tag.UNKNOWN) { throw ParseUtils.unexpectedEndElement(reader); Recovery.Tag tag = Recovery.Tag.forName(reader.getLocalName()); switch (tag) { case RECOVER_CREDENTIAL: { parseExtension(reader, tag.getLocalName(), node, RECOVERLUGIN_CLASSNAME, RECOVERLUGIN_PROPERTIES); break;
if (security != null) { final boolean elytronEnabled = (security instanceof SecurityMetadata && ((SecurityMetadata) security).isElytronEnabled()); if (security.getSecurityDomain() != null) { if (!elytronEnabled) { builder.requires(SecurityDomainService.SERVICE_NAME.append(security.getSecurityDomain())); } else { builder.requires(context.getCapabilityServiceName(AUTHENTICATION_CONTEXT_CAPABILITY, security.getSecurityDomain(), AuthenticationContext.class)); if (security.getSecurityDomainAndApplication() != null) { if (!elytronEnabled) { builder.requires(SecurityDomainService.SERVICE_NAME.append(security.getSecurityDomainAndApplication())); } else { builder.requires(context.getCapabilityServiceName(AUTHENTICATION_CONTEXT_CAPABILITY, security.getSecurityDomainAndApplication(), AuthenticationContext.class)); if (cd.getRecovery() != null && cd.getRecovery().getCredential() != null && cd.getRecovery().getCredential().getSecurityDomain() != null) { if (!elytronEnabled) { builder.requires(SecurityDomainService.SERVICE_NAME.append(cd.getRecovery().getCredential().getSecurityDomain())); } else { builder.requires(context.getCapabilityServiceName(AUTHENTICATION_CONTEXT_CAPABILITY, cd.getRecovery().getCredential().getSecurityDomain(), AuthenticationContext.class));
throws XMLStreamException, ParserException, ValidateException { for (Extension.Attribute attribute : Extension.Attribute.values()) { switch (attribute) { case CLASS_NAME: { requireSingleAttribute(reader, attribute.getLocalName()); final String value = reader.getAttributeValue(0); extensionClassName.parseAndSetParameter(value, operation, reader); if (Extension.Tag.forName(reader.getLocalName()) == Extension.Tag.UNKNOWN) { throw ParseUtils.unexpectedEndElement(reader); switch (Extension.Tag.forName(reader.getLocalName())) { case CONFIG_PROPERTY: { requireSingleAttribute(reader, "name");
boolean useStrictMin = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, POOL_USE_STRICT_MIN); String flushStrategyString = POOL_FLUSH_STRATEGY.resolveModelAttribute(context, connDefModel).asString(); final FlushStrategy flushStrategy = FlushStrategy.forName(flushStrategyString); Boolean isSameRM = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, SAME_RM_OVERRIDE); boolean interlivng = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, INTERLEAVING); final Capacity capacity = new Capacity(incrementer, decrementer); noRecovery = Boolean.FALSE; recovery = new Recovery(credential, recoverPlugin, noRecovery);
streamWriter.writeStartElement(Pool.Tag.CAPACITY.getLocalName()); if (conDef.hasDefined(CAPACITY_INCREMENTER_CLASS.getName())) { streamWriter.writeStartElement(Capacity.Tag.INCREMENTER.getLocalName()); CAPACITY_INCREMENTER_CLASS.marshallAsAttribute(conDef, streamWriter); CAPACITY_INCREMENTER_PROPERTIES.marshallAsElement(conDef, streamWriter); streamWriter.writeStartElement(Capacity.Tag.DECREMENTER.getLocalName()); CAPACITY_DECREMENTER_CLASS.marshallAsAttribute(conDef, streamWriter); CAPACITY_DECREMENTER_PROPERTIES.marshallAsElement(conDef, streamWriter); || conDef.hasDefined(RECOVERY_SECURITY_DOMAIN.getName()) || conDef.hasDefined(RECOVERY_ELYTRON_ENABLED.getName())) { streamWriter.writeStartElement(Recovery.Tag.RECOVER_CREDENTIAL.getLocalName()); RECOVERY_USERNAME.marshallAsElement(conDef, streamWriter); RECOVERY_PASSWORD.marshallAsElement(conDef, streamWriter); streamWriter.writeStartElement(Recovery.Tag.RECOVER_PLUGIN.getLocalName()); RECOVERLUGIN_CLASSNAME.marshallAsAttribute(conDef, streamWriter); if (conDef.hasDefined(RECOVERLUGIN_PROPERTIES.getName())) { for (Property property : conDef.get(RECOVERLUGIN_PROPERTIES.getName()).asPropertyList()) { writeProperty(streamWriter, conDef, property.getName(), property .getValue().asString(), org.jboss.jca.common.api.metadata.common.Extension.Tag.CONFIG_PROPERTY.getLocalName());
public static Extension extractExtension(final OperationContext operationContext, final ModelNode dataSourceNode, final SimpleAttributeDefinition className, final PropertiesAttributeDefinition propertyName) throws ValidateException, OperationFailedException { if (dataSourceNode.hasDefined(className.getName())) { String exceptionSorterClassName = getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, className); Map<String, String> unwrapped = propertyName.unwrap(operationContext, dataSourceNode); Map<String, String> exceptionSorterProperty = unwrapped.size() > 0 ? unwrapped : null; return new Extension(exceptionSorterClassName, exceptionSorterProperty); } else { return null; } }
final String securityDomain = credential.getSecurityDomain(); if (((Credential) credential).isElytronEnabled()) { try {
if (Capacity.Tag.forName(reader.getLocalName()) == Capacity.Tag.UNKNOWN) { throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName())); switch (Capacity.Tag.forName(reader.getLocalName())) { case INCREMENTER: { parseExtension(reader, reader.getLocalName(), operation, CAPACITY_INCREMENTER_CLASS , CAPACITY_INCREMENTER_PROPERTIES);
public static boolean isLegacySecurityRequired(Activation raxml) { boolean required = false; org.jboss.jca.common.api.metadata.resourceadapter.WorkManagerSecurity wmsecurity = raxml.getWorkManager() != null ? raxml.getWorkManager().getSecurity() : null; required = isLegacySecurityRequired(wmsecurity); if (!required) { List<ConnectionDefinition> connDefs = raxml.getConnectionDefinitions(); if (connDefs != null) { final List<ConnectionDefinition> clonedDefs; synchronized (raxml) { // Access to the collection is guarded by the instance clonedDefs = new ArrayList<>(connDefs); } for (ConnectionDefinition cd : clonedDefs) { Security cdSecurity = cd.getSecurity(); Credential cdRecoveryCredential = cd.getRecovery() == null? null : cd.getRecovery().getCredential(); if (isLegacySecurityRequired(cdSecurity) || isLegacySecurityRequired(cdRecoveryCredential)) { required = true; break; } } } } return required; }
switch (Validation.Tag.forName(reader.getLocalName())) { case BACKGROUND_VALIDATION: { String value = rawElementText(reader);
protected void parseElytronSupportedRecovery(XMLExtendedStreamReader reader, ModelNode node) throws XMLStreamException, ParserException, ValidateException { for (Recovery.Attribute attribute : Recovery.Attribute.values()) { switch (attribute) { case NO_RECOVERY: { return; } else { if (Recovery.Tag.forName(reader.getLocalName()) == Recovery.Tag.UNKNOWN) { throw ParseUtils.unexpectedEndElement(reader); Recovery.Tag tag = Recovery.Tag.forName(reader.getLocalName()); switch (tag) { case RECOVER_CREDENTIAL: { parseExtension(reader, tag.getLocalName(), node, RECOVERLUGIN_CLASSNAME, RECOVERLUGIN_PROPERTIES); break;
private static boolean isLegacySecurityRequired(org.jboss.jca.common.api.metadata.common.SecurityMetadata config) { boolean result = config != null && config instanceof SecurityMetadata && !((SecurityMetadata) config).isElytronEnabled(); if (result) { String domain = config.resolveSecurityDomain(); result = domain != null && domain.trim().length() > 0; } return result; } }
if (Capacity.Tag.forName(reader.getLocalName()) == Capacity.Tag.UNKNOWN) { throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName())); switch (Capacity.Tag.forName(reader.getLocalName())) { case INCREMENTER: { parseExtension(reader, reader.getLocalName(), operation, CAPACITY_INCREMENTER_CLASS, CAPACITY_INCREMENTER_PROPERTIES);
private void parseRecovery(XMLExtendedStreamReader reader, final ModelNode operation) throws XMLStreamException, ParserException, ValidateException { for (Recovery.Attribute attribute : Recovery.Attribute.values()) { switch (attribute) { case NO_RECOVERY: { return; } else { if (Recovery.Tag.forName(reader.getLocalName()) == Recovery.Tag.UNKNOWN) { throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName())); Recovery.Tag tag = Recovery.Tag.forName(reader.getLocalName()); switch (tag) { case RECOVER_CREDENTIAL: { parseExtension(reader, tag.getLocalName(), operation, RECOVER_PLUGIN_CLASSNAME, RECOVER_PLUGIN_PROPERTIES); break;
if (securityMetadata == null) return null; final String securityDomain = securityMetadata.resolveSecurityDomain(); if (securityMetadata instanceof org.jboss.as.connector.metadata.api.common.SecurityMetadata && ((org.jboss.as.connector.metadata.api.common.SecurityMetadata)securityMetadata).isElytronEnabled()) {
if (securityMetadata == null) return null; final String securityDomain = securityMetadata.resolveSecurityDomain(); if (securityMetadata instanceof org.jboss.as.connector.metadata.api.common.SecurityMetadata && ((org.jboss.as.connector.metadata.api.common.SecurityMetadata)securityMetadata).isElytronEnabled()) {