Package org.apache.abdera.factory

Examples of org.apache.abdera.factory.Factory


                Thread.currentThread().setContextClassLoader(osgiClassloader);

                try {

                    final Abdera a = new Abdera();
                    final Factory f = a.getFactory();
                    if (f instanceof FOMFactory) {
                        FOMFactory ff = (FOMFactory) f;
                        ff.registerExtension(new MediaExtensionFactory());
                        ff.registerExtension(new OpenSearchExtensionFactory());
                    }
View Full Code Here


        Book b = new Book();
        b.setId(id);
        b.setName(name);
       
       
        Factory factory = Abdera.getNewFactory();
        JAXBContext jc = JAXBContext.newInstance(Book.class);
       
        Entry e = factory.getAbdera().newEntry();
        e.setTitle(b.getName());
        e.setId(Long.toString(b.getId()));
       
       
        StringWriter writer = new StringWriter();
        jc.createMarshaller().marshal(b, writer);
       
        Content ct = factory.newContent(Content.Type.XML);
        ct.setValue(writer.toString());
        e.setContentElement(ct);
        return e;
    }  
View Full Code Here

        this.formattedOutput = formattedOutput;
    }
   
    protected Feed createFeedFromCollectionWrapper(Object o) throws Exception {
       
        Factory factory = Abdera.getNewFactory();
        Feed feed = factory.newFeed();
       
        boolean writerUsed = buildFeed(feed, o);
       
        if (feed.getEntries().size() > 0) {
            return feed;
View Full Code Here

   
   
   
    protected Entry createEntryFromObject(Object o, Class<?> cls) throws Exception {
       
        Factory factory = Abdera.getNewFactory();
        Entry entry = factory.getAbdera().newEntry();
       
        if (!buildEntry(entry, o)) {
            setEntryProperties(factory, entry, o, cls);
        }
       
View Full Code Here

        return false;
    }
   
    protected void createEntryContent(Entry e, Object o, Class<?> cls) throws Exception {
   
        Factory factory = Abdera.getNewFactory();
        JAXBContext jc = jaxbProvider.getJAXBContext(cls, cls);
       
        StringWriter writer = new StringWriter();
        jc.createMarshaller().marshal(o, writer);
       
        Content ct = factory.newContent(Content.Type.XML);
        ct.setValue(writer.toString());
        e.setContentElement(ct);
    }
View Full Code Here

    @Test
    public void testPost() throws Exception {
        //System.out.println(">>>ContentNegotiationTest.testPost");
        // Testing of entry creation
        Factory factory = abdera.getFactory();
        String customerName = "Fred Farkle";
        Entry entry = factory.newEntry();
        entry.setTitle("customer " + customerName);
        entry.setUpdated(new Date());
        entry.addAuthor("Apache Tuscany");
        // ID created by collection.
        Content content = abdera.getFactory().newContent();
View Full Code Here

    @Test
    public void testModifiedGetIfNoneMatch() throws Exception {
        //System.out.println(">>>ProviderFeedEntityTagsTestCase.testFeedModifiedGetIfNoneMatch");
        // Post some new content to the feed.
        Factory factory = abdera.getFactory();
        String customerName = "Fred Farkle";
        Entry entry = factory.newEntry();
        entry.setTitle("customer " + customerName);
        entry.setUpdated(new Date());
        entry.addAuthor("Apache Tuscany");
        Content content = abdera.getFactory().newContent();
        content.setContentType(Content.Type.TEXT);
View Full Code Here

    // MediaCollection role
    public Entry postMedia(String title, String slug, String contentType, InputStream media) {
        //System.out.println(">>> MediaCollectionImpl.postMedia title=" + title + ", slug=" + slug + ", contentType=" + contentType );

        Factory factory = abdera.getFactory();
        Entry entry = factory.newEntry();
        // Must provide entry to media as per Atom Pub spec (http://tools.ietf.org/html/rfc5023#section-9.6)
        // <?xml version="1.0"?>
        // <entry xmlns="http://www.w3.org/2005/Atom">
        //   <title>The Beach</title> (REQUIRED)
        //   <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> (REQUIRED)
View Full Code Here

        //          <author><name>Captain Lansing</name></author>
        //          <content>It's something moving... solid metal</content>
        //        </entry>

        // Testing of entry creation
        Factory factory = abdera.getFactory();
        String customerName = "Fred Farkle";
        Entry entry = factory.newEntry();
        entry.setTitle("customer " + customerName);
        entry.setUpdated(new Date());
        entry.addAuthor("Apache Tuscany");
        // ID created by collection.
        // entry.setId(id); // auto-provided
View Full Code Here

        //         <updated>2007-02-24T16:34:06Z</updated>
        //         <author><name>Captain Lansing</name></author>
        //         <content>Update: it's a hoax!</content>
        //       </entry>
        // Testing of entry creation
        Factory factory = abdera.getFactory();
        String customerName = "Molly Ringwald";
        Entry entry = factory.newEntry();
        entry.setTitle("customer " + customerName);
        entry.setUpdated( new Date());
        entry.addAuthor("Apache Tuscany");
        String id = eTag.substring( 1, eTag.length()-1);
        entry.setId(id); // auto-provided
View Full Code Here

TOP

Related Classes of org.apache.abdera.factory.Factory

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.