Package com.sun.syndication.feed.synd

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


        }
        // add SyndEnclosures as links with rel="enclosure" ONLY if
        // there are no SyndEntry.getLinks() with rel="enclosure"
        if (enclosures != null && linkRelEnclosureExists == false) {
            for (Iterator iter=enclosures.iterator(); iter.hasNext();) {
                SyndEnclosure syndEncl = (SyndEnclosure)iter.next();
                Link link = createAtomEnclosure(syndEncl);
                otherLinks.add(link);
            }
        }
        if (alternateLinks.size() > 0) aEntry.setAlternateLinks(alternateLinks);
View Full Code Here


    protected List createSyndEnclosures(List enclosures) {
        List sEnclosures = new ArrayList();
        for (int i=0;i<enclosures.size();i++) {
            Enclosure enc = (Enclosure) enclosures.get(i);
            SyndEnclosure sEnc = new SyndEnclosureImpl();
            sEnc.setUrl(enc.getUrl());
            sEnc.setType(enc.getType());
            sEnc.setLength(enc.getLength());
            sEnclosures.add(sEnc);
        }
        return sEnclosures;
    }
View Full Code Here

    }

    protected List createEnclosures(List sEnclosures) {
        List enclosures = new ArrayList();
        for (int i=0;i<sEnclosures.size();i++) {
            SyndEnclosure sEnc = (SyndEnclosure) sEnclosures.get(i);
            Enclosure enc = new Enclosure();
            enc.setUrl(sEnc.getUrl());
            enc.setType(sEnc.getType());
            enc.setLength(sEnc.getLength());
            enclosures.add(enc);
        }
        return enclosures;
    }
View Full Code Here

        return syndEntry;
    }

    public SyndEnclosure createSyndEnclosure(Entry entry, Link link) {
        SyndEnclosure syndEncl = new SyndEnclosureImpl();
        syndEncl.setUrl(link.getHrefResolved());
        syndEncl.setType(link.getType());
        syndEncl.setLength(link.getLength());
        return syndEncl;
    }
View Full Code Here

        }

        List sEnclosures = sEntry.getEnclosures();
        if (sEnclosures != null) {
            for (Iterator iter=sEnclosures.iterator(); iter.hasNext();) {
                SyndEnclosure syndEnclosure = (SyndEnclosure) iter.next();
                Link link = createAtomEnclosure(syndEnclosure);
                otherLinks.add(link);
            }
        }
View Full Code Here

                        if (bunds[0] != null) {
                            Bitstream[] bits = bunds[0].getBitstreams();
                            for (int i = 0; (i < bits.length); i++) {
                                String mime = bits[i].getFormat().getMIMEType();
                                if(podcastableMIMETypes.contains(mime)) {
                                    SyndEnclosure enc = new SyndEnclosureImpl();
                                    enc.setType(bits[i].getFormat().getMIMEType());
                                    enc.setLength(bits[i].getSize());
                                    enc.setUrl(urlOfBitstream(request, bits[i]));
                                    enclosures.add(enc);
                                } else {
                                    continue;
                                }
                            }
                        }
                        //Also try to add an external value from dc.identifier.other
                        // We are assuming that if this is set, then it is a media file
                        Metadatum[] externalMedia = item.getMetadataByMetadataString(externalSourceField);
                        if(externalMedia.length > 0)
                        {
                            for(int i = 0; i< externalMedia.length; i++)
                            {
                                SyndEnclosure enc = new SyndEnclosureImpl();
                                enc.setType("audio/x-mpeg");        //We can't determine MIME of external file, so just picking one.
                                enc.setLength(1);
                                enc.setUrl(externalMedia[i].value);
                                enclosures.add(enc);
                            }
                        }

                    } catch (Exception e) {
View Full Code Here

        return syndEntry;
    }

    public SyndEnclosure createSyndEnclosure(Feed feed, Entry entry,
            Link link) {
        SyndEnclosure syndEncl = new SyndEnclosureImpl();
        syndEncl.setUrl(link.getHrefResolved());
        syndEncl.setType(link.getType());
        syndEncl.setLength(link.getLength());
        return syndEncl;
    }
View Full Code Here

        }
        // add SyndEnclosures as links with rel="enclosure" ONLY if
        // there are no SyndEntry.getLinks() with rel="enclosure"
        if (enclosures != null && linkRelEnclosureExists == false) {
            for (Iterator iter=enclosures.iterator(); iter.hasNext();) {
                SyndEnclosure syndEncl = (SyndEnclosure)iter.next();
                Link link = createAtomEnclosure(syndEncl);
                otherLinks.add(link);
            }
        }
        if (alternateLinks.size() > 0) aEntry.setAlternateLinks(alternateLinks);
View Full Code Here

    protected void _testEnclosures(List encs,String prefix) throws Exception {
        Set s1 = new HashSet();
        Set s2 = new HashSet();
        for (int i=0;i<encs.size();i++) {
            SyndEnclosure enc = (SyndEnclosure) encs.get(i);
            s1.add(enc.getUrl()+" "+enc.getType()+" "+enc.getLength());
            s2.add(getPrefix() + "." +prefix+".enclousure["+i+"]^url"+" "+
                   getPrefix() + "." +prefix+".enclousure["+i+"]^type"+" "+
                   "100");
        }
        assertTrue(s1.equals(s2));
View Full Code Here

        return syndEntry;
    }

    public SyndEnclosure createSyndEnclosure(Entry entry, Link link) {
        SyndEnclosure syndEncl = new SyndEnclosureImpl();
        syndEncl.setUrl(link.getHrefResolved());
        syndEncl.setType(link.getType());
        syndEncl.setLength(link.getLength());
        return syndEncl;
    }
View Full Code Here

TOP

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

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.