Package com.semagia.atomico.server.feed

Examples of com.semagia.atomico.server.feed.IOutputAwareFeedHandler


        applyAuthorInfo(config, feed);
        for (ICollectionInfo info: storage.getCollectionInfos(config.getCollectionSortOrder())) {
            feed.addEntry(info, LinkUtils.linkToCollection(baseURI, info));
        }
        final MediaType mediaType = getFeedMediaType(feedMediaTypes);
        final IOutputAwareFeedHandler handler = makeFeedHandler(mediaType);
        return new FeedWritable(new OverviewFeedWriter(feed, handler), mediaType);
    }
View Full Code Here


                                storage.lastSnapshotModification(collId));
        feed.setFragmentsEntry(LinkUtils.linkToFragments(baseURI, collInfo).toASCIIString(),
                                config.getFragmentsEntryTitle(collTitle),
                                storage.lastFragmentModification(collId));
        final MediaType mediaType = getFeedMediaType(feedMediaTypes);
        final IOutputAwareFeedHandler handler = makeFeedHandler(mediaType);
        return new FeedWritable(new CollectionFeedWriter(feed, handler), mediaType);
    }
View Full Code Here

        applyAuthorInfo(config, feed, collInfo);
        for (IFragmentInfo info: storage.getFragmentInfos(collInfo.getCollectionId())) {
            feed.addEntry(info, LinkUtils.linkTo(baseURI, collInfo, info));
        }
        final MediaType mediaType = getFeedMediaType(feedMediaTypes);
        final IOutputAwareFeedHandler handler = makeFeedHandler(mediaType);
        return new FeedWritable(new FragmentsFeedWriter(feed, handler), mediaType);
    }
View Full Code Here

        applyAuthorInfo(config, feed, collInfo);
        for (ISnapshotInfo info: storage.getSnapshotInfos(collInfo.getCollectionId())) {
            feed.addEntry(info, LinkUtils.linkTo(baseURI, collInfo, info));
        }
        final MediaType mediaType = getFeedMediaType(feedMediaTypes);
        final IOutputAwareFeedHandler handler = makeFeedHandler(mediaType);
        return new FeedWritable(new SnapshotsFeedWriter(feed, handler), mediaType);
    }
View Full Code Here

     * @param acceptableMediaTypes The preferred media types (provided by a client).
     * @return A feed handler.
     * @throws UnsupportedMediaTypeException
     */
    private IOutputAwareFeedHandler makeFeedHandler(final MediaType mediaType) throws UnsupportedMediaTypeException {
        IOutputAwareFeedHandler handler = null;
        if (mediaType != null) {
            handler = FeedHandlerRegistry.createFeedHandler(mediaType);
        }
        if (handler == null) {
            throw new UnsupportedMediaTypeException("", FeedHandlerRegistry.getMediaTypes());
View Full Code Here

     * @return A feed handler for the media type.
     * @throws ResourceException If no feed handler is available for the
     *          the media type of the variant.
     */
    protected static final IOutputAwareFeedHandler makeFeedHandler(final Variant variant) throws ResourceException {
        IOutputAwareFeedHandler handler = FeedHandlerRegistry
                .createFeedHandler(MediaTypeUtils.toAtomicoMediaType(variant.getMediaType()));
        if (handler == null) {
            throw new ResourceException(Status.CLIENT_ERROR_NOT_ACCEPTABLE,
                    "No feed available for media type " + variant.getMediaType());
        }
View Full Code Here

        assertEquals(MediaType.ATOM_XML, factory.getMediaType());
    }

    public void testCreation() {
        final IFeedHandlerFactory factory = new AtomFeedHandlerFactory();
        final IOutputAwareFeedHandler handler = factory.createFeedHandler();
        assertNotNull(handler);
        assertTrue(handler instanceof AtomFeedHandler);
    }
View Full Code Here

        assertEquals(MediaType.JSON, factory.getMediaType());
    }

    public void testCreation() {
        final IFeedHandlerFactory factory = new JSONFeedHandlerFactory();
        final IOutputAwareFeedHandler handler = factory.createFeedHandler();
        assertNotNull(handler);
        assertTrue(handler instanceof JSONFeedHandler);
    }
View Full Code Here

TOP

Related Classes of com.semagia.atomico.server.feed.IOutputAwareFeedHandler

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.