Package com.amazonaws.services.sns.model

Examples of com.amazonaws.services.sns.model.Subscription


      if (endpointElement.hasAttribute("request-path")) {
        requestPath = endpointElement.getAttribute("request-path");
      } else {
        requestPath = String.format("/%s.do", channelAdapterId);
      }
      subscriptionList.add(new Subscription().withEndpoint(
          baseURI.concat(requestPath)).withProtocol(
          baseURI.startsWith("https") ? "https" : "http"));

      // register a HttpEndpoint at this path
      BeanDefinitionBuilder httpEndpointBuilder = BeanDefinitionBuilder
          .genericBeanDefinition(HttpEndpoint.class);
      String beanName = String
          .format("%s-httpEndpoint", channelAdapterId);
      parserContext.registerBeanComponent(new BeanComponentDefinition(
          httpEndpointBuilder.getBeanDefinition(), beanName,
          new String[] { requestPath }));
      snsExecutorBuilder.addPropertyReference("httpEndpoint", beanName);
    }

    // subscriptions element
    Element subscriptionsElement = DomUtils.getChildElementByTagName(
        element, "subscriptions");
    if (subscriptionsElement != null) {
      NodeList childNodes = subscriptionsElement.getChildNodes();
      for (int i = 0; i < childNodes.getLength(); i++) {
        Node child = childNodes.item(i);
        if (child.getNodeType() == Node.ELEMENT_NODE) {
          Element childElement = (Element) child;
          String localName = child.getLocalName();
          if ("http".equals(localName)) {
            String uri = childElement.getAttribute("base-uri");
            if (childElement.hasAttribute("request-path")) {
              uri = uri.concat(childElement
                  .getAttribute("request-path"));
            }
            subscriptionList.add(new Subscription().withEndpoint(
                uri).withProtocol(
                uri.startsWith("https") ? "https" : "http"));

          } else if ("sqs".equals(localName)) {
            String queueArn = null;
            if (childElement.hasAttribute("queue-arn")) {
              queueArn = childElement.getAttribute("queue-arn");
            }
            String queueId = null;
            if (childElement.hasAttribute("queue-id")) {
              queueId = childElement.getAttribute("queue-id");
            }
            Assert.state(queueArn != null || queueId != null,
                "One of 'queue-arn' or 'queue-id' needs to be defined");
            if (queueId != null) {
              String sqsBeanName = SqsParserUtils
                  .getExecutorBeanName(queueId);
              snsExecutorBuilder.addDependsOn(sqsBeanName);
              sqsExecutorMap.put(queueId,
                  new RuntimeBeanReference(sqsBeanName));
              subscriptionList.add(new Subscription()
                  .withEndpoint(queueId).withProtocol("sqs"));

            } else {
              subscriptionList
                  .add(new Subscription().withEndpoint(
                      queueArn).withProtocol("sqs"));
            }
          }
        }
      }
View Full Code Here


      if (endpointElement.hasAttribute("request-path")) {
        requestPath = endpointElement.getAttribute("request-path");
      } else {
        requestPath = String.format("/%s.do", channelAdapterId);
      }
      subscriptionList.add(new Subscription()
          .withEndpoint(baseURI.concat(requestPath))
          .withProtocol(
              baseURI.startsWith("https") ? "https" : "http"));

      // register a HttpEndpoint at this path
      BeanDefinitionBuilder httpEndpointBuilder = BeanDefinitionBuilder
          .genericBeanDefinition(HttpEndpoint.class);
      String beanName = String
          .format("%s-httpEndpoint", channelAdapterId);
      parserContext.registerBeanComponent(new BeanComponentDefinition(
          httpEndpointBuilder.getBeanDefinition(), beanName,
          new String[] { requestPath }));
      snsExecutorBuilder.addPropertyReference("httpEndpoint", beanName);
    }

    // subscriptions element
    Element subscriptionsElement = DomUtils.getChildElementByTagName(
        element, "subscriptions");
    if (subscriptionsElement != null) {
      NodeList childNodes = subscriptionsElement.getChildNodes();
      for (int i = 0; i < childNodes.getLength(); i++) {
        Node child = childNodes.item(i);
        if (child.getNodeType() == Node.ELEMENT_NODE) {
          Element childElement = (Element) child;
          String localName = child.getLocalName();
          if ("http".equals(localName)) {
            String uri = childElement.getAttribute("base-uri");
            if (childElement.hasAttribute("request-path")) {
              uri = uri.concat(childElement
                  .getAttribute("request-path"));
            }
            subscriptionList.add(new Subscription()
                .withEndpoint(uri)
                .withProtocol(
                    uri.startsWith("https") ? "https" :
                        "http"));

          } else if ("sqs".equals(localName)) {
            String queueArn = null;
            if (childElement.hasAttribute("queue-arn")) {
              queueArn = childElement.getAttribute("queue-arn");
            }
            String queueId = null;
            if (childElement.hasAttribute("queue-id")) {
              queueId = childElement.getAttribute("queue-id");
            }
            Assert.state(queueArn != null || queueId != null,
                "One of 'queue-arn' or 'queue-id' needs to be defined");
            if (queueId != null) {
              String sqsBeanName = SqsParserUtils
                  .getExecutorBeanName(queueId);
              snsExecutorBuilder.addDependsOn(sqsBeanName);
              sqsExecutorMap.put(queueId,
                  new RuntimeBeanReference(sqsBeanName));
              subscriptionList.add(new Subscription()
                  .withEndpoint(queueId)
                  .withProtocol("sqs"));

            } else {
              subscriptionList.add(new Subscription()
                  .withEndpoint(queueArn)
                  .withProtocol("sqs"));
            }
          }
        }
View Full Code Here

    out.println("<th>Raw Message Delivery</th>");
    out.println("<th>&nbsp;</th></tr>");

    for (int i = 0; subscriptions != null && i < subscriptions.size(); i++) {
       
          Subscription s = subscriptions.get(i);
          out.println("<tr>");
          out.println("<form action=\"/webui/cnsuser/subscription/?userId="+user.getUserId()+"&arn="+s.getSubscriptionArn()+"&topicArn="+topicArn+"\" method=POST>");
          out.println("<td>"+i+"</td>");
          out.println("<td>"+s.getSubscriptionArn() +"<input type='hidden' name='arn' value="+s.getSubscriptionArn()+"></td>");
          out.println("<td>"+s.getProtocol()+"</td>");
          if(s.getProtocol().toLowerCase().equals("cqs")&&isAdmin(request)){
             out.println("<td><a href='/webui/cqsuser?userId="+Util.getUserIdForQueueArn(s.getEndpoint())+"'>"+s.getEndpoint()+"</a></td>");
          } else {
            out.println("<td>"+s.getEndpoint()+"</td>");
          }
         
          if (s.getProtocol().toString().equals("http") && !s.getSubscriptionArn().equals("PendingConfirmation")) {
            out.println("<td><a href='#' onclick=\"window.open('/webui/cnsuser/subscription/editdeliverypolicy?subscriptionArn="+ s.getSubscriptionArn() + "&userId=" + userId + "', 'EditDeliveryPolicy', 'height=630,width=580,toolbar=no')\">View/Edit Delivery Policy</a></td>");
          } else {
            out.println("<td>&nbsp;</td>");
          }
         
          if ((s.getProtocol().toString().equals("https") || s.getProtocol().toString().equals("http") || s.getProtocol().toString().equals("cqs") || s.getProtocol().toString().equals("sqs"))
              && !s.getSubscriptionArn().equals("PendingConfirmation")) {
            String url = "/webui/cnsuser/subscription/rawmessagedeliverypolicy/?subscriptionArn="+ s.getSubscriptionArn() + "&userId=" + userId;
            out.println("<td><a href='#' onclick=\"window.open('" + url + "', 'RawMessageDelivery', 'height=200,width=580,toolbar=no')\">Raw Message Delivery</a></td>");
          } else {
            out.println("<td>&nbsp;</td>");
          }
       
          if (s.getSubscriptionArn().equals("PendingConfirmation")) {
            out.println("<td>&nbsp;</td>");
          } else {
            out.println("<td><input type='submit' value='Unsubscribe' name='Unsubscribe'/></td>");
          }
         
View Full Code Here

      if (endpointElement.hasAttribute("request-path")) {
        requestPath = endpointElement.getAttribute("request-path");
      } else {
        requestPath = String.format("/%s.do", channelAdapterId);
      }
      subscriptionList.add(new Subscription().withEndpoint(
          baseURI.concat(requestPath)).withProtocol(
          baseURI.startsWith("https") ? "https" : "http"));

      // register a HttpEndpoint at this path
      BeanDefinitionBuilder httpEndpointBuilder = BeanDefinitionBuilder
          .genericBeanDefinition(HttpEndpoint.class);
      String beanName = String
          .format("%s-httpEndpoint", channelAdapterId);
      parserContext.registerBeanComponent(new BeanComponentDefinition(
          httpEndpointBuilder.getBeanDefinition(), beanName,
          new String[] { requestPath }));
      snsExecutorBuilder.addPropertyReference("httpEndpoint", beanName);
    }

    // subscriptions element
    Element subscriptionsElement = DomUtils.getChildElementByTagName(
        element, "subscriptions");
    if (subscriptionsElement != null) {
      NodeList childNodes = subscriptionsElement.getChildNodes();
      for (int i = 0; i < childNodes.getLength(); i++) {
        Node child = childNodes.item(i);
        if (child.getNodeType() == Node.ELEMENT_NODE) {
          Element childElement = (Element) child;
          String localName = child.getLocalName();
          if ("http".equals(localName)) {
            String uri = childElement.getAttribute("base-uri");
            if (childElement.hasAttribute("request-path")) {
              uri = uri.concat(childElement
                  .getAttribute("request-path"));
            }
            subscriptionList.add(new Subscription().withEndpoint(
                uri).withProtocol(
                uri.startsWith("https") ? "https" : "http"));

          } else if ("sqs".equals(localName)) {
            String queueArn = null;
            if (childElement.hasAttribute("queue-arn")) {
              queueArn = childElement.getAttribute("queue-arn");
            }
            String queueId = null;
            if (childElement.hasAttribute("queue-id")) {
              queueId = childElement.getAttribute("queue-id");
            }
            Assert.state(queueArn != null || queueId != null,
                "One of 'queue-arn' or 'queue-id' needs to be defined");
            if (queueId != null) {
              String sqsBeanName = SqsParserUtils
                  .getExecutorBeanName(queueId);
              snsExecutorBuilder.addDependsOn(sqsBeanName);
              sqsExecutorMap.put(queueId,
                  new RuntimeBeanReference(sqsBeanName));
              subscriptionList.add(new Subscription()
                  .withEndpoint(queueId).withProtocol("sqs"));

            } else {
              subscriptionList
                  .add(new Subscription().withEndpoint(
                      queueArn).withProtocol("sqs"));
            }
          }
        }
      }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.sns.model.Subscription

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.