use of org.jboss.as.controller.PathElement in project wildfly by wildfly.
the class TimerServiceResource method timerCreated.
public void timerCreated(String id) {
PathElement address = PathElement.pathElement(EJB3SubsystemModel.TIMER, id);
this.delegate.registerChild(address, Resource.Factory.create());
}
use of org.jboss.as.controller.PathElement in project wildfly by wildfly.
the class AbstractEJBComponentRuntimeHandler method getComponentConfiguration.
private ServiceName getComponentConfiguration(final OperationContext context, final PathAddress operationAddress) throws OperationFailedException {
final List<PathElement> relativeAddress = new ArrayList<PathElement>();
final String typeKey = this.componentType.getResourceType();
boolean skip = true;
for (int i = operationAddress.size() - 1; i >= 0; i--) {
PathElement pe = operationAddress.getElement(i);
if (skip && !pe.getKey().equals(typeKey)) {
continue;
} else {
skip = false;
}
if (ModelDescriptionConstants.DEPLOYMENT.equals(pe.getKey())) {
final String runtimName = resolveRuntimeName(context, pe);
PathElement realPe = PathElement.pathElement(pe.getKey(), runtimName);
relativeAddress.add(0, realPe);
break;
} else {
relativeAddress.add(0, pe);
}
}
final PathAddress pa = PathAddress.pathAddress(relativeAddress);
final ServiceName config = componentConfigs.get(pa);
if (config == null) {
String exceptionMessage = EjbLogger.ROOT_LOGGER.noComponentRegisteredForAddress(operationAddress);
throw new OperationFailedException(exceptionMessage);
}
return config;
}
use of org.jboss.as.controller.PathElement in project wildfly by wildfly.
the class TimerServiceResourceDefinition method registerDataStoreTransformers.
private static void registerDataStoreTransformers(ResourceTransformationDescriptionBuilder timerService) {
DataStoreTransformer dataStoreTransformer = new DataStoreTransformer();
timerService.getAttributeBuilder().setDiscard(DiscardAttributeChecker.ALWAYS, //this is ok, as default-data-store only has any sense with new model, but it is always set!
EJB3SubsystemModel.DEFAULT_DATA_STORE).end();
timerService.discardOperations(ModelDescriptionConstants.ADD);
timerService.setCustomResourceTransformer(dataStoreTransformer);
timerService.rejectChildResource(EJB3SubsystemModel.DATABASE_DATA_STORE_PATH);
ResourceTransformationDescriptionBuilder fileDataStore = timerService.addChildRedirection(EJB3SubsystemModel.FILE_DATA_STORE_PATH, new PathAddressTransformer() {
@Override
public PathAddress transform(PathElement current, Builder builder) {
return builder.getCurrent();
}
});
fileDataStore.addOperationTransformationOverride(ModelDescriptionConstants.ADD).inheritResourceAttributeDefinitions().setCustomOperationTransformer(dataStoreTransformer).end();
}
use of org.jboss.as.controller.PathElement in project wildfly by wildfly.
the class ModClusterSubsystemXMLReader_1_0 method parseCustomLoadMetric.
void parseCustomLoadMetric(XMLExtendedStreamReader reader, List<ModelNode> list, PathAddress address) throws XMLStreamException {
final ModelNode customMetric = new ModelNode();
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 CAPACITY:
LoadMetricDefinition.CAPACITY.parseAndSetParameter(value, customMetric, reader);
break;
case WEIGHT:
LoadMetricDefinition.WEIGHT.parseAndSetParameter(value, customMetric, reader);
break;
case CLASS:
CustomLoadMetricDefinition.CLASS.parseAndSetParameter(value, customMetric, reader);
break;
default:
throw unexpectedAttribute(reader, i);
}
}
PathElement pe = PathElement.pathElement(CustomLoadMetricDefinition.PATH.getKey(), customMetric.get(CommonAttributes.CLASS).asString());
customMetric.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD);
customMetric.get(ModelDescriptionConstants.OP_ADDR).set(address.append(pe).toModelNode());
readProperties(reader, customMetric);
list.add(customMetric);
}
use of org.jboss.as.controller.PathElement in project wildfly by wildfly.
the class ModClusterSubsystemXMLReader_1_0 method parseLoadMetric.
void parseLoadMetric(XMLExtendedStreamReader reader, List<ModelNode> list, PathAddress address) throws XMLStreamException {
final ModelNode metric = new ModelNode();
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 TYPE:
LoadMetricDefinition.TYPE.parseAndSetParameter(value, metric, reader);
break;
case CAPACITY:
LoadMetricDefinition.CAPACITY.parseAndSetParameter(value, metric, reader);
break;
case WEIGHT:
LoadMetricDefinition.WEIGHT.parseAndSetParameter(value, metric, reader);
break;
default:
throw unexpectedAttribute(reader, i);
}
}
PathElement pe = PathElement.pathElement(LoadMetricDefinition.PATH.getKey(), metric.get(CommonAttributes.TYPE).asString());
metric.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD);
metric.get(ModelDescriptionConstants.OP_ADDR).set(address.append(pe).toModelNode());
readProperties(reader, metric);
list.add(metric);
}
Aggregations