本文整理汇总了Java中org.jboss.as.controller.parsing.ParseUtils.duplicateNamedElement方法的典型用法代码示例。如果您正苦于以下问题:Java ParseUtils.duplicateNamedElement方法的具体用法?Java ParseUtils.duplicateNamedElement怎么用?Java ParseUtils.duplicateNamedElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.as.controller.parsing.ParseUtils
的用法示例。
在下文中一共展示了ParseUtils.duplicateNamedElement方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readElement
import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void readElement(XMLExtendedStreamReader reader, List<ModelNode> list) throws XMLStreamException {
ParseUtils.requireNoAttributes(reader);
list.add(createAddOperation());
boolean gotConnector = false;
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
final String element = reader.getLocalName();
switch (element) {
case CommonAttributes.JMX_CONNECTOR: {
if (gotConnector) {
throw ParseUtils.duplicateNamedElement(reader, CommonAttributes.JMX_CONNECTOR);
}
parseConnector(reader);
gotConnector = true;
break;
}
default: {
throw ParseUtils.unexpectedElement(reader);
}
}
}
}
示例2: parseHeap
import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
private static void parseHeap(final XMLExtendedStreamReader reader, ModelNode addOp)
throws XMLStreamException {
// Handle attributes
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String value = reader.getAttributeValue(i);
if (!isNoNamespaceAttribute(reader, i)) {
throw ParseUtils.unexpectedAttribute(reader, i);
} else {
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
case SIZE: {
if (checkParseAndSetParameter(JvmAttributes.HEAP_SIZE, value, addOp, reader)) {
throw ParseUtils.duplicateNamedElement(reader, reader.getLocalName());
}
break;
}
case MAX_SIZE: {
if (checkParseAndSetParameter(JvmAttributes.MAX_HEAP_SIZE, value, addOp, reader)) {
throw ParseUtils.duplicateNamedElement(reader, reader.getLocalName());
}
break;
}
default:
throw ParseUtils.unexpectedAttribute(reader, i);
}
}
}
// Handle elements
requireNoContent(reader);
}
示例3: parsePermgen
import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
private static void parsePermgen(final XMLExtendedStreamReader reader, ModelNode addOp)
throws XMLStreamException {
// Handle attributes
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String value = reader.getAttributeValue(i);
if (!isNoNamespaceAttribute(reader, i)) {
throw ParseUtils.unexpectedAttribute(reader, i);
} else {
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
case SIZE: {
if (checkParseAndSetParameter(JvmAttributes.PERMGEN_SIZE, value, addOp, reader)) {
throw ParseUtils.duplicateNamedElement(reader, reader.getLocalName());
}
break;
}
case MAX_SIZE: {
if (checkParseAndSetParameter(JvmAttributes.MAX_PERMGEN_SIZE, value, addOp, reader)) {
throw ParseUtils.duplicateNamedElement(reader, reader.getLocalName());
}
break;
}
default:
throw ParseUtils.unexpectedAttribute(reader, i);
}
}
}
// Handle elements
requireNoContent(reader);
}
示例4: parseStack
import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
private static void parseStack(final XMLExtendedStreamReader reader, ModelNode addOp)
throws XMLStreamException {
// Handle attributes
boolean sizeSet = false;
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String value = reader.getAttributeValue(i);
if (!isNoNamespaceAttribute(reader, i)) {
throw ParseUtils.unexpectedAttribute(reader, i);
} else {
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
case SIZE: {
sizeSet = true;
if (checkParseAndSetParameter(JvmAttributes.STACK_SIZE, value, addOp, reader)){
throw ParseUtils.duplicateNamedElement(reader, reader.getLocalName());
}
break;
}
default:
throw ParseUtils.unexpectedAttribute(reader, i);
}
}
}
if (!sizeSet) {
throw ParseUtils.missingRequired(reader, Collections.singleton(Attribute.SIZE));
}
// Handle elements
requireNoContent(reader);
}
示例5: parseAgentLib
import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
private static void parseAgentLib(final XMLExtendedStreamReader reader, ModelNode addOp)
throws XMLStreamException {
// Handle attributes
boolean valueSet = false;
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String value = reader.getAttributeValue(i);
if (!isNoNamespaceAttribute(reader, i)) {
throw ParseUtils.unexpectedAttribute(reader, i);
} else {
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
case VALUE: {
if (checkParseAndSetParameter(JvmAttributes.AGENT_LIB, value, addOp, reader)){
throw ParseUtils.duplicateNamedElement(reader, reader.getLocalName());
}
valueSet = true;
break;
}
default:
throw ParseUtils.unexpectedAttribute(reader, i);
}
}
}
if (!valueSet) {
throw ParseUtils.missingRequired(reader, Collections.singleton(Attribute.VALUE));
}
// Handle elements
requireNoContent(reader);
}
示例6: parseAgentPath
import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
private static void parseAgentPath(final XMLExtendedStreamReader reader, ModelNode addOp)
throws XMLStreamException {
// Handle attributes
boolean valueSet = false;
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String value = reader.getAttributeValue(i);
if (!isNoNamespaceAttribute(reader, i)) {
throw ParseUtils.unexpectedAttribute(reader, i);
} else {
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
case VALUE: {
if (checkParseAndSetParameter(JvmAttributes.AGENT_PATH, value, addOp, reader)){
throw ParseUtils.duplicateNamedElement(reader, reader.getLocalName());
}
valueSet = true;
break;
}
default:
throw ParseUtils.unexpectedAttribute(reader, i);
}
}
}
if (!valueSet) {
throw ParseUtils.missingRequired(reader, Collections.singleton(Attribute.VALUE));
}
// Handle elements
requireNoContent(reader);
}
示例7: parseLaunchCommand
import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
private static void parseLaunchCommand(final XMLExtendedStreamReader reader, ModelNode addOp)
throws XMLStreamException {
// Handle attributes
boolean valueSet = false;
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String value = reader.getAttributeValue(i);
if (!isNoNamespaceAttribute(reader, i)) {
throw ParseUtils.unexpectedAttribute(reader, i);
} else {
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
case PREFIX: {
if (checkParseAndSetParameter(JvmAttributes.LAUNCH_COMMAND, value, addOp, reader)) {
throw ParseUtils.duplicateNamedElement(reader, reader.getLocalName());
}
valueSet = true;
break;
}
default:
throw ParseUtils.unexpectedAttribute(reader, i);
}
}
}
if (!valueSet) {
throw ParseUtils.missingRequired(reader, Collections.singleton(Attribute.PREFIX));
}
// Handle elements
requireNoContent(reader);
}
示例8: parseJavaagent
import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
private static void parseJavaagent(final XMLExtendedStreamReader reader, ModelNode addOp)
throws XMLStreamException {
// Handle attributes
boolean valueSet = false;
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String value = reader.getAttributeValue(i);
if (!isNoNamespaceAttribute(reader, i)) {
throw ParseUtils.unexpectedAttribute(reader, i);
} else {
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
case VALUE: {
if (checkParseAndSetParameter(JvmAttributes.JAVA_AGENT, value, addOp, reader)) {
throw ParseUtils.duplicateNamedElement(reader, reader.getLocalName());
}
valueSet = true;
break;
}
default:
throw ParseUtils.unexpectedAttribute(reader, i);
}
}
}
if (!valueSet) {
throw ParseUtils.missingRequired(reader, Collections.singleton(Attribute.VALUE));
}
// Handle elements
requireNoContent(reader);
}
示例9: parseStaticDiscoveryOption
import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
protected void parseStaticDiscoveryOption(final XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> list, final Set<String> staticDiscoveryOptionNames) throws XMLStreamException {
// OP_ADDR will be set after parsing the NAME attribute
final ModelNode staticDiscoveryOptionAddress = address.clone();
staticDiscoveryOptionAddress.add(CORE_SERVICE, DISCOVERY_OPTIONS);
final ModelNode addOp = Util.getEmptyOperation(ADD, new ModelNode());
list.add(addOp);
// Handle attributes
final Set<Attribute> required = EnumSet.of(Attribute.NAME, Attribute.HOST, Attribute.PORT);
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));
required.remove(attribute);
switch (attribute) {
case NAME: {
if (!staticDiscoveryOptionNames.add(value)) {
throw ParseUtils.duplicateNamedElement(reader, value);
}
addOp.get(OP_ADDR).set(staticDiscoveryOptionAddress).add(STATIC_DISCOVERY, value);
break;
}
case HOST: {
StaticDiscoveryResourceDefinition.HOST.parseAndSetParameter(value, addOp, reader);
break;
}
case PROTOCOL: {
StaticDiscoveryResourceDefinition.PROTOCOL.parseAndSetParameter(value, addOp, reader);
break;
}
case PORT: {
StaticDiscoveryResourceDefinition.PORT.parseAndSetParameter(value, addOp, reader);
break;
}
default:
throw unexpectedAttribute(reader, i);
}
}
if (required.size() > 0) {
throw missingRequired(reader, required);
}
requireNoContent(reader);
}
示例10: parseDiscoveryOptionAttributes
import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
private ModelNode parseDiscoveryOptionAttributes(final XMLExtendedStreamReader reader, final ModelNode address,
final List<ModelNode> list, final Set<String> discoveryOptionNames) throws XMLStreamException {
// OP_ADDR will be set after parsing the NAME attribute
final ModelNode discoveryOptionAddress = address.clone();
discoveryOptionAddress.add(CORE_SERVICE, DISCOVERY_OPTIONS);
final ModelNode addOp = Util.getEmptyOperation(ADD, new ModelNode());
list.add(addOp);
final Set<Attribute> required = EnumSet.of(Attribute.NAME, Attribute.CODE);
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));
required.remove(attribute);
switch (attribute) {
case NAME: {
if (!discoveryOptionNames.add(value)) {
throw ParseUtils.duplicateNamedElement(reader, value);
}
addOp.get(OP_ADDR).set(discoveryOptionAddress).add(DISCOVERY_OPTION, value);
break;
}
case CODE: {
DiscoveryOptionResourceDefinition.CODE.parseAndSetParameter(value, addOp, reader);
break;
}
case MODULE: {
DiscoveryOptionResourceDefinition.MODULE.parseAndSetParameter(value, addOp, reader);
break;
}
default:
throw unexpectedAttribute(reader, i);
}
}
if (required.size() > 0) {
throw missingRequired(reader, required);
}
return addOp;
}
示例11: parseStaticDiscoveryOption
import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
private void parseStaticDiscoveryOption(final XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> list, final Set<String> staticDiscoveryOptionNames) throws XMLStreamException {
// OP_ADDR will be set after parsing the NAME attribute
final ModelNode staticDiscoveryOptionAddress = address.clone();
staticDiscoveryOptionAddress.add(CORE_SERVICE, DISCOVERY_OPTIONS);
final ModelNode addOp = Util.getEmptyOperation(ADD, new ModelNode());
list.add(addOp);
// Handle attributes
final Set<Attribute> required = EnumSet.of(Attribute.NAME, Attribute.HOST, Attribute.PORT);
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));
required.remove(attribute);
switch (attribute) {
case NAME: {
if (!staticDiscoveryOptionNames.add(value)) {
throw ParseUtils.duplicateNamedElement(reader, value);
}
addOp.get(OP_ADDR).set(staticDiscoveryOptionAddress).add(STATIC_DISCOVERY, value);
break;
}
case HOST: {
StaticDiscoveryResourceDefinition.HOST.parseAndSetParameter(value, addOp, reader);
break;
}
case PROTOCOL: {
StaticDiscoveryResourceDefinition.PROTOCOL.parseAndSetParameter(value, addOp, reader);
break;
}
case PORT: {
StaticDiscoveryResourceDefinition.PORT.parseAndSetParameter(value, addOp, reader);
break;
}
default:
throw unexpectedAttribute(reader, i);
}
}
if (required.size() > 0) {
throw missingRequired(reader, required);
}
requireNoContent(reader);
}
示例12: parseDiscoveryOptionAttributes
import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
private ModelNode parseDiscoveryOptionAttributes(final XMLExtendedStreamReader reader, final ModelNode address,
final List<ModelNode> list, final Set<String> discoveryOptionNames) throws XMLStreamException {
// OP_ADDR will be set after parsing the NAME attribute
final ModelNode discoveryOptionAddress = address.clone();
discoveryOptionAddress.add(CORE_SERVICE, DISCOVERY_OPTIONS);
final ModelNode addOp = Util.getEmptyOperation(ADD, new ModelNode());
list.add(addOp);
final Set<Attribute> required = EnumSet.of(Attribute.NAME, Attribute.CODE);
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));
required.remove(attribute);
switch (attribute) {
case NAME: {
if (!discoveryOptionNames.add(value)) {
throw ParseUtils.duplicateNamedElement(reader, value);
}
addOp.get(OP_ADDR).set(discoveryOptionAddress).add(DISCOVERY_OPTION, value);
break;
}
case CODE: {
DiscoveryOptionResourceDefinition.CODE.parseAndSetParameter(value, addOp, reader);
break;
}
case MODULE: {
DiscoveryOptionResourceDefinition.MODULE.parseAndSetParameter(value, addOp, reader);
break;
}
default:
throw unexpectedAttribute(reader, i);
}
}
if (required.size() > 0) {
throw missingRequired(reader, required);
}
return addOp;
}
示例13: parseStaticDiscoveryOption
import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
private void parseStaticDiscoveryOption(final XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> list, final Set<String> staticDiscoveryOptionNames) throws XMLStreamException {
// OP_ADDR will be set after parsing the NAME attribute
final ModelNode staticDiscoveryOptionAddress = address.clone();
staticDiscoveryOptionAddress.add(CORE_SERVICE, DISCOVERY_OPTIONS);
final ModelNode addOp = Util.getEmptyOperation(ADD, new ModelNode());
list.add(addOp);
// Handle attributes
final Set<Attribute> required = EnumSet.of(Attribute.NAME, Attribute.HOST, Attribute.PORT);
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));
required.remove(attribute);
switch (attribute) {
case NAME: {
if (!staticDiscoveryOptionNames.add(value)) {
throw ParseUtils.duplicateNamedElement(reader, value);
}
addOp.get(OP_ADDR).set(staticDiscoveryOptionAddress).add(STATIC_DISCOVERY, value);
break;
}
case HOST: {
StaticDiscoveryResourceDefinition.HOST.parseAndSetParameter(value, addOp, reader);
break;
}
case PROTOCOL: {
if(namespace.getMajorVersion() > 2) {
StaticDiscoveryResourceDefinition.PROTOCOL.parseAndSetParameter(value, addOp, reader);
} else {
throw unexpectedAttribute(reader, i);
}
break;
}
case PORT: {
StaticDiscoveryResourceDefinition.PORT.parseAndSetParameter(value, addOp, reader);
break;
}
default:
throw unexpectedAttribute(reader, i);
}
}
if (required.size() > 0) {
throw missingRequired(reader, required);
}
requireNoContent(reader);
}
示例14: readElement
import org.jboss.as.controller.parsing.ParseUtils; //导入方法依赖的package包/类
@Override
public void readElement(XMLExtendedStreamReader reader, List<ModelNode> list) throws XMLStreamException {
final PathAddress address = PathAddress.pathAddress(SUBSYSTEM, RemotingExtension.SUBSYSTEM_NAME);
final ModelNode subsystem = Util.createAddOperation(address);
list.add(subsystem);
requireAttributes(reader);
boolean foundEndpoint = false;
// Handle elements
boolean doneWorkerThreadPool = false;
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
final Element element = Element.forName(reader.getLocalName());
switch (element) {
case WORKER_THREAD_POOL:
if (doneWorkerThreadPool) {
throw ParseUtils.duplicateNamedElement(reader, Element.WORKER_THREAD_POOL.getLocalName());
}
if (foundEndpoint) {
throw workerThreadPoolEndpointChoiceRequired(reader);
}
doneWorkerThreadPool = true;
parseWorkerThreadPool(reader, subsystem);
break;
case ENDPOINT:
if (doneWorkerThreadPool) {
throw workerThreadPoolEndpointChoiceRequired(reader);
}
parseEndpoint(reader, subsystem);
foundEndpoint = true;
break;
case CONNECTOR: {
// Add connector updates
parseConnector(reader, address.toModelNode(), list);
break;
}
case HTTP_CONNECTOR: {
// Add http connector updates
parseHttpConnector(reader, address.toModelNode(), list);
break;
}
case OUTBOUND_CONNECTIONS: {
// parse the outbound-connections
this.parseOutboundConnections(reader, address.toModelNode(), list);
break;
}
default: {
throw unexpectedElement(reader);
}
}
}
}