Examples of TaskAdapter


Examples of org.rssowl.core.model.util.TaskAdapter

  private List<ITask> getDeleteFeedsTasks(final List<Exception> ex) throws PersistenceException {
    List<ITask> tasks = new ArrayList<ITask>();

    List<FeedReference> feedRefs = saveFeedsHelper();
    for (final FeedReference feedRef : feedRefs) {
      tasks.add(new TaskAdapter() {
        public IStatus run(IProgressMonitor monitor) {
          try {
            fDao.deleteFeed(feedRef);
          } catch (Exception e) {
            ex.add(e);
View Full Code Here

Examples of org.rssowl.core.model.util.TaskAdapter

          // existingFeed[0].merge(feed);
          // break;
        }
      }

      tasks.add(new TaskAdapter() {
        public IStatus run(IProgressMonitor monitor) {
          try {
            // Uncomment this line and comment the following one to use load the
            // full feed before the merge
            // existingFeed[0] =
View Full Code Here

Examples of org.rssowl.core.model.util.TaskAdapter

    for (int i = 0; i < limit; i++) {
      final int a = i;

      /* Add Task to save a Feed (88%) */
      if (a % 8 != 0) {
        tasks.add(new TaskAdapter() {
          public IStatus run(IProgressMonitor monitor) {
            try {
              fDao.saveFeed(feeds.get(a + limit));
            } catch (Exception e) {
              ex.add(e);
            }
            return Status.OK_STATUS;
          }
        });
      }

      /* Add Task to resolve a Feed (12%) */
      if (a % 8 == 0) {
        tasks.add(new TaskAdapter() {
          public IStatus run(IProgressMonitor monitor) {
            try {
              IFeed feed = feedRefs.get(a).resolve();

              if (feed.getAuthor() != null)
View Full Code Here

Examples of org.rssowl.core.util.TaskAdapter

    /* Save some Feeds first */
    saveFeedsHelper();

    final SavedSearchService smService = new SavedSearchService();

    tasks.add(new TaskAdapter() {
      public IStatus run(IProgressMonitor monitor) {
        try {
          smService.updateSavedSearches(cacheService.getSearchMarks());
          smService.stopService();
        } catch (Exception e) {
View Full Code Here

Examples of org.rssowl.core.util.TaskAdapter

  private List<ITask> getSaveAndIndexFeedsTasks(final List<Exception> ex) {
    List<ITask> tasks = new ArrayList<ITask>();
    List<IFeed> feeds = interpretFeedsHelper();

    for (final IFeed feed : feeds) {
      tasks.add(new TaskAdapter() {
        public IStatus run(IProgressMonitor monitor) {
          try {
            DynamicDAO.save(feed);
          } catch (Exception e) {
            ex.add(e);
View Full Code Here

Examples of org.rssowl.core.util.TaskAdapter

    /* Save some Feeds first */
    saveFeedsHelper();

    /* Query 1: News is *new*, *unread*, *updated*, *read* */
    ITask task = new TaskAdapter() {
      public IStatus run(IProgressMonitor monitor) {
        List<ISearchCondition> conditions = new ArrayList<ISearchCondition>();

        ISearchField field1 = factory.createSearchField(INews.STATE, INews.class.getName());
        conditions.add(factory.createSearchCondition(field1, SearchSpecifier.IS, EnumSet.of(INews.State.NEW, State.UNREAD, State.UPDATED, State.READ)));

        results[0] = fModelSearch.searchNews(conditions, false).size();

        return Status.OK_STATUS;
      }
    };
    tasks.clear();
    tasks.add(task);
    long l1 = TestUtils.executeAndWait(tasks, 1);
    System.out.println("Searching [States (" + results[0] + " results, Occur.SHOULD, Cold)] in " + FEEDS + " Feeds took: " + l1 + "ms");

    /* Recreate */
    Owl.getPersistenceService().recreateSchema();
    fModelSearch.shutdown();
    fModelSearch.startup();
    saveFeedsHelper();

    /* Query 2: Entire News contains 'news' */
    task = new TaskAdapter() {
      public IStatus run(IProgressMonitor monitor) {
        List<ISearchCondition> conditions = new ArrayList<ISearchCondition>();

        ISearchField field1 = factory.createSearchField(IEntity.ALL_FIELDS, INews.class.getName());
        conditions.add(factory.createSearchCondition(field1, SearchSpecifier.CONTAINS, "news"));

        results[0] = fModelSearch.searchNews(conditions, false).size();

        return Status.OK_STATUS;
      }
    };
    tasks.clear();
    tasks.add(task);
    System.gc();
    long l2 = TestUtils.executeAndWait(tasks, 1);
    System.out.println("Searching [Entire News (" + results[0] + " results, Occur.SHOULD, Cold)] in " + FEEDS + " Feeds took: " + l2 + "ms");

    /* Recreate */
    Owl.getPersistenceService().recreateSchema();
    fModelSearch.shutdown();
    fModelSearch.startup();
    saveFeedsHelper();

    /*
     * Query 3: Title contains 'news' OR Author contains 's*' OR Category begins
     * with 'e'
     */
    task = new TaskAdapter() {
      public IStatus run(IProgressMonitor monitor) {
        List<ISearchCondition> conditions = new ArrayList<ISearchCondition>();

        ISearchField field1 = factory.createSearchField(INews.TITLE, INews.class.getName());
        conditions.add(factory.createSearchCondition(field1, SearchSpecifier.CONTAINS, "news"));

        ISearchField field2 = factory.createSearchField(INews.AUTHOR, INews.class.getName());
        conditions.add(factory.createSearchCondition(field2, SearchSpecifier.CONTAINS, "s*"));

        ISearchField field3 = factory.createSearchField(INews.CATEGORIES, INews.class.getName());
        conditions.add(factory.createSearchCondition(field3, SearchSpecifier.BEGINS_WITH, "e"));

        results[0] = fModelSearch.searchNews(conditions, false).size();

        return Status.OK_STATUS;
      }
    };
    tasks.clear();
    tasks.add(task);
    System.gc();
    long l3 = TestUtils.executeAndWait(tasks, 1);
    System.out.println("Searching [Title, Author, Categories (" + results[0] + " results, Occur.SHOULD, Cold)] in " + FEEDS + " Feeds took: " + l3 + "ms");

    /* Recreate */
    Owl.getPersistenceService().recreateSchema();
    fModelSearch.shutdown();
    fModelSearch.startup();
    saveFeedsHelper();

    /*
     * Query 4: Title contains 'news' AND Author contains 's*' AND Category
     * begins with 'e'
     */
    task = new TaskAdapter() {
      public IStatus run(IProgressMonitor monitor) {
        List<ISearchCondition> conditions = new ArrayList<ISearchCondition>();

        ISearchField field1 = factory.createSearchField(INews.TITLE, INews.class.getName());
        conditions.add(factory.createSearchCondition(field1, SearchSpecifier.CONTAINS, "news"));

        ISearchField field2 = factory.createSearchField(INews.AUTHOR, INews.class.getName());
        conditions.add(factory.createSearchCondition(field2, SearchSpecifier.CONTAINS, "s*"));

        ISearchField field3 = factory.createSearchField(INews.CATEGORIES, INews.class.getName());
        conditions.add(factory.createSearchCondition(field3, SearchSpecifier.BEGINS_WITH, "e"));

        results[0] = fModelSearch.searchNews(conditions, true).size();

        return Status.OK_STATUS;
      }
    };
    tasks.clear();
    tasks.add(task);
    System.gc();
    long l4 = TestUtils.executeAndWait(tasks, 1);
    System.out.println("Searching [Title, Author, Categories (" + results[0] + " results, Occur.MUST, Cold)] in " + FEEDS + " Feeds took: " + l4 + "ms");

    /* Recreate */
    Owl.getPersistenceService().recreateSchema();
    fModelSearch.shutdown();
    fModelSearch.startup();
    saveFeedsHelper();

    /* Query 5: Publish Date before Now AND After 2000 */
    task = new TaskAdapter() {
      public IStatus run(IProgressMonitor monitor) {
        List<ISearchCondition> conditions = new ArrayList<ISearchCondition>();

        ISearchField field1 = factory.createSearchField(INews.PUBLISH_DATE, INews.class.getName());
        conditions.add(factory.createSearchCondition(field1, SearchSpecifier.IS_BEFORE, new Date()));

        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.YEAR, 2000);

        ISearchField field2 = factory.createSearchField(INews.PUBLISH_DATE, INews.class.getName());
        conditions.add(factory.createSearchCondition(field2, SearchSpecifier.IS_AFTER, cal.getTime()));

        results[0] = fModelSearch.searchNews(conditions, true).size();

        return Status.OK_STATUS;
      }
    };
    tasks.clear();
    tasks.add(task);
    System.gc();
    long l5 = TestUtils.executeAndWait(tasks, 1);
    System.out.println("Searching [Date Range (" + results[0] + " results, Occur.MUST, Cold)] in " + FEEDS + " Feeds took: " + l5 + "ms");

    /* Recreate */
    Owl.getPersistenceService().recreateSchema();
    fModelSearch.shutdown();
    fModelSearch.startup();
    saveFeedsHelper();

    /* Query 6: News is *new*, *unread*, *updated* and Has Attachments IS TRUE */
    task = new TaskAdapter() {
      public IStatus run(IProgressMonitor monitor) {
        List<ISearchCondition> conditions = new ArrayList<ISearchCondition>();

        ISearchField field1 = factory.createSearchField(INews.STATE, INews.class.getName());
        conditions.add(factory.createSearchCondition(field1, SearchSpecifier.IS, EnumSet.of(INews.State.NEW, INews.State.UNREAD, INews.State.UPDATED)));
View Full Code Here

Examples of org.rssowl.core.util.TaskAdapter

    List<IMark> marks = rootFolder.getMarks();
    for (IMark mark : marks) {
      if (mark instanceof IBookMark) {
        final IBookMark bookmark = (IBookMark) mark;

        tasks.add(new TaskAdapter() {
          public IStatus run(IProgressMonitor monitor) {
            return fController.reload(bookmark, null, new NullProgressMonitor());
          }
        });
      }
View Full Code Here

Examples of org.rssowl.core.util.TaskAdapter

    feeds = null;
    System.gc();

    final INewsDAO newsDAO = DynamicDAO.getDAO(INewsDAO.class);
    List<ITask> tasks = new ArrayList<ITask>();
    tasks.add(new TaskAdapter() {
      public IStatus run(IProgressMonitor monitor) {
        List<INews> news = new ArrayList<INews>();
        for (FeedLinkReference feedRef : feedRefs) {
          if (resolveFeed) {
            news.addAll(feedRef.resolve().getNewsByStates(unreadStates));
View Full Code Here

Examples of org.rssowl.core.util.TaskAdapter

    final List<Exception> ex = new ArrayList<Exception>();

    /* Prepare Tasks */
    for (int i = 1; i < FEEDS + 1; i++) {
      final int c = i;
      tasks.add(new TaskAdapter() {
        public IStatus run(IProgressMonitor monitor) {
          try {
            URI feedLink = fPluginLocation.resolve("data/performance/" + c + ".xml").toURL().toURI();
            IFeed feed = new Feed(feedLink);

View Full Code Here

Examples of org.rssowl.core.util.TaskAdapter

  private List<ITask> getSaveFeedsTasks(final List<Exception> ex) {
    List<ITask> tasks = new ArrayList<ITask>();
    List<IFeed> feeds = interpretFeedsHelper();

    for (final IFeed feed : feeds) {
      tasks.add(new TaskAdapter() {
        public IStatus run(IProgressMonitor monitor) {
          try {
            DynamicDAO.save(feed);
          } catch (Exception e) {
            ex.add(e);
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.