From: <st...@us...> - 2007-08-15 13:29:00
|
Revision: 4999 http://smartfrog.svn.sourceforge.net/smartfrog/?rev=4999&view=rev Author: steve_l Date: 2007-08-15 06:28:54 -0700 (Wed, 15 Aug 2007) Log Message: ----------- SFOS-392 atom Modified Paths: -------------- trunk/core/components/atom/atom.iml Added Paths: ----------- trunk/core/components/atom/build.xml trunk/core/components/atom/ivy.xml trunk/core/components/atom/src/org/smartfrog/services/atom/server/AbstractAtomServlet.java trunk/core/components/atom/src/org/smartfrog/services/atom/server/BufferAtomServlet.java Removed Paths: ------------- trunk/core/components/atom/src/org/smartfrog/services/atom/server/AtomServlet.java trunk/core/components/atom/src/org/smartfrog/services/www/ Modified: trunk/core/components/atom/atom.iml =================================================================== --- trunk/core/components/atom/atom.iml 2007-08-15 13:26:46 UTC (rev 4998) +++ trunk/core/components/atom/atom.iml 2007-08-15 13:28:54 UTC (rev 4999) @@ -5,6 +5,7 @@ <exclude-output /> <content url="file://$MODULE_DIR$"> <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" /> </content> <orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" /> Added: trunk/core/components/atom/build.xml =================================================================== --- trunk/core/components/atom/build.xml (rev 0) +++ trunk/core/components/atom/build.xml 2007-08-15 13:28:54 UTC (rev 4999) @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8"?> +<project name="atom" default="default"> + + <!-- + /** (C) Copyright 2007 Hewlett-Packard Development Company, LP + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information: www.smartfrog.org + + */ + --> + + <description> + Ant support. Derived from a (relicensed as LGPL) release of the samples of Ant in Action + </description> + <!--we are a component --> + <property name="is.component" value="true"/> + <property name="ivy.enabled" value="true"/> + + <!-- override point --> + <property file="build.properties"/> + + + <property name="root.dir" location="../.."/> + <!-- Import common stuff --> + <import file="${root.dir}/common.xml"/> + + + <echo message="==================================================================="/> + <echo message="= ${ant.project.name}"/> +</project> \ No newline at end of file Added: trunk/core/components/atom/ivy.xml =================================================================== --- trunk/core/components/atom/ivy.xml (rev 0) +++ trunk/core/components/atom/ivy.xml 2007-08-15 13:28:54 UTC (rev 4999) @@ -0,0 +1,64 @@ +<?xml version="1.0" ?> +<?xml-stylesheet type="text/xsl" href="http://ivyrep.jayasoft.org/ivy-doc.xsl"?> +<ivy-module version="1.0"> + <info organisation="org.smartfrog" module="sf-atom"> + <license name="LGPL"/> + <ivyauthor name="Hewlett-Packard" url="http://www.smartfrog.org"/> + <description> + Atom support + Created 15-Aug-2007 by slo + </description> + </info> +<!-- FIXME: Ivy 1.4.1 buildlist bug + <configurations defaultconfmapping="default"> + <include file="../../antbuild/ivy/configurations.xml"/> + </configurations> + --> +<configurations defaultconfmapping="default"> + <conf name="default" extends="master,runtime"/> + <conf name="build" visibility="private" + description="artifacts needed to build the application"/> + <conf name="compile" visibility="private" + description="artifacts needed to compile the application"/> + <conf name="daemon" visibility="private" + description="the classpath needed to run smartfrog daemons"/> + <conf name="test" extends="default" + description="the classpath needed to run tests"/> + <conf name="master" description="contains the artifact but no dependencies"/> + <conf name="redist" description="redistributals excluding smartfrog artifacts"/> + <conf name="runtime" description="runtime but not the artifact" + extends="redist"/> +</configurations> + + <publications> + <!--get the artifact from our module name--> + <artifact conf="master"/> + </publications> + <dependencies> + <dependency org="org.smartfrog" + name="smartfrog" + changing="true" + rev="latest.integration" + conf="compile,runtime,daemon->services"/> + <dependency org="org.smartfrog" + name="sf-tasks" + rev="latest.integration" + conf="build->default"/> + <dependency org="org.smartfrog" + name="sf-testharness" + rev="latest.integration" + conf="test->default"/> + <dependency org="org.smartfrog" + name="sf-jetty" + rev="latest.integration" + conf="redist->redist;runtime,compile->default"/> + <dependency org="rome" + name="rome" + rev="${rome.version}" + conf="compile,redist->default"/> + <dependency org="jdom" + name="jdom" + rev="${jdom.version}" + conf="compile,redist->default"/> + </dependencies> +</ivy-module> \ No newline at end of file Copied: trunk/core/components/atom/src/org/smartfrog/services/atom/server/AbstractAtomServlet.java (from rev 4996, trunk/core/components/atom/src/org/smartfrog/services/atom/server/AtomServlet.java) =================================================================== --- trunk/core/components/atom/src/org/smartfrog/services/atom/server/AbstractAtomServlet.java (rev 0) +++ trunk/core/components/atom/src/org/smartfrog/services/atom/server/AbstractAtomServlet.java 2007-08-15 13:28:54 UTC (rev 4999) @@ -0,0 +1,71 @@ +/** (C) Copyright 2007 Hewlett-Packard Development Company, LP + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information: www.smartfrog.org + + */ +package org.smartfrog.services.atom.server; + +import com.sun.syndication.feed.synd.SyndFeed; +import com.sun.syndication.io.FeedException; +import com.sun.syndication.io.SyndFeedOutput; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** created 13-Apr-2007 12:33:16 */ + +public abstract class AbstractAtomServlet extends HttpServlet { + private static final String APPLICATION_XML = "application/xml"; + private static final String ATOM_1_0 = "atom_1.0"; + + /** + * This is what subclasses must return a feed for a specific request + * @param request incoming request + * @return feed to serve up + */ + protected abstract SyndFeed lookupFeed(HttpServletRequest request); + + /** + * process a GET request + * + * @param request request + * @param response response + * @throws ServletException if the feed doesn't work + * @throws IOException on IO problems + */ + protected void doGet(HttpServletRequest request, + HttpServletResponse response) + throws ServletException, IOException { + + try { + SyndFeed feed = lookupFeed(request); + feed.setFeedType(ATOM_1_0); + response.setContentType(APPLICATION_XML); + SyndFeedOutput output = new SyndFeedOutput(); + output.output(feed, response.getWriter()); + } + catch (FeedException e) { + //wrap and throw; let the stack handle it. + ServletException se = + new ServletException("When creating feed", e); + throw se; + } + } +} Deleted: trunk/core/components/atom/src/org/smartfrog/services/atom/server/AtomServlet.java =================================================================== --- trunk/core/components/atom/src/org/smartfrog/services/atom/server/AtomServlet.java 2007-08-15 13:26:46 UTC (rev 4998) +++ trunk/core/components/atom/src/org/smartfrog/services/atom/server/AtomServlet.java 2007-08-15 13:28:54 UTC (rev 4999) @@ -1,69 +0,0 @@ -/** (C) Copyright 2007 Hewlett-Packard Development Company, LP - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - For more information: www.smartfrog.org - - */ -package org.smartfrog.services.atom.server; - -/*import com.sun.syndication.feed.synd.SyndFeed; -import com.sun.syndication.io.FeedException; -import com.sun.syndication.io.SyndFeedOutput;*/ - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -/** created 13-Apr-2007 12:33:16 */ - -public class AtomServlet extends HttpServlet { - private static final String APPLICATION_XML = "application/xml"; - private static final String ATOM_1_0 = "atom_1.0"; - -/* - SyndFeed lookupFeed(HttpServletRequest request) { - return null; - }*/ - - /** - * process a GET request - * - * @param request request - * @param response response - * @throws ServletException if the feed doesn't work - * @throws IOException on IO problems - */ - protected void doGet(HttpServletRequest request, - HttpServletResponse response) - throws ServletException, IOException { - -/* try { - SyndFeed feed = lookupFeed(request); - feed.setFeedType(ATOM_1_0); - response.setContentType(APPLICATION_XML); - SyndFeedOutput output = new SyndFeedOutput(); - output.output(feed, response.getWriter()); - } - catch (FeedException e) { - //wrap and throw; let the stack handle it. - ServletException se = - new ServletException("When creating feed", e); - throw se; - }*/ - } -} Added: trunk/core/components/atom/src/org/smartfrog/services/atom/server/BufferAtomServlet.java =================================================================== --- trunk/core/components/atom/src/org/smartfrog/services/atom/server/BufferAtomServlet.java (rev 0) +++ trunk/core/components/atom/src/org/smartfrog/services/atom/server/BufferAtomServlet.java 2007-08-15 13:28:54 UTC (rev 4999) @@ -0,0 +1,55 @@ +/** (C) Copyright 2007 Hewlett-Packard Development Company, LP + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +For more information: www.smartfrog.org + +*/ +package org.smartfrog.services.atom.server; + +import com.sun.syndication.feed.synd.SyndFeed; +import com.sun.syndication.feed.synd.SyndFeedImpl; + +import javax.servlet.http.HttpServletRequest; + +/** + * This implementation of the servlet hosts a buffer of things to serve up, which + * it proceeds to do whenever it has to + * Created 15-Aug-2007 13:45:17 + * + */ + +public class BufferAtomServlet extends AbstractAtomServlet { + + private SyndFeed feed=new SyndFeedImpl(); + + /** + * This is what subclasses must return a feed for a specific request + * + * @param request incoming request + * @return feed to serve up + */ + protected SyndFeed lookupFeed(HttpServletRequest request) { + return feed; + } + + /** + * Return the single feed + * @return the feed + */ + public SyndFeed getFeed() { + return feed; + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |