Examples of SubscriptionEntry


Examples of org.apache.airavata.wsmg.broker.subscription.SubscriptionEntry

                int nRead;
                byte[] buffer = new byte[1024];
                ByteArrayOutputStream outStream = new ByteArrayOutputStream();

                while (rs.next()) {
                    SubscriptionEntry subscriptionEntry = new SubscriptionEntry();
                    subscriptionEntry.setSubscriptionId(rs.getString("SubscriptionId"));

                    /*
                     * Read Binary Stream
                     */
                    InputStream inStream = null;

                    try {
                        inStream = rs.getBinaryStream("content");
                        while ((nRead = inStream.read(buffer)) != -1) {
                            outStream.write(buffer, 0, nRead);
                        }
                        outStream.flush();

                        subscriptionEntry.setSubscribeXml(new String(outStream.toByteArray()));

                    } catch (IOException ie) {
                        logger.error("Unable to read XML from database", ie);

                        // skip this subscription entry
View Full Code Here

Examples of org.apache.airavata.wsmg.broker.subscription.SubscriptionEntry

                + unexpirableSubscriptions.size());

        Collection<SubscriptionState> entries = expirableSubscriptions.values();

        for (SubscriptionState s : entries) {
            SubscriptionEntry se = new SubscriptionEntry();
            se.setSubscribeXml(s.getSubscribeXml());
            se.setSubscriptionId(s.getId());
            ret.add(se);
        }
        entries = unexpirableSubscriptions.values();
        for (SubscriptionState s : entries) {
            SubscriptionEntry se = new SubscriptionEntry();
            se.setSubscribeXml(s.getSubscribeXml());
            se.setSubscriptionId(s.getId());
            ret.add(se);
        }

        return ret;
    }
View Full Code Here

Examples of org.apache.airavata.wsmg.broker.subscription.SubscriptionEntry

                int nRead;
                byte[] buffer = new byte[1024];
                ByteArrayOutputStream outStream = new ByteArrayOutputStream();

                while (rs.next()) {
                    SubscriptionEntry subscriptionEntry = new SubscriptionEntry();
                    subscriptionEntry.setSubscriptionId(rs.getString("SubscriptionId"));

                    /*
                     * Read Binary Stream
                     */
                    InputStream inStream = null;

                    try {
                        inStream = rs.getBinaryStream("content");
                        while ((nRead = inStream.read(buffer)) != -1) {
                            outStream.write(buffer, 0, nRead);
                        }
                        outStream.flush();

                        subscriptionEntry.setSubscribeXml(new String(outStream.toByteArray()));

                    } catch (IOException ie) {
                        logger.error("Unable to read XML from database", ie);

                        // skip this subscription entry
View Full Code Here

Examples of org.apache.airavata.wsmg.broker.subscription.SubscriptionEntry

                int nRead;
                byte[] buffer = new byte[1024];
                ByteArrayOutputStream outStream = new ByteArrayOutputStream();

                while (rs.next()) {
                    SubscriptionEntry subscriptionEntry = new SubscriptionEntry();
                    subscriptionEntry.setSubscriptionId(rs.getString("SubscriptionId"));

                    /*
                     * Read Binary Stream
                     */
                    InputStream inStream = null;

                    try {
                        inStream = rs.getBinaryStream("content");
                        while ((nRead = inStream.read(buffer)) != -1) {
                            outStream.write(buffer, 0, nRead);
                        }
                        outStream.flush();

                        subscriptionEntry.setSubscribeXml(new String(outStream.toByteArray()));

                    } catch (IOException ie) {
                        logger.error("Unable to read XML from database", ie);

                        // skip this subscription entry
View Full Code Here

Examples of org.apache.roller.planet.pojos.SubscriptionEntry

       
        // make sure we are using a persistent object
        Subscription testSub = mgr.getSubscriptionById(sub.getId());
       
        // store
        SubscriptionEntry testEntry = new SubscriptionEntry();
        testEntry.setPermalink(title);
        testEntry.setTitle(title);
        testEntry.setPubTime(new java.sql.Timestamp(System.currentTimeMillis()));
        testEntry.setSubscription(testSub);
        testSub.getEntries().add(testEntry);
        mgr.saveEntry(testEntry);
       
        // flush
        PlanetFactory.getPlanet().flush();
       
        // query to make sure we return the persisted object
        SubscriptionEntry entry = mgr.getEntryById(testEntry.getId());
       
        if(entry == null)
            throw new PlanetException("error inserting new entry");
       
        return entry;
View Full Code Here

Examples of org.apache.roller.planet.pojos.SubscriptionEntry

     */
    public static void teardownEntry(String id) throws Exception {
       
        // lookup
        PlanetManager mgr = PlanetFactory.getPlanet().getPlanetManager();
        SubscriptionEntry entry = mgr.getEntryById(id);
       
        // remove
        mgr.deleteEntry(entry);
        entry.getSubscription().getEntries().remove(entry);
       
        // flush
        PlanetFactory.getPlanet().flush();
    }
View Full Code Here

Examples of org.apache.roller.planet.pojos.SubscriptionEntry

           
            // Populate subscription object with new entries
            PluginManager ppmgr = WebloggerFactory.getWeblogger().getPluginManager();
            Map pagePlugins = ppmgr.getWeblogEntryPlugins(localWeblog);
            for ( WeblogEntry rollerEntry : entries ) {
                SubscriptionEntry entry = new SubscriptionEntry();
                String content = "";
                if (!StringUtils.isEmpty(rollerEntry.getText())) {
                    content = rollerEntry.getText();
                } else {
                    content = rollerEntry.getSummary();
                }
                content = ppmgr.applyWeblogEntryPlugins(pagePlugins, rollerEntry, content);
               
                entry.setAuthor(rollerEntry.getCreator().getScreenName());
                entry.setTitle(rollerEntry.getTitle());
                entry.setPubTime(rollerEntry.getPubTime());
                entry.setText(content);
                entry.setPermalink(rollerEntry.getPermalink());
                entry.setCategoriesString(rollerEntry.getCategory().getPath());
               
                newSub.addEntry(entry);
            }
           
        } catch (WebloggerException ex) {
View Full Code Here

Examples of org.apache.roller.planet.pojos.SubscriptionEntry

        }
       
        // add entries
        List<SyndEntry> feedEntries = feed.getEntries();
        for( SyndEntry feedEntry : feedEntries ) {
            SubscriptionEntry newEntry = buildEntry(feedEntry);
           
            // some kludge to handle feeds with no entry dates
            if (newEntry.getPubTime() == null) {
                log.debug("No published date, assigning fake date for "+feedURL);
                newEntry.setPubTime(new Timestamp(cal.getTimeInMillis()));
                cal.add(Calendar.DATE, -1);
            }
           
            if(newEntry != null) {
                newSub.addEntry(newEntry);
View Full Code Here

Examples of org.apache.roller.planet.pojos.SubscriptionEntry

        // if we don't have a permalink then we can't continue
        if(romeEntry.getLink() == null) {
            return null;
        }
       
        SubscriptionEntry newEntry = new SubscriptionEntry();
       
        newEntry.setTitle(romeEntry.getTitle());
        newEntry.setPermalink(romeEntry.getLink());
       
        // Play some games to get the author
        DCModule entrydc = (DCModule)romeEntry.getModule(DCModule.URI);
        if (romeEntry.getAuthor() != null) {
            newEntry.setAuthor(romeEntry.getAuthor());
        } else {
            newEntry.setAuthor(entrydc.getCreator()); // use <dc:creator>
        }
       
        // Play some games to get the updated date
        if (romeEntry.getUpdatedDate() != null) {
            newEntry.setUpdateTime(new Timestamp(romeEntry.getUpdatedDate().getTime()));
        }
        // TODO: should we set a default update time here?
       
        // And more games getting publish date
        if (romeEntry.getPublishedDate() != null) {
            newEntry.setPubTime(new Timestamp(romeEntry.getPublishedDate().getTime())); // use <pubDate>
        } else if (entrydc != null && entrydc.getDate() != null) {
            newEntry.setPubTime(new Timestamp(entrydc.getDate().getTime())); // use <dc:date>
        } else {
            newEntry.setPubTime(newEntry.getUpdateTime());
        }
       
        // get content and unescape if it is 'text/plain'
        if (romeEntry.getContents().size() > 0) {
            SyndContent content= (SyndContent)romeEntry.getContents().get(0);
            if (content != null && content.getType().equals("text/plain")) {
                newEntry.setText(StringEscapeUtils.unescapeHtml(content.getValue()));
            } else if (content != null) {
                newEntry.setText(content.getValue());
            }
        }
       
        // no content, try summary
        if (newEntry.getText() == null || newEntry.getText().trim().length() == 0) {
            if (romeEntry.getDescription() != null) {
                newEntry.setText(romeEntry.getDescription().getValue());
            }
        }
       
        // copy categories
        if (romeEntry.getCategories().size() > 0) {
            List list = new ArrayList();
            Iterator cats = romeEntry.getCategories().iterator();
            while (cats.hasNext()) {
                SyndCategory cat = (SyndCategory)cats.next();
                list.add(cat.getName());
            }
            newEntry.setCategoriesString(list);
        }
       
        return newEntry;
    }
View Full Code Here

Examples of org.apache.roller.planet.pojos.SubscriptionEntry

       
        // make sure we are using a persistent object
        Subscription testSub = mgr.getSubscriptionById(sub.getId());
       
        // store
        SubscriptionEntry testEntry = new SubscriptionEntry();
        testEntry.setPermalink(title);
        testEntry.setTitle(title);
        testEntry.setPubTime(new java.sql.Timestamp(System.currentTimeMillis()));
        testEntry.setSubscription(testSub);
        testSub.getEntries().add(testEntry);
        mgr.saveEntry(testEntry);
       
        // flush
        PlanetFactory.getPlanet().flush();
       
        // query to make sure we return the persisted object
        SubscriptionEntry entry = mgr.getEntryById(testEntry.getId());
       
        if(entry == null)
            throw new PlanetException("error inserting new entry");
       
        return entry;
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.