Package org.uddi.sub_v3

Examples of org.uddi.sub_v3.Subscription


    }

    public Object createObject(Attributes attributes) {
        String host = attributes.getValue("host");
        User user = (User) digester.peek();
        Subscription subscription = user.createSubscription(host);
        String autoConnect = attributes.getValue("autoConnect");
        if (autoConnect == null) {
            autoConnect = "false";
        }
        if ("true".equalsIgnoreCase(autoConnect) ||
            "yes".equalsIgnoreCase(autoConnect)) {
            subscription.setAutoConnect(true);
        } else {
            subscription.setAutoConnect(false);
        }
        subscription.setPassword(attributes.getValue("password"));
        subscription.setType(attributes.getValue("type"));
        subscription.setUsername(attributes.getValue("username"));
        return (subscription);
    }
View Full Code Here


     * If there are none, a zero-length array is returned.
     */
    public Subscription[] getSubscriptions() {

        synchronized (subscriptions) {
            Subscription results[] = new Subscription[subscriptions.size()];
            return ((Subscription[]) subscriptions.values().toArray(results));
        }

    }
View Full Code Here

      getSubscriptionResults.setAuthInfo(userAuthToken);
      getSubscriptionResults.setSubscriptionKey(modelSubscription.getSubscriptionKey());
     
      XMLGregorianCalendar calendarStart = DatatypeFactory.newInstance().newXMLGregorianCalendar(modelSubscription.getCoverageStart());
      XMLGregorianCalendar calendarEnd = DatatypeFactory.newInstance().newXMLGregorianCalendar(modelSubscription.getCoverageEnd());
      CoveragePeriod coverage = new CoveragePeriod();
      coverage.setStartPoint(calendarStart);
      coverage.setEndPoint(calendarEnd);
      getSubscriptionResults.setCoveragePeriod(coverage);
     
      String authToken = (String) session.getAttribute("token-" + modelSubscription.getFromClerkName());
      getSubscriptionResults.setAuthInfo(authToken);
            SyncSubscription syncSubscription = new SyncSubscription();
View Full Code Here

    duration.addTo(nextDesiredNotificationDate);

    if (subscription.getLastNotified()==null || nextDesiredNotificationDate.after(startPoint) && nextDesiredNotificationDate.before(endPoint)) {
      getSubscriptionResults = new GetSubscriptionResults();
     
      CoveragePeriod period = new CoveragePeriod();
      GregorianCalendar calendar = new GregorianCalendar();
      calendar.setTimeInMillis(startPoint.getTime());
      period.setStartPoint(DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar));
      calendar.setTimeInMillis(endPoint.getTime());
      period.setEndPoint(DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar));
      getSubscriptionResults.setCoveragePeriod(period);
    }
    return getSubscriptionResults;
   
  }
View Full Code Here

    Date expiresAfter = ((org.apache.juddi.model.Subscription)obj).getExpiresAfter();
    Date now = new Date();
    if (expiresAfter.getTime() < now.getTime())
      throw new InvalidKeyPassedException(new ErrorMessage("errors.getsubscriptionresult.SubscriptionExpired", subscriptionKey));
   
    CoveragePeriod coveragePeriod = body.getCoveragePeriod();
    if (coveragePeriod == null)
      throw new InvalidTimeException(new ErrorMessage("errors.getsubscriptionresult.NullCoveragePeriod"));
   
    if (coveragePeriod.getStartPoint() == null || coveragePeriod.getEndPoint() == null)
      throw new InvalidTimeException(new ErrorMessage("errors.getsubscriptionresult.InvalidDateInCoveragePeriod"));
   
    GregorianCalendar startPoint = coveragePeriod.getStartPoint().toGregorianCalendar();
    GregorianCalendar endPoint = coveragePeriod.getEndPoint().toGregorianCalendar();
    if (startPoint.getTimeInMillis() > endPoint.getTimeInMillis())
      throw new InvalidTimeException(new ErrorMessage("errors.getsubscriptionresult.StartPointAfterEndPoint", startPoint.toString()));   
  }
View Full Code Here

    //nextDesiredNotificationDate = lastTime + the Interval Duration, which should be:
    //AFTER the lastNotified time and BEFORE the endTime (current time). If it is
    //after the endTime, then the user does not want a notification yet, so we accumulate.
    if (subscription.getLastNotified()==null || nextDesiredNotificationDate.after(startPoint) && nextDesiredNotificationDate.before(endPoint)) {
      getSubscriptionResults = new GetSubscriptionResults();
      CoveragePeriod period = new CoveragePeriod();
      GregorianCalendar calendar = new GregorianCalendar();
      calendar.setTimeInMillis(startPoint.getTime());
      period.setStartPoint(DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar));
      calendar.setTimeInMillis(endPoint.getTime());
      period.setEndPoint(DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar));
      if (log.isDebugEnabled()) log.debug("Period " + period.getStartPoint() + " " + period.getEndPoint());
      getSubscriptionResults.setCoveragePeriod(period);
    } else {
      log.debug("Client does not yet want a notification. The next desidered notification Date " + nextDesiredNotificationDate + ". The current interval ["
        + startPoint + " , " + endPoint + "] therefore skipping this notification cycle.");
      if (desiredDate==null || nextDesiredNotificationDate.getTime() < desiredDate.getTime()) {
View Full Code Here

  }
 
  public void deleteSubscription(String authInfo, String subscriptionKey) {
    try {
      // Delete the entity and make sure it is removed
      DeleteSubscription ds = new DeleteSubscription();
      ds.setAuthInfo(authInfo);
     
      ds.getSubscriptionKey().add(subscriptionKey);
      subscription.deleteSubscription(ds);
    }
    catch(Exception e) {
      logger.error(e.getMessage(), e);
      Assert.fail("No exception should be thrown.");
View Full Code Here

      try {
        UDDIClerkManager manager = WebHelper.getUDDIClerkManager(session.getServletContext());
        UDDIClerk clerk = manager.getClientConfig().getUDDIClerks().get(modelSubscription.getFromClerkName());
        Transport transport = WebHelper.getTransport(session.getServletContext(), clerk.getUDDINode());
        UDDISubscriptionPortType subscriptionService = transport.getUDDISubscriptionService();
        DeleteSubscription deleteSubscription = new DeleteSubscription();
        String authToken = (String) session.getAttribute("token-" + clerk.getName());
        deleteSubscription.setAuthInfo(authToken);
        deleteSubscription.getSubscriptionKey().add(modelSubscription.getSubscriptionKey());
        subscriptionService.deleteSubscription(deleteSubscription);
        logger.info("Deleted Subscription " + modelSubscription.getSubscriptionKey()
            + " from UDDI server " + clerk.getUDDINode().getName());
      } catch (Exception e) {
        error = "Could not delete subscription. Reason: " + e.getMessage();
View Full Code Here

  }
 
  public void deleteSubscription(String authInfo, String subscriptionKey) {
    try {
      // Delete the entity and make sure it is removed
      DeleteSubscription ds = new DeleteSubscription();
      ds.setAuthInfo(authInfo);
     
      ds.getSubscriptionKey().add(subscriptionKey);
      subscription.deleteSubscription(ds);
    }
    catch(Exception e) {
      logger.error(e.getMessage(), e);
      Assert.fail("No exception should be thrown.");
View Full Code Here

    deleteSubscription(authInfoJoe, JOE_SUBSCRIPTION_KEY);
  }
 
  public void getJoePublisherSubscriptionResults(String authInfoJoe) {   
    try {
      GetSubscriptionResults getSubResultsIn = (GetSubscriptionResults)EntityCreator.buildFromDoc(JOE_SUBSCRIPTIONRESULTS_XML, "org.uddi.sub_v3");
      getSubResultsIn.setAuthInfo(authInfoJoe);
     
      SubscriptionResultsList result = subscription.getSubscriptionResults(getSubResultsIn);
      if (result == null)
        Assert.fail("Null result from getSubscriptionResults operation");
View Full Code Here

TOP

Related Classes of org.uddi.sub_v3.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.