Package de.nava.informa.core

Examples of de.nava.informa.core.ChannelIF


    logger.info("Query returned " + nrOfHits + " hits.");
    List<ItemResult> results = new ArrayList<ItemResult>();
    for (int i = 0; i < hits.length() && i < maxResults; i++) {
      Document doc = hits.doc(i);
      long channelId = Long.parseLong(doc.get(ItemFieldConstants.CHANNEL_ID));
      ChannelIF channel = channels.getById(channelId);
      if (channel == null) {
        throw new UnretrievableException("channel " + channelId);
      }
      // TODO: could this be done in another fashion or using a context?
      long itemId = Long.parseLong(doc.get(ItemFieldConstants.ITEM_ID));
      ItemIF item = channel.getItem(itemId);
      if (item == null) {
        throw new UnretrievableException("item " + itemId);
      }
      results.add(new ItemResult(item, hits.score(i)));
    }
View Full Code Here


  }

  public ChannelIF getById(long channelId) {
    Iterator it = getChannels().iterator();
    while (it.hasNext()) {
      ChannelIF channel = (ChannelIF) it.next();
      if (channel.getId() == channelId) {
        return channel;
      }
    }
    return null;
  }
View Full Code Here

    throws java.io.IOException {

    Collection<ItemIF> items = new ArrayList<ItemIF>();
    Iterator itC = channels.iterator();
    while (itC.hasNext()) {
      ChannelIF channel = (ChannelIF) itC.next();
      if (logger.isDebugEnabled()) {
        logger.debug("Searching channel " + channel + " for items.");
      }
      items.addAll(channel.getItems());
    }
    if (!items.isEmpty()) {
      indexItems(createNewIndex, items);
    } else {
      logger.info("No items found for indexing.");
View Full Code Here

    PollerApproverIF a = new CustomApprover("wanted");
    PollerWorkerThread worker = new PollerWorkerThread(o, a, Poller.POLICY_SCAN_ALL, null, null);

    // Create temp and main channels.
    try {
      final ChannelIF cMain = pm.createChannel("main", getTestURL());
      final ChannelIF cTemp = pm.createChannel("temp", getTestURL());
      final ItemIF item1 = pm.createItem(cTemp, "wanted");
      pm.createItem(cTemp, "unwanted");

      // Check items in temp agains main channel.
      ChannelRecord rec = new ChannelRecord(cMain, 0, 0);
View Full Code Here

    PollerApproverIF a = new CustomApprover("wanted");
    PollerWorkerThread worker = new PollerWorkerThread(o, a, Poller.POLICY_SCAN_ALL, null, null);

    // Create temp and main channels.
    try {
      final ChannelIF cMain = pm.createChannel("main", getTestURL());
      final ChannelIF cTemp = pm.createChannel("temp", getTestURL());
      pm.createItem(cTemp, "wanted");
      pm.createItem(cTemp, "unwanted");

      // Add duplicate "wanted" item to main channel.
      final ItemIF item3 = pm.createItem(cMain, "wanted");
View Full Code Here

    assertFalse(PollerWorkerThread.differ("a", "a"));
  }

  public void testChannelHasChanged() {
    try {
      final ChannelIF a = pm.createChannel("test", getTestURL());

      assertTrue(PollerWorkerThread.channelHasChanged(null, a));
      assertFalse(PollerWorkerThread.channelHasChanged(a, a));

      final ChannelIF b = pm.createChannel("test2", getTestURL());
      assertTrue(PollerWorkerThread.channelHasChanged(a, b));

      final ChannelIF c = pm.createChannel("test", getTestURL());
      assertFalse(PollerWorkerThread.channelHasChanged(a, c));
    } catch (PersistenceManagerException e) {
      e.printStackTrace();
      fail();
    }
View Full Code Here

  /* (Kein Javadoc)
   * @see de.innovationgate.webgate.api.templates.SimpleContentSource#getCreated()
   */
  public Date getCreated() {
        ChannelIF channel = getChannel();
        if (channel != null) {
            return channel.getPubDate();
        }
        else {
            return new Date(Long.MIN_VALUE);
        }
   
View Full Code Here

  /* (Kein Javadoc)
   * @see de.innovationgate.webgate.api.templates.SimpleContentSource#getContent(java.lang.String, java.lang.Object)
   */
  public Object getContent(String folder, Object key) {
   
        ChannelIF channel = getChannel();
        if (channel == null) {
            return null;
        }
       
    // folder may be left out blank or null, because its not needed anyway.
    Collection items = channel.getItems();
    Iterator iter = items.iterator();
   
    while(iter.hasNext()){
      Item item = (Item) iter.next();
      if( item.getTitle().equalsIgnoreCase((String) key) ) {
View Full Code Here

   * @see de.innovationgate.webgate.api.templates.SimpleContentSource#find(java.lang.String, java.lang.String, java.util.Map)
   */
  public Map find(String folder, String query, Map parameters) throws WGQueryException {
   
    URL rssURL;
        ChannelIF channel = null;
   
    try {
      // rssURL      = new URL(query);
      channel = FeedParser.parse(new ChannelBuilder(), retrievePage(query));
            if (channel != null) {
                _channel.set(channel);
            }
            else {
                throw new WGQueryException("Unable to retrieve or parse feed", query);
            }
        } 
    catch (Exception e) {
            throw new WGQueryException("Exception retrieving or parsing feed", query, e);
    }
   
   
    List items = new ArrayList(channel.getItems());
    Map itemMap = new LinkedMap();
    Iterator iter = items.iterator();
   
    while(iter.hasNext()){
      Item item = (Item) iter.next();
View Full Code Here

TOP

Related Classes of de.nava.informa.core.ChannelIF

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.