Package com.sun.syndication.feed.synd

Examples of com.sun.syndication.feed.synd.SyndFeed


            Collections.singletonList( artifact2 ) );
        expect( metadataRepository.getArtifacts( TEST_REPO, GROUP_ID, ARTIFACT_ID, "1.0.3-SNAPSHOT" ) ).andReturn(
            Collections.singletonList( artifact3 ) );
        metadataRepositoryControl.replay();

        SyndFeed feed = newVersionsProcessor.process( reqParams, metadataRepository );

        assertEquals( "New Versions of Artifact 'org.apache.archiva:artifact-two'", feed.getTitle() );
        assertEquals( "New versions of artifact 'org.apache.archiva:artifact-two' found during repository scan.",
                      feed.getDescription() );
        assertEquals( "en-us", feed.getLanguage() );
        assertEquals( whenGatheredNext, feed.getPublishedDate() );

        List<SyndEntry> entries = feed.getEntries();

        assertEquals( 2, entries.size() );

        assertEquals( "New Versions of Artifact 'org.apache.archiva:artifact-two' as of " + whenGathered,
                      entries.get( 0 ).getTitle() );
View Full Code Here


        metadataRepository.setArtifactsByDateRange( newArtifacts );

        Map<String, String> reqParams = new HashMap<>();
        reqParams.put( RssFeedProcessor.KEY_REPO_ID, TEST_REPO );

        SyndFeed feed = newArtifactsProcessor.process( reqParams, metadataRepository );

        // check that the date used in the call is close to the one passed (5 seconds difference at most)
        Calendar cal = Calendar.getInstance( TimeZone.getTimeZone( "GMT" ) );
        cal.add( Calendar.DATE, -30 );
        assertTrue( ( metadataRepository.getFrom().getTime() - cal.getTimeInMillis() ) < 1000 * 5 );
        assertEquals( null, metadataRepository.getTo() );
        assertEquals( TEST_REPO, metadataRepository.getRepoId() );

        assertTrue( feed.getTitle().equals( "New Artifacts in Repository 'test-repo'" ) );
        assertTrue(
            feed.getDescription().equals( "New artifacts found in repository 'test-repo' during repository scan." ) );
        assertTrue( feed.getLanguage().equals( "en-us" ) );
        assertTrue( feed.getPublishedDate().equals( whenGathered ) );

        List<SyndEntry> entries = feed.getEntries();
        assertEquals( entries.size(), 1 );
        assertTrue(
            entries.get( 0 ).getTitle().equals( "New Artifacts in Repository 'test-repo' as of " + whenGathered ) );
        assertTrue( entries.get( 0 ).getPublishedDate().equals( whenGathered ) );
    }
View Full Code Here

        {
            log.debug( "No updates found, feed not generated." );
            return null;
        }
       
        SyndFeed feed = new SyndFeedImpl();
        feed.setTitle( title );       
        feed.setDescription( description );
        feed.setLanguage( DEFAULT_LANGUAGE );
        feed.setPublishedDate( dataEntries.get( dataEntries.size() - 1 ).getPublishedDate() );
        feed.setFeedType( DEFAULT_FEEDTYPE );
        feed.setEntries( getEntries( dataEntries ) );

        log.debug( "Finished generating the feed \'{}\'.", title );
       
        return feed;
    }
View Full Code Here

                                ". Reason :" +
                                method.getStatusLine());
            }
            InputStream response = method.getResponseBodyAsStream();
            SyndFeedInput input = new SyndFeedInput();
            SyndFeed feed = input.build(new XmlReader(response));
            retFeed = (Feed) cx.newObject(feedReaderObject, "Feed", new Object[0]);
            retFeed.setFeed(feed);
        } catch (SSLHandshakeException e) {
            if (e.getMessage().indexOf(
                    "sun.security.validator.ValidatorException: PKIX path building failed") > -1) {
View Full Code Here

    public Scriptable jsGet_XML() throws CarbonException {

        Context cx = Context.getCurrentContext();

        //Creating a bogus feed
        SyndFeed feed = new SyndFeedImpl();
        feed.setFeedType(this.getType());
        feed.setTitle("placeHolderTitle");
        feed.setDescription("placeHoldeDescription");
        feed.setLink("http://place.holder.link");
        List entries = feed.getEntries();
        entries.add(entry);
        feed.setEntries(entries);

        SyndFeedOutput output = new SyndFeedOutput();
        try {
            String xmlRep = output.outputString(feed);
View Full Code Here

   */
  @SuppressWarnings("unchecked")
  public JSONObject process(String feedUrl, String feedXml,
      boolean getSummaries, int numEntries) throws GadgetException {
    try {
      SyndFeed feed = new SyndFeedInput().build(new StringReader(feedXml));
      JSONObject json = new JSONObject();
      json.put("Title", feed.getTitle());
      json.put("URL", feedUrl);
      json.put("Description", feed.getDescription());
      json.put("Link", feed.getLink());

      List<SyndPerson> authors = feed.getAuthors();
      String jsonAuthor = null;
      if (authors != null && !authors.isEmpty()) {
        SyndPerson author = authors.get(0);
        if (author.getName() != null) {
          jsonAuthor = author.getName();
        } else if (author.getEmail() != null) {
          jsonAuthor = author.getEmail();
        }
      }
      JSONArray entries = new JSONArray();
      json.put("Entry", entries);

      int entryCnt = 0;
      for (Object obj : feed.getEntries()) {
        SyndEntry e = (SyndEntry) obj;
        if (entryCnt >= numEntries) {
          break;
        }
        entryCnt++;
View Full Code Here

                    .getClassLoader());
            c = getGmailConnection();
            c.setUrl(gmailFeedUrl);
            final URLConnection con = c.openConnection();
            final SyndFeedInput feedInput = new SyndFeedInput();
            final SyndFeed gmail = feedInput.build(new XmlReader(con));
            for (final Object entry : gmail.getEntries()) {
                if (entry instanceof SyndEntry) {
                    messages.add(new RssGmailMessage((SyndEntry) entry));
                }
            }
            if (log.isDebugEnabled()) {
View Full Code Here

    @Override
    public Representation toRepresentation(Object source, Variant target,
            UniformResource resource) throws IOException {
        if (source instanceof SyndFeed) {
            SyndFeed feed = (SyndFeed) source;

            if (feed.getFeedType() == null) {
                if (VARIANT_APPLICATION_RSS.isCompatible(target)) {
                    feed.setFeedType("rss_2.0");
                } else {
                    feed.setFeedType("atom_1.0");
                }
            }

            return new SyndFeedRepresentation(feed);
        }
View Full Code Here

  public void setRuntimeData(ChannelRuntimeData rd) throws PortalException {
    runtimeData = rd;
  }

  private static SyndFeed getFeed(String xmlUri) throws PortalException {
    SyndFeed feed;
    try {
      final SyndFeedInput input = new SyndFeedInput();
      if (xmlUri.substring(0, 7).equalsIgnoreCase("http://") ||
          xmlUri.substring(0, 8).equalsIgnoreCase("https://")) {
        final HttpClient client = HttpClientManager.getNewHTTPClient();
View Full Code Here

        this.lastUpdate = lastUpdate;
    }

    public boolean accept(MuleMessage message)
    {
        SyndFeed feed;
        try
        {
            feed = message.getPayload(DataTypeFactory.create(SyndFeed.class));
        }
        catch (TransformerException e)
        {
            throw new MuleRuntimeException(CoreMessages.failedToReadPayload(), e);
        }

        Date updated = feed.getPublishedDate();
        if (updated == null)
        {
            if (isAcceptWithoutUpdateDate())
            {
                if (logger.isDebugEnabled())
View Full Code Here

TOP

Related Classes of com.sun.syndication.feed.synd.SyndFeed

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.