incubator-wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From el...@apache.org
Subject svn commit: r834791 [7/8] - in /incubator/wink/site/trunk/src/site: apt/ resources/1.0/html/ resources/1.0/html/attachments/ resources/1.0/html/attachments/2328628/ resources/1.0/html/attachments/2328642/ resources/1.0/html/attachments/2329360/ resourc...
Date Wed, 11 Nov 2009 07:39:50 GMT
Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113135.java
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113135.java?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113135.java (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113135.java Wed Nov 11 07:39:44 2009
@@ -0,0 +1,62 @@
+package myPackage;
+
+import java.util.Date;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.wink.common.model.atom.AtomEntry;
+import org.apache.wink.common.model.atom.AtomFeed;
+import org.apache.wink.common.model.atom.AtomLink;
+import org.apache.wink.common.model.atom.AtomPerson;
+import org.apache.wink.common.model.atom.AtomText;
+import org.apache.wink.common.model.atom.AtomTextType;
+
+@Path("/getAtom")
+public class ProduceAtom {
+
+    @GET
+    @Produces(MediaType.APPLICATION_ATOM_XML)
+    public AtomFeed getFeed() {
+        AtomFeed feed = new AtomFeed();
+        feed.setId("tag:example.org,2007:/foo");
+        feed.setTitle(new AtomText("Test Feed"));
+        feed.setSubtitle(new AtomText("Feed subtitle"));
+        feed.setUpdated(new Date());
+
+        AtomPerson person = new AtomPerson();
+        person.setName("Shiva HR");
+        feed.getAuthors().add(person);
+
+        AtomLink link1 = new AtomLink();
+        link1.setHref("http://example.com");
+        feed.getLinks().add(link1);
+
+        AtomLink link2 = new AtomLink();
+        link2.setHref("http://example.com/foo");
+        link2.setRel("self");
+        feed.getLinks().add(link2);
+
+        AtomEntry entry = new AtomEntry();
+        entry.setId("tag:example.org,2007:/foo/entries/1");
+        entry.setTitle(new AtomText("Entry title"));
+
+        AtomText summary = new AtomText();
+        summary.setType(AtomTextType.html);
+        summary.setValue("<p>This is the entry title</p>");
+        entry.setSummary(summary);
+
+        entry.setUpdated(new Date());
+        entry.setPublished(new Date());
+
+        AtomLink link3 = new AtomLink();
+        link3.setHref("http://example.com/foo/entries/1");
+        entry.getLinks().add(link3);
+
+        feed.getEntries().add(entry);
+
+        return feed;
+    }
+}

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113135.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113136.java
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113136.java?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113136.java (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113136.java Wed Nov 11 07:39:44 2009
@@ -0,0 +1,33 @@
+package myPackage;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.apache.abdera.Abdera;
+import org.apache.abdera.contrib.rss.RssFeed;
+import org.apache.abdera.model.Document;
+import org.apache.abdera.model.Entry;
+import org.apache.abdera.parser.ParseException;
+import org.apache.abdera.parser.Parser;
+
+public class ConsumeRssUsingAbdera {
+
+    public static void main(String[] args) throws ParseException, IOException {
+        System.out.println("Consuming RSS Documents using Abdera...\n");
+        Abdera abdera = new Abdera();
+        Parser parser = abdera.getParser();
+        URL url = new URL("http://www.rssboard.org/files/sample-rss-2.xml");
+        Document<RssFeed> doc = parser.parse(url.openStream());
+        RssFeed rssFeed = doc.getRoot();
+        System.out.println("Title: " + rssFeed.getTitle());
+        System.out.println("Description: " + rssFeed.getSubtitle() + "\n");
+        int itemCount = 0;
+        for (Entry entry : rssFeed.getEntries()) {
+            System.out.println("Item " + ++itemCount + ":");
+            System.out.println("\tTitle: " + entry.getTitle());
+            System.out.println("\tPublish Date: " + entry.getPublished());
+            System.out.println("\tDescription: " + entry.getContent());
+        }
+    }
+
+}

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113136.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113137.zip
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113137.zip?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113137.zip
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113138.zip
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113138.zip?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113138.zip
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113139.java
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113139.java?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113139.java (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113139.java Wed Nov 11 07:39:44 2009
@@ -0,0 +1,31 @@
+package myPackage;
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.wink.client.Resource;
+import org.apache.wink.client.RestClient;
+import org.apache.wink.common.model.rss.RssChannel;
+import org.apache.wink.common.model.rss.RssFeed;
+import org.apache.wink.common.model.rss.RssItem;
+
+public class ConsumeRssUsingWink {
+
+    public static void main(String[] args) {
+        System.out.println("Consuming RSS Documents using Apache Wink...\n");
+        RestClient client = new RestClient();
+        String url = "http://www.rssboard.org/files/sample-rss-2.xml";
+        Resource resource = client.resource(url);
+        RssFeed rss = resource.accept(MediaType.APPLICATION_XML).get(RssFeed.class);
+        RssChannel channel = rss.getChannel();
+        System.out.println("Title: " + channel.getTitle());
+        System.out.println("Description: " + channel.getDescription() + "\n");
+        int itemCount = 0;
+        for (RssItem item : channel.getItems()) {
+            System.out.println("Item " + ++itemCount + ":");
+            System.out.println("\tTitle: " + item.getTitle());
+            System.out.println("\tPublish Date: " + item.getPubDate());
+            System.out.println("\tDescription: " + item.getDescription());
+        }
+    }
+
+}

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/3113139.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456452.zip
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456452.zip?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456452.zip
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456454.zip
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456454.zip?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456454.zip
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456455.java
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456455.java?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456455.java (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456455.java Wed Nov 11 07:39:44 2009
@@ -0,0 +1,41 @@
+package myPackage;
+
+import org.apache.abdera.protocol.server.CollectionAdapter;
+import org.apache.abdera.protocol.server.Provider;
+import org.apache.abdera.protocol.server.RequestContext;
+import org.apache.abdera.protocol.server.TargetType;
+import org.apache.abdera.protocol.server.impl.AbstractWorkspaceProvider;
+import org.apache.abdera.protocol.server.impl.RegexTargetResolver;
+import org.apache.abdera.protocol.server.impl.SimpleWorkspaceInfo;
+import org.apache.abdera.protocol.server.impl.TemplateTargetBuilder;
+
+public class APP_ContentProvider extends AbstractWorkspaceProvider implements Provider {
+    public static String FEED_TAG = "entries";
+
+    private final APP_CollectionAdapter collectionAdapter;
+
+    public APP_ContentProvider() {
+        this.collectionAdapter = new APP_CollectionAdapter();
+
+        super.setTargetResolver(new RegexTargetResolver()
+            .setPattern("/blog(\\?[^#]*)?", TargetType.TYPE_SERVICE)
+            .setPattern("/blog/" + FEED_TAG + "(\\?[^#]*)?", TargetType.TYPE_COLLECTION)
+            .setPattern("/blog/" + FEED_TAG + "/([^/#?]+)(\\?[^#]*)?", TargetType.TYPE_ENTRY));
+
+        setTargetBuilder(new TemplateTargetBuilder()
+            .setTemplate(TargetType.TYPE_SERVICE, "{target_base}/blog")
+            .setTemplate(TargetType.TYPE_COLLECTION, "{target_base}/blog/{collection}{-opt|?|q,c,s,p,l,i,o}{-join|&|q,c,s,p,l,i,o}")
+            .setTemplate(TargetType.TYPE_CATEGORIES, "{target_base}/blog/{collection};categories")
+            .setTemplate(TargetType.TYPE_ENTRY, "{target_base}/blog/{collection}/{entry}"));
+
+        SimpleWorkspaceInfo workspace = new SimpleWorkspaceInfo();
+        workspace.setTitle("IISc MILE Lab Weblog");
+        workspace.addCollection(collectionAdapter);
+        addWorkspace(workspace);
+    }
+
+    public CollectionAdapter getCollectionAdapter(RequestContext request) {
+        return collectionAdapter;
+    }
+
+}

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456455.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456456.xml
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456456.xml?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456456.xml (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456456.xml Wed Nov 11 07:39:44 2009
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+	id="WebApp_ID" version="2.5">
+	<display-name>APP_Server_Abdera</display-name>
+	<welcome-file-list>
+		<welcome-file>index.jsp</welcome-file>
+	</welcome-file-list>
+
+	<servlet>
+		<description></description>
+		<display-name>APP_Servlet</display-name>
+		<servlet-name>APP_Servlet</servlet-name>
+		<servlet-class>org.apache.abdera.protocol.server.servlet.AbderaServlet</servlet-class>
+		<init-param>
+			<param-name>org.apache.abdera.protocol.server.Provider</param-name>
+			<param-value>myPackage.APP_ContentProvider</param-value>
+		</init-param>
+		<init-param>
+			<param-name>org.apache.abdera.protocol.server.CollectionAdapter</param-name>
+			<param-value>myPackage.APP_CollectionAdapter</param-value>
+		</init-param>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>APP_Servlet</servlet-name>
+		<url-pattern>/blog/*</url-pattern>
+	</servlet-mapping>
+</web-app>
\ No newline at end of file

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456456.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456457.java
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456457.java?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456457.java (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456457.java Wed Nov 11 07:39:44 2009
@@ -0,0 +1,240 @@
+package myPackage;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.activation.MimeType;
+
+import org.apache.abdera.Abdera;
+import org.apache.abdera.factory.StreamBuilder;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.model.Document;
+import org.apache.abdera.model.Entry;
+import org.apache.abdera.model.Feed;
+import org.apache.abdera.model.Link;
+import org.apache.abdera.parser.ParseException;
+import org.apache.abdera.protocol.server.ProviderHelper;
+import org.apache.abdera.protocol.server.RequestContext;
+import org.apache.abdera.protocol.server.ResponseContext;
+import org.apache.abdera.protocol.server.TargetType;
+import org.apache.abdera.protocol.server.context.BaseResponseContext;
+import org.apache.abdera.protocol.server.context.EmptyResponseContext;
+import org.apache.abdera.protocol.server.context.ResponseContextException;
+import org.apache.abdera.protocol.server.impl.AbstractCollectionAdapter;
+import org.apache.abdera.util.MimeTypeHelper;
+
+/**
+ * The Collection Adapter is the piece that actually implements the business
+ * logic of the AtomPub server. It bridges the protocol with the backend
+ * persistence.
+ */
+public class APP_CollectionAdapter extends AbstractCollectionAdapter {
+    private static String FEED_TAG = "entries";
+    private Document      feedDocument;
+
+    public ResponseContext getFeed(RequestContext request) {
+        Abdera abdera = request.getAbdera();
+        Document feed = getFeedDocument(abdera);
+        return new BaseResponseContext(feed);
+    }
+
+    public ResponseContext postEntry(RequestContext request) {
+        Abdera abdera = request.getAbdera();
+        try {
+            Document entryDocument = constructEntryDocument(request, abdera);
+            if (entryDocument != null) {
+                Entry entry = (Entry)entryDocument.getRoot();
+                manageAnEntry(entry, null, abdera);
+                BaseResponseContext rc = new BaseResponseContext(entry);
+                IRI baseUri = ProviderHelper.resolveBase(request);
+                rc.setLocation(baseUri.resolve(FEED_TAG + "/" + entry.getId()).toString());
+                rc.setStatus(201); //generate a HTTP 201 response in case of success
+                return rc;
+            } else {
+                return new EmptyResponseContext(400);
+            }
+        } catch (ParseException pe) {
+            return new EmptyResponseContext(415);
+        } catch (ClassCastException cce) {
+            return new EmptyResponseContext(415);
+        } catch (Exception e) {
+            return new EmptyResponseContext(400);
+        }
+    }
+
+    public ResponseContext getEntry(RequestContext request) {
+        Entry entry = (Entry)getAbderaEntry(request);
+        if (entry != null) {
+            Document entryDocument = ((Entry)entry.clone()).getDocument();
+            return new BaseResponseContext(entryDocument);
+        } else {
+            return new EmptyResponseContext(404);
+        }
+    }
+
+    public ResponseContext deleteEntry(RequestContext request) {
+        Entry entry = getAbderaEntry(request);
+        if (entry != null) {
+            entry.discard();
+            return new EmptyResponseContext(204);
+        } else {
+            return new EmptyResponseContext(404);
+        }
+    }
+
+    public ResponseContext putEntry(RequestContext request) {
+        Entry origEntry = getAbderaEntry(request);
+        if (origEntry != null) {
+            try {
+                Abdera abdera = request.getAbdera();
+                Document newEntryDocument = constructEntryDocument(request, abdera);
+                if (newEntryDocument != null) {
+                    Entry newEntry = (Entry)newEntryDocument.getRoot();
+                    manageAnEntry(newEntry, origEntry, abdera);
+                    return new BaseResponseContext(newEntry);
+                } else {
+                    return new EmptyResponseContext(400);
+                }
+            } catch (ParseException pe) {
+                return new EmptyResponseContext(415);
+            } catch (ClassCastException cce) {
+                return new EmptyResponseContext(415);
+            } catch (Exception e) {
+                if ("409".equalsIgnoreCase(e.getMessage())) {
+                    return new EmptyResponseContext(409);
+                } else {
+                    return new EmptyResponseContext(400);
+                }
+            }
+        } else {
+            return new EmptyResponseContext(404);
+        }
+    }
+
+    private synchronized Document getFeedDocument(Abdera abdera) {
+        if (feedDocument == null) {
+            feedDocument = initializeFeedDocument(abdera);
+        }
+        return feedDocument;
+    }
+
+    private Document initializeFeedDocument(Abdera abdera) {
+        StreamBuilder out = (StreamBuilder)abdera.getWriterFactory().newStreamWriter("fom");
+        out.startDocument().startFeed().writeId("http://mile.ee.iisc.ernet.in")
+            .writeTitle("Latest developments at MILE Lab, IISc :")
+            .writeUpdated(new Date())
+            .writeLink(FEED_TAG)
+            .writeCategory("lab-updates");
+
+        out
+            .startEntry()
+            .writeId("tts_demo")
+            .writeTitle("Kannada and Tamil language TTS Web Demo")
+            .writeLink(FEED_TAG + "/tts_demo")
+            .writeUpdated(new Date())
+            .writePublished(new Date())
+            .writeEdited(new Date())
+            .writeSummary("Kannada/Tamil language Text-To-Speech (TTS) Demo by MILE Lab, IISc is " +
+            		"available at http://mile.ee.iisc.ernet.in:8080/tts_demo/ ")
+            .writeAuthor("ShivaHR").endEntry();
+
+        out
+            .startEntry()
+            .writeId("tamil_ocr")
+            .writeTitle("Tamil OCR achieves 94.3% accuracy on 1000 scanned pages")
+            .writeLink(FEED_TAG + "/tamil_ocr")
+            .writeUpdated(new Date())
+            .writePublished(new Date())
+            .writeEdited(new Date())
+            .writeSummary("Tamil OCR (Optical Character Recognizer) being developed at MILE Lab, IISc " +
+            		"achieves an accuracy of 94.3%! The testing was carried out by CDAC-Pune on " +
+            		"1000 pages scanned from books printed between 1950-2000.")
+            .writeAuthor("ShivaHR").endEntry();
+
+        Document doc = (Document)out.endFeed().endDocument().getBase();
+
+        return doc;
+    }
+
+    /**
+     * Create a skeletal entry, to be filled up later
+     */
+    private Document constructEntryDocument(RequestContext request, Abdera abdera) throws Exception {
+        MimeType contentType = request.getContentType();
+        if (contentType != null && !MimeTypeHelper.isAtom(contentType.toString())) {
+            throw new ParseException();
+        }
+        return (Document)request.getDocument(abdera.getParser()).clone();
+    }
+
+    /*
+     * Utility method to manage the creation or update of an entry.
+     */
+    private void manageAnEntry(Entry currentEntry, Entry originalEntry, Abdera abdera)
+        throws Exception {
+        IRI id;
+        if (originalEntry != null) {
+            id = originalEntry.getId();
+            if (!currentEntry.getId().equals(id)) {
+                throw new Exception("409");
+            }
+            originalEntry.discard();
+        } else {
+            id = currentEntry.getId();
+            if (id == null) {
+                id = new IRI(abdera.getFactory().newUuidUri());
+                currentEntry.getIdElement().setValue(id.toString());
+            }
+        }
+        currentEntry.setUpdated(new Date());
+        String hrefValue = FEED_TAG + "/" + id;
+        List<Link> links = currentEntry.getLinks();
+        //links.clear(); //doesn't work - throws a java.lang.UnsupportedOperationException!
+        if (links.size() > 0) {
+            links.get(0).setHref(hrefValue);
+        } else {
+            currentEntry.addLink(hrefValue);
+        }
+        Feed feed = (Feed)getFeedDocument(abdera).getRoot();
+        feed.insertEntry(currentEntry);
+        feed.setUpdated(new Date());
+    }
+
+    private Entry getAbderaEntry(RequestContext request) {
+        Abdera abdera = request.getAbdera();
+        Document feed = getFeedDocument(abdera);
+        try {
+            Feed currentFeed = (Feed)feed.getRoot();
+            return currentFeed.getEntry(getEntryID(request));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    /**
+     * The id of the entry is the last token in the URL. Ugly way of extracting
+     * it, till I find a better mechanism.
+     */
+    private String getEntryID(RequestContext request) {
+        if (request.getTarget().getType() != TargetType.TYPE_ENTRY) {
+            return null;
+        }
+        String path = request.getUri().toString();
+        String[] segments = path.split("/");
+        return segments[segments.length - 1];
+    }
+
+    public String getAuthor(RequestContext request) throws ResponseContextException {
+        return "ShivaHR";
+    }
+
+    public String getId(RequestContext request) {
+        return "blog/entries";
+    }
+
+    public String getTitle(RequestContext request) {
+        return "Entries";
+    }
+
+}

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456457.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456458.jsp
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456458.jsp?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456458.jsp (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456458.jsp Wed Nov 11 07:39:44 2009
@@ -0,0 +1,140 @@
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+	pageEncoding="ISO-8859-1"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Atom Publishing Protocol (APP) Server using Apache Abdera</title>
+<STYLE type="text/css">
+body {
+	font-family: "Lucida Grande", "Lucida Sans Unicode", sans-serif;
+	font-size: small;
+	background-color: #A6D2FF;
+	text-align: center;
+}
+
+h1,h2,h3,h4 {
+	font-family: palatino, georgia, serif;
+	margin-bottom: 0px;
+	text-align: left;
+	color: darkblue;
+	font-weight: normal;
+}
+
+h4 {
+	font-family: "Lucida Grande", "Lucida Sans Unicode", sans-serif;
+	font-size: 8pt;
+	text-transform: uppercase;
+	font-weight: bold;
+}
+
+p {
+	margin-top: 0px;
+}
+
+#h3-content {
+	font-variant: small-caps;
+	font-size: small;
+}
+
+#page-container {
+	background-color: white;
+	border-color: black;
+	width: 725px;
+	border-color: black;
+	position: relative;
+	margin: 0pt auto;
+}
+
+#main-content {
+	padding-left: 25px;
+	padding-right: 25px;
+	text-align: left;
+	float: left;
+	position: relative;
+	background-color: white;
+}
+
+#left-content {
+	padding: 0px;
+	text-align: left;
+	float: left;
+	position: relative;
+	background-color: white;
+}
+
+#links-bar {
+	text-align: center;
+	font-family: palatino, georgia, serif;
+	color: gray;
+	background-color: transparent;
+	font-variant: small-caps;
+	padding: 5px;
+}
+
+li {
+	padding-bottom: 5px;
+	list-style-image: none;
+	list-style-position: outside;
+	list-style-type: none;
+	font-size: 9pt;
+}
+</STYLE>
+</head>
+<body>
+<%
+    /*******************************************************************************
+     * Licensed Materials - Property of IBM
+     * (c) Copyright IBM Corporation 2006. All Rights Reserved.
+     * 
+     * Note to U.S. Government Users Restricted Rights:
+     * Use, duplication or disclosure restricted by GSA ADP Schedule
+     * Contract with IBM Corp. 
+     *******************************************************************************/
+    String serviceDocument = "blog";
+    String feedDocument = "blog/entries";
+    String specificEntry = "blog/entries/rail";
+    String IBM_document =
+        "http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.ajax.feed.samples.help/docs/GettingStarted_useage.html";
+%>
+
+<DIV id="page-container">
+<DIV id="main-content">
+<DIV id="left-content">
+<h3>ATOM Publishing Protocol support</h3>
+<p id="h3-content">Demonstrates the ability to create, retrieve,
+update, and delete ATOM content, using the ATOM Publishing Protocol
+(APP) support in Apache Abdera.</p>
+<h4>Read the service document</h4>
+<p id="h4-content">The service document describes the available
+content on the APP Server - currently available feeds, and the URL at
+which they can be accessed. Click <a href="<%=serviceDocument%>"><%=serviceDocument%></a>
+</p>
+<h4>Read the available feed</h4>
+<p id="h4-content">View the feed, and use this operation to check on
+the contents of the feed following a create, update, and delete of
+specific entries in the feed. Click <a href="<%=feedDocument%>"><%=feedDocument%></a>
+</p>
+<h4>Read a specific entry in the feed</h4>
+<p id="h4-content">An operation to view the discrete entries that
+compose a feed. Click <a href="<%=specificEntry%>"><%=specificEntry%></a></p>
+<h4>Create a new entry</h4>
+<p id="h4-content">Use the <a href="http://curl.haxx.se/">curl
+tool</a> to perform the POST action, and view its result. Refer <a
+	href="<%=IBM_document%>">this
+documentation</a> to understand how this can be done</p>
+<h4>Update an existing entry, using Atom Publishing Protocol</h4>
+<p id="h4-content">Use the <a href="http://curl.haxx.se/">curl
+tool</a> to perform the PUT action, and view its result. Refer <a
+	href="<%=IBM_document%>">this
+documentation</a> to understand how this can be done</p>
+<h4>Delete an existing entry</h4>
+<p id="h4-content">Use the <a href="http://curl.haxx.se/">curl
+tool</a> to perform the DELETE action, and view its result. Refer <a
+	href="<%=IBM_document%>">this
+documentation</a> to understand how this can be done</p>
+</DIV>
+</DIV>
+</DIV>
+</BODY>
+</HTML>
\ No newline at end of file

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456458.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456459.jsp
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456459.jsp?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456459.jsp (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456459.jsp Wed Nov 11 07:39:44 2009
@@ -0,0 +1,140 @@
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+	pageEncoding="ISO-8859-1"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Atom Publishing Protocol (APP) Server using Apache Wink</title>
+<STYLE type="text/css">
+body {
+	font-family: "Lucida Grande", "Lucida Sans Unicode", sans-serif;
+	font-size: small;
+	background-color: #A6D2FF;
+	text-align: center;
+}
+
+h1,h2,h3,h4 {
+	font-family: palatino, georgia, serif;
+	margin-bottom: 0px;
+	text-align: left;
+	color: darkblue;
+	font-weight: normal;
+}
+
+h4 {
+	font-family: "Lucida Grande", "Lucida Sans Unicode", sans-serif;
+	font-size: 8pt;
+	text-transform: uppercase;
+	font-weight: bold;
+}
+
+p {
+	margin-top: 0px;
+}
+
+#h3-content {
+	font-variant: small-caps;
+	font-size: small;
+}
+
+#page-container {
+	background-color: white;
+	border-color: black;
+	width: 725px;
+	border-color: black;
+	position: relative;
+	margin: 0pt auto;
+}
+
+#main-content {
+	padding-left: 25px;
+	padding-right: 25px;
+	text-align: left;
+	float: left;
+	position: relative;
+	background-color: white;
+}
+
+#left-content {
+	padding: 0px;
+	text-align: left;
+	float: left;
+	position: relative;
+	background-color: white;
+}
+
+#links-bar {
+	text-align: center;
+	font-family: palatino, georgia, serif;
+	color: gray;
+	background-color: transparent;
+	font-variant: small-caps;
+	padding: 5px;
+}
+
+li {
+	padding-bottom: 5px;
+	list-style-image: none;
+	list-style-position: outside;
+	list-style-type: none;
+	font-size: 9pt;
+}
+</STYLE>
+</head>
+<body>
+<%
+    /*******************************************************************************
+     * Licensed Materials - Property of IBM
+     * (c) Copyright IBM Corporation 2006. All Rights Reserved.
+     * 
+     * Note to U.S. Government Users Restricted Rights:
+     * Use, duplication or disclosure restricted by GSA ADP Schedule
+     * Contract with IBM Corp. 
+     *******************************************************************************/
+    String serviceDocument = "blog";
+    String feedDocument = "blog/entries";
+    String specificEntry = "blog/entries/rail";
+    String IBM_document =
+        "http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.ajax.feed.samples.help/docs/GettingStarted_useage.html";
+%>
+
+<DIV id="page-container">
+<DIV id="main-content">
+<DIV id="left-content">
+<h3>ATOM Publishing Protocol support</h3>
+<p id="h3-content">Demonstrates the ability to create, retrieve,
+update, and delete ATOM content, using the ATOM Publishing Protocol
+(APP) support in Apache Wink.</p>
+<h4>Read the service document</h4>
+<p id="h4-content">The service document describes the available
+content on the APP Server - currently available feeds, and the URL at
+which they can be accessed. Click <a href="<%=serviceDocument%>"><%=serviceDocument%></a>
+</p>
+<h4>Read the available feed</h4>
+<p id="h4-content">View the feed, and use this operation to check on
+the contents of the feed following a create, update, and delete of
+specific entries in the feed. Click <a href="<%=feedDocument%>"><%=feedDocument%></a>
+</p>
+<h4>Read a specific entry in the feed</h4>
+<p id="h4-content">An operation to view the discrete entries that
+compose a feed. Click <a href="<%=specificEntry%>"><%=specificEntry%></a></p>
+<h4>Create a new entry</h4>
+<p id="h4-content">Use the <a href="http://curl.haxx.se/">curl
+tool</a> to perform the POST action, and view its result. Refer <a
+	href="<%=IBM_document%>">this
+documentation</a> to understand how this can be done</p>
+<h4>Update an existing entry, using Atom Publishing Protocol</h4>
+<p id="h4-content">Use the <a href="http://curl.haxx.se/">curl
+tool</a> to perform the PUT action, and view its result. Refer <a
+	href="<%=IBM_document%>">this
+documentation</a> to understand how this can be done</p>
+<h4>Delete an existing entry</h4>
+<p id="h4-content">Use the <a href="http://curl.haxx.se/">curl
+tool</a> to perform the DELETE action, and view its result. Refer <a
+	href="<%=IBM_document%>">this
+documentation</a> to understand how this can be done</p>
+</DIV>
+</DIV>
+</DIV>
+</BODY>
+</HTML>
\ No newline at end of file

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456459.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456460.java
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456460.java?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456460.java (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456460.java Wed Nov 11 07:39:44 2009
@@ -0,0 +1,155 @@
+package myPackage;
+
+import java.net.URI;
+import java.util.Date;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.EntityTag;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.wink.common.annotations.Workspace;
+import org.apache.wink.common.model.atom.AtomCategory;
+import org.apache.wink.common.model.atom.AtomEntry;
+import org.apache.wink.common.model.atom.AtomFeed;
+import org.apache.wink.common.model.atom.AtomLink;
+import org.apache.wink.common.model.atom.AtomPerson;
+import org.apache.wink.common.model.atom.AtomText;
+
+@Workspace(workspaceTitle = "IISc MILE Lab Weblog", collectionTitle = "Entries")
+@Path("/entries")
+public class EntriesCollection {
+    private static AtomFeed feed = initializeFeedDocument("entries");
+
+    @GET
+    @Produces(MediaType.APPLICATION_ATOM_XML)
+    public AtomFeed getFeed() {
+        return feed;
+    }
+
+    @POST
+    @Consumes(MediaType.APPLICATION_ATOM_XML)
+    @Produces(MediaType.APPLICATION_ATOM_XML)
+    public Response postEntry(AtomEntry newEntry, @Context UriInfo uriInfo) {
+        if (searchEntry(newEntry.getId()) != null) {
+            throw new WebApplicationException(Response.Status.CONFLICT);
+        }
+
+        URI uri = uriInfo.getAbsolutePathBuilder().segment(newEntry.getId()).build();
+        pruneEntry(newEntry, uri);
+        feed.getEntries().add(0, newEntry);
+        feed.setUpdated(new Date());
+
+        return Response.status(Response.Status.CREATED).entity(newEntry).location(uri)
+            .tag(new EntityTag(newEntry.getId())).build();
+    }
+
+    @GET
+    @Path("{id}")
+    @Produces(MediaType.APPLICATION_ATOM_XML)
+    public AtomEntry getEntry(@PathParam("id") String entryId) {
+        AtomEntry entry = searchEntry(entryId);
+        if (entry == null) {
+            throw new WebApplicationException(Response.Status.NOT_FOUND);
+        } else {
+            return entry;
+        }
+    }
+
+    @PUT
+    @Path("{id}")
+    @Consumes(MediaType.APPLICATION_ATOM_XML)
+    @Produces(MediaType.APPLICATION_ATOM_XML)
+    public AtomEntry putEntry(@PathParam("id") String entryId,
+                              AtomEntry updatedEntry,
+                              @Context UriInfo uriInfo) {
+        AtomEntry oldEntry = getEntry(entryId);
+        feed.getEntries().remove(oldEntry);
+        pruneEntry(updatedEntry, uriInfo.getAbsolutePath());
+        feed.getEntries().add(0, updatedEntry);
+        feed.setUpdated(new Date());
+        return updatedEntry;
+    }
+
+    @DELETE
+    @Path("{id}")
+    public void deleteEntry(@PathParam("id") String entryId) {
+        AtomEntry oldEntry = getEntry(entryId);
+        feed.getEntries().remove(oldEntry);
+        feed.setUpdated(new Date());
+    }
+
+    private static AtomFeed initializeFeedDocument(String basePath) {
+        AtomFeed feed = new AtomFeed();
+        feed.setId("http://mile.ee.iisc.ernet.in");
+        feed.setTitle(new AtomText("Latest developments at MILE Lab, IISc :"));
+        feed.setUpdated(new Date());
+        AtomLink link1 = new AtomLink();
+        link1.setHref(basePath);
+        feed.getLinks().add(link1);
+        AtomCategory category1 = new AtomCategory();
+        category1.setTerm("lab-updates");
+        feed.getCategories().add(category1);
+
+        AtomEntry entry1 = new AtomEntry();
+        entry1.setId("tts_demo");
+        entry1.setTitle(new AtomText("Kannada and Tamil language TTS Web Demo"));
+        AtomLink link2 = new AtomLink();
+        link2.setHref(basePath + "/" + entry1.getId());
+        entry1.getLinks().add(link2);
+        entry1.setUpdated(new Date());
+        entry1.setPublished(new Date());
+        //entry1.setEdited(new Date());
+        entry1.setSummary(new AtomText("Kannada/Tamil language Text-To-Speech (TTS) Demo by MILE Lab, " +
+        		"IISc is available at http://mile.ee.iisc.ernet.in:8080/tts_demo/ "));
+        AtomPerson person1 = new AtomPerson();
+        person1.setName("ShivaHR");
+        entry1.getAuthors().add(person1);
+        feed.getEntries().add(entry1);
+
+        AtomEntry entry2 = new AtomEntry();
+        entry2.setId("tamil_ocr");
+        entry2.setTitle(new AtomText("Tamil OCR achieves 94.3% accuracy on 1000 scanned pages"));
+        AtomLink link3 = new AtomLink();
+        link3.setHref(basePath + "/" + entry2.getId());
+        entry2.getLinks().add(link3);
+        entry2.setUpdated(new Date());
+        entry2.setPublished(new Date());
+        //entry2.setEdited(new Date());
+        entry2.setSummary(new AtomText("Tamil OCR (Optical Character Recognizer) being developed at " +
+        		"MILE Lab, IISc achieves an accuracy of 94.3%! The testing was carried out by " +
+        		"CDAC-Pune on 1000 pages scanned from books printed between 1950-2000."));
+        AtomPerson person2 = new AtomPerson();
+        person2.setName("ShivaHR");
+        entry2.getAuthors().add(person2);
+        feed.getEntries().add(entry2);
+        return feed;
+    }
+
+    private AtomEntry searchEntry(String entryId) {
+        for (AtomEntry entry : feed.getEntries()) {
+            if (entry.getId().equals(entryId)) {
+                return entry;
+            }
+        }
+        return null;
+    }
+
+    private void pruneEntry(AtomEntry newEntry, URI uri) {
+        newEntry.getLinks().clear();
+        AtomLink link = new AtomLink();
+        link.setHref(uri.toString());
+        newEntry.getLinks().add(link);
+        newEntry.setUpdated(new Date());
+    }
+}

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456460.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456461
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456461?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456461 (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456461 Wed Nov 11 07:39:44 2009
@@ -0,0 +1 @@
+myPackage.EntriesCollection

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456462.xml
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456462.xml?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456462.xml (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456462.xml Wed Nov 11 07:39:44 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+	id="WebApp_ID" version="2.5">
+	<display-name>APP_Server_Wink</display-name>
+	<welcome-file-list>
+		<welcome-file>index.jsp</welcome-file>
+	</welcome-file-list>
+
+	<servlet>
+		<servlet-name>restSdkService</servlet-name>
+		<servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
+		<init-param>
+			<param-name>applicationConfigLocation</param-name>
+			<param-value>/WEB-INF/application</param-value>
+		</init-param>
+	</servlet>
+
+	<servlet-mapping>
+		<servlet-name>restSdkService</servlet-name>
+		<url-pattern>/blog/*</url-pattern>
+	</servlet-mapping>
+</web-app>
\ No newline at end of file

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4456462.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4751361.java
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4751361.java?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4751361.java (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4751361.java Wed Nov 11 07:39:44 2009
@@ -0,0 +1,155 @@
+package myPackage;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.wink.client.ClientResponse;
+import org.apache.wink.client.Resource;
+import org.apache.wink.client.RestClient;
+import org.apache.wink.common.internal.utils.MediaTypeUtils;
+import org.apache.wink.common.model.app.AppCollection;
+import org.apache.wink.common.model.app.AppService;
+import org.apache.wink.common.model.app.AppWorkspace;
+import org.apache.wink.common.model.atom.AtomEntry;
+import org.apache.wink.common.model.atom.AtomFeed;
+import org.apache.wink.common.model.atom.AtomLink;
+import org.apache.wink.common.model.atom.AtomPerson;
+import org.apache.wink.common.model.atom.AtomText;
+
+public class APP_Client_Wink {
+    private static String     SERVICE_URL = "http://localhost:8080/APP_Server_Wink/blog/";
+    private static String     FEED_URL    = "http://localhost:8080/APP_Server_Wink/blog/entries/";
+    private static String     ENTRY_URL   = "http://localhost:8080/APP_Server_Wink/blog/entries/kan_ocr";
+
+    private static RestClient restClient  = new RestClient();
+
+    public static void main(String[] args) {
+        System.out.println("--- I. Contents of Service Document at " + SERVICE_URL + " ---");
+        getServiceDocument();
+
+        System.out.println("--- II. Contents of Feed Document at " + FEED_URL + " ---");
+        getEntries();
+
+        AtomEntry newEntry = createNewEntry();
+        System.out.println("--- III. Posting a new entry into the Feed ---");
+        postEntry(newEntry);
+        System.out.println("--- IV. Contents of Feed Document after Post ---");
+        getEntries();
+
+        AtomEntry changedEntry = changeEntry(newEntry);
+        System.out.println("--- V. Changing the last entry posted ---");
+        putEntry(changedEntry);
+        System.out.println("--- VI. Entry content after change ---");
+        getEntry();
+
+        System.out.println("--- VII. Deleting the last entry posted ---");
+        deleteEntry();
+        System.out.println("--- VIII. Contents of Feed Document after Delete ---");
+        getEntries();
+    }
+
+    private static void getServiceDocument() {
+        Resource resource = restClient.resource(SERVICE_URL);
+        AppService service =
+            resource.accept(MediaTypeUtils.ATOM_SERVICE_DOCUMENT).get(AppService.class);
+        List<AppWorkspace> workspaces = service.getWorkspace();
+        for (AppWorkspace workspace : workspaces) {
+            System.out.println("\t" + workspace.getTitle().getValue());
+            List<AppCollection> collections = workspace.getCollection();
+            for (AppCollection collection : collections) {
+                System.out.println("\t" + collection.getTitle().getValue()
+                    + "\t:\t"
+                    + collection.getHref());
+            }
+            System.out.print("\n");
+        }
+    }
+
+    private static void getEntries() {
+        Resource feedResource = restClient.resource(FEED_URL);
+        AtomFeed feed = feedResource.accept(MediaType.APPLICATION_ATOM_XML).get(AtomFeed.class);
+        int counter = 1;
+        System.out.println("\t" + feed.getTitle().getValue() + "\n");
+        List<AtomEntry> entries = feed.getEntries();
+        for (AtomEntry atomEntry : entries) {
+            System.out.print("\t" + counter++ + ") ");
+            displayEntry(atomEntry);
+        }
+    }
+
+    private static AtomEntry createNewEntry() {
+        AtomEntry entry = new AtomEntry();
+        entry.setId("kan_ocr");
+        entry.setTitle(new AtomText("New algorithm to detect and split merged characters in Kannada OCR"));
+        AtomLink link = new AtomLink();
+        link.setHref(FEED_URL + "/" + entry.getId());
+        entry.getLinks().add(link);
+        entry.setUpdated(new Date());
+        entry.setPublished(new Date());
+        entry.setSummary(new AtomText("The new algorithm to detect and split merged characters in " +
+        		"Kannada OCR is yeilding good results. We will soon be publishing the " +
+        		"algorithm and results in one of the upcoming conferences."));
+        AtomPerson person = new AtomPerson();
+        person.setName("ShivaHR");
+        entry.getAuthors().add(person);
+        return entry;
+    }
+
+    private static AtomEntry changeEntry(AtomEntry curEntry) {
+        curEntry.setTitle(new AtomText("A new algorithm to detect and split merged characters in Kannada OCR will be published soon!"));
+        return curEntry;
+    }
+
+    private static void postEntry(AtomEntry newEntry) {
+        Resource feedResource = restClient.resource(FEED_URL);
+        ClientResponse response =
+            feedResource.contentType(MediaType.APPLICATION_ATOM_XML).post(newEntry);
+        if (response.getStatusCode() == 201) {
+            System.out.println("\t" + "Post successful\n");
+        } else {
+            System.out.println("\t" + "Response code received from server = "
+                + response.getStatusCode()
+                + "\n");
+        }
+    }
+
+    private static void putEntry(AtomEntry changedEntry) {
+        Resource feedResource = restClient.resource(ENTRY_URL);
+        ClientResponse response =
+            feedResource.contentType(MediaType.APPLICATION_ATOM_XML).put(changedEntry);
+        if (response.getStatusCode() == 200) {
+            System.out.println("\t" + "Change successful\n");
+        } else {
+            System.out.println("\t" + "Response code received from server = "
+                + response.getStatusCode()
+                + "\n");
+        }
+    }
+
+    private static void getEntry() {
+        Resource feedResource = restClient.resource(ENTRY_URL);
+        AtomEntry atomEntry = feedResource.accept(MediaType.APPLICATION_ATOM_XML).get(AtomEntry.class);
+        System.out.print("\t");
+        displayEntry(atomEntry);
+    }
+
+    private static void deleteEntry() {
+        Resource feedResource = restClient.resource(ENTRY_URL);
+        ClientResponse response = feedResource.delete();
+        if (response.getStatusCode() == 204) {
+            System.out.println("\t" + "Delete successful\n");
+        } else {
+            System.out.println("\t" + "Response code received from server = "
+                + response.getStatusCode()
+                + "\n");
+        }
+    }
+
+    private static void displayEntry(AtomEntry atomEntry) {
+        System.out.println(atomEntry.getTitle().getValue());
+        System.out.println("\t" + atomEntry.getUpdated().toString());
+        System.out.println("\t" + atomEntry.getSummary().getValue() + "\n");
+    }
+}

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4751361.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4751362.java
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4751362.java?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4751362.java (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4751362.java Wed Nov 11 07:39:44 2009
@@ -0,0 +1,155 @@
+package myPackage;
+
+import java.util.Date;
+import java.util.List;
+
+import org.apache.abdera.Abdera;
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Collection;
+import org.apache.abdera.model.Document;
+import org.apache.abdera.model.Entry;
+import org.apache.abdera.model.Feed;
+import org.apache.abdera.model.Service;
+import org.apache.abdera.model.Workspace;
+import org.apache.abdera.protocol.client.AbderaClient;
+import org.apache.abdera.protocol.client.ClientResponse;
+import org.apache.abdera.protocol.client.RequestOptions;
+
+public class APP_Client_Abdera {
+    private static String     SERVICE_URL = "http://localhost:8080/APP_Server_Abdera/blog";
+    private static String     FEED_URL    = "http://localhost:8080/APP_Server_Abdera/blog/entries";
+    private static String     ENTRY_URL   = "http://localhost:8080/APP_Server_Abdera/blog/entries/kan_ocr";
+
+    private static Abdera abdera      = new Abdera();
+
+    public static void main(String[] args) {
+        System.out.println("--- I. Contents of Service Document at " + SERVICE_URL + " ---");
+        getServiceDocument();
+
+        System.out.println("--- II. Contents of Feed Document at " + FEED_URL + " ---");
+        getEntries();
+
+        Entry newEntry = createNewEntry();
+        System.out.println("--- III. Posting a new entry into the Feed ---");
+        postEntry(newEntry);
+        System.out.println("--- IV. Contents of Feed Document after Post ---");
+        getEntries();
+
+        Entry changedEntry = changeEntry(newEntry);
+        System.out.println("--- V. Changing the last entry posted ---");
+        putEntry(changedEntry);
+        System.out.println("--- VI. Entry content after change ---");
+        getEntry();
+
+        System.out.println("--- VII. Deleting the last entry posted ---");
+        deleteEntry();
+        System.out.println("--- VIII. Contents of Feed Document after Delete ---");
+        getEntries();
+    }
+
+    private static void getServiceDocument() {
+        AbderaClient abderaClient = new AbderaClient(abdera);
+        Document<Service> introspection = abderaClient.get(SERVICE_URL).getDocument();
+        Service service = introspection.getRoot();
+        List<Workspace> workspaces = service.getWorkspaces();
+        for (Workspace workspace : workspaces) {
+            System.out.println("\t" + workspace.getTitle());
+            List<Collection> collections = workspace.getCollections();
+            for (Collection collection : collections) {
+                System.out.println("\t" + collection.getTitle() + "\t:\t" + collection.getHref());
+            }
+            System.out.print("\n");
+        }
+    }
+
+    private static void getEntries() {
+        AbderaClient abderaClient = new AbderaClient(abdera);
+        RequestOptions opts = new RequestOptions();
+        opts.setContentType("application/atom+xml;type=feed");
+        ClientResponse response = abderaClient.get(FEED_URL, opts);
+        Feed feed = (Feed)response.getDocument().getRoot();
+        int counter = 1;
+        System.out.println("\t" + feed.getTitle() + "\n");
+        List<Entry> entries = feed.getEntries();
+        for (Entry atomEntry : entries) {
+            System.out.print("\t" + counter++ + ") ");
+            displayEntry(atomEntry);
+        }
+    }
+
+    private static Entry createNewEntry() {
+        Factory factory = abdera.getFactory();
+        Entry entry = factory.newEntry();
+        entry.setId("kan_ocr");
+        entry.setTitle("New algorithm to detect and split merged characters in Kannada OCR");
+        entry.addLink(FEED_URL + "/kan_ocr");
+        entry.setUpdated(new Date());
+        entry.setPublished(new Date());
+        entry.setSummary("The new algorithm to detect and split merged characters in " +
+                        "Kannada OCR is yeilding good results. We will soon be publishing the " +
+                        "algorithm and results in one of the upcoming conferences.");
+        entry.addAuthor("ShivaHR");
+        return entry;
+    }
+
+    private static Entry changeEntry(Entry curEntry) {
+        curEntry.setTitle("A new algorithm to detect and split merged characters in Kannada OCR will be published soon!");
+        return curEntry;
+    }
+
+    private static void postEntry(Entry newEntry) {
+        AbderaClient abderaClient = new AbderaClient(abdera);
+        RequestOptions opts = new RequestOptions();
+        opts.setContentType("application/atom+xml;type=entry");
+        ClientResponse response = abderaClient.post(FEED_URL, newEntry, opts);
+        if (response.getStatus() == 201) {
+            System.out.println("\t" + "Post successful\n");
+        } else {
+            System.out.println("\t" + "Response code received from server = "
+                + response.getStatus()
+                + "\n");
+        }
+    }
+
+    private static void putEntry(Entry changedEntry) {
+        AbderaClient abderaClient = new AbderaClient(abdera);
+        RequestOptions opts = new RequestOptions();
+        opts.setContentType("application/atom+xml;type=entry");
+        ClientResponse response = abderaClient.put(ENTRY_URL, changedEntry.getDocument(), opts);
+        if (response.getStatus() == 200) {
+            System.out.println("\t" + "Change successful\n");
+        } else {
+            System.out.println("\t" + "Response code received from server = "
+                + response.getStatus()
+                + "\n");
+        }
+    }
+
+    private static void getEntry() {
+        AbderaClient abderaClient = new AbderaClient(abdera);
+        RequestOptions opts = new RequestOptions();
+        opts.setContentType("application/atom+xml;type=entry");
+        ClientResponse response = abderaClient.get(ENTRY_URL, opts);
+        Entry entry = (Entry)response.getDocument().getRoot();
+        System.out.print("\t");
+        displayEntry(entry);
+    }
+
+    private static void deleteEntry() {
+        AbderaClient abderaClient = new AbderaClient(abdera);
+        ClientResponse response = abderaClient.delete(ENTRY_URL);
+        if (response.getStatus() == 204) {
+            System.out.println("\t" + "Delete successful\n");
+        } else {
+            System.out.println("\t" + "Response code received from server = "
+                + response.getStatus()
+                + "\n");
+        }
+    }
+
+    private static void displayEntry(Entry atomEntry) {
+        System.out.println(atomEntry.getTitle());
+        System.out.println("\t" + atomEntry.getUpdated().toString());
+        System.out.println("\t" + atomEntry.getSummary() + "\n");
+    }
+}

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/attachments/2852765/4751362.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/images/border/spacer.gif
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/images/border/spacer.gif?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/images/border/spacer.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/images/icons/bullet_blue.gif
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/images/icons/bullet_blue.gif?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/images/icons/bullet_blue.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/images/icons/emoticons/check.gif
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/images/icons/emoticons/check.gif?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/images/icons/emoticons/check.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/images/icons/emoticons/information.gif
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/images/icons/emoticons/information.gif?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/images/icons/emoticons/information.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/images/icons/emoticons/warning.gif
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/images/icons/emoticons/warning.gif?rev=834791&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/images/icons/emoticons/warning.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/wink/site/trunk/src/site/resources/1.0/html/index.html
URL: http://svn.apache.org/viewvc/incubator/wink/site/trunk/src/site/resources/1.0/html/index.html?rev=834791&view=auto
==============================================================================
--- incubator/wink/site/trunk/src/site/resources/1.0/html/index.html (added)
+++ incubator/wink/site/trunk/src/site/resources/1.0/html/index.html Wed Nov 11 07:39:44 2009
@@ -0,0 +1,347 @@
+
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+	<head>
+		<title>WINK (Apache Wink) Test</title>
+		<link rel="stylesheet" href="styles/site.css" type="text/css" />
+        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+    </head>
+
+	<body>
+		<table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
+			<tr>
+				<td valign="top" class="pagebody">
+					<center>
+						<h1><font color="#0050B2">Space Details:</font></h1>
+					</center>
+					<table class="grid" border="1" cellpadding="0" cellspacing="0" width="100%">
+						<tr>
+							<td width="200">
+								<b>Key:</b>
+							</td>
+							<td>WINK</td>
+						</tr>
+						<tr>
+							<td width="200">
+								<b>Name:</b>
+							</td>
+							<td>Apache Wink</td>
+						</tr>
+						<tr>
+							<td width="200">
+								<b>Description:</b>
+							</td>
+							<td></td>
+						</tr>
+						<tr>
+							<td width="200">
+								<b>Creator (Creation Date):</b>
+							</td>
+							<td>dims (Jun 01, 2009)</td>
+						</tr>
+						<tr>
+							<td width="200">
+								<b>Last Modifier (Mod. Date):</b>
+							</td>
+							<td>dims (Jun 01, 2009)</td>
+						</tr>
+					</table>
+                    <br/>
+                    <br/>
+                    <p>
+                        <h2><font color="#0050B2">Available Pages:</font></h2>
+                            <ul>
+                        <li>
+        
+                    <a href="Apache Wink Developer Guide.html">Apache Wink Developer Guide</a>
+        
+                            <ul>
+                    <li>
+        
+                    <a href="1 Introduction to Apache Wink.html">1 Introduction to Apache Wink</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="2 Apache Wink Building Blocks.html">2 Apache Wink Building Blocks</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="3 Getting Started with Apache Wink.html">3 Getting Started with Apache Wink</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="4 JAX-RS Concepts.html">4 JAX-RS Concepts</a>
+        
+                            <ul>
+                    <li>
+        
+                    <a href="JAX-RS Application Configuration.html">JAX-RS Application Configuration</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="JAX-RS Caching.html">JAX-RS Caching</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="JAX-RS Getting Started.html">JAX-RS Getting Started</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="JAX-RS Resources, HTTP Methods, and Paths.html">JAX-RS Resources, HTTP Methods, and Paths</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="JAX-RS Request and Response Entities.html">JAX-RS Request and Response Entities</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="JAX-RS Parameters.html">JAX-RS Parameters</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="JAX-RS HTTP Headers.html">JAX-RS HTTP Headers</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="JAX-RS Content Negotiation.html">JAX-RS Content Negotiation</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="JAX-RS Context Information.html">JAX-RS Context Information</a>
+        
+                    </li>
+            </ul>
+            </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="5 Apache Wink Server.html">5 Apache Wink Server</a>
+        
+                            <ul>
+                    <li>
+        
+                    <a href="5.1 Registration and Configuration.html">5.1 Registration and Configuration</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="5.2 Annotations.html">5.2 Annotations</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="5.3 Resource Matching.html">5.3 Resource Matching</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="5.4 APP Service Document.html">5.4 APP Service Document</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="5.5 Spring Integration.html">5.5 Spring Integration</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="5.6 WebDAV Extension.html">5.6 WebDAV Extension</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="5.7 Handler Chain - Runtime Extension.html">5.7 Handler Chain - Runtime Extension</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="5.8 Link Builder.html">5.8 Link Builder</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="5.9 Assets.html">5.9 Assets</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="5.10 Admin Views.html">5.10 Admin Views</a>
+        
+                    </li>
+            </ul>
+            </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="6 Apache Wink Client.html">6 Apache Wink Client</a>
+        
+                            <ul>
+                    <li>
+        
+                    <a href="6.1 Getting Started with Apache Wink Client.html">6.1 Getting Started with Apache Wink Client</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="6.2 Configuring the Apache Wink Client.html">6.2 Configuring the Apache Wink Client</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="6.3 Input and Output Stream Adapters.html">6.3 Input and Output Stream Adapters</a>
+        
+                    </li>
+            </ul>
+            </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="7 Apache Wink Representations.html">7 Apache Wink Representations</a>
+        
+                            <ul>
+                    <li>
+        
+                    <a href="7.1 JSON.html">7.1 JSON</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="7.2 APP.html">7.2 APP</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="7.3 Atom.html">7.3 Atom</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="7.4 RSS.html">7.4 RSS</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="7.5 HTML.html">7.5 HTML</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="7.6 CSV.html">7.6 CSV</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="7.7 OpenSearch.html">7.7 OpenSearch</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="7.8 MultiPart.html">7.8 MultiPart</a>
+        
+                    </li>
+            </ul>
+            </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="Appendix A - Feeds Support.html">Appendix A - Feeds Support</a>
+        
+                    </li>
+            </ul>
+                    <ul>
+                    <li>
+        
+                    <a href="Appendix B - Google App Engine.html">Appendix B - Google App Engine</a>
+        
+                    </li>
+            </ul>
+            </li>
+            </ul>
+                    </p>
+				</td>
+			</tr>
+		</table>
+		<table border="0" cellpadding="0" cellspacing="0" width="100%">
+			<tr>
+				<td height="12" background="http://cwiki.apache.org/confluence/images/border/border_bottom.gif"><img src="images/border/spacer.gif" width="1" height="1" border="0"/></td>
+			</tr>
+			<tr>
+				<td align="center"><font color="grey">Document generated by Confluence on Nov 11, 2009 06:57</font></td>
+			</tr>
+		</table>
+	</body>
+</html>
\ No newline at end of file

Propchange: incubator/wink/site/trunk/src/site/resources/1.0/html/index.html
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message