Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source.
   * Copyright 2011, Red Hat, Inc., and individual contributors
   * as indicated by the @author tags. See the copyright.txt file in the
   * distribution for a full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 
 package org.jboss.as.ejb3.subsystem;
 
 
 import java.util.List;
 
 import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD;
 import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP;
 import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
 import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUBSYSTEM;
 import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.VALUE;
 import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION;
 import static org.jboss.as.controller.parsing.ParseUtils.duplicateAttribute;
 import static org.jboss.as.controller.parsing.ParseUtils.missingRequired;
 import static org.jboss.as.controller.parsing.ParseUtils.readStringAttributeElement;
 import static org.jboss.as.controller.parsing.ParseUtils.requireNoAttributes;
 import static org.jboss.as.controller.parsing.ParseUtils.requireNoContent;
 import static org.jboss.as.controller.parsing.ParseUtils.requireNoNamespaceAttribute;
 import static org.jboss.as.controller.parsing.ParseUtils.unexpectedAttribute;
 import static org.jboss.as.controller.parsing.ParseUtils.unexpectedElement;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.CORE_THREADS;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.DEFAULT;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.DEFAULT_MDB_INSTANCE_POOL;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.DEFAULT_RESOURCE_ADAPTER_NAME;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.DEFAULT_SLSB_INSTANCE_POOL;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.INSTANCE_ACQUISITION_TIMEOUT;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.INSTANCE_ACQUISITION_TIMEOUT_UNIT;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.MAX_POOL_SIZE;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.MAX_THREADS;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.NAME;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.PATH;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.RELATIVE_TO;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.SERVICE;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.STRICT_MAX_BEAN_INSTANCE_POOL;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.TIMER_SERVICE;

User: Jaikiran Pai
 
 
     @Override
     public void writeContent(final XMLExtendedStreamWriter writerfinal SubsystemMarshallingContext contextthrows XMLStreamException {
 
         context.startSubsystemElement(.false);
 
         ModelNode model = context.getModelNode();
         if (model.hasDefined(.))  {
             writer.writeAttribute(.model.get(.).asString());
         }
 
         // write the mdb element
             // <mdb>
             writer.writeStartElement(..getLocalName());
             // write out the mdb element contents
             this.writeMDB(writermodel);
             // </mdb>
             writer.writeEndElement();
         }
        // write the session-bean element
            // <session-bean>
            // <stateless>
            // write out the <bean-instance-pool-ref>
            this.writeDefaultSLSBPool(writermodel);
            // </stateless>
            writer.writeEndElement();
            // </session-bean>
            writer.writeEndElement();
        }
        // write the pools element
            // <pools>
            // <bean-instance-pools>
            // write the bean instance pools
            this.writeBeanInstancePools(writermodel);
            // </bean-instance-pools>
            writer.writeEndElement();
            // </pools>
            writer.writeEndElement();
        }
        // timer-service
        if (model.hasDefined() && model.get().hasDefined()) {
            // <timer-service>
            final ModelNode timerServiceModel = model.get();
            this.writeTimerService(writertimerServiceModel);
            // </timer-service>
            writer.writeEndElement();
        }
        // write the subsystem end element
        writer.writeEndElement();
    }

    
    @Override
    public void readElement(final XMLExtendedStreamReader readerfinal List<ModelNodeoperationsthrows XMLStreamException {
        final ModelNode ejb3SubsystemAddOperation = new ModelNode();
        ejb3SubsystemAddOperation.get().set();
        ejb3SubsystemAddOperation.get().add(.);
        final String liteValue = reader.getAttributeValue(null.);
        if (liteValue != null) {
            ejb3SubsystemAddOperation.get(.).set(Boolean.parseBoolean(liteValue));
        }
        operations.add(ejb3SubsystemAddOperation);
        // elements
        final EnumSet<EJB3SubsystemXMLElementencountered = EnumSet.noneOf(EJB3SubsystemXMLElement.class);
        while (reader.hasNext() && reader.nextTag() != .) {
            switch (EJB3SubsystemNamespace.forUri(reader.getNamespaceURI())) {
                case : {
                    final EJB3SubsystemXMLElement element = EJB3SubsystemXMLElement.forName(reader.getLocalName());
                    if (!encountered.add(element)) {
                        throw unexpectedElement(reader);
                    }
                    switch (element) {
                        case : {
                            // read <mdb>
                            this.parseMDB(readeroperations);
                            break;
                        }
                        case : {
                            // read <pools>
                            this.parsePools(readeroperations);
                            break;
                        }
                        case : {
                            // read <session-bean>
                            this.parseSessionBean(readeroperations);
                            break;
                        }
                        case : {
                            parseTimerService(readeroperations);
                            break;
                        }
                        default: {
                            throw unexpectedElement(reader);
                        }
                    }
                    break;
                }
                default: {
                    throw unexpectedElement(reader);
                }
            }
        }
    }

    
Writes out the <mdb> element and its nested elements

Parameters:
writer XML writer
mdbModelNode The <mdb> element org.jboss.dmr.ModelNode
Throws:
javax.xml.stream.XMLStreamException
    private void writeMDB(final XMLExtendedStreamWriter writerfinal ModelNode mdbModelNodethrows XMLStreamException {
        if (mdbModelNode.hasDefined(.)) {
            // <resource-adapter-ref>
            final String resourceAdapterName = mdbModelNode.get(.).asString();
            // write the value
            writer.writeAttribute(..getLocalName(), resourceAdapterName);
            // </resource-adapter-ref>
            writer.writeEndElement();
        }
        if (mdbModelNode.hasDefined(.)) {
            // <bean-instance-pool-ref>
            final String poolRefName = mdbModelNode.get(.).asString();
            // write the value
            writer.writeAttribute(..getLocalName(), poolRefName);
            // </bean-instance-pool-ref>
            writer.writeEndElement();
        }
    }

    
Writes out the <session-bean> element and its nested elements

Parameters:
writer XML writer
model The <session-bean> element org.jboss.dmr.ModelNode
Throws:
javax.xml.stream.XMLStreamException
    private void writeSessionBean(final XMLExtendedStreamWriter writerfinal ModelNode modelthrows XMLStreamException {
            // <stateless>
            // contents of <stateless> element
            final ModelNode statelessBeanModeNode = model.get(..getLocalName());
            this.writeDefaultSLSBPool(writerstatelessBeanModeNode);
            // </stateless>
            writer.writeEndElement();
        }
    }
    private void writeDefaultSLSBPool(final XMLExtendedStreamWriter writerfinal ModelNode modelthrows XMLStreamException {
            // <bean-instance-pool-ref>
            // contents of pool-ref
            final String poolRefName = model.get(.).asString();
            writer.writeAttribute(..getLocalName(), poolRefName);
            // </bean-instance-pool-ref>
            writer.writeEndElement();
        }
    }
    private void writePools(final XMLExtendedStreamWriter writerfinal ModelNode poolsModelNodethrows XMLStreamException {
        if (poolsModelNode.hasDefined(..getLocalName())) {
            // <bean-instance-pools>
            // write contents of bean-instance-pools
            final ModelNode beanInstancePoolsModelNode = poolsModelNode.get(..getLocalName());
            this.writeBeanInstancePools(writerbeanInstancePoolsModelNode);
            // </bean-instance-pools>
            writer.writeEndElement();
        }
    }
    private void writeBeanInstancePools(final XMLExtendedStreamWriter writerfinal ModelNode beanInstancePoolModelNodethrows XMLStreamException {
        if (beanInstancePoolModelNode.hasDefined(.)) {
            final List<PropertystrictMaxPools = beanInstancePoolModelNode.get(.).asPropertyList();
            for (Property property : strictMaxPools) {
                // <strict-max-pool>
                // contents of strict-max-pool
                final ModelNode strictMaxPoolModelNode = property.getValue();
                this.writeStrictMaxPoolConfig(writerstrictMaxPoolModelNode);
                // </strict-max-pool>
                writer.writeEndElement();
            }
        }
    }
    private void writeStrictMaxPoolConfig(final XMLExtendedStreamWriter writerfinal ModelNode strictMaxPoolModelNodethrows XMLStreamException {
        // write the "name" attribute of the pool
        final String poolName = strictMaxPoolModelNode.get(.).asString();
        writer.writeAttribute(..getLocalName(), poolName);
        if (strictMaxPoolModelNode.hasDefined(.)) {
            // value of max-pool-size attribute
            final ModelNode maxPoolSize = strictMaxPoolModelNode.get(.);
            writer.writeAttribute(..getLocalName(), maxPoolSize.asString());
        }
        if (strictMaxPoolModelNode.hasDefined(.)) {
            // value of instance-acquisition-timeout attribute
            final ModelNode timeout = strictMaxPoolModelNode.get(.);
        }
        if (strictMaxPoolModelNode.hasDefined(.)) {
            // value of instance-acquisition-timeout-unit attribute
            final ModelNode unit = strictMaxPoolModelNode.get(.);
        }
    }
    private void writeTimerService(final XMLExtendedStreamWriter writerfinal ModelNode timerServiceModelthrows XMLStreamException {
        // <thread-pool>
        final ModelNode coreThreads = timerServiceModel.get();
        if (coreThreads.isDefined()) {
            // write the core-threads attribute
            writer.writeAttribute(..getLocalName(), "" + coreThreads.asInt());
        }
        final ModelNode maxThreads = timerServiceModel.get();
        if (maxThreads.isDefined()) {
            // write the core-threads attribute
            writer.writeAttribute(..getLocalName(), "" + maxThreads.asInt());
        }
        // </thread-pool>
        writer.writeEndElement();
        // <data-store>
        final ModelNode path = timerServiceModel.get();
        if (path.isDefined()) {
            // write the path attribute
            writer.writeAttribute(..getLocalName(), path.asString());
        }
        final ModelNode relativeTo = timerServiceModel.get();
        if (relativeTo.isDefined()) {
            // write the relative-to attribute
            writer.writeAttribute(..getLocalName(), relativeTo.asString());
        }
        // </data-store>
        writer.writeEndElement();
    }
    private ModelNode parseMDB(final XMLExtendedStreamReader readerList<ModelNodeoperationsthrows XMLStreamException {
        ModelNode mdbModelNode = new ModelNode();
        // no attributes expected
        requireNoAttributes(reader);
        while (reader.hasNext() && reader.nextTag() != .) {
            switch (EJB3SubsystemXMLElement.forName(reader.getLocalName())) {
                case : {
                    final String poolName = readStringAttributeElement(reader..getLocalName());
                    final ModelNode setDefaultMDBPoolOperation = this.createSetDefaultMDBPoolOperation(poolName);
                    operations.add(setDefaultMDBPoolOperation);
                    break;
                }
                case : {
                    final String resourceAdapterName = readStringAttributeElement(reader..getLocalName());
                    final ModelNode setDefaultRANameOperation = this.createSetDefaultRAOperation(resourceAdapterName);
                    operations.add(setDefaultRANameOperation);
                    break;
                }
                default: {
                    throw unexpectedElement(reader);
                }
            }
        }
        return mdbModelNode;
    }
    private void parseSessionBean(final XMLExtendedStreamReader readerfinal List<ModelNodeoperationsthrows XMLStreamException {
        // no attributes expected
        requireNoAttributes(reader);
        while (reader.hasNext() && reader.nextTag() != .) {
            switch (EJB3SubsystemXMLElement.forName(reader.getLocalName())) {
                case : {
                    this.parseStatelessBean(readeroperations);
                    break;
                }
                default: {
                    throw unexpectedElement(reader);
                }
            }
        }
    }
    private void parseStatelessBean(final XMLExtendedStreamReader readerfinal List<ModelNodeoperationsthrows XMLStreamException {
        // no attributes expected
        requireNoAttributes(reader);
        while (reader.hasNext() && reader.nextTag() != .) {
            switch (EJB3SubsystemXMLElement.forName(reader.getLocalName())) {
                case : {
                    final String poolName = readStringAttributeElement(reader..getLocalName());
                    final ModelNode setDefaultSLSBPoolOperation = this.createSetDefaultSLSBPoolOperation(poolName);
                    operations.add(setDefaultSLSBPoolOperation);
                    break;
                }
                default: {
                    throw unexpectedElement(reader);
                }
            }
        }
    }
    private void parsePools(final XMLExtendedStreamReader readerfinal List<ModelNodeoperationsthrows XMLStreamException {
        // no attributes expected
        requireNoAttributes(reader);
        while (reader.hasNext() && reader.nextTag() != .) {
            switch (EJB3SubsystemXMLElement.forName(reader.getLocalName())) {
                case : {
                    this.parseBeanInstancePools(readeroperations);
                    break;
                }
                default: {
                    throw unexpectedElement(reader);
                }
            }
        }
    }
    private void parseBeanInstancePools(final XMLExtendedStreamReader readerList<ModelNodeoperationsthrows XMLStreamException {
        // no attributes expected
        requireNoAttributes(reader);
        while (reader.hasNext() && reader.nextTag() != .) {
            switch (EJB3SubsystemXMLElement.forName(reader.getLocalName())) {
                case : {
                    this.parseStrictMaxPool(readeroperations);
                    break;
                }
                default: {
                    throw unexpectedElement(reader);
                }
            }
        }
    }
    private void parseStrictMaxPool(final XMLExtendedStreamReader readerList<ModelNodeoperationsthrows XMLStreamException {
        final int count = reader.getAttributeCount();
        String poolName = null;
        Integer maxPoolSize = null;
        Long timeout = null;
        String unit = null;
        for (int i = 0; i < counti++) {
            requireNoNamespaceAttribute(readeri);
            final String value = reader.getAttributeValue(i);
            final EJB3SubsystemXMLAttribute attribute = EJB3SubsystemXMLAttribute.forName(reader.getAttributeLocalName(i));
            switch (attribute) {
                case :
                    poolName = value;
                    break;
                case :
                    if (!isPositiveInt(value.trim())) {
                        throw new XMLStreamException("Illegal value: " + value + " for " + ..getLocalName(), reader.getLocation());
                    }
                    maxPoolSize = new Integer(value.trim());
                    break;
                case :
                    if (!isPositiveInt(value.trim())) {
                        throw new XMLStreamException("Illegal value: " + value + " for " + ..getLocalName(), reader.getLocation());
                    }
                    timeout = new Long(value.trim());
                    break;
                case :
                    if (!isValidTimeoutUnit(value.trim())) {
                        throw new XMLStreamException("Illegal value: " + value + " for " + ..getLocalName(), reader.getLocation());
                    }
                    unit = value.trim().toUpperCase(.);
                    break;
                default:
                    throw unexpectedAttribute(readeri);
            }
        }
        requireNoContent(reader);
        if (poolName == null) {
            throw missingRequired(reader, Collections.singleton(..getLocalName()));
        }
        // create and add the operation
        operations.add(this.createAddStrictMaxBeanInstancePoolOperation(poolNamemaxPoolSizetimeoutunit));
    }
    private void parseTimerService(final XMLExtendedStreamReader readerList<ModelNodeoperationsthrows XMLStreamException {
        requireNoAttributes(reader);
        final ModelNode address = new ModelNode();
        address.add(.);
        address.add();
        final ModelNode timerServiceAdd = new ModelNode();
        timerServiceAdd.get().set();
        timerServiceAdd.get().set(address);
        Integer coreThreads = null;
        Integer maxThreads = null;
        String dataStorePath = null;
        String dataStorePathRelativeTo = null;
        while (reader.hasNext() && reader.nextTag() != .) {
            switch (EJB3SubsystemXMLElement.forName(reader.getLocalName())) {
                case : {
                    final int count = reader.getAttributeCount();
                    for (int i = 0; i < counti++) {
                        requireNoNamespaceAttribute(readeri);
                        final String value = reader.getAttributeValue(i);
                        final EJB3SubsystemXMLAttribute attribute = EJB3SubsystemXMLAttribute.forName(reader.getAttributeLocalName(i));
                        switch (attribute) {
                            case :
                                if (coreThreads != null) {
                                    throw unexpectedAttribute(readeri);
                                }
                                coreThreads = Integer.valueOf(value);
                                break;
                            case :
                                if (maxThreads != null) {
                                    throw unexpectedAttribute(readeri);
                                }
                                maxThreads = Integer.valueOf(value);
                                break;
                            default:
                                throw unexpectedAttribute(readeri);
                        }
                    }
                    if (coreThreads != null) {
                        timerServiceAdd.get().set(coreThreads.intValue());
                    }
                    if (maxThreads != null) {
                        timerServiceAdd.get().set(maxThreads.intValue());
                    }
                    requireNoContent(reader);
                    break;
                }
                case : {
                    final int count = reader.getAttributeCount();
                    for (int i = 0; i < counti++) {
                        requireNoNamespaceAttribute(readeri);
                        final String value = reader.getAttributeValue(i);
                        final EJB3SubsystemXMLAttribute attribute = EJB3SubsystemXMLAttribute.forName(reader.getAttributeLocalName(i));
                        switch (attribute) {
                            case :
                                if (dataStorePath != null) {
                                    throw unexpectedAttribute(readeri);
                                }
                                dataStorePath = value;
                                break;
                            case :
                                if (dataStorePathRelativeTo != null) {
                                    throw unexpectedAttribute(readeri);
                                }
                                dataStorePathRelativeTo = value;
                                break;
                            default:
                                throw unexpectedAttribute(readeri);
                        }
                    }
                    if (dataStorePath == null) {
                        throw missingRequired(reader, Collections.singleton(.));
                    }
                    timerServiceAdd.get().set(dataStorePath);
                    if (dataStorePathRelativeTo != null) {
                        timerServiceAdd.get().set(dataStorePathRelativeTo);
                    }
                    requireNoContent(reader);
                    break;
                }
                default: {
                    throw unexpectedElement(reader);
                }
            }
        }
        operations.add(timerServiceAdd);
    }
    private boolean isPositiveInt(String val) {
        if (val == null || val.trim().isEmpty()) {
            return false;
        }
        try {
            final Integer value = Integer.parseInt(val);
            if (value <= 0) {
                return false;
            }
        } catch (NumberFormatException nfe) {
            return false;
        }
        return true;
    }
    private boolean isValidTimeoutUnit(final String val) {
        if (val == null || val.trim().isEmpty()) {
            return false;
        }
        final String upperCaseUnitValue = val.toUpperCase(.);
        try {
            final TimeUnit unit = TimeUnit.valueOf(upperCaseUnitValue);
            if (unit == . || unit == . || unit == . || unit == .) {
                return true;
            }
        } catch (IllegalArgumentException iae) {
            return false;
        }
        return false;
    }

    

Parses all attributes from the current element and sets them in the specified ModelNode.

Parameters:
reader the XMLExtendedStreamReader used to read the configuration XML.
node the ModelNode that will hold the parsed attributes.
expectedAttributes an EnumSet containing all expected attributes. If the parsed attribute is not one of the expected attributes, an exception is thrown.
requiredAttributes an EnumSet containing all required attributes. If a required attribute is not found, an exception is thrown.
Throws:
javax.xml.stream.XMLStreamException if an error occurs while parsing the XML, if an attribute is not one of the expected attributes or if one of the required attributes is not parsed.
    private void parseAttributes(XMLExtendedStreamReader readerModelNode nodeEnumSet<EJB3SubsystemXMLAttributeexpectedAttributes,
                                 EnumSet<EJB3SubsystemXMLAttributerequiredAttributesthrows XMLStreamException {
        EnumSet<EJB3SubsystemXMLAttributeparsedAttributes = EnumSet.noneOf(EJB3SubsystemXMLAttribute.class);
        if (requiredAttributes == null) {
            requiredAttributes = EnumSet.noneOf(EJB3SubsystemXMLAttribute.class);
        }
        for (int i = 0; i < reader.getAttributeCount(); i++) {
            requireNoNamespaceAttribute(readeri);
            final String attrValue = reader.getAttributeValue(i);
            final EJB3SubsystemXMLAttribute attribute = EJB3SubsystemXMLAttribute.forName(reader.getAttributeLocalName(i));
            // check for unexpected attributes.
            if (!expectedAttributes.contains(attribute))
                throw unexpectedAttribute(readeri);
            // check for duplicate attributes.
            if (!parsedAttributes.add(attribute)) {
                throw duplicateAttribute(readerattribute.getLocalName());
            }
            requiredAttributes.remove(attribute);
            node.get(attribute.getLocalName()).set(attrValue);
        }
        // throw an exception if a required attribute wasn't found.
        if (!requiredAttributes.isEmpty()) {
            throw missingRequired(readerrequiredAttributes);
        }
    }
    private ModelNode createSetDefaultSLSBPoolOperation(final String poolName) {
        // create /subsystem=ejb3:write-attribute(name=default-mdb-instance-pool,value=poolName) operation
        final ModelNode setDefaultSLSBPoolOperation = new ModelNode();
        setDefaultSLSBPoolOperation.get().set();
        // set the address for this operation
        setDefaultSLSBPoolOperation.get().set(this.getEJB3SubsystemAddress().toModelNode());
        // set the params for the operation
        setDefaultSLSBPoolOperation.get().set();
        setDefaultSLSBPoolOperation.get().set(poolName);
        return setDefaultSLSBPoolOperation;
    }
    private ModelNode createSetDefaultMDBPoolOperation(final String poolName) {
        // create /subsystem=ejb3:write-attribute(name=default-mdb-instance-pool,value=poolName) operation
        final ModelNode setDefaultMDBPoolOperation = new ModelNode();
        setDefaultMDBPoolOperation.get().set();
        // set the address for this operation
        setDefaultMDBPoolOperation.get().set(this.getEJB3SubsystemAddress().toModelNode());
        // set the params for the operation
        setDefaultMDBPoolOperation.get().set();
        setDefaultMDBPoolOperation.get().set(poolName);
        return setDefaultMDBPoolOperation;
    }
    private ModelNode createSetDefaultRAOperation(final String resourceAdapterName) {
        // create /subsystem=ejb3:write-attribute(name=default-resource-adapter-name,value=poolName) operation
        final ModelNode setDefaultRAName = new ModelNode();
        setDefaultRAName.get().set();
        // set the address for this operation
        setDefaultRAName.get().set(this.getEJB3SubsystemAddress().toModelNode());
        // set the params for the operation
        setDefaultRAName.get().set();
        setDefaultRAName.get().set(resourceAdapterName);
        return setDefaultRAName;
    }
    private ModelNode createAddStrictMaxBeanInstancePoolOperation(final String namefinal Integer maxPoolSizefinal Long timeoutfinal String timeoutUnit) {
        // create /subsystem=ejb3/strict-max-bean-instance-pool=name:add(...)
        final ModelNode addStrictMaxPoolOperation = new ModelNode();
        addStrictMaxPoolOperation.get().set();
        // set the address for this operation
        final PathAddress address = this.getEJB3SubsystemAddress().append(PathElement.pathElement(name));
        addStrictMaxPoolOperation.get().set(address.toModelNode());
        // set the params for the operation
        if (maxPoolSize != null) {
            addStrictMaxPoolOperation.get().set(maxPoolSize);
        }
        if (timeout != null) {
            addStrictMaxPoolOperation.get().set(timeout);
        }
        if (timeoutUnit != null) {
            addStrictMaxPoolOperation.get().set(timeoutUnit);
        }
        return addStrictMaxPoolOperation;
    }
        PathAddress addr = PathAddress.pathAddress(PathElement.pathElement(.));
        return addr;
    }
New to GrepCode? Check out our FAQ X