Package com.google.gdata.data

Examples of com.google.gdata.data.ExtensionProfile$Handler


                    // Generate the corresponding Atom representation of the feed
                    StringWriter stringWriter = new StringWriter();
                    com.google.gdata.util.common.xml.XmlWriter w =
                        new com.google.gdata.util.common.xml.XmlWriter(stringWriter);
                    feedEntry.generateAtom(w, new ExtensionProfile());
                    w.flush();

                    // Write the Atom representation(XML) into Http response content
                    OutputStreamWriter osw = new OutputStreamWriter(response.getOutputStream());
                    PrintWriter out = new PrintWriter(response.getOutputStream());
View Full Code Here


        return Feed.class;
    }

    public ExtensionProfile getExtensionProfile() {

        return new ExtensionProfile();
    }
View Full Code Here

        this.instance.setExtensionProfile(null);
        fail("value must not be null");
        }catch (IllegalArgumentException e) {

        }
        ExtensionProfile profile = this.instance.getExtensionProfile();
        assertNotNull(profile);
        assertSame(profile,this.instance.getExtensionProfile());
        this.instance.visiteInitialize();
        assertSame(profile,this.instance.getExtensionProfile());
        assertNull(new ProvidedServiceConfig().getExtensionProfile());
View Full Code Here

    /*
     * Test method for 'org.apache.lucene.gdata.server.registry.ProvidedServiceConfig.visiteDestroy()'
     */
    public void testVisiteDestroy() {
        ExtensionProfile profile = this.instance.getExtensionProfile();
        assertNotNull(profile);
        assertNotNull(instance.extProfThreadLocal.get());
        instance.visiteDestroy();
        assertNull(instance.extProfThreadLocal.get());
        instance.visiteDestroy();
View Full Code Here

    protected void setUp() {
        this.reg = GDataServerRegistry.getRegistry();
        this.configurator = new ProvidedServiceConfig();
        this.configurator.setEntryType(Entry.class);
        this.configurator.setFeedType(Feed.class);
        this.configurator.setExtensionProfile(new ExtensionProfile());
    }
View Full Code Here

    protected void setUp() throws Exception {
        this.config = new ProvidedServiceConfig();
       
        this.config.setFeedType(feedType);
        this.config.setEntryType(entryType);
        this.config.setExtensionProfile(new ExtensionProfile());
        reg.registerService(this.config);
    }
View Full Code Here

    }

    private Document buildDomDocument() throws ParserConfigurationException,
            IOException, SAXException {
        StringWriter stringWriter = new StringWriter();
        ExtensionProfile profile = this.applyAble.getServiceConfig()
                .getExtensionProfile();
        if (profile == null)
            throw new IllegalStateException("ExtensionProfile is not set");
        XmlWriter writer = new XmlWriter(stringWriter);
        this.applyAble.generateAtom(writer, profile);
View Full Code Here

    /**
     * @see org.apache.lucene.gdata.server.registry.ProvidedService#getExtensionProfile()
     */
    public ExtensionProfile getExtensionProfile() {
        ExtensionProfile ext = this.extProfThreadLocal.get();
        if (ext != null) {
            return ext;
        }
        if(this.extensionProfile == null)
            return null;
View Full Code Here

    public void visiteDestroy() {
        /*
         * Check every thread after request destroyed to release all profiles to
         * the pool
         */
        ExtensionProfile ext = this.extProfThreadLocal.get();
        if (ext == null) {
            if(LOG.isDebugEnabled())
            LOG.debug("ThreadLocal owns no ExtensionProfile in requestDestroy for service "
                            + this.serviceName);
            return;
View Full Code Here

                // Generate the corresponding Atom representation of the feed
                StringWriter stringWriter = new StringWriter();
                com.google.gdata.util.common.xml.XmlWriter w =
                    new com.google.gdata.util.common.xml.XmlWriter(stringWriter);
                feed.generateAtom(w, new ExtensionProfile());
                w.flush();

                // Write the Atom representation(XML) into Http response content
                OutputStreamWriter osw = new OutputStreamWriter(response.getOutputStream());
                PrintWriter out = new PrintWriter(response.getOutputStream());
                out.println(stringWriter.toString());
                out.close();

                System.out.println("Feed content in plain text:" + stringWriter.toString());
            } else {
                response.sendError(HttpServletResponse.SC_NOT_FOUND);
            }

        } else if (path.startsWith("/")) {

            // get HTTP request asking for an entry

            // Return a specific entry in the collection
            com.google.gdata.data.Entry feedEntry = null;

            // Invoke the get operation on the service implementation
            Message requestMessage = messageFactory.createMessage();
            String id = path.substring(1);
            requestMessage.setBody(new Object[] {id});
            Message responseMessage = getInvoker.invoke(requestMessage);
            if (responseMessage.isFault()) {
                throw new ServletException((Throwable)responseMessage.getBody());
            }

            if (supportsFeedEntries) {
                // The service implementation returns a feed entry
                feedEntry = (com.google.gdata.data.Entry)responseMessage.getBody();

                System.out.println("entry title: " + feedEntry.getTitle().getPlainText());

            } else {
                // The service implementation only returns a data item, create
                // an entry
                // from it
                Entry<Object, Object> entry = new Entry<Object, Object>(id, responseMessage.getBody());
                // FIXME The line below needs to be fixed
                // feedEntry = feedEntry(entry, itemClassType, itemXMLType,
                // mediator, abderaFactory);
            }

            // Write the Gdata entry
            if (feedEntry != null) {

                // Write a GData entry using Atom representation
                response.setContentType("application/atom+xml; charset=utf-8");

                // Generate the corresponding Atom representation of the feed
                StringWriter stringWriter = new StringWriter();
                com.google.gdata.util.common.xml.XmlWriter w =
                    new com.google.gdata.util.common.xml.XmlWriter(stringWriter);
                feedEntry.generateAtom(w, new ExtensionProfile());
                w.flush();

                // Write the Atom representation(XML) into Http response content
                OutputStreamWriter osw = new OutputStreamWriter(response.getOutputStream());
                PrintWriter out = new PrintWriter(response.getOutputStream());
View Full Code Here

TOP

Related Classes of com.google.gdata.data.ExtensionProfile$Handler

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.