Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.IConditionalGet


  public void testDeleteFeedDeletesConditionalGet() throws Exception {
    IFeed feed = createFeed();

    DynamicDAO.save(feed);

    IConditionalGet conditionalGet = fTypesFactory.createConditionalGet("2005/11/04", feed.getLink(), null);

    DynamicDAO.save(conditionalGet);

    DynamicDAO.delete(feed);
    assertNull(DynamicDAO.load(IFeed.class, feed.getId()));
View Full Code Here


    IFeed feed = createFeed();
    DynamicDAO.save(feed);

    final String ifModifiedSince = "2005/11/04";
    final String ifNoneMatch = "2005/05/12";
    IConditionalGet conditionalGet = fTypesFactory.createConditionalGet(ifModifiedSince, feed.getLink(), ifNoneMatch);
    DynamicDAO.save(conditionalGet);
    conditionalGet = null;
    System.gc();
    conditionalGet = DynamicDAO.getDAO(IConditionalGetDAO.class).load(feed.getLink());
    assertEquals(ifModifiedSince, conditionalGet.getIfModifiedSince());
    assertEquals(ifNoneMatch, conditionalGet.getIfNoneMatch());
    assertEquals(feed.getLink().toString(), conditionalGet.getLink().toString());
  }
View Full Code Here

      /* Notify about Bookmark getting loaded */
      fireBookMarkAboutToLoad(bookmark);

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

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

      /* Sync Specific Item Limit derived from retention settings */
      if (SyncUtils.isSynchronized(bookmark)) {
        IPreferenceScope defaultPreferences = Owl.getPreferenceService().getDefaultScope();
        IPreferenceScope preferences = Owl.getPreferenceService().getEntityScope(bookmark);

        /* Item Limit */
        int itemLimit;
        if (preferences.getBoolean(DefaultPreferences.DEL_NEWS_BY_COUNT_STATE))
          itemLimit = preferences.getInteger(DefaultPreferences.DEL_NEWS_BY_COUNT_VALUE);
        else
          itemLimit = defaultPreferences.getInteger(DefaultPreferences.DEL_NEWS_BY_COUNT_VALUE);

        properties.put(IConnectionPropertyConstants.ITEM_LIMIT, itemLimit);

        /* Date Limit */
        long dateLimit = 0;
        if (preferences.getBoolean(DefaultPreferences.DEL_NEWS_BY_AGE_STATE)) {
          int days = preferences.getInteger(DefaultPreferences.DEL_NEWS_BY_AGE_VALUE);
          dateLimit = DateUtils.getToday().getTimeInMillis() - (days * DateUtils.DAY);
        }

        if (dateLimit != 0)
          properties.put(IConnectionPropertyConstants.DATE_LIMIT, dateLimit);

        /* Uncommitted Synchronized Items */
        if (fSyncService != null)
          properties.put(IConnectionPropertyConstants.UNCOMMITTED_ITEMS, fSyncService.getUncommittedItems());
      }

      /* 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);
      }

      /* Return on Cancelation or shutdown or deletion */
      if (!shouldProceedReloading(monitor, bookmark))
        return Status.CANCEL_STATUS;

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

      /* Return on Cancelation or shutdown or deletion */
      if (!shouldProceedReloading(monitor, bookmark) || result == null)
        return Status.CANCEL_STATUS;

      /* Remember Homepage of feed */
      feedHomepage = result.getFirst().getHomepage();

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

      /* Return on Cancelation or shutdown or deletion */
      if (!shouldProceedReloading(monitor, bookmark))
        return Status.CANCEL_STATUS;

      /* Load the Favicon directly afterwards if required */
      if (!InternalOwl.PERF_TESTING && OwlUI.getFavicon(bookmark) == null)
        loadFavicon(bookmark, monitor, result.getThird(), feedHomepage);

      /* Return on Cancelation or shutdown or deletion */
      if (!shouldProceedReloading(monitor, bookmark))
        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 otherMonitor) {

            /* Return on Cancelation or shutdown or deletion */
 
View Full Code Here

    /* Retrieve the InputStream out of the Feed's Link */
    InputStream inS = openStream(link, properties);

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

    /* Return on Cancelation or Shutdown */
    if (monitor.isCanceled()) {
      closeStream(inS, true);
      return null;
View Full Code Here

      closeStream(inS, true);
      return null;
    }

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

    /* Return on Cancelation or Shutdown */
    if (monitor.isCanceled()) {
      closeStream(inS, true);
      return null;
View Full Code Here

    filter.addAction(fFactory.createFilterAction("action1"));
    filter.addAction(fFactory.createFilterAction("action2"));

    DynamicDAO.save(filter);

    IConditionalGet conditionalGet = fFactory.createConditionalGet("2008-10-12-1943", URI.create("http://www.rssowl.org"), "foobar");
    DynamicDAO.save(conditionalGet);
    conditionalGet = fFactory.createConditionalGet("2008-10-12-1943", URI.create("http://www.rssowl.de"), "foobar");
    DynamicDAO.save(conditionalGet);
  }
View Full Code Here

        query.descend("fLink").constrain(condGet.getLink().toString()); //$NON-NLS-1$

        List<IConditionalGet> result = query.execute();
        assertEquals(1, result.size());

        IConditionalGet otherCondGet = result.get(0);
        assertEquals(condGet.getIfModifiedSince(), otherCondGet.getIfModifiedSince());
        assertEquals(condGet.getIfNoneMatch(), otherCondGet.getIfNoneMatch());
      }

      /* Assert EntityIdsByEventType */
      EntityIdsByEventType eventType = db.query(EntityIdsByEventType.class).get(0);
      EntityIdsByEventType otherEventType = defragmentedDb.query(EntityIdsByEventType.class).get(0);
View Full Code Here

    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 {
      Owl.getConnectionService().getHandler(feed.getLink()).openStream(feed.getLink(), null, conProperties);
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.IConditionalGet

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.