@Override
  public void marshallAsElement(ModelNode resourceModel, XMLStreamWriter writer)
      throws XMLStreamException {
    if (resourceModel.hasDefined(getName()) && resourceModel.asInt() > 0) {
      final ModelNode modules = resourceModel.get(getName());
      for (ModelNode module : modules.asList()) {
        writer.writeStartElement(getXmlName());
        writer.writeAttribute(Attribute.CODE.getLocalName(), module.get(CODE).asString());
        if (module.hasDefined(Constants.LOGIN_MODULE_STACK_REF)) {
          writer.writeAttribute(
              Attribute.LOGIN_MODULE_STACK_REF.getLocalName(),
              module.get(Constants.LOGIN_MODULE_STACK_REF).asString());
        }

        if (module.hasDefined(Constants.MODULE_OPTIONS)) {
          for (ModelNode option : module.get(Constants.MODULE_OPTIONS).asList()) {
            writer.writeEmptyElement(Element.MODULE_OPTION.getLocalName());
            writer.writeAttribute(Attribute.NAME.getLocalName(), option.asProperty().getName());
            writer.writeAttribute(
                Attribute.VALUE.getLocalName(), option.asProperty().getValue().asString());
          }
        }
        writer.writeEndElement();
      }
    }
  }
  /**
   * Compares two models to make sure that they are the same
   *
   * @param node1 the first model
   * @param node2 the second model
   * @throws AssertionFailedError if the models were not the same
   */
  protected void compare(ModelNode node1, ModelNode node2) {
    Assert.assertEquals(getCompareStackAsString() + " types", node1.getType(), node2.getType());
    if (node1.getType() == ModelType.OBJECT) {
      final Set<String> keys1 = node1.keys();
      final Set<String> keys2 = node2.keys();
      Assert.assertEquals(node1 + "\n" + node2, keys1.size(), keys2.size());

      for (String key : keys1) {
        final ModelNode child1 = node1.get(key);
        Assert.assertTrue("Missing: " + key + "\n" + node1 + "\n" + node2, node2.has(key));
        final ModelNode child2 = node2.get(key);
        if (child1.isDefined()) {
          Assert.assertTrue(child1.toString(), child2.isDefined());
          stack.get().push(key + "/");
          compare(child1, child2);
          stack.get().pop();
        } else {
          Assert.assertFalse(child2.asString(), child2.isDefined());
        }
      }
    } else if (node1.getType() == ModelType.LIST) {
      List<ModelNode> list1 = node1.asList();
      List<ModelNode> list2 = node2.asList();
      Assert.assertEquals(list1 + "\n" + list2, list1.size(), list2.size());

      for (int i = 0; i < list1.size(); i++) {
        stack.get().push(i + "/");
        compare(list1.get(i), list2.get(i));
        stack.get().pop();
      }

    } else if (node1.getType() == ModelType.PROPERTY) {
      Property prop1 = node1.asProperty();
      Property prop2 = node2.asProperty();
      Assert.assertEquals(prop1 + "\n" + prop2, prop1.getName(), prop2.getName());
      stack.get().push(prop1.getName() + "/");
      compare(prop1.getValue(), prop2.getValue());
      stack.get().pop();

    } else {
      try {
        Assert.assertEquals(
            getCompareStackAsString()
                + "\n\""
                + node1.asString()
                + "\"\n\""
                + node2.asString()
                + "\"\n-----",
            node2.asString().trim(),
            node1.asString().trim());
      } catch (AssertionFailedError error) {
        throw error;
      }
    }
  }
  private List<CommonAdminObject> buildAdminObjects(ModelNode parentNode) {
    List<CommonAdminObject> adminObjets = new ArrayList<CommonAdminObject>();
    if (parentNode.hasDefined(ADMIN_OBJECTS)) {
      for (ModelNode adminObject : parentNode.get(ADMIN_OBJECTS).asList()) {
        Map<String, String> configProperties = null;
        if (adminObject.hasDefined(CONFIG_PROPERTIES)) {
          configProperties =
              new HashMap<String, String>(adminObject.get(CONFIG_PROPERTIES).asList().size());
          for (ModelNode property : adminObject.get(CONFIG_PROPERTIES).asList()) {
            configProperties.put(property.asProperty().getName(), property.asString());
          }
        }
        String className = getStringIfSetOrGetDefault(adminObject, CLASS_NAME, null);
        String jndiName = getStringIfSetOrGetDefault(adminObject, JNDI_NAME, null);
        String poolName = getStringIfSetOrGetDefault(adminObject, POOL_NAME, null);
        boolean enabled = getBooleanIfSetOrGetDefault(adminObject, ENABLED, false);
        boolean useJavaContext = getBooleanIfSetOrGetDefault(adminObject, USE_JAVA_CONTEXT, false);

        CommonAdminObject adminObjet =
            new CommonAdminObjectImpl(
                configProperties, className, jndiName, poolName, enabled, useJavaContext);

        adminObjets.add(adminObjet);
      }
    }
    return adminObjets;
  }
Beispiel #4
0
 @Override
 public void marshallAsElement(
     final AttributeDefinition attribute,
     final ModelNode resourceModel,
     final boolean marshallDefault,
     final XMLStreamWriter writer)
     throws XMLStreamException {
   for (ModelNode property : resourceModel.get(attribute.getName()).asList()) {
     writer.writeStartElement(attribute.getXmlName());
     writer.writeAttribute(
         org.jboss.as.controller.parsing.Attribute.NAME.getLocalName(),
         property.asProperty().getName());
     writer.writeCharacters(property.asProperty().getValue().asString());
     writer.writeEndElement();
   }
 }
  void launchServices(
      final OperationContext context,
      final PathAddress pathAddress,
      final ModelNode model,
      final ServiceVerificationHandler verificationHandler,
      final List<ServiceController<?>> newControllers)
      throws OperationFailedException {
    Handler newHandler = new Handler();

    newHandler.setClazz(
        HandlerResourceDefinition.CLASS.resolveModelAttribute(context, model).asString());

    ModelNode handler = Resource.Tools.readModel(context.readResourceFromRoot(pathAddress));

    if (handler.hasDefined(COMMON_HANDLER_PARAMETER.getName())) {
      for (ModelNode handlerParameter : handler.get(COMMON_HANDLER_PARAMETER.getName()).asList()) {
        Property property = handlerParameter.asProperty();
        String paramName = property.getName();
        String paramValue =
            HandlerParameterResourceDefinition.VALUE
                .resolveModelAttribute(context, property.getValue())
                .asString();

        KeyValueType kv = new KeyValueType();

        kv.setKey(paramName);
        kv.setValue(paramValue);

        newHandler.add(kv);
      }
    }

    SAMLHandlerService service = new SAMLHandlerService(newHandler);
    PathElement providerAlias = pathAddress.subAddress(0, pathAddress.size() - 1).getLastElement();

    ServiceTarget serviceTarget = context.getServiceTarget();
    ServiceBuilder<SAMLHandlerService> serviceBuilder =
        serviceTarget.addService(
            createServiceName(providerAlias.getValue(), newHandler.getClazz()), service);
    ServiceName serviceName;

    if (providerAlias.getKey().equals(IDENTITY_PROVIDER.getName())) {
      serviceName = IdentityProviderService.createServiceName(providerAlias.getValue());
    } else {
      serviceName = ServiceProviderService.createServiceName(providerAlias.getValue());
    }

    serviceBuilder.addDependency(
        serviceName, EntityProviderService.class, service.getEntityProviderService());

    ServiceController<SAMLHandlerService> controller =
        serviceBuilder
            .addListener(verificationHandler)
            .setInitialMode(ServiceController.Mode.PASSIVE)
            .install();

    if (newControllers != null) {
      newControllers.add(controller);
    }
  }
 @Override
 public void marshallAsElement(
     AttributeDefinition attribute,
     ModelNode resourceModel,
     boolean marshallDefault,
     XMLStreamWriter writer)
     throws XMLStreamException {
   resourceModel = resourceModel.get(attribute.getName());
   if (resourceModel.isDefined()) {
     for (ModelNode property : resourceModel.asList()) {
       writer.writeEmptyElement(REALM_MAPPING);
       writer.writeAttribute(FROM, property.asProperty().getName());
       writer.writeAttribute(TO, property.asProperty().getValue().asString());
     }
   }
 }
  private void writeWorkspaces(XMLExtendedStreamWriter writer, ModelNode repository)
      throws XMLStreamException {
    boolean started = false;
    // Write these model attributes of 'repository' onto the 'workspaces' XML element ...
    if (ModelAttributes.DEFAULT_WORKSPACE.isMarshallable(repository, false)) {
      started = startIfNeeded(writer, Element.WORKSPACES, started);
      ModelAttributes.DEFAULT_WORKSPACE.marshallAsAttribute(repository, writer);
    }
    if (ModelAttributes.ALLOW_WORKSPACE_CREATION.isMarshallable(repository, false)) {
      started = startIfNeeded(writer, Element.WORKSPACES, started);
      ModelAttributes.ALLOW_WORKSPACE_CREATION.marshallAsAttribute(repository, writer);
    }
    if (ModelAttributes.WORKSPACES_CACHE_CONTAINER.isMarshallable(repository, false)) {
      started = startIfNeeded(writer, Element.WORKSPACES, started);
      ModelAttributes.WORKSPACES_CACHE_CONTAINER.marshallAsAttribute(repository, writer);
    }
    if (has(repository, ModelKeys.PREDEFINED_WORKSPACE_NAMES)) {
      started = startIfNeeded(writer, Element.WORKSPACES, started);
      ModelNode names = repository.get(ModelKeys.PREDEFINED_WORKSPACE_NAMES);
      if (names.isDefined()) {
        Map<String, String> workspacesInitialContent = new HashMap<String, String>();
        if (has(repository, ModelKeys.WORKSPACES_INITIAL_CONTENT)) {
          List<ModelNode> initialContentNodes =
              repository.get(ModelKeys.WORKSPACES_INITIAL_CONTENT).asList();
          for (ModelNode modelNode : initialContentNodes) {
            Property property = modelNode.asProperty();
            workspacesInitialContent.put(property.getName(), property.getValue().asString());
          }
        }

        for (ModelNode workspace : repository.get(ModelKeys.PREDEFINED_WORKSPACE_NAMES).asList()) {
          writer.writeStartElement(Element.WORKSPACE.getLocalName());
          String name = workspace.asString();
          writer.writeAttribute(Attribute.NAME.getLocalName(), name);

          if (workspacesInitialContent.containsKey(name)) {
            writer.writeStartElement(Element.INITIAL_CONTENT.getLocalName());
            writer.writeCharacters(workspacesInitialContent.get(name));
            writer.writeEndElement();
          }

          writer.writeEndElement();
        }
      }
    }
    if (has(repository, ModelKeys.DEFAULT_INITIAL_CONTENT)) {
      started = startIfNeeded(writer, Element.WORKSPACES, started);
      writer.writeStartElement(Element.INITIAL_CONTENT.getLocalName());
      writer.writeCharacters(repository.get(ModelKeys.DEFAULT_INITIAL_CONTENT).asString());
      writer.writeEndElement();
    }
    if (started) {
      writer.writeEndElement();
    }
  }
  private void configureIdentityStore(
      OperationContext context,
      ServiceBuilder<PartitionManager> serviceBuilder,
      ServiceVerificationHandler verificationHandler,
      List<ServiceController<?>> newControllers,
      PartitionManagerService partitionManagerService,
      String configurationName,
      NamedIdentityConfigurationBuilder namedIdentityConfigurationBuilder,
      ModelNode modelNode)
      throws OperationFailedException {
    Property prop = modelNode.asProperty();
    String storeType = prop.getName();
    ModelNode identityStore = prop.getValue().asProperty().getValue();
    IdentityStoreConfigurationBuilder<?, ?> storeConfig = null;

    if (storeType.equals(JPA_STORE.getName())) {
      storeConfig =
          configureJPAIdentityStore(
              context,
              serviceBuilder,
              verificationHandler,
              newControllers,
              partitionManagerService,
              identityStore,
              configurationName,
              namedIdentityConfigurationBuilder);
    } else if (storeType.equals(FILE_STORE.getName())) {
      storeConfig =
          configureFileIdentityStore(
              context,
              serviceBuilder,
              verificationHandler,
              newControllers,
              partitionManagerService,
              identityStore,
              configurationName,
              namedIdentityConfigurationBuilder);
    } else if (storeType.equals(LDAP_STORE.getName())) {
      storeConfig =
          configureLDAPIdentityStore(context, identityStore, namedIdentityConfigurationBuilder);
    }

    ModelNode supportAttributeNode =
        JPAStoreResourceDefinition.SUPPORT_ATTRIBUTE.resolveModelAttribute(context, identityStore);

    storeConfig.supportAttributes(supportAttributeNode.asBoolean());

    ModelNode supportCredentialNode =
        JPAStoreResourceDefinition.SUPPORT_CREDENTIAL.resolveModelAttribute(context, identityStore);

    storeConfig.supportCredentials(supportCredentialNode.asBoolean());

    configureSupportedTypes(context, identityStore, storeConfig);
    configureCredentialHandlers(context, identityStore, storeConfig);
  }
  private static Extension extractExtension(
      final ModelNode node, final String className, final String propertyName)
      throws ValidateException {
    if (node.hasDefined(className)) {
      String exceptionSorterClassName = node.get(className).asString();

      getStringIfSetOrGetDefault(node, className, null);

      Map<String, String> exceptionSorterProperty = null;
      if (node.hasDefined(propertyName)) {
        exceptionSorterProperty =
            new HashMap<String, String>(node.get(propertyName).asList().size());
        for (ModelNode property : node.get(propertyName).asList()) {
          exceptionSorterProperty.put(
              property.asProperty().getName(), property.asProperty().getValue().asString());
        }
      }

      return new Extension(exceptionSorterClassName, exceptionSorterProperty);
    } else {
      return null;
    }
  }
 @Override
 void formatDefined(StringBuilder buf, int newLineOffset, ModelNode value) {
   final Property prop = value.asProperty();
   buf.append(prop.getName());
   final ModelNode propValue = prop.getValue();
   final ModelNodeFormatterBase formatter = Factory.forType(propValue.getType());
   if (formatter == LIST) {
     buf.append('\n');
     formatter.format(buf, newLineOffset + OFFSET, propValue);
   } else {
     buf.append('=');
     formatter.format(buf, newLineOffset, propValue);
   }
 }
 @Override
 public void marshallAsElement(
     AttributeDefinition attribute,
     ModelNode resourceModel,
     boolean marshallDefault,
     XMLStreamWriter writer)
     throws XMLStreamException {
   resourceModel = resourceModel.get(attribute.getName());
   if (wrapElement) {
     writer.writeStartElement(wrapperElement == null ? attribute.getName() : wrapperElement);
   }
   for (ModelNode property : resourceModel.asList()) {
     writer.writeEmptyElement(attribute.getXmlName());
     writer.writeAttribute(
         org.jboss.as.controller.parsing.Attribute.NAME.getLocalName(),
         property.asProperty().getName());
     writer.writeAttribute(
         org.jboss.as.controller.parsing.Attribute.VALUE.getLocalName(),
         property.asProperty().getValue().asString());
   }
   if (wrapElement) {
     writer.writeEndElement();
   }
 }
  protected ModifiableResourceAdaptors buildResourceAdaptersObject(ModelNode operation)
      throws OperationFailedException {
    List<ResourceAdapter> resourceAdapters = new ArrayList<ResourceAdapter>();
    Map<String, String> configProperties = null;
    if (operation.hasDefined(CONFIG_PROPERTIES)) {
      configProperties =
          new HashMap<String, String>(operation.get(CONFIG_PROPERTIES).asList().size());
      for (ModelNode property : operation.get(CONFIG_PROPERTIES).asList()) {
        configProperties.put(property.asProperty().getName(), property.asString());
      }
    }
    String archive = getStringIfSetOrGetDefault(operation, ARCHIVE, null);
    TransactionSupportEnum transactionSupport =
        operation.hasDefined(TRANSACTIONSUPPORT)
            ? TransactionSupportEnum.valueOf(operation.get(TRANSACTIONSUPPORT).asString())
            : null;
    String bootstrapContext = getStringIfSetOrGetDefault(operation, BOOTSTRAPCONTEXT, null);
    List<String> beanValidationGroups = null;
    if (operation.hasDefined(BEANVALIDATIONGROUPS)) {
      beanValidationGroups =
          new ArrayList<String>(operation.get(BEANVALIDATIONGROUPS).asList().size());
      for (ModelNode beanValidtion : operation.get(BEANVALIDATIONGROUPS).asList()) {
        beanValidationGroups.add(beanValidtion.asString());
      }
    }
    ResourceAdapter ra;
    try {
      ra =
          new ResourceAdapterImpl(
              archive,
              transactionSupport,
              buildConnectionDefinitionObject(operation),
              buildAdminObjects(operation),
              configProperties,
              beanValidationGroups,
              bootstrapContext);
    } catch (ValidateException e) {
      throw new OperationFailedException(e, operation);
    }

    resourceAdapters.add(ra);

    return new ModifiableResourceAdaptors(resourceAdapters);
  }
Beispiel #13
0
    private void writeProperties(final XMLExtendedStreamWriter writer, final ModelNode node)
        throws XMLStreamException {
      writer.writeStartElement(Element.PROPERTIES.getLocalName());

      if (node.getType() == ModelType.LIST) {
        for (ModelNode prop : node.asList()) {
          if (prop.getType() == ModelType.PROPERTY) {
            writer.writeStartElement(Element.PROPERTY.getLocalName());

            final Property property = prop.asProperty();
            writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName());
            writeAttribute(writer, Attribute.VALUE, property.getValue());

            writer.writeEndElement();
          }
        }
      }
      writer.writeEndElement();
    }
 /**
  * Checks the existence of a resource. If the resource exists, {@code true} is returned, otherwise
  * {@code false}.
  *
  * @param address the address of the resource to check.
  * @param client the client used to execute the operation.
  * @return {@code true} if the resources exists, otherwise {@code false}.
  * @throws IOException if an error occurs executing the operation.
  * @throws RuntimeException if the operation fails.
  */
 private boolean resourceExists(final ModelNode address, final ModelControllerClient client)
     throws IOException {
   final Property childAddress = ServerOperations.getChildAddress(address);
   final ModelNode parentAddress = ServerOperations.getParentAddress(address);
   final ModelNode r =
       client.execute(
           ServerOperations.createOperation(ServerOperations.READ_RESOURCE, parentAddress, false));
   reportFailure(r);
   boolean found = false;
   final String name = childAddress.getName();
   if (ServerOperations.isSuccessfulOutcome(r)) {
     for (ModelNode dataSource : ServerOperations.readResult(r).get(name).asList()) {
       if (dataSource.asProperty().getName().equals(childAddress.getValue().asString())) {
         found = true;
       }
     }
   }
   return found;
 }
Beispiel #15
0
  private EditableDocument parseWorkspaces(
      OperationContext context, ModelNode model, EditableDocument configDoc)
      throws OperationFailedException {
    EditableDocument workspacesDoc = configDoc.getOrCreateDocument(FieldName.WORKSPACES);
    boolean allowWorkspaceCreation =
        attribute(context, model, ModelAttributes.ALLOW_WORKSPACE_CREATION).asBoolean();
    String defaultWorkspaceName =
        attribute(context, model, ModelAttributes.DEFAULT_WORKSPACE).asString();
    workspacesDoc.set(FieldName.ALLOW_CREATION, allowWorkspaceCreation);
    workspacesDoc.set(FieldName.DEFAULT, defaultWorkspaceName);
    if (model.hasDefined(ModelKeys.PREDEFINED_WORKSPACE_NAMES)) {
      for (ModelNode name : model.get(ModelKeys.PREDEFINED_WORKSPACE_NAMES).asList()) {
        workspacesDoc.getOrCreateArray(FieldName.PREDEFINED).add(name.asString());
      }

      if (model.hasDefined(ModelKeys.WORKSPACES_INITIAL_CONTENT)) {
        EditableDocument initialContentDocument =
            workspacesDoc.getOrCreateDocument(FieldName.INITIAL_CONTENT);
        List<ModelNode> workspacesInitialContent =
            model.get(ModelKeys.WORKSPACES_INITIAL_CONTENT).asList();
        for (ModelNode initialContent : workspacesInitialContent) {
          Property initialContentProperty = initialContent.asProperty();
          initialContentDocument.set(
              initialContentProperty.getName(), initialContentProperty.getValue().asString());
        }
      }
    }
    if (model.hasDefined(ModelKeys.DEFAULT_INITIAL_CONTENT)) {
      EditableDocument initialContentDocument =
          workspacesDoc.getOrCreateDocument(FieldName.INITIAL_CONTENT);
      initialContentDocument.set(
          FieldName.DEFAULT_INITIAL_CONTENT,
          model.get(ModelKeys.DEFAULT_INITIAL_CONTENT).asString());
    }
    return workspacesDoc;
  }
  public OperationResult execute(
      final OperationContext context, final ModelNode operation, final ResultHandler resultHandler)
      throws OperationFailedException {
    final ModelNode opAddr = operation.require(OP_ADDR);
    final String jndiName = PathAddress.pathAddress(opAddr).getLastElement().getValue();

    // Compensating is add
    final ModelNode model = context.getSubModel();
    final ModelNode compensating = Util.getEmptyOperation(ADD, opAddr);

    if (model.has(CONNECTION_PROPERTIES)) {
      for (ModelNode property : model.get(CONNECTION_PROPERTIES).asList()) {
        compensating
            .get(CONNECTION_PROPERTIES, property.asProperty().getName())
            .set(property.asString());
      }
    }
    for (final AttributeDefinition attribute : getModelProperties()) {
      if (model.get(attribute.getName()).isDefined()) {
        compensating.get(attribute.getName()).set(model.get(attribute.getName()));
      }
    }

    if (context.getRuntimeContext() != null) {
      context
          .getRuntimeContext()
          .setRuntimeTask(
              new RuntimeTask() {
                public void execute(RuntimeTaskContext context) throws OperationFailedException {
                  final ServiceRegistry registry = context.getServiceRegistry();

                  final ServiceName binderServiceName =
                      ContextNames.JAVA_CONTEXT_SERVICE_NAME.append(jndiName);
                  final ServiceController<?> binderController =
                      registry.getService(binderServiceName);
                  if (binderController != null) {
                    binderController.setMode(ServiceController.Mode.REMOVE);
                  }

                  final ServiceName referenceFactoryServiceName =
                      DataSourceReferenceFactoryService.SERVICE_NAME_BASE.append(jndiName);
                  final ServiceController<?> referenceFactoryController =
                      registry.getService(referenceFactoryServiceName);
                  if (referenceFactoryController != null) {
                    referenceFactoryController.setMode(ServiceController.Mode.REMOVE);
                  }

                  final ServiceName dataSourceServiceName =
                      AbstractDataSourceService.SERVICE_NAME_BASE.append(jndiName);
                  final ServiceController<?> dataSourceController =
                      registry.getService(dataSourceServiceName);
                  if (dataSourceController != null) {
                    dataSourceController.setMode(ServiceController.Mode.REMOVE);
                  }
                  resultHandler.handleResultComplete();
                }
              });
    } else {
      resultHandler.handleResultComplete();
    }

    return new BasicOperationResult(compensating);
  }
Beispiel #17
0
    @Override
    public void validateParameter(String parameterName, ModelNode plan)
        throws OperationFailedException {
      if (plan == null) {
        throw new OperationFailedException(MESSAGES.nullVar("plan").getLocalizedMessage());
      }
      if (!plan.hasDefined(ROLLOUT_PLAN)) {
        throw new OperationFailedException(
            MESSAGES.requiredChildIsMissing(ROLLOUT_PLAN, ROLLOUT_PLAN, plan.toString()));
      }
      ModelNode rolloutPlan1 = plan.get(ROLLOUT_PLAN);

      final Set<String> keys;
      try {
        keys = rolloutPlan1.keys();
      } catch (IllegalArgumentException e) {
        throw new OperationFailedException(
            MESSAGES.requiredChildIsMissing(ROLLOUT_PLAN, IN_SERIES, plan.toString()));
      }
      if (!keys.contains(IN_SERIES)) {
        throw new OperationFailedException(
            MESSAGES.requiredChildIsMissing(ROLLOUT_PLAN, IN_SERIES, plan.toString()));
      }
      if (keys.size() > 2 || keys.size() == 2 && !keys.contains(ROLLBACK_ACROSS_GROUPS)) {
        throw new OperationFailedException(
            MESSAGES.unrecognizedChildren(
                ROLLOUT_PLAN, IN_SERIES + ", " + ROLLBACK_ACROSS_GROUPS, plan.toString()));
      }

      final ModelNode inSeries = rolloutPlan1.get(IN_SERIES);
      if (!inSeries.isDefined()) {
        throw new OperationFailedException(
            MESSAGES.requiredChildIsMissing(ROLLOUT_PLAN, IN_SERIES, plan.toString()));
      }

      final List<ModelNode> groups = inSeries.asList();
      if (groups.isEmpty()) {
        throw new OperationFailedException(MESSAGES.inSeriesIsMissingGroups(plan.toString()));
      }

      for (ModelNode group : groups) {
        if (group.hasDefined(SERVER_GROUP)) {
          final ModelNode serverGroup = group.get(SERVER_GROUP);
          final Set<String> groupKeys;
          try {
            groupKeys = serverGroup.keys();
          } catch (IllegalArgumentException e) {
            throw new OperationFailedException(
                MESSAGES.serverGroupExpectsSingleChild(plan.toString()));
          }
          if (groupKeys.size() != 1) {
            throw new OperationFailedException(
                MESSAGES.serverGroupExpectsSingleChild(plan.toString()));
          }
          validateInSeriesServerGroup(serverGroup.asProperty().getValue());
        } else if (group.hasDefined(CONCURRENT_GROUPS)) {
          final ModelNode concurrent = group.get(CONCURRENT_GROUPS);
          for (ModelNode child : concurrent.asList()) {
            validateInSeriesServerGroup(child.asProperty().getValue());
          }
        } else {
          throw new OperationFailedException(MESSAGES.unexpectedInSeriesGroup(plan.toString()));
        }
      }
    }
  private List<CommonConnDef> buildConnectionDefinitionObject(ModelNode parentNode)
      throws ValidateException {
    List<CommonConnDef> connDefs = new ArrayList<CommonConnDef>();
    if (parentNode.hasDefined(CONNECTIONDEFINITIONS)) {
      for (ModelNode conDefNode : parentNode.get(CONNECTIONDEFINITIONS).asList()) {
        Map<String, String> configProperties = null;
        if (conDefNode.hasDefined(CONFIG_PROPERTIES)) {
          configProperties =
              new HashMap<String, String>(conDefNode.get(CONFIG_PROPERTIES).asList().size());
          for (ModelNode property : conDefNode.get(CONFIG_PROPERTIES).asList()) {
            configProperties.put(property.asProperty().getName(), property.asString());
          }
        }
        String className = getStringIfSetOrGetDefault(conDefNode, CLASS_NAME, null);
        String jndiName = getStringIfSetOrGetDefault(conDefNode, JNDI_NAME, null);
        String poolName = getStringIfSetOrGetDefault(conDefNode, POOL_NAME, null);
        boolean enabled = getBooleanIfSetOrGetDefault(conDefNode, ENABLED, false);
        boolean useJavaContext = getBooleanIfSetOrGetDefault(conDefNode, USE_JAVA_CONTEXT, false);
        boolean useCcm = getBooleanIfSetOrGetDefault(conDefNode, USE_CCM, true);

        Integer maxPoolSize = getIntIfSetOrGetDefault(conDefNode, MAX_POOL_SIZE, null);
        Integer minPoolSize = getIntIfSetOrGetDefault(conDefNode, MIN_POOL_SIZE, null);
        boolean prefill = getBooleanIfSetOrGetDefault(conDefNode, POOL_PREFILL, false);
        boolean useStrictMin = getBooleanIfSetOrGetDefault(conDefNode, POOL_USE_STRICT_MIN, false);
        final FlushStrategy flushStrategy =
            conDefNode.hasDefined(FLUSH_STRATEGY)
                ? FlushStrategy.valueOf(conDefNode.get(FLUSH_STRATEGY).asString())
                : FlushStrategy.FAILING_CONNECTION_ONLY;

        Integer allocationRetry = getIntIfSetOrGetDefault(conDefNode, ALLOCATION_RETRY, null);
        Long allocationRetryWaitMillis =
            getLongIfSetOrGetDefault(conDefNode, ALLOCATION_RETRY_WAIT_MILLIS, null);
        Long blockingTimeoutMillis =
            getLongIfSetOrGetDefault(conDefNode, BLOCKING_TIMEOUT_WAIT_MILLIS, null);
        Long idleTimeoutMinutes = getLongIfSetOrGetDefault(conDefNode, IDLETIMEOUTMINUTES, null);
        Integer xaResourceTimeout = getIntIfSetOrGetDefault(conDefNode, XA_RESOURCE_TIMEOUT, null);
        CommonTimeOut timeOut =
            new CommonTimeOutImpl(
                blockingTimeoutMillis,
                idleTimeoutMinutes,
                allocationRetry,
                allocationRetryWaitMillis,
                xaResourceTimeout);
        CommonPool pool =
            new CommonPoolImpl(minPoolSize, maxPoolSize, prefill, useStrictMin, flushStrategy);

        String securityDomain = getStringIfSetOrGetDefault(conDefNode, SECURITY_DOMAIN, null);
        String securityDomainAndApplication =
            getStringIfSetOrGetDefault(conDefNode, SECURITY_DOMAIN_AND_APPLICATION, null);
        boolean application = getBooleanIfSetOrGetDefault(conDefNode, APPLICATION, true);
        CommonSecurity security =
            new CommonSecurityImpl(securityDomain, securityDomainAndApplication, application);

        Long backgroundValidationMillis =
            getLongIfSetOrGetDefault(conDefNode, BACKGROUNDVALIDATIONMINUTES_REMOVE, null);
        backgroundValidationMillis =
            getLongIfSetOrGetDefault(conDefNode, BACKGROUNDVALIDATIONMILLIS, null);
        boolean backgroundValidation =
            getBooleanIfSetOrGetDefault(conDefNode, BACKGROUNDVALIDATION, false);
        boolean useFastFail = getBooleanIfSetOrGetDefault(conDefNode, USE_FAST_FAIL_REMOVE, false);
        useFastFail = getBooleanIfSetOrGetDefault(conDefNode, USE_FAST_FAIL, false);
        CommonValidation validation =
            new CommonValidationImpl(backgroundValidation, backgroundValidationMillis, useFastFail);
        final String recoveryUsername =
            getStringIfSetOrGetDefault(conDefNode, RECOVERY_USERNAME, null);
        final String recoveryPassword =
            getStringIfSetOrGetDefault(conDefNode, RECOVERY_PASSWORD, null);
        final String recoverySecurityDomain =
            getStringIfSetOrGetDefault(conDefNode, RECOVERY_SECURITY_DOMAIN, null);

        final Credential credential =
            new CredentialImpl(recoveryUsername, recoveryPassword, recoverySecurityDomain);

        final Extension recoverPlugin =
            extractExtension(conDefNode, RECOVERLUGIN_CLASSNAME, RECOVERLUGIN_PROPERTIES);
        final boolean noRecovery = getBooleanIfSetOrGetDefault(conDefNode, NO_RECOVERY, false);
        Recovery recovery = new Recovery(credential, recoverPlugin, noRecovery);
        CommonConnDef connectionDefinition =
            new CommonConnDefImpl(
                configProperties,
                className,
                jndiName,
                poolName,
                enabled,
                useJavaContext,
                useCcm,
                pool,
                timeOut,
                validation,
                security,
                recovery);

        connDefs.add(connectionDefinition);
      }
    }
    return connDefs;
  }