use of org.jboss.as.controller.SimpleAttributeDefinition in project wildfly by wildfly.
the class ModClusterSubsystemXMLReader_3_0 method parsePropConf.
void parsePropConf(XMLExtendedStreamReader reader, ModelNode conf) throws XMLStreamException {
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
requireNoNamespaceAttribute(reader, i);
final String value = reader.getAttributeValue(i);
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch(attribute) {
case ADVERTISE_SOCKET:
case PROXY_URL:
case ADVERTISE:
case ADVERTISE_SECURITY_KEY:
case EXCLUDED_CONTEXTS:
case AUTO_ENABLE_CONTEXTS:
case STOP_CONTEXT_TIMEOUT:
case SOCKET_TIMEOUT:
case SSL_CONTEXT:
case STICKY_SESSION:
case STICKY_SESSION_REMOVE:
case STICKY_SESSION_FORCE:
case WORKER_TIMEOUT:
case MAX_ATTEMPTS:
case FLUSH_PACKETS:
case FLUSH_WAIT:
case PING:
case SMAX:
case TTL:
case NODE_TIMEOUT:
case BALANCER:
case LOAD_BALANCING_GROUP:
case CONNECTOR:
case STATUS_INTERVAL:
case SESSION_DRAINING_STRATEGY:
((SimpleAttributeDefinition) ModClusterConfigResourceDefinition.ATTRIBUTES_BY_NAME.get(attribute.getLocalName())).parseAndSetParameter(value, conf, reader);
break;
case PROXIES:
ModClusterConfigResourceDefinition.PROXIES.getParser().parseAndSetParameter(ModClusterConfigResourceDefinition.PROXIES, value, conf, reader);
break;
case PROXY_LIST:
// Keep deprecated PROXY_LIST to be able to support EAP 6.x slaves
ModClusterConfigResourceDefinition.PROXY_LIST.parseAndSetParameter(value, conf, reader);
break;
default:
throw unexpectedAttribute(reader, i);
}
}
}
use of org.jboss.as.controller.SimpleAttributeDefinition in project wildfly by wildfly.
the class CmpSubsystem10Parser method writeHilo.
private void writeHilo(final XMLExtendedStreamWriter writer, final String name, final ModelNode model) throws XMLStreamException {
writer.writeStartElement(Element.HILO.getLocalName());
writer.writeAttribute(Attribute.NAME.getLocalName(), name);
HiLoKeyGeneratorResourceDefinition.JNDI_NAME.marshallAsAttribute(model, writer);
for (SimpleAttributeDefinition attribute : HiLoKeyGeneratorResourceDefinition.ATTRIBUTES) {
if (!attribute.equals(HiLoKeyGeneratorResourceDefinition.JNDI_NAME))
attribute.marshallAsElement(model, writer);
}
writer.writeEndElement();
}
use of org.jboss.as.controller.SimpleAttributeDefinition in project wildfly by wildfly.
the class CmpSubsystem11Parser method parseHilo.
@Override
protected ModelNode parseHilo(final XMLExtendedStreamReader reader, final PathAddress parentAddress) throws XMLStreamException {
final ModelNode op = Util.createAddOperation();
String name = null;
int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
requireNoNamespaceAttribute(reader, i);
final String value = reader.getAttributeValue(i);
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch(attribute) {
case NAME:
{
name = value;
break;
}
case JNDI_NAME:
{
HiLoKeyGeneratorResourceDefinition.JNDI_NAME.parseAndSetParameter(value, op, reader);
break;
}
default:
throw unexpectedAttribute(reader, i);
}
}
if (name == null) {
throw missingRequired(reader, Collections.singleton(Attribute.NAME));
}
op.get(OP_ADDR).set(parentAddress.append(HILO_KEY_GENERATOR, name).toModelNode());
final EnumSet<Element> required = EnumSet.of(Element.DATA_SOURCE, Element.TABLE_NAME, Element.ID_COLUMN, Element.SEQUENCE_COLUMN, Element.SEQUENCE_NAME);
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
final String value = reader.getElementText();
final String tag = reader.getLocalName();
final Element element = Element.forName(tag);
required.remove(element);
SimpleAttributeDefinition attribute = HiLoKeyGeneratorResourceDefinition.ATTRIBUTE_MAP.get(tag);
if (attribute == null) {
throw unexpectedElement(reader);
}
attribute.parseAndSetParameter(value, op, reader);
}
if (!required.isEmpty()) {
throw missingRequiredElement(reader, required);
}
return op;
}
use of org.jboss.as.controller.SimpleAttributeDefinition in project wildfly by wildfly.
the class ConnectionPropertyDefinition method registerAttributes.
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
if (deployed) {
SimpleAttributeDefinition runtimeAttribute = new SimpleAttributeDefinitionBuilder(Constants.CONNECTION_PROPERTY_VALUE).setFlags(AttributeAccess.Flag.STORAGE_RUNTIME).build();
resourceRegistration.registerReadOnlyAttribute(runtimeAttribute, XMLDataSourceRuntimeHandler.INSTANCE);
} else {
resourceRegistration.registerReadOnlyAttribute(Constants.CONNECTION_PROPERTY_VALUE, null);
}
}
use of org.jboss.as.controller.SimpleAttributeDefinition in project wildfly by wildfly.
the class DataSourceDefinition method registerAttributes.
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
if (deployed) {
for (final SimpleAttributeDefinition attribute : DATASOURCE_ATTRIBUTE) {
SimpleAttributeDefinition runtimeAttribute = new SimpleAttributeDefinitionBuilder(attribute).setFlags(AttributeAccess.Flag.STORAGE_RUNTIME).build();
resourceRegistration.registerReadOnlyAttribute(runtimeAttribute, XMLDataSourceRuntimeHandler.INSTANCE);
}
for (final PropertiesAttributeDefinition attribute : DATASOURCE_PROPERTIES_ATTRIBUTES) {
PropertiesAttributeDefinition runtimeAttribute = new PropertiesAttributeDefinition.Builder(attribute).setFlags(AttributeAccess.Flag.STORAGE_RUNTIME).build();
resourceRegistration.registerReadOnlyAttribute(runtimeAttribute, XMLDataSourceRuntimeHandler.INSTANCE);
}
} else {
ReloadRequiredWriteAttributeHandler reloadRequiredWriteAttributeHandler = new ReloadRequiredWriteAttributeHandler(DATASOURCE_ATTRIBUTE);
CredentialReferenceWriteAttributeHandler credentialReferenceWriteAttributeHandler = new CredentialReferenceWriteAttributeHandler(CREDENTIAL_REFERENCE, RECOVERY_CREDENTIAL_REFERENCE);
for (final SimpleAttributeDefinition attribute : DATASOURCE_ATTRIBUTE) {
if (PoolConfigurationRWHandler.ATTRIBUTES.contains(attribute.getName())) {
resourceRegistration.registerReadWriteAttribute(attribute, PoolConfigurationRWHandler.PoolConfigurationReadHandler.INSTANCE, PoolConfigurationRWHandler.LocalAndXaDataSourcePoolConfigurationWriteHandler.INSTANCE);
} else if (attribute.getName().equals(ENLISTMENT_TRACE.getName())) {
resourceRegistration.registerReadWriteAttribute(attribute, null, new EnlistmentTraceAttributeWriteHandler());
} else if (attribute.getName().equals(CREDENTIAL_REFERENCE.getName()) || attribute.getName().equals(RECOVERY_CREDENTIAL_REFERENCE.getName())) {
resourceRegistration.registerReadWriteAttribute(attribute, null, credentialReferenceWriteAttributeHandler);
} else {
resourceRegistration.registerReadWriteAttribute(attribute, null, reloadRequiredWriteAttributeHandler);
}
}
ReloadRequiredWriteAttributeHandler reloadRequiredPropertiesWriteHandler = new ReloadRequiredWriteAttributeHandler(DATASOURCE_PROPERTIES_ATTRIBUTES);
for (final PropertiesAttributeDefinition attribute : DATASOURCE_PROPERTIES_ATTRIBUTES) {
if (PoolConfigurationRWHandler.ATTRIBUTES.contains(attribute.getName())) {
resourceRegistration.registerReadWriteAttribute(attribute, PoolConfigurationRWHandler.PoolConfigurationReadHandler.INSTANCE, PoolConfigurationRWHandler.LocalAndXaDataSourcePoolConfigurationWriteHandler.INSTANCE);
} else {
resourceRegistration.registerReadWriteAttribute(attribute, null, reloadRequiredPropertiesWriteHandler);
}
}
}
}
Aggregations