本文整理汇总了Java中org.jboss.dmr.Property.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java Property.getValue方法的具体用法?Java Property.getValue怎么用?Java Property.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.dmr.Property
的用法示例。
在下文中一共展示了Property.getValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getChildDescription
import org.jboss.dmr.Property; //导入方法依赖的package包/类
/**
* Looks for the description of a specific child resource.
* @param type The type of the child resource
* @param name The name of the instance
* @return the description of the specific child resource or {@link #EMPTY} if no such resource exists.
*/
public ResourceDescription getChildDescription(String type, String name) {
if (hasChildrenDefined()) {
List<Property> children = get("children").asPropertyList();
for (Property child : children) {
if (type.equals(child.getName()) && child.getValue().hasDefined(MODEL_DESCRIPTION)) {
List<Property> modelDescriptions = child.getValue().get(MODEL_DESCRIPTION).asPropertyList();
for (Property modelDescription : modelDescriptions) {
if (name.equals(modelDescription.getName())) {
return new ResourceDescription(modelDescription.getValue());
}
}
}
}
}
return EMPTY;
}
示例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: writeProperties
import org.jboss.dmr.Property; //导入方法依赖的package包/类
void writeProperties(final XMLExtendedStreamWriter writer, final ModelNode modelNode, Element element,
boolean standalone) throws XMLStreamException {
final List<Property> properties = modelNode.asPropertyList();
if (properties.size() > 0) {
writer.writeStartElement(element.getLocalName());
for (Property prop : properties) {
writer.writeStartElement(Element.PROPERTY.getLocalName());
writer.writeAttribute(NAME, prop.getName());
ModelNode sysProp = prop.getValue();
SystemPropertyResourceDefinition.VALUE.marshallAsAttribute(sysProp, writer);
if (!standalone) {
SystemPropertyResourceDefinition.BOOT_TIME.marshallAsAttribute(sysProp, writer);
}
writer.writeEndElement();
}
writer.writeEndElement();
}
}
示例4: processSubsystems
import org.jboss.dmr.Property; //导入方法依赖的package包/类
/**
* Create the transformers. This will remotely resolve the subsystem versions.
*
* @param extensions the extensions
* @throws OperationFailedException
*/
private void processSubsystems(final Transformers transformers, final ModelNode extensions) throws OperationFailedException {
this.transformers = transformers;
final ModelNode subsystems = executeBlocking(new IOTask<ModelNode>() {
@Override
void sendMessage(FlushableDataOutput output) throws IOException {
sendResponse(output, DomainControllerProtocol.PARAM_OK, extensions);
}
});
if(failed) {
throw new OperationFailedException("failed to setup transformers");
}
final TransformationTarget target = transformers.getTarget();
for(final Property subsystem : subsystems.asPropertyList()) {
final String subsystemName = subsystem.getName();
final ModelNode version = subsystem.getValue();
target.addSubsystemVersion(subsystemName, ModelVersion.fromString(version.asString()));
}
}
示例5: testObjectWithList
import org.jboss.dmr.Property; //导入方法依赖的package包/类
@Test
public void testObjectWithList() throws Exception {
final ModelNode value = parse("a=b,c=[d,e]");
assertNotNull(value);
assertEquals(ModelType.OBJECT, value.getType());
final List<Property> list = value.asPropertyList();
assertEquals(2, list.size());
Property prop = list.get(0);
assertNotNull(prop);
assertEquals("a", prop.getName());
assertEquals("b", prop.getValue().asString());
prop = list.get(1);
assertNotNull(prop);
assertEquals("c", prop.getName());
final ModelNode de = prop.getValue();
assertEquals(ModelType.LIST, de.getType());
final List<ModelNode> deList = de.asList();
assertEquals(2, deList.size());
assertEquals("d", deList.get(0).asString());
assertEquals("e", deList.get(1).asString());
}
示例6: 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;
}
示例7: getServersForGroup
import org.jboss.dmr.Property; //导入方法依赖的package包/类
public static Set<ServerIdentity> getServersForGroup(String groupName, ModelNode hostModel, final String localHostName, final Map<String, ProxyController> serverProxies) {
Set<ServerIdentity> result;
if (hostModel.hasDefined(SERVER_CONFIG)) {
result = 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 (groupName != null && !groupName.equals(serverGroupName)) {
continue;
}
ServerIdentity groupedServer = new ServerIdentity(localHostName, serverGroupName, serverName);
result.add(groupedServer);
}
} else {
result = Collections.emptySet();
}
return result;
}
示例8: getGlobalSuggestedCount
import org.jboss.dmr.Property; //导入方法依赖的package包/类
private static int getGlobalSuggestedCount(final OperationContext context, final ModelNode workers) throws OperationFailedException {
int count = 0;
if (!workers.isDefined()){
return count;
}
for (Property property : workers.asPropertyList()) {
ModelNode worker = property.getValue();
ModelNode ioThreadsModel = WORKER_IO_THREADS.resolveModelAttribute(context, worker);
ModelNode maxTaskThreadsModel = WORKER_TASK_MAX_THREADS.resolveModelAttribute(context, worker);
if (ioThreadsModel.isDefined()) {
count += ioThreadsModel.asInt();
} else {
count += getSuggestedIoThreadCount();
}
if (maxTaskThreadsModel.isDefined()) {
count += maxTaskThreadsModel.asInt();
} else {
count += getSuggestedTaskCount();
}
}
return count;
}
示例9: 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());
}
}
}
示例10: writeContent
import org.jboss.dmr.Property; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException {
context.startSubsystemElement(Namespace.CURRENT.getUriString(), false);
final ModelNode node = context.getModelNode();
final ModelNode mbean = node.get(SmppMbeanDefinition.MBEAN);
for (Property mbeanProp : mbean.asPropertyList()) {
writer.writeStartElement(SmppMbeanDefinition.MBEAN);
final ModelNode mbeanEntry = mbeanProp.getValue();
SmppMbeanDefinition.NAME_ATTR.marshallAsAttribute(mbeanEntry, true, writer);
SmppMbeanDefinition.TYPE_ATTR.marshallAsAttribute(mbeanEntry, true, writer);
final ModelNode property = mbeanEntry.get(SmppMbeanPropertyDefinition.PROPERTY);
if (property != null && property.isDefined()) {
for (Property propertyProp : property.asPropertyList()) {
writer.writeStartElement(SmppMbeanPropertyDefinition.PROPERTY);
final ModelNode propertyEntry = propertyProp.getValue();
SmppMbeanPropertyDefinition.NAME_ATTR.marshallAsAttribute(propertyEntry, true, writer);
SmppMbeanPropertyDefinition.TYPE_ATTR.marshallAsAttribute(propertyEntry, true, writer);
SmppMbeanPropertyDefinition.VALUE_ATTR.marshallAsAttribute(propertyEntry, true, writer);
writer.writeEndElement();
}
}
writer.writeEndElement();
}
writer.writeEndElement();
}
示例11: writeThreadFactory
import org.jboss.dmr.Property; //导入方法依赖的package包/类
public void writeThreadFactory(final XMLExtendedStreamWriter writer, final Property property, final String elementName, final boolean includeName) throws XMLStreamException {
writer.writeStartElement(elementName);
ModelNode node = property.getValue();
if (includeName) {
writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName());
}
PoolAttributeDefinitions.GROUP_NAME.marshallAsAttribute(node, writer);
PoolAttributeDefinitions.THREAD_NAME_PATTERN.marshallAsAttribute(node, writer);
PoolAttributeDefinitions.PRIORITY.marshallAsAttribute(node, writer);
writer.writeEndElement();
}
示例12: writeContent
import org.jboss.dmr.Property; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException {
context.startSubsystemElement(Namespace.CURRENT.getUriString(), false);
ModelNode scanners = context.getModelNode();
for (final Property list : scanners.asPropertyList()) {
final ModelNode node = list.getValue();
for (final Property scanner : node.asPropertyList()) {
final String scannerName = scanner.getName();
final ModelNode configuration = scanner.getValue();
writer.writeEmptyElement(DEPLOYMENT_SCANNER);
if (!DeploymentScannerExtension.DEFAULT_SCANNER_NAME.equals(scannerName)) {
writer.writeAttribute(NAME, scannerName);
}
DeploymentScannerDefinition.PATH.marshallAsAttribute(configuration, writer);
DeploymentScannerDefinition.RELATIVE_TO.marshallAsAttribute(configuration, writer);
DeploymentScannerDefinition.SCAN_ENABLED.marshallAsAttribute(configuration, writer);
DeploymentScannerDefinition.SCAN_INTERVAL.marshallAsAttribute(configuration, writer);
DeploymentScannerDefinition.AUTO_DEPLOY_ZIPPED.marshallAsAttribute(configuration, writer);
DeploymentScannerDefinition.AUTO_DEPLOY_EXPLODED.marshallAsAttribute(configuration, writer);
DeploymentScannerDefinition.AUTO_DEPLOY_XML.marshallAsAttribute(configuration, writer);
DeploymentScannerDefinition.DEPLOYMENT_TIMEOUT.marshallAsAttribute(configuration, writer);
DeploymentScannerDefinition.RUNTIME_FAILURE_CAUSES_ROLLBACK.marshallAsAttribute(configuration, writer);
}
writer.writeEndElement();
}
}
示例13: writeContent
import org.jboss.dmr.Property; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException {
context.startSubsystemElement(Namespace.CURRENT.getUriString(), false);
ModelNode scanners = context.getModelNode();
for (final Property list : scanners.asPropertyList()) {
final ModelNode node = list.getValue();
for (final Property scanner : node.asPropertyList()) {
final String scannerName = scanner.getName();
final ModelNode configuration = scanner.getValue();
writer.writeEmptyElement(DEPLOYMENT_SCANNER);
if (!DeploymentScannerExtension.DEFAULT_SCANNER_NAME.equals(scannerName)) {
writer.writeAttribute(NAME, scannerName);
}
DeploymentScannerDefinition.PATH.marshallAsAttribute(configuration, writer);
DeploymentScannerDefinition.RELATIVE_TO.marshallAsAttribute(configuration, writer);
DeploymentScannerDefinition.SCAN_ENABLED.marshallAsAttribute(configuration, writer);
DeploymentScannerDefinition.SCAN_INTERVAL.marshallAsAttribute(configuration, writer);
DeploymentScannerDefinition.AUTO_DEPLOY_ZIPPED.marshallAsAttribute(configuration, writer);
DeploymentScannerDefinition.AUTO_DEPLOY_EXPLODED.marshallAsAttribute(configuration, writer);
DeploymentScannerDefinition.AUTO_DEPLOY_XML.marshallAsAttribute(configuration, writer);
DeploymentScannerDefinition.DEPLOYMENT_TIMEOUT.marshallAsAttribute(configuration, writer);
}
writer.writeEndElement();
}
}
示例14: writeUnboundedQueueThreadPool
import org.jboss.dmr.Property; //导入方法依赖的package包/类
public void writeUnboundedQueueThreadPool(final XMLExtendedStreamWriter writer, final Property property, final String elementName, final boolean includeName)
throws XMLStreamException {
writer.writeStartElement(elementName);
ModelNode node = property.getValue();
if (includeName) {
writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName());
}
writeCountElement(PoolAttributeDefinitions.MAX_THREADS, node, writer);
writeTime(writer, node, Element.KEEPALIVE_TIME);
writeRef(writer, node, Element.THREAD_FACTORY, THREAD_FACTORY);
writer.writeEndElement();
}
示例15: listDeployments
import org.jboss.dmr.Property; //导入方法依赖的package包/类
public static void listDeployments(CommandContext ctx,
boolean l) throws CommandException {
if (!l) {
printList(ctx, Util.getDeployments(ctx.
getModelControllerClient()), l);
return;
}
final ModelControllerClient client = ctx.getModelControllerClient();
final List<String> names = Util.getDeployments(client);
if (names.isEmpty()) {
return;
}
final StrictSizeTable table = new StrictSizeTable(names.size());
final List<Property> descriptions = getDeploymentDescriptions(ctx, names).
asPropertyList();
for (Property prop : descriptions) {
final ModelNode step = prop.getValue();
if (step.hasDefined(Util.RESULT)) {
final ModelNode result = step.get(Util.RESULT);
table.addCell(Util.NAME, result.get(Util.NAME).asString());
table.addCell(Util.RUNTIME_NAME, result.get(Util.RUNTIME_NAME).
asString());
if (result.has(Util.ENABLED)) {
table.addCell(Util.ENABLED, result.get(Util.ENABLED).asString());
}
if (result.has(Util.PERSISTENT)) {
table.addCell(Util.PERSISTENT, result.get(Util.PERSISTENT).asString());
}
if (result.has(Util.STATUS)) {
table.addCell(Util.STATUS, result.get(Util.STATUS).asString());
}
}
if (!table.isAtLastRow()) {
table.nextRow();
}
}
ctx.printLine(table.toString());
}