本文整理汇总了Java中org.jboss.dmr.Property.getName方法的典型用法代码示例。如果您正苦于以下问题:Java Property.getName方法的具体用法?Java Property.getName怎么用?Java Property.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.dmr.Property
的用法示例。
在下文中一共展示了Property.getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertParameters
import org.jboss.dmr.Property; //导入方法依赖的package包/类
private static String convertParameters(ModelNode op) {
StringBuilder result = new StringBuilder();
boolean first = true;
for (Property parameter : op.asPropertyList()) {
String name = parameter.getName();
if (Constants.OP.equals(name)
|| Constants.OP_ADDR.equals(name)
|| Constants.OPERATION_HEADERS.equals(name)) {
continue;
}
if (!first) {
result.append(", ");
}
first = false;
result.append(name).append("=").append(convertValue(parameter.getValue()));
}
if (result.length() > 0) {
return "(" + result.toString() + ")";
}
return "";
}
示例2: getSystemProperties
import org.jboss.dmr.Property; //导入方法依赖的package包/类
/**
* This returns the system properties that are set in the AS JVM. This is not the system properties
* in the JVM of this client object - it is actually the system properties in the remote
* JVM of the AS instance that the client is talking to.
*
* @return the AS JVM's system properties
* @throws Exception any error
*/
public Properties getSystemProperties() throws Exception {
final String[] address = { CORE_SERVICE, PLATFORM_MBEAN, "type", "runtime" };
final ModelNode op = createReadAttributeRequest(true, "system-properties", Address.root().add(address));
final ModelNode results = execute(op);
if (isSuccess(results)) {
// extract the DMR representation into a java Properties object
final Properties sysprops = new Properties();
final ModelNode node = getResults(results);
final List<Property> propertyList = node.asPropertyList();
for (Property property : propertyList) {
final String name = property.getName();
final ModelNode value = property.getValue();
if (name != null) {
sysprops.put(name, value != null ? value.asString() : "");
}
}
return sysprops;
} else {
throw new FailureException(results, "Failed to get system properties");
}
}
示例3: fromModelNode
import org.jboss.dmr.Property; //导入方法依赖的package包/类
/**
* Obtains the address from the given ModelNode which is assumed to be a property list that
* contains all the address parts and only the address parts.
*
* @param node address node
* @return the address
*/
public static Address fromModelNode(ModelNode node) {
// Rather than just store node as this.addressNode, we want to make sure it can be used as a valid address.
// This also builds our own instance of ModelNode rather than use the one the caller gave us.
Address address = Address.root();
// if the node is not defined, this simply represents the root address
if (!node.isDefined()) {
return address;
}
try {
List<Property> addressList = node.asPropertyList();
for (Property addressProperty : addressList) {
String resourceType = addressProperty.getName();
String resourceName = addressProperty.getValue().asString();
address.add(resourceType, resourceName);
}
return address;
} catch (Exception e) {
throw new IllegalArgumentException("Node cannot be used as an address: " + node.toJSONString(true));
}
}
示例4: toAddressParts
import org.jboss.dmr.Property; //导入方法依赖的package包/类
/**
* @return returns the address split into its individual parts.
* e.g. "/one=two" will return a 2-element array {"one", "two"}.
*/
public String[] toAddressParts() {
if (isRoot()) {
return new String[0];
}
List<Property> properties = addressNode.asPropertyList();
String[] parts = new String[properties.size() * 2];
int i = 0;
for (Property property : properties) {
String name = property.getName();
String value = property.getValue().asString();
parts[i++] = name;
parts[i++] = value;
}
return parts;
}
示例5: getJVMRestartOperations
import org.jboss.dmr.Property; //导入方法依赖的package包/类
private Map<Set<ServerIdentity>, ModelNode> getJVMRestartOperations(final PathAddress address, final ModelNode hostModel) {
// See which servers are affected by this JVM change
final String pathName = address.getElement(0).getValue();
final Map<Set<ServerIdentity>, ModelNode> result;
if (hostModel.hasDefined(SERVER_CONFIG)) {
final Set<ServerIdentity> servers = new HashSet<ServerIdentity>();
for (Property prop : hostModel.get(SERVER_CONFIG).asPropertyList()) {
final String serverName = prop.getName();
if (serverProxies.get(serverName) == null) {
// No running server
continue;
}
final ModelNode server = prop.getValue();
if (server.hasDefined(JVM) && server.get(JVM).keys().contains(pathName)) {
final String serverGroupName = server.require(GROUP).asString();
final ServerIdentity groupedServer = new ServerIdentity(localHostName, serverGroupName, serverName);
servers.add(groupedServer);
}
}
result = getServerRestartRequiredOperations(servers);
} else {
result = Collections.emptyMap();
}
return result;
}
示例6: extensionVersionTest
import org.jboss.dmr.Property; //导入方法依赖的package包/类
private void extensionVersionTest(ModelControllerClient client, String addressPrefix) throws Exception {
String address = addressPrefix == null ? ADDRESS : addressPrefix + '/' + ADDRESS;
ModelNode op = createOpNode(address, "read-resource");
op.get("recursive").set(true);
op.get("include-runtime").set(true);
ModelNode result = executeForResult(op, client);
ModelNode subsystems = result.get("subsystem");
Assert.assertEquals("extension has no subsystems", ModelType.OBJECT, subsystems.getType());
for (Property subsystem : subsystems.asPropertyList()) {
String subsystemName = subsystem.getName();
int version = Integer.parseInt(subsystemName);
ModelNode value = subsystem.getValue();
Assert.assertEquals(subsystemName + " has major version", ModelType.INT, value.get("management-major-version").getType());
Assert.assertEquals(subsystemName + " has minor version", ModelType.INT, value.get("management-minor-version").getType());
Assert.assertEquals(subsystemName + " has micro version", ModelType.INT, value.get("management-micro-version").getType());
Assert.assertEquals(subsystemName + " has namespaces", ModelType.LIST, value.get("xml-namespaces").getType());
Assert.assertEquals(subsystemName + " has correct major version", version, value.get("management-major-version").asInt());
Assert.assertEquals(subsystemName + " has correct minor version", version, value.get("management-minor-version").asInt());
Assert.assertEquals(subsystemName + " has correct micro version", version, value.get("management-micro-version").asInt());
Assert.assertTrue(subsystemName + " has more than zero namespaces", value.get("xml-namespaces").asInt() > 0);
}
}
示例7: fixModel
import org.jboss.dmr.Property; //导入方法依赖的package包/类
@Override
public ModelNode fixModel(final ModelNode modelNode) {
// Recursively remove the attributes
if (modelNode.getType() == ModelType.OBJECT) {
for (Property property : modelNode.asPropertyList()) {
final String name = property.getName();
final ModelNode value = property.getValue();
if (value.isDefined()) {
if (value.getType() == ModelType.OBJECT) {
modelNode.get(name).set(fixModel(value));
} else if (value.getType() == ModelType.STRING) {
if (name.equals(attribute.getName())) {
modelNode.get(name).set(value.asString().replace(from, to));
}
}
}
}
}
return modelNode;
}
示例8: execute
import org.jboss.dmr.Property; //导入方法依赖的package包/类
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
final ModelNode result = context.getResult().setEmptyList();
final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR));
final ModelNode discoveryOptions = Resource.Tools.readModel(context.readResourceFromRoot(address));
final ModelNode list = discoveryOptions.get(ModelDescriptionConstants.OPTIONS).clone();
if (list.isDefined()) {
for(Property option : list.asPropertyList()) {
String type = option.getName();
if(type.equals(ModelDescriptionConstants.CUSTOM_DISCOVERY)) {
// for compatibility
type = ModelDescriptionConstants.DISCOVERY_OPTION;
}
final String name = option.getValue().get(ModelDescriptionConstants.NAME).asString();
result.add(type, name);
}
}
context.completeStep(ResultHandler.NOOP_RESULT_HANDLER);
}
示例9: updateOptionsAttribute
import org.jboss.dmr.Property; //导入方法依赖的package包/类
protected void updateOptionsAttribute(OperationContext context, ModelNode operation, String type) {
final PathAddress operationAddress = PathAddress.pathAddress(operation.get(OP_ADDR));
final PathAddress discoveryOptionsAddress = operationAddress.subAddress(0, operationAddress.size() - 1);
final ModelNode discoveryOptions = Resource.Tools.readModel(context.readResourceFromRoot(discoveryOptionsAddress));
// Get the current list of discovery options and remove the given discovery option
// from the list to maintain the order
final ModelNode currentList = discoveryOptions.get(ModelDescriptionConstants.OPTIONS);
final String name = operationAddress.getLastElement().getValue();
final ModelNode newList = new ModelNode().setEmptyList();
for (ModelNode e : currentList.asList()) {
final Property prop = e.asProperty();
final String discoveryOptionType = prop.getName();
final String discoveryOptionName = prop.getValue().get(ModelDescriptionConstants.NAME).asString();
if (!(discoveryOptionType.equals(type) && discoveryOptionName.equals(name))) {
newList.add(e);
}
}
final ModelNode writeOp = Util.getWriteAttributeOperation(discoveryOptionsAddress, ModelDescriptionConstants.OPTIONS, newList);
final OperationStepHandler writeHandler = context.getRootResourceRegistration().getSubModel(discoveryOptionsAddress).getOperationHandler(PathAddress.EMPTY_ADDRESS, WRITE_ATTRIBUTE_OPERATION);
context.addStep(writeOp, writeHandler, OperationContext.Stage.MODEL);
}
示例10: processIgnoredResource
import org.jboss.dmr.Property; //导入方法依赖的package包/类
private static Map<String, IgnoredType> processIgnoredResource(final ModelNode model, Set<String> domainIgnoredExtensions) {
Map<String, IgnoredType> ignoredResources = null;
if (model.hasDefined(IGNORED_RESOURCES)) {
ignoredResources = new HashMap<>();
for (Property prop : model.require(IGNORED_RESOURCES).asPropertyList()) {
String type = prop.getName();
ModelNode ignoredModel = prop.getValue();
IgnoredType ignoredType = ignoredModel.get(WILDCARD).asBoolean(false) ? new IgnoredType() : new IgnoredType(ignoredModel.get(NAMES));
ignoredResources.put(type, ignoredType);
}
}
if (domainIgnoredExtensions != null && !domainIgnoredExtensions.isEmpty()) {
IgnoredType slaveIgnoredExtensions = null;
if (ignoredResources == null) {
ignoredResources = new HashMap<>();
} else {
slaveIgnoredExtensions = ignoredResources.get(EXTENSION);
}
IgnoredType ignoredExtensions = new IgnoredType(slaveIgnoredExtensions, domainIgnoredExtensions);
ignoredResources.put(EXTENSION, ignoredExtensions);
DomainControllerLogger.ROOT_LOGGER.tracef("Ignoring extensions %s", ignoredExtensions.names);
} else {
DomainControllerLogger.ROOT_LOGGER.tracef("No domain ignored extensions: %s", domainIgnoredExtensions);
}
return ignoredResources;
}
示例11: validateParameter
import org.jboss.dmr.Property; //导入方法依赖的package包/类
@Override
public void validateParameter(String parameterName, ModelNode values) throws OperationFailedException {
for (Property property : values.asPropertyList()) {
if (!VALID_PROPERTIES.containsKey(property.getName())) {
throw new OperationFailedException("Invalid property name: " + property.getName());
}
if (!VALID_PROPERTIES.get(property.getName()).contains(property.getValue().asString().toUpperCase())) {
throw new OperationFailedException(
"Invalid value of property " + property.getName() + ": " + property.getValue());
}
}
}
示例12: isXa
import org.jboss.dmr.Property; //导入方法依赖的package包/类
private boolean isXa(ModelNode adr) {
List<Property> props = adr.asPropertyList();
Property lastProp = props.get(props.size() - 1);
switch (lastProp.getName()) {
case XA_DATASOURCE:
return true;
case DATASOURCE:
return false;
default:
String msg = String.format(
"DMR Address [%s] was supposed to be either a [%s] or [%s] address, which it is not",
adr.toString(), XA_DATASOURCE, DATASOURCE);
throw new IllegalStateException(msg);
}
}
示例13: getServerPathOperations
import org.jboss.dmr.Property; //导入方法依赖的package包/类
private Map<Set<ServerIdentity>, ModelNode> getServerPathOperations(ModelNode operation, PathAddress address, ModelNode hostModel, boolean forDomain) {
String pathName = address.getElement(0).getValue();
Map<Set<ServerIdentity>, ModelNode> result;
if (forDomain && hostModel.hasDefined(PATH) && hostModel.get(PATH).keys().contains(pathName)) {
// Host will take precedence; ignore the domain
result = Collections.emptyMap();
} else if (ADD.equals(operation.get(OP).asString()) && !operation.hasDefined(PATH)) {
// don't push named only paths
result = Collections.emptyMap();
} else if (hostModel.hasDefined(SERVER_CONFIG)) {
Set<ServerIdentity> servers = new HashSet<ServerIdentity>();
for (Property prop : hostModel.get(SERVER_CONFIG).asPropertyList()) {
String serverName = prop.getName();
if (serverProxies.get(serverName) == null) {
continue;
}
ModelNode server = prop.getValue();
String serverGroupName = server.require(GROUP).asString();
if (server.hasDefined(PATH) && server.get(PATH).keys().contains(pathName)) {
// Server takes precedence; ignore domain
continue;
}
ServerIdentity groupedServer = new ServerIdentity(localHostName, serverGroupName, serverName);
servers.add(groupedServer);
}
ModelNode serverOp = operation.clone();
serverOp.get(OP_ADDR).setEmptyList().add(PATH, pathName);
result = Collections.singletonMap(servers, serverOp);
} else {
result = Collections.emptyMap();
}
return result;
}
示例14: addOptions
import org.jboss.dmr.Property; //导入方法依赖的package包/类
private static void addOptions(OperationContext context, ModelNode properties, OptionMap.Builder builder) throws OperationFailedException {
final ClassLoader loader = WildFlySecurityManager.getClassLoaderPrivileged(ConnectorUtils.class);
for (Property property : properties.asPropertyList()) {
String name = property.getName();
if (!name.contains(".")) {
name = "org.xnio.Options." + name;
}
final Option option = Option.fromString(name, loader);
String value = PropertyResource.VALUE.resolveModelAttribute(context, property.getValue()).asString();
builder.set(option, option.parseValue(value, loader));
}
}
示例15: findActiveOperation
import org.jboss.dmr.Property; //导入方法依赖的package包/类
private String findActiveOperation(DomainClient client, PathAddress address, String opName, OperationContext.ExecutionStatus targetStatus, long executionStart, boolean serverOpOnly) throws Exception {
ModelNode op = Util.createEmptyOperation(READ_CHILDREN_RESOURCES_OPERATION, address);
op.get(CHILD_TYPE).set(ACTIVE_OPERATION);
long maxTime = TimeoutUtil.adjust(5000);
long timeout = executionStart + maxTime;
List<String> activeOps = new ArrayList<String>();
String opToCancel = null;
do {
activeOps.clear();
ModelNode result = executeForResult(op, client);
if (result.isDefined()) {
assertEquals(result.asString(), ModelType.OBJECT, result.getType());
for (Property prop : result.asPropertyList()) {
if (prop.getValue().get(OP).asString().equals(opName)) {
PathAddress pa = PathAddress.pathAddress(prop.getValue().get(OP_ADDR));
if (!serverOpOnly || pa.size() > 2 && pa.getElement(1).getKey().equals(SERVER)) {
activeOps.add(prop.getName() + " -- " + prop.getValue().toString());
if (targetStatus == null || prop.getValue().get(EXECUTION_STATUS).asString().equals(targetStatus.toString())) {
opToCancel = prop.getName();
}
}
}
}
}
if (opToCancel == null) {
Thread.sleep(50);
}
} while ((opToCancel == null || activeOps.size() > 1) && System.currentTimeMillis() <= timeout);
assertTrue(opName + " not present after " + maxTime + " ms", activeOps.size() > 0);
assertEquals("Multiple instances of " + opName + " present: " + activeOps, 1, activeOps.size());
assertNotNull(opName + " not in status " + targetStatus + " after " + maxTime + " ms", opToCancel);
return opToCancel;
}