use of org.jboss.as.controller.AttributeDefinition in project wildfly-camel by wildfly-extras.
the class CamelRootResource method registerChildren.
@Override
public void registerChildren(ManagementResourceRegistration resourceRegistration) {
resourceRegistration.registerSubModel(new CamelContextResource(subsystemState));
if (registerRuntimeOnly) {
AttributeDefinition eldef = new SimpleAttributeDefinitionBuilder("dummy", ModelType.STRING, false).build();
AttributeDefinition attdef = new SimpleListAttributeDefinition.Builder(ModelConstants.ENDPOINTS, eldef).setStorageRuntime().build();
resourceRegistration.registerReadOnlyAttribute(attdef, new CamelRuntimeOnlyHandler());
}
}
use of org.jboss.as.controller.AttributeDefinition in project wildfly by wildfly.
the class IdentityResourceDefinition method registerAttributes.
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
outflowSecurityDomains.clear();
ReloadRequiredWriteAttributeHandler handler = new ReloadRequiredWriteAttributeHandler(ATTRIBUTES);
for (AttributeDefinition attribute : ATTRIBUTES) {
resourceRegistration.registerReadWriteAttribute(attribute, null, handler);
}
}
use of org.jboss.as.controller.AttributeDefinition in project wildfly by wildfly.
the class JaxrsSubsystemParser_2_0 method writeContent.
/**
* {@inheritDoc}
*/
@Override
public void writeContent(final XMLExtendedStreamWriter streamWriter, final SubsystemMarshallingContext context) throws XMLStreamException {
context.startSubsystemElement(NAMESPACE, false);
ModelNode subsystem = context.getModelNode();
for (AttributeDefinition attr : JaxrsAttribute.ATTRIBUTES) {
attr.marshallAsElement(subsystem, true, streamWriter);
}
streamWriter.writeEndElement();
}
use of org.jboss.as.controller.AttributeDefinition in project wildfly by wildfly.
the class JacORBExtension method registerTransformers.
/**
* Register the transformers for the 1.3.0 version.
*
* @param subsystem the subsystems registration
*/
protected static void registerTransformers(final SubsystemRegistration subsystem) {
ChainedTransformationDescriptionBuilder chained = ResourceTransformationDescriptionBuilder.Factory.createChainedSubystemInstance(CURRENT_MODEL_VERSION);
ModelVersion MODEL_VERSION_EAP64 = ModelVersion.create(1, 4, 0);
// also EAP6.2
ModelVersion MODEL_VERSION_EAP63 = ModelVersion.create(1, 3, 0);
ResourceTransformationDescriptionBuilder builder64 = chained.createBuilder(CURRENT_MODEL_VERSION, MODEL_VERSION_EAP64);
builder64.getAttributeBuilder().addRejectCheck(RejectAttributeChecker.DEFINED, JacORBSubsystemDefinitions.PERSISTENT_SERVER_ID).setDiscard(DiscardAttributeChecker.DEFAULT_VALUE, JacORBSubsystemDefinitions.PERSISTENT_SERVER_ID).setValueConverter(AttributeConverter.DEFAULT_VALUE, JacORBSubsystemDefinitions.INTEROP_CHUNK_RMI_VALUETYPES);
ResourceTransformationDescriptionBuilder builder63 = chained.createBuilder(MODEL_VERSION_EAP64, MODEL_VERSION_EAP63);
builder63.getAttributeBuilder().addRejectCheck(RejectAttributeChecker.DEFINED, IORTransportConfigDefinition.ATTRIBUTES.toArray(new AttributeDefinition[0])).addRejectCheck(RejectAttributeChecker.DEFINED, IORASContextDefinition.ATTRIBUTES.toArray(new AttributeDefinition[0])).addRejectCheck(RejectAttributeChecker.DEFINED, IORSASContextDefinition.ATTRIBUTES.toArray(new AttributeDefinition[0])).end().rejectChildResource(IORSettingsDefinition.INSTANCE.getPathElement());
chained.buildAndRegister(subsystem, new ModelVersion[] { MODEL_VERSION_EAP64, MODEL_VERSION_EAP63 });
}
use of org.jboss.as.controller.AttributeDefinition in project wildfly by wildfly.
the class MessagingSubsystemParser method parseSecurityRoles.
private void parseSecurityRoles(final XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> operations) throws XMLStreamException {
final Map<String, Set<AttributeDefinition>> permsByRole = new HashMap<String, Set<AttributeDefinition>>();
String localName = null;
do {
reader.nextTag();
localName = reader.getLocalName();
final Element element = Element.forName(localName);
if (element != Element.PERMISSION_ELEMENT_NAME) {
break;
}
final Set<Attribute> required = EnumSet.of(Attribute.ROLES_ATTR_NAME, Attribute.TYPE_ATTR_NAME);
List<String> roles = null;
AttributeDefinition perm = null;
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
requireNoNamespaceAttribute(reader, i);
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
required.remove(attribute);
switch(attribute) {
case ROLES_ATTR_NAME:
roles = parseRolesAttribute(reader, i);
break;
case TYPE_ATTR_NAME:
perm = SecurityRoleDefinition.ROLE_ATTRIBUTES_BY_XML_NAME.get(reader.getAttributeValue(i));
if (perm == null) {
throw ControllerLogger.ROOT_LOGGER.invalidAttributeValue(reader.getAttributeValue(i), reader.getAttributeName(i), SecurityRoleDefinition.ROLE_ATTRIBUTES_BY_XML_NAME.keySet(), reader.getLocation());
}
break;
default:
throw ParseUtils.unexpectedAttribute(reader, i);
}
}
if (!required.isEmpty()) {
throw missingRequired(reader, required);
}
for (String role : roles) {
role = role.trim();
Set<AttributeDefinition> perms = permsByRole.get(role);
if (perms == null) {
perms = new HashSet<AttributeDefinition>();
permsByRole.put(role, perms);
}
perms.add(perm);
}
// Scan to element end
reader.discardRemainder();
} while (reader.hasNext());
for (Map.Entry<String, Set<AttributeDefinition>> entry : permsByRole.entrySet()) {
final String role = entry.getKey();
final Set<AttributeDefinition> perms = entry.getValue();
final ModelNode addr = address.clone();
addr.add(ROLE, role);
final ModelNode operation = new ModelNode();
operation.get(OP).set(ADD);
operation.get(OP_ADDR).set(addr);
for (AttributeDefinition perm : SecurityRoleDefinition.ATTRIBUTES) {
operation.get(perm.getName()).set(perms.contains(perm));
}
operations.add(operation);
}
}
Aggregations