Package org.uddi.subr_v3

Examples of org.uddi.subr_v3.NotifySubscriptionListener


          && endPoint.after(modelSubscription.getLastNotified())) {
         log.info("We already send out a notification within this coverage period, no need to send another one.");
         return;
      }
      org.apache.juddi.model.BindingTemplate bindingTemplate= em.find(org.apache.juddi.model.BindingTemplate.class, modelSubscription.getBindingKey());
      NotifySubscriptionListener body = new NotifySubscriptionListener();
      if (resultList.getServiceList().getServiceInfos()!=null &&
          resultList.getServiceList().getServiceInfos().getServiceInfo().size() == 0) {
        resultList.getServiceList().setServiceInfos(null);
      }
      body.setSubscriptionResultsList(resultList);
      String authorizedName = modelSubscription.getAuthorizedName();
      UDDISecurityImpl security = new UDDISecurityImpl();
      try {
        //obtain a token for this publisher
        org.uddi.api_v3.AuthToken token = security.getAuthToken(authorizedName);
        body.setAuthInfo(token.getAuthInfo());
      } catch (DispositionReportFaultMessage e) {
        body.setAuthInfo("Failed to generate token, please contact UDDI admin");
        log.error(e.getMessage(),e);
      }
     
      if (bindingTemplate!=null) {
        if (AccessPointType.END_POINT.toString().equalsIgnoreCase(bindingTemplate.getAccessPointType())) {
          QName qName = new QName(SUBR_V3_NAMESPACE, SUBSCRIPTION_LISTENER);
          try {
            Service service = Service.create(new URL(bindingTemplate.getAccessPointUrl()), qName);
            UDDISubscriptionListenerPortType subscriptionListenerPort = (UDDISubscriptionListenerPortType) service.getPort(UDDISubscriptionListenerPortType.class);
            log.info("Sending out notification to " + bindingTemplate.getAccessPointUrl());
            subscriptionListenerPort.notifySubscriptionListener(body);
            //there maybe more chunks we have to send
            String chunkToken=body.getSubscriptionResultsList().getChunkToken();
            while(chunkToken!=null) {
              UddiEntityPublisher publisher = new UddiEntityPublisher();
              publisher.setAuthorizedName(modelSubscription.getAuthorizedName());
              log.debug("Sending out next chunk: " + chunkToken + " to " + bindingTemplate.getAccessPointUrl());
              getSubscriptionResults.setChunkToken(chunkToken);
              resultList = subscriptionImpl.getSubscriptionResults(getSubscriptionResults, publisher);
              body.setSubscriptionResultsList(resultList);
              subscriptionListenerPort.notifySubscriptionListener(body);
              chunkToken=body.getSubscriptionResultsList().getChunkToken();
            }
            //now log to the db that we completed sending the notification.
            Date notificationDate = new Date();
            modelSubscription.setLastNotified(notificationDate);
            em.persist(modelSubscription);
View Full Code Here

TOP

Related Classes of org.uddi.subr_v3.NotifySubscriptionListener

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.