Examples of IConditionalGet


Examples of org.rssowl.core.model.types.IConditionalGet

  public void testDeleteFeedDeletesConditionalGet() throws Exception {
    IFeed feed = createFeed();
   
    fModelDAO.saveFeed(feed);
   
    IConditionalGet conditionalGet = fTypesFactory.createConditionalGet("2005/11/04",
        feed.getLink(), null);

    fModelDAO.saveConditionalGet(conditionalGet);
   
    fModelDAO.deleteFeed(new FeedReference(feed.getId()));
View Full Code Here

Examples of org.rssowl.core.model.types.IConditionalGet

    IFeed feed = createFeed();
    fModelDAO.saveFeed(feed);
   
    final String ifModifiedSince = "2005/11/04";
    final String ifNoneMatch = "2005/05/12";
    IConditionalGet conditionalGet = fTypesFactory.createConditionalGet(ifModifiedSince,
        feed.getLink(), ifNoneMatch);
    fModelDAO.saveConditionalGet(conditionalGet);
    conditionalGet = null;
    System.gc();
    conditionalGet = fModelDAO.loadConditionalGet(feed.getLink());
    assertEquals(ifModifiedSince, conditionalGet.getIfModifiedSince());
    assertEquals(ifNoneMatch, conditionalGet.getIfNoneMatch());
    assertEquals(feed.getLink(), conditionalGet.getLink());
  }
View Full Code Here

Examples of org.rssowl.core.model.types.IConditionalGet

    }
    for (INews news : ReverseIterator.createInstance(feed.getNews())) {
      fDb.delete(news);
    }
    IModelDAO dao = NewsModel.getDefault().getPersistenceLayer().getModelDAO();
    IConditionalGet conditionalGet = dao.loadConditionalGet(feed.getLink());
    if (conditionalGet != null)
      fDb.delete(conditionalGet);
   
    removeFromItemsBeingDeleted(feed);
  }
View Full Code Here

Examples of org.rssowl.core.model.types.IConditionalGet

    String ifNoneMatch = null;
    if (inS instanceof IConditionalGetCompatible) {
      ifModifiedSince = ((IConditionalGetCompatible) inS).getIfModifiedSince();
      ifNoneMatch = ((IConditionalGetCompatible) inS).getIfNoneMatch();
    }
    IConditionalGet conditionalGet = NewsModel.getDefault().getTypesFactory().createConditionalGet(ifModifiedSince, feedUrl, ifNoneMatch);

    Map<Object, Object> conProperties = new HashMap<Object, Object>();
    ifModifiedSince = conditionalGet.getIfModifiedSince();
    if (ifModifiedSince != null)
      conProperties.put(IConnectionPropertyConstants.IF_MODIFIED_SINCE, ifModifiedSince);

    ifNoneMatch = conditionalGet.getIfNoneMatch();
    if (ifNoneMatch != null)
      conProperties.put(IConnectionPropertyConstants.IF_NONE_MATCH, ifNoneMatch);

    try {
      conManager.load(feed.getLink(), conProperties);
View Full Code Here

Examples of org.rssowl.core.persist.IConditionalGet

    /* Retrieve the InputStream out of the Feed's Link */
    InputStream inS = new ByteArrayInputStream(FEED.getBytes());

    /* Retrieve Conditional Get if present */
    IConditionalGet conditionalGet = getConditionalGet(link, inS);

    /* Return on Cancelation or Shutdown */
    if (monitor.isCanceled()) {
      try {
        inS.close();
View Full Code Here

Examples of org.rssowl.core.persist.IConditionalGet

      fDb.delete(category);
    }
    for (INews news : ReverseIterator.createInstance(feed.getNews())) {
      fDb.delete(news);
    }
    IConditionalGet conditionalGet = getConditionalGetDAO().load(feed.getLink());
    if (conditionalGet != null)
      fDb.delete(conditionalGet);

    removeFromItemsBeingDeleted(feed);
  }
View Full Code Here

Examples of org.rssowl.core.persist.IConditionalGet

    String ifNoneMatch = null;
    if (inS instanceof IConditionalGetCompatible) {
      ifModifiedSince = ((IConditionalGetCompatible) inS).getIfModifiedSince();
      ifNoneMatch = ((IConditionalGetCompatible) inS).getIfNoneMatch();
    }
    IConditionalGet conditionalGet = Owl.getModelFactory().createConditionalGet(ifModifiedSince, feedUrl, ifNoneMatch);

    Map<Object, Object> conProperties = new HashMap<Object, Object>();
    ifModifiedSince = conditionalGet.getIfModifiedSince();
    if (ifModifiedSince != null)
      conProperties.put(IConnectionPropertyConstants.IF_MODIFIED_SINCE, ifModifiedSince);

    ifNoneMatch = conditionalGet.getIfNoneMatch();
    if (ifNoneMatch != null)
      conProperties.put(IConnectionPropertyConstants.IF_NONE_MATCH, ifNoneMatch);

    try {
      new DefaultProtocolHandler().openStream(feed.getLink(), conProperties);
View Full Code Here

Examples of org.rssowl.core.persist.IConditionalGet

        throw new ConnectionException(Activator.getDefault().createErrorStatus(e.getMessage(), e));
      }
    }

    /* Create Conditional Get Object */
    IConditionalGet conditionalGet = null;
    if (lastArticleId != null)
      conditionalGet = factory.createConditionalGet(null, link, String.valueOf(lastArticleId));

    return Pair.create(feed, conditionalGet);
  }
View Full Code Here

Examples of org.rssowl.core.persist.IConditionalGet

      /* Return on Cancelation or shutdown */
      if (monitor.isCanceled() || fShuttingDown)
        return Status.CANCEL_STATUS;

      /* Load Conditional Get for the URL */
      IConditionalGet conditionalGet = fConditionalGetDAO.load(feedLink);

      /* Define Properties for Connection */
      Map<Object, Object> properties = new HashMap<Object, Object>();
      properties.put(IConnectionPropertyConstants.CON_TIMEOUT, FEED_CON_TIMEOUT);

      /* Add Conditional GET Headers if present */
      if (conditionalGet != null) {
        String ifModifiedSince = conditionalGet.getIfModifiedSince();
        if (ifModifiedSince != null)
          properties.put(IConnectionPropertyConstants.IF_MODIFIED_SINCE, ifModifiedSince);

        String ifNoneMatch = conditionalGet.getIfNoneMatch();
        if (ifNoneMatch != null)
          properties.put(IConnectionPropertyConstants.IF_NONE_MATCH, ifNoneMatch);
      }

      /* Load the Feed */
      final Pair<IFeed, IConditionalGet> pairResult = Owl.getConnectionService().reload(feedLink, monitor, properties);

      /* Return on Cancelation or Shutdown */
      if (monitor.isCanceled() || fShuttingDown)
        return Status.CANCEL_STATUS;

      /* Update ConditionalGet Entity */
      boolean conditionalGetIsNull = (conditionalGet == null);
      conditionalGet = updateConditionalGet(feedLink, conditionalGet, pairResult.getSecond());
      boolean deleteConditionalGet = (!conditionalGetIsNull && conditionalGet == null);

      /* Return on Cancelation or Shutdown */
      if (monitor.isCanceled() || fShuttingDown)
        return Status.CANCEL_STATUS;

      /* Load the Favicon directly afterwards if required */
      if (OwlUI.getFavicon(bookmark) == null) {
        try {
          byte[] faviconBytes = null;

          /* First try using the Homepage of the Feed */
          URI homepage = pairResult.getFirst().getHomepage();
          if (homepage != null && StringUtils.isSet(homepage.toString()))
            faviconBytes = Owl.getConnectionService().getFeedIcon(homepage);

          /* Then try with Feed address itself */
          if (faviconBytes == null)
            faviconBytes = Owl.getConnectionService().getFeedIcon(feedLink);

          /* Store locally */
          if (!monitor.isCanceled() && !fShuttingDown)
            OwlUI.storeImage(bookmark.getId(), faviconBytes, OwlUI.BOOKMARK);
        } catch (UnknownFeedException e) {
          Activator.getDefault().getLog().log(e.getStatus());
        }
      }

      /* Return on Cancelation or Shutdown */
      if (monitor.isCanceled() || fShuttingDown)
        return Status.CANCEL_STATUS;

      /* Merge and Save Feed */
      if (!Owl.TESTING) {
        final IConditionalGet finalConditionalGet = conditionalGet;
        final boolean finalDeleteConditionalGet = deleteConditionalGet;
        fSaveFeedQueue.schedule(new TaskAdapter() {
          public IStatus run(IProgressMonitor monitor) {
            fAppService.handleFeedReload(bookmark, pairResult.getFirst(), finalConditionalGet, finalDeleteConditionalGet);
            return Status.OK_STATUS;
View Full Code Here

Examples of org.rssowl.core.persist.IConditionalGet

      /* Return on Cancelation or shutdown */
      if (monitor.isCanceled() || fShuttingDown)
        return Status.CANCEL_STATUS;

      /* Load Conditional Get for the URL */
      IConditionalGet conditionalGet = fConditionalGetDAO.load(feedLink);

      /* Define Properties for Connection */
      Map<Object, Object> properties = new HashMap<Object, Object>();
      properties.put(IConnectionPropertyConstants.CON_TIMEOUT, FEED_CON_TIMEOUT);

      /* Add Conditional GET Headers if present */
      if (conditionalGet != null) {
        String ifModifiedSince = conditionalGet.getIfModifiedSince();
        if (ifModifiedSince != null)
          properties.put(IConnectionPropertyConstants.IF_MODIFIED_SINCE, ifModifiedSince);

        String ifNoneMatch = conditionalGet.getIfNoneMatch();
        if (ifNoneMatch != null)
          properties.put(IConnectionPropertyConstants.IF_NONE_MATCH, ifNoneMatch);
      }

      /* Load the Feed */
      final Pair<IFeed, IConditionalGet> pairResult = Owl.getConnectionService().reload(feedLink, monitor, properties);

      /* Return on Cancelation or Shutdown */
      if (monitor.isCanceled() || fShuttingDown)
        return Status.CANCEL_STATUS;

      /* Update ConditionalGet Entity */
      boolean conditionalGetIsNull = (conditionalGet == null);
      conditionalGet = updateConditionalGet(feedLink, conditionalGet, pairResult.getSecond());
      boolean deleteConditionalGet = (!conditionalGetIsNull && conditionalGet == null);

      /* Return on Cancelation or Shutdown */
      if (monitor.isCanceled() || fShuttingDown)
        return Status.CANCEL_STATUS;

      /* Load the Favicon directly afterwards if required */
      if (!InternalOwl.PERF_TESTING && OwlUI.getFavicon(bookmark) == null) {
        try {
          byte[] faviconBytes = null;

          /* First try using the Homepage of the Feed */
          URI homepage = pairResult.getFirst().getHomepage();
          if (homepage != null && StringUtils.isSet(homepage.toString()))
            faviconBytes = Owl.getConnectionService().getFeedIcon(homepage);

          /* Then try with Feed address itself */
          if (faviconBytes == null)
            faviconBytes = Owl.getConnectionService().getFeedIcon(feedLink);

          /* Store locally */
          if (!monitor.isCanceled() && !fShuttingDown)
            OwlUI.storeImage(bookmark.getId(), faviconBytes, OwlUI.BOOKMARK, 16, 16);
        } catch (UnknownFeedException e) {
          Activator.getDefault().getLog().log(e.getStatus());
        }
      }

      /* Return on Cancelation or Shutdown */
      if (monitor.isCanceled() || fShuttingDown)
        return Status.CANCEL_STATUS;

      /* Merge and Save Feed */
      if (!InternalOwl.TESTING) {
        final IConditionalGet finalConditionalGet = conditionalGet;
        final boolean finalDeleteConditionalGet = deleteConditionalGet;
        fSaveFeedQueue.schedule(new TaskAdapter() {
          public IStatus run(IProgressMonitor monitor) {

            /* Return on Cancelation or Shutdown */
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.