// Path: spring-integration-aws/src/main/java/org/springframework/integration/aws/config/AwsParserUtils.java
// public final class AwsParserUtils {
// 
// 	private AwsParserUtils() {
// 	}
// 
// 	public static void registerPermissions(Element element,
// 			BeanDefinitionBuilder executorBuilder,
// 			ParserContext parserContext) {
// 
// 		Element permissionsElement = DomUtils.getChildElementByTagName(element,
// 				"permissions");
// 		if (permissionsElement != null) {
// 			Set<Permission> permissions = new HashSet<Permission>();
// 			NodeList permNodes = permissionsElement.getChildNodes();
// 			for (int i = 0; i < permNodes.getLength(); i++) {
// 				Node permNode = permNodes.item(i);
// 				if (Node.ELEMENT_NODE == permNode.getNodeType()) {
// 					Element permissionElement = (Element) permNode;
// 					Permission permission = new Permission(
// 							permissionElement.getAttribute("label"),
// 							new HashSet<String>(), new HashSet<String>());
// 
// 					Element actionsElement = DomUtils.getChildElementByTagName(
// 							permissionElement, "actions");
// 					NodeList actionNodes = actionsElement.getChildNodes();
// 					for (int j = 0; j < actionNodes.getLength(); j++) {
// 						Node actionNode = actionNodes.item(j);
// 						if (Node.ELEMENT_NODE == actionNode.getNodeType()) {
// 							Element actionElement = (Element) actionNode;
// 							permission.getActions().add(
// 									actionElement.getTextContent());
// 						}
// 					}
// 
// 					Element accountsElement = DomUtils
// 							.getChildElementByTagName(permissionElement,
// 									"aws-accounts");
// 					NodeList accountNodes = accountsElement.getChildNodes();
// 					for (int j = 0; j < accountNodes.getLength(); j++) {
// 						Node accountNode = accountNodes.item(j);
// 						if (Node.ELEMENT_NODE == accountNode.getNodeType()) {
// 							Element accountElement = (Element) accountNode;
// 							permission.getAwsAccountIds().add(
// 									accountElement.getTextContent());
// 						}
// 					}
// 
// 					permissions.add(permission);
// 				}
// 			}
// 
// 			executorBuilder.addPropertyValue("permissions", permissions);
// 		}
// 	}
// 
// }
// 
// Path: spring-integration-aws/src/main/java/org/springframework/integration/aws/sqs/outbound/SqsOutboundGateway.java
// public class SqsOutboundGateway extends AbstractReplyProducingMessageHandler {
// 
// 	private SqsExecutor sqsExecutor;
// 	private boolean producesReply = true; // false for
// 											// outbound-channel-adapter, true
// 											// for outbound-gateway
// 
// 	public SqsOutboundGateway() {
// 		super();
// 	}
// 
// 	public void setSqsExecutor(SqsExecutor sqsExecutor) {
// 		this.sqsExecutor = sqsExecutor;
// 	}
// 
// 	@Override
// 	protected void doInit() {
// 		super.doInit();
// 		Assert.notNull(sqsExecutor, "'sqsExecutor' must not be null");
// 	}
// 
// 	@Override
// 	protected Object handleRequestMessage(Message<?> requestMessage) {
// 
// 		final Object result = this.sqsExecutor
// 				.executeOutboundOperation(requestMessage);
// 
// 		if (result == null || !producesReply) {
// 			return null;
// 		}
// 
// 		return MessageBuilder.withPayload(result)
// 				.copyHeaders(requestMessage.getHeaders()).build();
// 
// 	}
// 
// 	/**
// 	 * If set to 'false', this component will act as an Outbound Channel
// 	 * Adapter. If not explicitly set this property will default to 'true'.
// 	 * 
// 	 * @param producesReply
// 	 *            Defaults to 'true'.
// 	 * 
// 	 */
// 	public void setProducesReply(boolean producesReply) {
// 		this.producesReply = producesReply;
// 	}
// 
// }


import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.parsing.BeanComponentDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.aws.config.AwsParserUtils;
import org.springframework.integration.aws.sqs.outbound.SqsOutboundGateway;
import org.springframework.integration.config.xml.AbstractConsumerEndpointParser;
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
import org.springframework.util.StringUtils;
import org.w3c.dom.Element;

		final String replyChannel = gatewayElement
				.getAttribute("reply-channel");

		if (StringUtils.hasText(replyChannel)) {
			sqsOutboundGatewayBuilder.addPropertyReference("outputChannel",
					replyChannel);
		}

		final BeanDefinitionBuilder sqsExecutorBuilder = SqsParserUtils
				.getSqsExecutorBuilder(gatewayElement, parserContext);

		final BeanDefinition sqsExecutorBuilderBeanDefinition = sqsExecutorBuilder
				.getBeanDefinition();
		final String gatewayId = this
				.resolveId(gatewayElement,
						sqsOutboundGatewayBuilder.getRawBeanDefinition(),
						parserContext);
		final String sqsExecutorBeanName = SqsParserUtils
				.getExecutorBeanName(gatewayId);

		parserContext.registerBeanComponent(new BeanComponentDefinition(
				sqsExecutorBuilderBeanDefinition, sqsExecutorBeanName));

		sqsOutboundGatewayBuilder.addPropertyReference("sqsExecutor",
				sqsExecutorBeanName);

		SqsParserUtils.registerExecutorProxy(gatewayElement,
				sqsExecutorBeanName, parserContext);

// Path: spring-integration-aws/src/main/java/org/springframework/integration/aws/config/AwsParserUtils.java
// public final class AwsParserUtils {
// 
// 	private AwsParserUtils() {
// 	}
// 
// 	public static void registerPermissions(Element element,
// 			BeanDefinitionBuilder executorBuilder,
// 			ParserContext parserContext) {
// 
// 		Element permissionsElement = DomUtils.getChildElementByTagName(element,
// 				"permissions");
// 		if (permissionsElement != null) {
// 			Set<Permission> permissions = new HashSet<Permission>();
// 			NodeList permNodes = permissionsElement.getChildNodes();
// 			for (int i = 0; i < permNodes.getLength(); i++) {
// 				Node permNode = permNodes.item(i);
// 				if (Node.ELEMENT_NODE == permNode.getNodeType()) {
// 					Element permissionElement = (Element) permNode;
// 					Permission permission = new Permission(
// 							permissionElement.getAttribute("label"),
// 							new HashSet<String>(), new HashSet<String>());
// 
// 					Element actionsElement = DomUtils.getChildElementByTagName(
// 							permissionElement, "actions");
// 					NodeList actionNodes = actionsElement.getChildNodes();
// 					for (int j = 0; j < actionNodes.getLength(); j++) {
// 						Node actionNode = actionNodes.item(j);
// 						if (Node.ELEMENT_NODE == actionNode.getNodeType()) {
// 							Element actionElement = (Element) actionNode;
// 							permission.getActions().add(
// 									actionElement.getTextContent());
// 						}
// 					}
// 
// 					Element accountsElement = DomUtils
// 							.getChildElementByTagName(permissionElement,
// 									"aws-accounts");
// 					NodeList accountNodes = accountsElement.getChildNodes();
// 					for (int j = 0; j < accountNodes.getLength(); j++) {
// 						Node accountNode = accountNodes.item(j);
// 						if (Node.ELEMENT_NODE == accountNode.getNodeType()) {
// 							Element accountElement = (Element) accountNode;
// 							permission.getAwsAccountIds().add(
// 									accountElement.getTextContent());
// 						}
// 					}
// 
// 					permissions.add(permission);
// 				}
// 			}
// 
// 			executorBuilder.addPropertyValue("permissions", permissions);
// 		}
// 	}
// 
// }
// 
// Path: spring-integration-aws/src/main/java/org/springframework/integration/aws/sqs/outbound/SqsOutboundGateway.java
// public class SqsOutboundGateway extends AbstractReplyProducingMessageHandler {
// 
// 	private SqsExecutor sqsExecutor;
// 	private boolean producesReply = true; // false for
// 											// outbound-channel-adapter, true
// 											// for outbound-gateway
// 
// 	public SqsOutboundGateway() {
// 		super();
// 	}
// 
// 	public void setSqsExecutor(SqsExecutor sqsExecutor) {
// 		this.sqsExecutor = sqsExecutor;
// 	}
// 
// 	@Override
// 	protected void doInit() {
// 		super.doInit();
// 		Assert.notNull(sqsExecutor, "'sqsExecutor' must not be null");
// 	}
// 
// 	@Override
// 	protected Object handleRequestMessage(Message<?> requestMessage) {
// 
// 		final Object result = this.sqsExecutor
// 				.executeOutboundOperation(requestMessage);
// 
// 		if (result == null || !producesReply) {
// 			return null;
// 		}
// 
// 		return MessageBuilder.withPayload(result)
// 				.copyHeaders(requestMessage.getHeaders()).build();
// 
// 	}
// 
// 	/**
// 	 * If set to 'false', this component will act as an Outbound Channel
// 	 * Adapter. If not explicitly set this property will default to 'true'.
// 	 * 
// 	 * @param producesReply
// 	 *            Defaults to 'true'.
// 	 * 
// 	 */
// 	public void setProducesReply(boolean producesReply) {
// 		this.producesReply = producesReply;
// 	}
// 
// }


// Path: spring-integration-aws/src/main/java/org/springframework/integration/aws/sqs/config/SqsOutboundGatewayParser.java
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.parsing.BeanComponentDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.aws.config.AwsParserUtils;
import org.springframework.integration.aws.sqs.outbound.SqsOutboundGateway;
import org.springframework.integration.config.xml.AbstractConsumerEndpointParser;
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
import org.springframework.util.StringUtils;
import org.w3c.dom.Element;


		final String replyChannel = gatewayElement
				.getAttribute("reply-channel");

		if (StringUtils.hasText(replyChannel)) {
			sqsOutboundGatewayBuilder.addPropertyReference("outputChannel",
					replyChannel);
		}

		final BeanDefinitionBuilder sqsExecutorBuilder = SqsParserUtils
				.getSqsExecutorBuilder(gatewayElement, parserContext);

		final BeanDefinition sqsExecutorBuilderBeanDefinition = sqsExecutorBuilder
				.getBeanDefinition();
		final String gatewayId = this
				.resolveId(gatewayElement,
						sqsOutboundGatewayBuilder.getRawBeanDefinition(),
						parserContext);
		final String sqsExecutorBeanName = SqsParserUtils
				.getExecutorBeanName(gatewayId);

		parserContext.registerBeanComponent(new BeanComponentDefinition(
				sqsExecutorBuilderBeanDefinition, sqsExecutorBeanName));

		sqsOutboundGatewayBuilder.addPropertyReference("sqsExecutor",
				sqsExecutorBeanName);

		SqsParserUtils.registerExecutorProxy(gatewayElement,
				sqsExecutorBeanName, parserContext);

		AwsParserUtils.registerPermissions(gatewayElement, sqsExecutorBuilder,