use of org.jboss.as.controller.registry.Resource in project wildfly by wildfly.
the class ExportJournalOperation method resolvePath.
private static String resolvePath(OperationContext context, PathManager pathManager, PathElement pathElement) throws OperationFailedException {
Resource serverResource = context.readResource(EMPTY_ADDRESS);
// if the path resource does not exist, resolve its attributes against an empty ModelNode to get its default values
final ModelNode model = serverResource.hasChild(pathElement) ? serverResource.getChild(pathElement).getModel() : new ModelNode();
final String path = PathDefinition.PATHS.get(pathElement.getValue()).resolveModelAttribute(context, model).asString();
final String relativeToPath = PathDefinition.RELATIVE_TO.resolveModelAttribute(context, model).asString();
final String relativeTo = AbsolutePathService.isAbsoluteUnixOrWindowsPath(path) ? null : relativeToPath;
return pathManager.resolveRelativePathEntry(path, relativeTo);
}
use of org.jboss.as.controller.registry.Resource in project wildfly by wildfly.
the class BroadcastGroupDefinition method getAvailableConnectors.
private static Set<String> getAvailableConnectors(final OperationContext context, final ModelNode operation) throws OperationFailedException {
PathAddress address = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR));
PathAddress active = MessagingServices.getActiveMQServerPathAddress(address);
Resource activeMQServerResource = context.readResourceFromRoot(active);
Set<String> availableConnectors = new HashSet<String>();
availableConnectors.addAll(activeMQServerResource.getChildrenNames(CommonAttributes.HTTP_CONNECTOR));
availableConnectors.addAll(activeMQServerResource.getChildrenNames(CommonAttributes.IN_VM_CONNECTOR));
availableConnectors.addAll(activeMQServerResource.getChildrenNames(CommonAttributes.REMOTE_CONNECTOR));
availableConnectors.addAll(activeMQServerResource.getChildrenNames(CommonAttributes.CONNECTOR));
return availableConnectors;
}
use of org.jboss.as.controller.registry.Resource in project wildfly by wildfly.
the class DsXmlDeploymentInstallProcessor method getRegistration.
private ManagementResourceRegistration getRegistration(final boolean xa, final DeploymentUnit unit) {
final Resource root = unit.getAttachment(DeploymentModelUtils.DEPLOYMENT_RESOURCE);
synchronized (root) {
ManagementResourceRegistration registration = unit.getAttachment(DeploymentModelUtils.MUTABLE_REGISTRATION_ATTACHMENT);
final PathAddress address = xa ? XA_DATASOURCE_ADDRESS : DATASOURCE_ADDRESS;
ManagementResourceRegistration subModel = registration.getSubModel(address);
if (subModel == null) {
throw new IllegalStateException(address.toString());
}
return subModel;
}
}
use of org.jboss.as.controller.registry.Resource in project wildfly by wildfly.
the class DsXmlDeploymentInstallProcessor method getOrCreate.
static Resource getOrCreate(final Resource parent, final PathAddress address) {
Resource current = parent;
for (final PathElement element : address) {
synchronized (current) {
if (current.hasChild(element)) {
current = current.requireChild(element);
} else {
final Resource resource = Resource.Factory.create();
current.registerChild(element, resource);
current = resource;
}
}
}
return current;
}
use of org.jboss.as.controller.registry.Resource in project wildfly by wildfly.
the class PersistenceUnitServiceHandler method getOrCreateResource.
/**
* TODO this is a temporary hack into internals until DeploymentUnit exposes a proper Resource-based API
*/
private static Resource getOrCreateResource(final Resource parent, final PathElement element) {
synchronized (parent) {
if (parent.hasChild(element)) {
return parent.requireChild(element);
} else {
final Resource resource = Resource.Factory.create();
parent.registerChild(element, resource);
return resource;
}
}
}
Aggregations