lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r412574 [1/4] - in /lucene/java/trunk: ./ contrib/gdata-server/ contrib/gdata-server/lib/ contrib/gdata-server/src/ contrib/gdata-server/src/java/ contrib/gdata-server/src/java/org/ contrib/gdata-server/src/java/org/apache/ contrib/gdata-se...
Date Wed, 07 Jun 2006 21:56:29 GMT
Author: cutting
Date: Wed Jun  7 14:56:25 2006
New Revision: 412574

URL: http://svn.apache.org/viewvc?rev=412574&view=rev
Log:
LUCENE-578.  First version of gdata-server.  Contributed by Simon Willnauer.

Added:
    lucene/java/trunk/contrib/gdata-server/
    lucene/java/trunk/contrib/gdata-server/build.xml
    lucene/java/trunk/contrib/gdata-server/lib/
    lucene/java/trunk/contrib/gdata-server/lib/commons-logging-1.1.jar   (with props)
    lucene/java/trunk/contrib/gdata-server/lib/easymock.jar   (with props)
    lucene/java/trunk/contrib/gdata-server/lib/gdata-client-1.0.jar   (with props)
    lucene/java/trunk/contrib/gdata-server/lib/log4j-1.2.13.jar   (with props)
    lucene/java/trunk/contrib/gdata-server/lib/servlet-api.jar   (with props)
    lucene/java/trunk/contrib/gdata-server/src/
    lucene/java/trunk/contrib/gdata-server/src/java/
    lucene/java/trunk/contrib/gdata-server/src/java/lucenestorage.properties.xml
    lucene/java/trunk/contrib/gdata-server/src/java/org/
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/package.html
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/package.html
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/FeedNotFoundException.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataEntityBuilder.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataRequest.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataRequestException.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataResponse.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataService.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/Service.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/ServiceException.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/ServiceFactory.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/package.html
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/DataBuilderException.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/FeedInstanceConfigurator.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/GDataServerRegistry.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/RegistryBuilder.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/RegistryContextListener.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/package.html
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/AbstractGdataServlet.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/RequestControllerServlet.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/AbstractGdataRequestHandler.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/DefaultDeleteHandler.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/DefaultGetHandler.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/DefaultInsertHandler.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/DefaultRequestHandlerFactory.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/DefaultUpdateHandler.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/GDataRequestHandler.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/GDataRequestHandlerException.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/RequestHandlerFactory.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/package.html
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/package.html
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/IDGenerator.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/Storage.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/StorageController.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/StorageException.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/StorageFactory.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/ModifiedEntryFilter.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/StorageBuffer.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/StorageCoreController.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/StorageEntryWrapper.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/StorageImplementation.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/StorageModifier.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/StorageQuery.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/configuration/
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/configuration/StorageConfigurator.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/configuration/package.html
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/package.html
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/util/
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/util/ReferenceCounter.java
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/util/package.html
    lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/package.html
    lucene/java/trunk/contrib/gdata-server/src/test/
    lucene/java/trunk/contrib/gdata-server/src/test/org/
    lucene/java/trunk/contrib/gdata-server/src/test/org/apache/
    lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/
    lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/
    lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/
    lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/TestGDataRequest.java
    lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/TestGDataResponse.java
    lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/registry/
    lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/registry/TestEntityBuilderIncomingEntry.xml
    lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/registry/TestEntityBuilderIncomingFeed.xml
    lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/registry/TestFeedRegistry.java
    lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/registry/TestGDataEntityBuilder.java
    lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/servlet/
    lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/servlet/TestAbstractGdataServlet.java
    lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/
    lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/TestIDGenerator.java
    lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/lucenestorage/
    lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/lucenestorage/TestModifiedEntryFilter.java
    lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/lucenestorage/TestStorageModifier.java
    lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/lucenestorage/TestStorageQuery.java
    lucene/java/trunk/contrib/gdata-server/webroot/
    lucene/java/trunk/contrib/gdata-server/webroot/WEB-INF/
    lucene/java/trunk/contrib/gdata-server/webroot/WEB-INF/classes/
    lucene/java/trunk/contrib/gdata-server/webroot/WEB-INF/classes/lucenestorage.properties.xml
    lucene/java/trunk/contrib/gdata-server/webroot/WEB-INF/web.xml
Modified:
    lucene/java/trunk/build.xml

Modified: lucene/java/trunk/build.xml
URL: http://svn.apache.org/viewvc/lucene/java/trunk/build.xml?rev=412574&r1=412573&r2=412574&view=diff
==============================================================================
--- lucene/java/trunk/build.xml (original)
+++ lucene/java/trunk/build.xml Wed Jun  7 14:56:25 2006
@@ -379,6 +379,7 @@
         <packageset dir="contrib/surround/src/java"/>
         <packageset dir="contrib/swing/src/java"/>
         <packageset dir="contrib/wordnet/src/java"/>
+    <packageset dir="contrib/gdata-server/src/java"/> 
 
         <group title="Core" packages="org.apache.*:org.apache.lucene.analysis:org.apache.lucene.analysis.standard*"/>
 

Added: lucene/java/trunk/contrib/gdata-server/build.xml
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/build.xml?rev=412574&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/build.xml (added)
+++ lucene/java/trunk/contrib/gdata-server/build.xml Wed Jun  7 14:56:25 2006
@@ -0,0 +1,50 @@
+<?xml version="1.0"?> 
+ 
+<project name="gdata-server" default="default"> 
+ 
+    <description> 
+    Serverside Google Data API implementation 
+  </description> 
+     
+    <property name="gdata.war.name" value="gdata-server"/> 
+    <property name="gdata.lib.dir" value="lib"/> 
+     
+    <path id="additional.dependencies"> 
+        <pathelement location="lib/servlet-api.jar" /> 
+        <!-- easymock version 1.2 for java 1.3 --> 
+        <pathelement location="lib/easymock.jar" /> 
+        <pathelement location="lib/gdata-client-1.0.jar" /> 
+        <pathelement location="lib/commons-logging-1.1.jar" /> 
+        <pathelement location="lib/commons-jxpath-1.2.jar" /> 
+        <pathelement location="lib/je.jar" /> 
+         
+         
+    </path> 
+     
+ 
+    <pathconvert property="project.classpath" targetos="unix" refid="additional.dependencies" /> 
+ 
+       <property name="javac.source" value="1.5"/> 
+       <property name="javac.target" value="1.5"/> 
+    <import file="../contrib-build.xml" /> 
+ 
+    <target name="prepare-dist" depends="jar-core"> 
+        <echo>Prepare dist directory</echo> 
+        <delete dir="${dist.dir}"/> 
+        <mkdir dir="${dist.dir}"/> 
+    </target> 
+     <target name="war-gdata" depends="prepare-dist"> 
+         <echo>Distributing GData War </echo> 
+        <war destfile="${dist.dir}/${gdata.war.name}.war" 
+             webxml="webroot/WEB-INF/web.xml"> 
+        <fileset dir="webroot" excludes="WEB-INF/web.xml"/> 
+ 
+            <lib dir="${gdata.lib.dir}" includes="commons-logging-1.1.jar"/> 
+            <lib dir="${gdata.lib.dir}" includes="gdata-client-1.0.jar"/> 
+ 
+        <lib dir="${build.dir}" includes="${final.name}.jar"/> 
+        <lib file="${lucene.jar}" /> 
+        </war> 
+      </target> 
+ 
+</project> 
\ No newline at end of file

Added: lucene/java/trunk/contrib/gdata-server/lib/commons-logging-1.1.jar
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/lib/commons-logging-1.1.jar?rev=412574&view=auto
==============================================================================
Binary file - no diff available.

Propchange: lucene/java/trunk/contrib/gdata-server/lib/commons-logging-1.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: lucene/java/trunk/contrib/gdata-server/lib/easymock.jar
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/lib/easymock.jar?rev=412574&view=auto
==============================================================================
Binary file - no diff available.

Propchange: lucene/java/trunk/contrib/gdata-server/lib/easymock.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: lucene/java/trunk/contrib/gdata-server/lib/gdata-client-1.0.jar
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/lib/gdata-client-1.0.jar?rev=412574&view=auto
==============================================================================
Binary file - no diff available.

Propchange: lucene/java/trunk/contrib/gdata-server/lib/gdata-client-1.0.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: lucene/java/trunk/contrib/gdata-server/lib/log4j-1.2.13.jar
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/lib/log4j-1.2.13.jar?rev=412574&view=auto
==============================================================================
Binary file - no diff available.

Propchange: lucene/java/trunk/contrib/gdata-server/lib/log4j-1.2.13.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: lucene/java/trunk/contrib/gdata-server/lib/servlet-api.jar
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/lib/servlet-api.jar?rev=412574&view=auto
==============================================================================
Binary file - no diff available.

Propchange: lucene/java/trunk/contrib/gdata-server/lib/servlet-api.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: lucene/java/trunk/contrib/gdata-server/src/java/lucenestorage.properties.xml
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/lucenestorage.properties.xml?rev=412574&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/lucenestorage.properties.xml (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/lucenestorage.properties.xml Wed Jun  7 14:56:25 2006
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?> 
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> 
+<properties> 
+<comment>Lucene Storage Properties</comment> 
+<entry key="gdata.server.storage.lucene.buffersize">20</entry> 
+<entry key="gdata.server.storage.lucene.optimizeInterval">20</entry> 
+<entry key="gdata.server.storage.lucene.persistFactor">20</entry> 
+<entry key="gdata.server.storage.lucene.directory">/tmp/storage/</entry> 
+<entry key="gdata.server.storage.lucene.recover">true</entry> 
+<entry key="gdata.server.storage.lucene.recover.keepFiles">false</entry> 
+</properties> 

Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/package.html
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/package.html?rev=412574&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/package.html (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/package.html Wed Jun  7 14:56:25 2006
@@ -0,0 +1,10 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> 
+<html> 
+<head> 
+   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
+   <meta name="Author" content="Simon Willnauer"> 
+</head> 
+<body> 
+Contains classes for the internal representation of GData feeds and entries. 
+</body> 
+</html> 
\ No newline at end of file

Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/package.html
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/package.html?rev=412574&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/package.html (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/package.html Wed Jun  7 14:56:25 2006
@@ -0,0 +1 @@
+<html><body>Top-level package.</body></html> 
\ No newline at end of file

Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/FeedNotFoundException.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/FeedNotFoundException.java?rev=412574&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/FeedNotFoundException.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/FeedNotFoundException.java Wed Jun  7 14:56:25 2006
@@ -0,0 +1,52 @@
+package org.apache.lucene.gdata.server; 
+ 
+ 
+/** 
+ * Will be thrown if a requested feed could not be found or is not 
+ * registerd. 
+ *  
+ * @author Simon Willnauer 
+ *  
+ */ 
+public class FeedNotFoundException extends ServiceException { 
+ 
+    private static final long serialVersionUID = 1L; 
+ 
+    /** 
+     * Constructs a FeedNotFoundException 
+     */ 
+    public FeedNotFoundException() { 
+        super(); 
+ 
+    } 
+ 
+    /** 
+     * @param arg0 - 
+     *            message 
+     * @param arg1 - 
+     *            cause 
+     */ 
+    public FeedNotFoundException(String arg0, Throwable arg1) { 
+        super(arg0, arg1); 
+ 
+    } 
+ 
+    /** 
+     * @param arg0 - 
+     *            message 
+     */ 
+    public FeedNotFoundException(String arg0) { 
+        super(arg0); 
+ 
+    } 
+ 
+    /** 
+     * @param arg0 - 
+     *            cause 
+     */ 
+    public FeedNotFoundException(Throwable arg0) { 
+        super(arg0); 
+ 
+    } 
+ 
+} 
\ No newline at end of file

Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataEntityBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataEntityBuilder.java?rev=412574&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataEntityBuilder.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataEntityBuilder.java Wed Jun  7 14:56:25 2006
@@ -0,0 +1,171 @@
+/** 
+ * Copyright 2004 The Apache Software Foundation 
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License. 
+ */ 
+package org.apache.lucene.gdata.server; 
+ 
+import java.io.IOException; 
+import java.io.Reader; 
+ 
+import org.apache.lucene.gdata.server.registry.DataBuilderException; 
+import org.apache.lucene.gdata.server.registry.FeedInstanceConfigurator; 
+import org.apache.lucene.gdata.server.registry.GDataServerRegistry; 
+ 
+import com.google.gdata.data.BaseEntry; 
+import com.google.gdata.data.BaseFeed; 
+import com.google.gdata.data.ExtensionProfile; 
+import com.google.gdata.util.ParseException; 
+ 
+/** 
+ * {@link com.google.gdata.data.BaseFeed}, 
+ * {@link com.google.gdata.data.BaseEntry} instances have to be build from a 
+ * {@link java.io.Reader} instance as they come in from a client request or out 
+ * of a storage. 
+ * <p> 
+ * To provide a generic builder class the {@link GDataEntityBuilder} requests 
+ * the type of the feed / entry and the corresponding 
+ * {@link com.google.gdata.data.ExtensionProfile} form the global 
+ * {@link org.apache.lucene.gdata.server.registry.GDataServerRegistry} and builds the 
+ * instances from the provided reader. 
+ * </p> 
+ *  
+ * @author Simon Willnauer 
+ *  
+ */ 
+public class GDataEntityBuilder { 
+    private static final GDataServerRegistry REGISTRY = GDataServerRegistry.getRegistry(); // TODO find another way for getting the registered feeds 
+ 
+    /** 
+     * Builds a {@link BaseFeed} instance from the {@link Reader} provided by 
+     * the {@link GDataRequest} 
+     *  
+     * @param request - 
+     *            the request to build the instance from 
+     * @return - a BaseFeed instance 
+     * @throws FeedNotFoundException - 
+     *             if the feed is not registered 
+     * @throws IOException - 
+     *             if an I/O Exception occures on the provided reader 
+     * @throws ParseException - 
+     *             if the feed could not be parsed 
+     */ 
+    public static BaseFeed buildFeed(final GDataRequest request) 
+            throws FeedNotFoundException, IOException, ParseException { 
+        if (request == null) 
+            throw new IllegalArgumentException("request must not be null"); 
+        return buildFeed(request.getFeedId(), request.getReader(),request.getExtensionProfile()); 
+    } 
+ 
+    /** 
+     * Builds a {@link BaseFeed} from the provided {@link Reader} 
+     *  
+     * @param feedId - 
+     *            the feed ID to request the feed type from the registry 
+     * @param reader - 
+     *            the reader to build the feed from 
+     * @param profile - extension profile to parse the resource 
+     * @return - a BaseFeed instance 
+     * @throws FeedNotFoundException - 
+     *             if the feed is not registered 
+     * @throws IOException - 
+     *             if an I/O Exception occures on the provided reader 
+     * @throws ParseException - 
+     *             if the feed could not be parsed 
+     */ 
+    public static BaseFeed buildFeed(final String feedId, final Reader reader,final ExtensionProfile profile) 
+            throws FeedNotFoundException, ParseException, IOException { 
+ 
+        BaseFeed retVal = null; 
+        try { 
+            retVal = (BaseFeed) createEntityInstance(feedId); 
+        } catch (FeedNotFoundException e) { 
+            throw e; 
+        } catch (Exception e) { 
+            DataBuilderException ex = new DataBuilderException( 
+                    "Could not build Feed for Feed class ", e); 
+            ex.setStackTrace(e.getStackTrace()); 
+            throw ex; 
+        } 
+        retVal.parseAtom(profile, reader); 
+ 
+        return retVal; 
+    } 
+ 
+    /** 
+     * Builds a {@link BaseEntry} instance from the {@link Reader} provided by 
+     * the {@link GDataRequest} 
+     *  
+     * @param request - 
+     *            the request to build the instance from 
+     * @return - a BaseEntry instance 
+     * @throws FeedNotFoundException - 
+     *             if the feed, requested by the client is not registered 
+     * @throws IOException - 
+     *             if an I/O Exception occures on the provided reader 
+     * @throws ParseException - 
+     *             if the entry could not be parsed 
+     */ 
+    public static BaseEntry buildEntry(final GDataRequest request) 
+            throws FeedNotFoundException, IOException, ParseException { 
+        if (request == null) 
+            throw new IllegalArgumentException("request must not be null"); 
+        return buildEntry(request.getFeedId(), request.getReader(),request.getExtensionProfile()); 
+    } 
+ 
+    /** 
+     * Builds a {@link BaseFeed} instance from the {@link Reader} provided by 
+     * the {@link GDataRequest} 
+     * @param feedId - 
+     *            the feed ID to request the feed type from the registry 
+     * @param reader - 
+     *            the reader to build the feed from  
+     * @param profile - extension profile to parse the resource 
+     * @return - a BaseFeed instance 
+     * @throws FeedNotFoundException - 
+     *             if the feed is not registered 
+     * @throws IOException - 
+     *             if an I/O Exception occures on the provided reader 
+     * @throws ParseException - 
+     *             if the entry could not be parsed 
+     */ 
+    public static BaseEntry buildEntry(final String feedId, final Reader reader,final ExtensionProfile profile) 
+            throws FeedNotFoundException, ParseException, IOException { 
+ 
+        BaseEntry retVal = null; 
+        try { 
+            retVal = ((BaseFeed) createEntityInstance(feedId)).createEntry(); 
+        } catch (FeedNotFoundException e) { 
+            throw e; 
+        } catch (Exception e) { 
+            DataBuilderException ex = new DataBuilderException( 
+                    "Could not build Entry for Entry class ", e); 
+            ex.setStackTrace(e.getStackTrace()); 
+            throw ex; 
+        } 
+        retVal.parseAtom(new ExtensionProfile(), reader); 
+        return retVal; 
+    } 
+ 
+    private static Object createEntityInstance(String feedId) 
+            throws FeedNotFoundException, InstantiationException, 
+            IllegalAccessException { 
+        FeedInstanceConfigurator config = REGISTRY.getFeedConfigurator(feedId); 
+        if (config == null) 
+            throw new FeedNotFoundException( 
+                    "No feed for requested feed ID found - " + feedId); 
+        Class feedClass = config.getFeedType(); 
+        return feedClass.newInstance(); 
+    } 
+ 
+} 

Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataRequest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataRequest.java?rev=412574&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataRequest.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataRequest.java Wed Jun  7 14:56:25 2006
@@ -0,0 +1,442 @@
+/** 
+ * Copyright 2004 The Apache Software Foundation 
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License. 
+ */ 
+ 
+package org.apache.lucene.gdata.server; 
+ 
+import java.io.IOException; 
+import java.io.Reader; 
+import java.util.Enumeration; 
+import java.util.Map; 
+import java.util.StringTokenizer; 
+ 
+import javax.servlet.http.HttpServletRequest; 
+ 
+import org.apache.commons.logging.Log; 
+import org.apache.commons.logging.LogFactory; 
+import org.apache.lucene.gdata.server.registry.GDataServerRegistry; 
+ 
+import com.google.gdata.data.ExtensionProfile; 
+ 
+/** 
+ * The GDataRequest Class wraps the incoming HttpServletRequest. Needed 
+ * information coming with the HttpServletRequest can be accessed directly. It 
+ * represents an abstraction on the plain HttpServletRequest. Every GData 
+ * specific data coming from the client will be availiable and can be accessed 
+ * via the GDataRequest. 
+ * <p> 
+ * GDataRequest instances will be passed to any action requested by the client. 
+ * This class also holds the logic to retrieve important information like 
+ * response format, the reqeusted feed instance and query parameters. 
+ *  
+ * </p> 
+ *  
+ * @author Simon Willnauer 
+ *  
+ */ 
+/* this class might be extracted as an interface in later development */ 
+public class GDataRequest { 
+ 
+    private static final Log LOG = LogFactory.getLog(GDataRequest.class); 
+ 
+    private static final String RESPONSE_FORMAT_PARAMETER = "alt"; 
+ 
+    private static final String RESPONSE_FORMAT_PARAMETER_RSS = "rss"; 
+ 
+    private static final int DEFAULT_ITEMS_PER_PAGE = 25; 
+ 
+    private static final int DEFAULT_START_INDEX = 1; 
+ 
+    private static final String START_INDEX_NEXT_PAGE_PARAMETER = "start-index"; 
+ 
+    private static final String ITEMS_PER_PAGE_PARAMETER = "max-results"; 
+ 
+    private String contextPath; 
+ 
+    @SuppressWarnings("unused") 
+    private static final String RESPONSE_FORMAT_PARAMETER_ATOM = "atom"; 
+ 
+    // Atom is the default resopnse format 
+    private OutputFormat responseFormat = OutputFormat.ATOM; 
+ 
+    private final HttpServletRequest request; 
+ 
+    private String feedId = null; 
+ 
+    private String entryId = null; 
+     
+    private ExtensionProfile extensionProfile= null; 
+ 
+    private String entryVersion = null; 
+ 
+    private GDataRequestType type; 
+ 
+    /** 
+     * Creates a new FeedRequest 
+     *  
+     * @param requst - 
+     *            the incoming HttpServletReqeust 
+     * @param type - 
+     *            the request type 
+     *  
+     */ 
+    public GDataRequest(final HttpServletRequest requst, 
+            final GDataRequestType type) { 
+        if (requst == null) 
+            throw new IllegalArgumentException("request must not be null "); 
+        if (type == null) 
+            throw new IllegalArgumentException("request type must not be null "); 
+        this.request = requst; 
+        this.type = type; 
+         
+    } 
+ 
+    /** 
+     * Initialize the GDataRequest. This will initialize all needed values / 
+     * attributes in this request. 
+     *  
+     * @throws GDataRequestException 
+     */ 
+    public void initializeRequest() throws GDataRequestException { 
+        generateIdentificationProperties(); 
+        setOutputFormat(); 
+        /* 
+         * ExtensionProfile is used for building the Entry / Feed Instances from an inputstream or reader 
+         */ 
+        this.extensionProfile = GDataServerRegistry.getRegistry().getExtensionProfile(this.feedId); 
+        if(this.extensionProfile == null) 
+            throw new GDataRequestException("feed is not registered or extension profile could not be created"); 
+    } 
+ 
+    /** 
+     * @return - the id of the requested feed 
+     */ 
+    public String getFeedId() { 
+ 
+        return this.feedId; 
+    } 
+ 
+    /** 
+     * @return - the entry id of the requested Entry if specified, otherwise 
+     *         <code>null</code> 
+     */ 
+    public String getEntryId() { 
+ 
+        return this.entryId; 
+    } 
+ 
+    /** 
+     * @return the version Id of the requested Entry if specified, otherwise 
+     *         <code>null</code> 
+     */ 
+    public String getEntryVersion() { 
+        return this.entryVersion; 
+    } 
+ 
+    /** 
+     * A Reader instance to read form the client input stream 
+     *  
+     * @return - the HttpServletRequest {@link Reader} 
+     * @throws IOException - 
+     *             if an I/O Exception occures 
+     */ 
+    public Reader getReader() throws IOException { 
+        return this.request.getReader(); 
+    } 
+ 
+    /** 
+     * Returns the {@link HttpServletRequest} parameter map containig all <i>GET</i> 
+     * request parameters. 
+     *  
+     * @return the parameter map 
+     */ 
+    @SuppressWarnings("unchecked") 
+    public Map<String, String[]> getQueryParameter() { 
+        return this.request.getParameterMap(); 
+    } 
+ 
+    /** 
+     * The {@link HttpServletRequest} request parameter names 
+     *  
+     * @return parameter names enumeration 
+     */ 
+    @SuppressWarnings("unchecked") 
+    public Enumeration<String> getQueryParameterNames() { 
+        return this.request.getParameterNames(); 
+    } 
+ 
+    /** 
+     * Either <i>Atom</i> or <i>RSS</i> 
+     *  
+     * @return - The output format requested by the client 
+     */ 
+    public OutputFormat getRequestedResponseFormat() { 
+ 
+        return this.responseFormat; 
+    } 
+ 
+    private void generateIdentificationProperties() 
+            throws GDataRequestException { 
+        /* generate all needed data to identify the requested feed/entry */ 
+        String pathInfo = this.request.getPathInfo(); 
+        /* 
+         * TODO this has to be changed to support the category queries. Category 
+         * queries could also be rewrited in the Servlet. 
+         */ 
+        if (pathInfo.length() <= 1) 
+            throw new GDataRequestException( 
+                    "No feed or entry specified for this request"); 
+        StringTokenizer tokenizer = new StringTokenizer(pathInfo, "/"); 
+        this.feedId = tokenizer.nextToken(); 
+        this.entryId = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : ""; 
+        this.entryVersion = tokenizer.hasMoreTokens() ? tokenizer.nextToken() 
+                : ""; 
+ 
+    } 
+ 
+    private void setOutputFormat() { 
+        String formatParameter = this.request 
+                .getParameter(RESPONSE_FORMAT_PARAMETER); 
+        if (formatParameter == null) 
+            return; 
+        if (formatParameter.equalsIgnoreCase(RESPONSE_FORMAT_PARAMETER_RSS)) 
+            this.responseFormat = OutputFormat.RSS; 
+ 
+    } 
+ 
+    /** 
+     * @return - the number of returned items per page 
+     */ 
+    public int getItemsPerPage() { 
+ 
+        if (this.request.getParameter(ITEMS_PER_PAGE_PARAMETER) == null) 
+            return DEFAULT_ITEMS_PER_PAGE; 
+        int retval = -1; 
+        try { 
+            retval = new Integer(this.request 
+                    .getParameter(ITEMS_PER_PAGE_PARAMETER)).intValue(); 
+        } catch (Exception e) { 
+            LOG.warn("Intems per page could not be parsed - " + e.getMessage(), 
+                    e); 
+        } 
+        return retval < 0 ? DEFAULT_ITEMS_PER_PAGE : retval; 
+    } 
+ 
+    /** 
+     * Start index represents the number of the first entry of the query - 
+     * result. The order depends on the query. Is the query a search query the 
+     * this value will be assinged to the score in a common feed query the value 
+     * will be assigned to the update time of the entries. 
+     *  
+     * @return - the requested start index 
+     */ 
+    public int getStartIndex() { 
+        if (this.request.getParameter(START_INDEX_NEXT_PAGE_PARAMETER) == null) 
+            return DEFAULT_START_INDEX; 
+        int retval = -1; 
+        try { 
+            retval = new Integer(this.request 
+                    .getParameter(START_INDEX_NEXT_PAGE_PARAMETER)).intValue(); 
+        } catch (Exception e) { 
+            LOG.warn("Start-index could not be parsed - " + e.getMessage(), e); 
+        } 
+        return retval < 0 ? DEFAULT_START_INDEX : retval; 
+    } 
+ 
+    /** 
+     * The selfid is <i>href</i> pointing to the requested resource 
+     *  
+     * @return - the self id 
+     */ 
+    public String getSelfId() { 
+        StringBuilder builder = new StringBuilder(); 
+        builder.append(buildRequestIDString(false)); 
+ 
+        builder.append(getQueryString()); 
+ 
+        return builder.toString(); 
+    } 
+ 
+    /** 
+     * The <i>href</i> id of the next page of the requested resource. 
+     *  
+     * @return the id of the next page 
+     */ 
+    public String getNextId() { 
+        // StringBuilder builder = new StringBuilder(); 
+        // builder.append(buildRequestIDString()); 
+        //         
+        // builder.append(getQueryString()); 
+        //         
+        // if(this.request.getParameter(START_INDEX_NEXT_PAGE_PARAMETER)== 
+        // null){ 
+        // builder.append("&").append(START_INDEX_NEXT_PAGE_PARAMETER).append("="); 
+        // builder.append(DEFAULT_ITEMS_PER_PAGE+1); 
+        // } 
+        // else{ 
+        //             
+        // int next = 0; 
+        // try{ 
+        // next = 
+        // Integer.parseInt(this.request.getParameter(START_INDEX_NEXT_PAGE_PARAMETER)); 
+        // }catch (Exception e) { 
+        // // 
+        // } 
+        //             
+        // if(next < 0) 
+        // builder.append(DEFAULT_ITEMS_PER_PAGE+1); 
+        // else 
+        // builder.append(next+DEFAULT_ITEMS_PER_PAGE); 
+        // int pos = builder.indexOf(START_INDEX_NEXT_PAGE_PARAMETER); 
+        // boolean end = builder.lastIndexOf("&",pos) < pos; 
+        // builder.replace(pos+START_INDEX_NEXT_PAGE_PARAMETER.length()+1,pos+START_INDEX_NEXT_PAGE_PARAMETER.length()+3,""+next); 
+        //             
+        //             
+        // System.out.println(end); 
+        // } 
+        //             
+        //         
+        //         
+        // return builder.toString(); 
+        return buildRequestIDString(false); 
+ 
+    } 
+ 
+    private String buildRequestIDString(boolean endingSlash) { 
+        StringBuilder builder = new StringBuilder("http://"); 
+        builder.append(this.request.getHeader("Host")); 
+        builder.append(this.request.getRequestURI()); 
+        if (endingSlash && !this.request.getRequestURI().endsWith("/")) 
+            builder.append("/"); 
+ 
+        return builder.toString(); 
+    } 
+ 
+    /** 
+     * This will return the current query string including all parameters. 
+     * Additionaly the <code>max-resul</code> parameter will be added if not 
+     * specified. 
+     * <p> 
+     * <code>max-resul</code> indicates the number of results returned to the 
+     * client. The default value is 25. 
+     * </p> 
+     *  
+     * @return - the query string incluing all parameters 
+     */ 
+    public String getQueryString() { 
+        String retVal = this.request.getQueryString(); 
+ 
+        if (this.request.getParameter(ITEMS_PER_PAGE_PARAMETER) != null) 
+            return retVal; 
+        String tempString = (retVal == null ? "?" + ITEMS_PER_PAGE_PARAMETER 
+                + "=" + DEFAULT_ITEMS_PER_PAGE : "&" + ITEMS_PER_PAGE_PARAMETER 
+                + "=" + DEFAULT_ITEMS_PER_PAGE); 
+ 
+        return retVal == null ? tempString : retVal + tempString; 
+ 
+    } 
+ 
+    /** 
+     * This enum represents the OutputFormat of the GDATA Server 
+     *  
+     * @author Simon Willnauer 
+     *  
+     */ 
+    public static enum OutputFormat { 
+        /** 
+         * Output format ATOM. ATOM is the default response format. 
+         */ 
+        ATOM, 
+        /** 
+         * Output format RSS 
+         */ 
+        RSS 
+    } 
+ 
+    /** 
+     * Returns the requested path including the domain name and the requested 
+     * resource <i>http://www.apache.org/path/resource/</i> 
+     *  
+     * @return the context path 
+     */ 
+    public String getContextPath() { 
+        if (this.contextPath == null) 
+            this.contextPath = buildRequestIDString(true); 
+        return this.contextPath; 
+    } 
+ 
+    /** 
+     * Indicates the request type 
+     *  
+     * @author Simon Willnauer 
+     *  
+     */ 
+    public enum GDataRequestType { 
+        /** 
+         * Type FeedRequest 
+         */ 
+        GET, 
+        /** 
+         * Type UpdateRequest 
+         */ 
+        UPDATE, 
+        /** 
+         * Type DeleteRequest 
+         */ 
+        DELETE, 
+        /** 
+         * Type InsertRequest 
+         */ 
+        INSERT 
+    } 
+ 
+    /** 
+     * {@link GDataRequestType} 
+     *  
+     * @return the current request type 
+     */ 
+    public GDataRequestType getType() { 
+        return this.type; 
+    } 
+ 
+    /** 
+     * If the reuquest is a {@link GDataRequestType#GET} request and there is 
+     * no entry id specified, the requested resource is a feed. 
+     *  
+     * @return - <code>true</code> if an only if the requested resource is a feed 
+     */ 
+    public boolean isFeedRequested() { 
+ 
+        return (this.type.equals(GDataRequestType.GET) && (this.entryId == null|| this.entryId.length() == 0|| (this.entryId.equals('/')))); 
+    } 
+ 
+    /** 
+     * * If the reuquest is a {@link GDataRequestType#GET} request and there is 
+     * an entry id specified, the requested resource is an entry. 
+     *  
+     * @return - <code>true</code> if an only if the requested resource is an entry 
+     */ 
+    public boolean isEntryRequested() { 
+        return !this.isFeedRequested(); 
+    } 
+ 
+    /** 
+     * @return - the extensionProfile for the requested resource 
+     */ 
+    public ExtensionProfile getExtensionProfile() { 
+        return this.extensionProfile; 
+    } 
+ 
+} 

Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataRequestException.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataRequestException.java?rev=412574&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataRequestException.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataRequestException.java Wed Jun  7 14:56:25 2006
@@ -0,0 +1,67 @@
+/** 
+ * Copyright 2004 The Apache Software Foundation 
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License. 
+ */ 
+ 
+package org.apache.lucene.gdata.server; 
+ 
+/** 
+ * This exception wraps all exceptions occure inside the {@link org.apache.lucene.gdata.server.GDataRequest} 
+ * @author Simon Willnauer 
+ * 
+ */ 
+public class GDataRequestException extends Exception { 
+ 
+    /** 
+     * Serial version ID. -> Implements Serializable 
+     */ 
+    private static final long serialVersionUID = -4440777051466950723L; 
+ 
+    /** 
+     * Constructs a new GDataException 
+     */ 
+    public GDataRequestException() { 
+        super(); 
+         
+    } 
+ 
+    /** 
+     * Constructs a new GDataException with a given message string 
+     * @param arg0 - the excpetion message  
+     */ 
+    public GDataRequestException(String arg0) { 
+        super(arg0); 
+         
+    } 
+ 
+    /** 
+     * Constructs a new GDataException with a given message string and cause 
+     * @param arg0 - the exception message 
+     * @param arg1 - the exception who caused this exception 
+     */ 
+    public GDataRequestException(String arg0, Throwable arg1) { 
+        super(arg0, arg1); 
+         
+    } 
+ 
+    /** 
+     * Constructs a new GDataException with a given cause 
+     * @param arg0 - exception cause 
+     */ 
+    public GDataRequestException(Throwable arg0) { 
+        super(arg0); 
+         
+    } 
+ 
+} 

Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataResponse.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataResponse.java?rev=412574&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataResponse.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataResponse.java Wed Jun  7 14:56:25 2006
@@ -0,0 +1,242 @@
+/** 
+ * Copyright 2004 The Apache Software Foundation 
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License. 
+ */ 
+ 
+package org.apache.lucene.gdata.server; 
+ 
+import java.io.IOException; 
+import java.io.Writer; 
+ 
+import javax.servlet.http.HttpServletResponse; 
+ 
+import org.apache.lucene.gdata.server.GDataRequest.OutputFormat; 
+ 
+import com.google.gdata.data.BaseEntry; 
+import com.google.gdata.data.BaseFeed; 
+import com.google.gdata.data.ExtensionProfile; 
+import com.google.gdata.util.common.xml.XmlWriter; 
+import com.google.gdata.util.common.xml.XmlWriter.Namespace; 
+ 
+/** 
+ * The FeedRequest Class wraps the curren HttpServletResponse. Any action on the 
+ * HttpServletRequest will be executed via this class. This represents an 
+ * abstraction on the plain {@link HttpServletResponse}. Any action which has 
+ * to be performed on the underlaying {@link HttpServletResponse} will be 
+ * executed within this class. 
+ * <p> 
+ * The GData basicly writes two different kinds ouf reponse to the output 
+ * stream. 
+ * <ol> 
+ * <li>update, delete or insert requests will respond with a statuscode and if 
+ * successful the feed entry modified or created</li> 
+ * <li>get requests will respond with a statuscode and if successful the 
+ * requested feed</li> 
+ * </ol> 
+ *  
+ * For this purpose the {@link GDataResponse} class provides the overloaded 
+ * method 
+ * {@link org.apache.lucene.gdata.server.GDataResponse#sendResponse(BaseEntry, ExtensionProfile)} 
+ * which sends the entry e.g feed to the output stream. 
+ * </p> 
+ *  
+ *  
+ *  
+ *  
+ * @author Simon Willnauer 
+ *  
+ */ 
+public class GDataResponse { 
+    private int error; 
+ 
+    private boolean isError = false; 
+ 
+    private String encoding; 
+ 
+    private OutputFormat outputFormat; 
+ 
+    private final HttpServletResponse response; 
+ 
+    private static final String DEFAUL_NAMESPACE_URI = "http://www.w3.org/2005/Atom"; 
+ 
+    private static final Namespace DEFAULT_NAMESPACE = new Namespace("", 
+            DEFAUL_NAMESPACE_URI); 
+ 
+    /** 
+     * Creates a new GDataResponse 
+     *  
+     * @param response - 
+     *            The underlaying {@link HttpServletResponse} 
+     */ 
+    public GDataResponse(HttpServletResponse response) { 
+        if (response == null) 
+            throw new IllegalArgumentException("response must not be null"); 
+        this.response = response; 
+        this.response.setContentType("text/xml"); 
+    } 
+ 
+    /** 
+     * Sets an error code to this FeedResponse. 
+     *  
+     * @param errorCode - 
+     *            {@link HttpServletResponse} error code 
+     */ 
+    public void setError(int errorCode) { 
+        this.isError = true; 
+        this.error = errorCode; 
+    } 
+    /** 
+     * Sets the status of the underlaying response 
+     * @see HttpServletResponse 
+     * @param responseCode - the status of the response 
+     */ 
+    public void setResponseCode(int responseCode){ 
+        this.response.setStatus(responseCode); 
+    } 
+    /** 
+     * This method sends the specified error to the user if set 
+     *  
+     * @throws IOException - 
+     *             if an I/O Exception occures 
+     */ 
+    public void sendError() throws IOException { 
+        if (this.isError) 
+            this.response.sendError(this.error); 
+    } 
+ 
+    /** 
+     * @return - the {@link HttpServletResponse} writer 
+     * @throws IOException - 
+     *             If an I/O exception occures 
+     */ 
+    public Writer getWriter() throws IOException { 
+        return this.response.getWriter(); 
+    } 
+ 
+    /** 
+     * Sends a response for a get e.g. query request. This method must not 
+     * invoked in a case of an error performing the requeste action. 
+     *  
+     * @param feed - 
+     *            the feed to respond to the client 
+     * @param profile - 
+     *            the extension profil for the feed to write 
+     * @throws IOException - 
+     *             if an I/O exception accures, often caused by an already 
+     *             closed Writer or OutputStream 
+     *  
+     */ 
+    public void sendResponse(BaseFeed feed, ExtensionProfile profile) 
+            throws IOException { 
+        if (feed == null) 
+            throw new IllegalArgumentException("feed must not be null"); 
+        if(profile == null) 
+            throw new IllegalArgumentException("extension profil must not be null"); 
+        XmlWriter writer = createWriter(); 
+         
+        if (this.outputFormat.equals(OutputFormat.ATOM)) 
+            feed.generateAtom(writer, profile); 
+        else 
+            feed.generateRss(writer, profile); 
+ 
+    } 
+ 
+    /** 
+     *  
+     * Sends a response for an update, insert or delete request. This method 
+     * must not invoked in a case of an error performing the requeste action. 
+     * If the specified response format is ATOM the default namespace will be set to ATOM. 
+     * @param entry - 
+     *            the modified / created entry to send 
+     * @param profile - 
+     *            the entries extension profile 
+     * @throws IOException - 
+     *             if an I/O exception accures, often caused by an already 
+     *             closed Writer or OutputStream 
+     */ 
+    public void sendResponse(BaseEntry entry, ExtensionProfile profile) 
+            throws IOException { 
+        if (entry == null) 
+            throw new IllegalArgumentException("entry must not be null"); 
+        if(profile == null) 
+            throw new IllegalArgumentException("extension profil must not be null"); 
+        XmlWriter writer = createWriter(); 
+        if (this.outputFormat.equals(OutputFormat.ATOM)) 
+            entry.generateAtom(writer, profile); 
+        else 
+            entry.generateRss(writer, profile); 
+    } 
+ 
+    private XmlWriter createWriter() throws IOException { 
+        XmlWriter writer = new XmlWriter(getWriter(), this.encoding); 
+        // set the default namespace to Atom if Atom is the response format 
+        if(this.outputFormat.equals(OutputFormat.ATOM)) 
+            writer.setDefaultNamespace(DEFAULT_NAMESPACE); 
+        return writer; 
+    } 
+ 
+    /** 
+     * This encoding will be used to encode the xml representation of feed or 
+     * entry written to the {@link HttpServletResponse} output stream. 
+     *  
+     * @return - the entry / feed encoding 
+     */ 
+    public String getEncoding() { 
+        return this.encoding; 
+    } 
+ 
+    /** 
+     * This encoding will be used to encode the xml representation of feed or 
+     * entry written to the {@link HttpServletResponse} output stream. <i>UTF-8</i> 
+     * <i>ISO-8859-1</i> 
+     *  
+     * @param encoding - 
+     *            string represents the encoding 
+     */ 
+    public void setEncoding(String encoding) { 
+        this.encoding = encoding; 
+    } 
+ 
+    /** 
+     * @return - the response 
+     *         {@link org.apache.lucene.gdata.server.GDataRequest.OutputFormat} 
+     */ 
+    public OutputFormat getOutputFormat() { 
+        return this.outputFormat; 
+    } 
+ 
+    /** 
+     * @param outputFormat - 
+     *            the response 
+     *            {@link org.apache.lucene.gdata.server.GDataRequest.OutputFormat} 
+     */ 
+    public void setOutputFormat(OutputFormat outputFormat) { 
+        this.outputFormat = outputFormat; 
+    } 
+    /** 
+     * @see Object#toString() 
+     */ 
+    @Override 
+    public String toString(){ 
+        StringBuilder builder = new StringBuilder(" GDataResponse: "); 
+        builder.append("Error: ").append(this.error); 
+        builder.append(" outputFormat: ").append(getOutputFormat()); 
+        builder.append(" encoding: ").append(this.encoding); 
+         
+        return builder.toString(); 
+         
+         
+    } 
+ 
+} 

Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataService.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataService.java?rev=412574&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataService.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/GDataService.java Wed Jun  7 14:56:25 2006
@@ -0,0 +1,275 @@
+/** 
+ * Copyright 2004 The Apache Software Foundation 
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License. 
+ */ 
+package org.apache.lucene.gdata.server; 
+ 
+import java.io.IOException; 
+import java.util.List; 
+ 
+import org.apache.commons.logging.Log; 
+import org.apache.commons.logging.LogFactory; 
+import org.apache.lucene.gdata.server.registry.GDataServerRegistry; 
+import org.apache.lucene.gdata.storage.Storage; 
+import org.apache.lucene.gdata.storage.StorageException; 
+import org.apache.lucene.gdata.storage.StorageFactory; 
+ 
+import com.google.gdata.data.BaseEntry; 
+import com.google.gdata.data.BaseFeed; 
+import com.google.gdata.data.DateTime; 
+import com.google.gdata.data.Generator; 
+import com.google.gdata.data.Link; 
+import com.google.gdata.util.ParseException; 
+ 
+/** 
+ * @author Simon Willnauer 
+ *  
+ */ 
+public class GDataService extends Service { 
+    private static final Log LOGGER = LogFactory.getLog(GDataService.class); 
+ 
+    private Storage storage; 
+ 
+    private GDataServerRegistry registry = GDataServerRegistry.getRegistry(); 
+ 
+    private static final Generator generator; 
+ 
+    private static final String generatorName = "Lucene GData-Server"; 
+ 
+    private static final String generatorURI = "http://lucene.apache.org"; 
+    static { 
+        generator = new Generator(); 
+        generator.setName(generatorName); 
+        generator.setUri(generatorURI); 
+        generator.setVersion("0.1"); 
+    } 
+ 
+    protected GDataService() throws ServiceException { 
+        try { 
+            this.storage = StorageFactory.getStorage(); 
+             
+        } catch (StorageException e) { 
+            LOGGER 
+                    .fatal( 
+                            "Can't get Storage Instance -- can't serve any requests", 
+                            e); 
+            ServiceException ex = new ServiceException( 
+                    "Can't get Storage instance" + e.getMessage(), e); 
+            ex.setStackTrace(e.getStackTrace()); 
+            throw ex; 
+        } 
+    } 
+ 
+    /** 
+     * @see org.apache.lucene.gdata.server.Service#createEntry(org.apache.lucene.gdata.server.GDataRequest, 
+     *      org.apache.lucene.gdata.server.GDataResponse) 
+     */ 
+    @Override 
+    public BaseEntry createEntry(GDataRequest request, GDataResponse response) 
+            throws ServiceException { 
+ 
+        checkFeedIsRegisterd(request); 
+        if (LOGGER.isInfoEnabled()) 
+            LOGGER.info("create Entry for feedId: " + request.getFeedId()); 
+        BaseEntry entry = buildEntry(request); 
+        setUpdateTime(entry); 
+        try { 
+ 
+            this.storage.storeEntry(entry, request.getFeedId()); 
+        } catch (Exception e) { 
+            ServiceException ex = new ServiceException("Could not store entry", 
+                    e); 
+            ex.setStackTrace(e.getStackTrace()); 
+            throw ex; 
+        } 
+        return entry; 
+    } 
+ 
+    /** 
+     * @see org.apache.lucene.gdata.server.Service#deleteEntry(org.apache.lucene.gdata.server.GDataRequest, 
+     *      org.apache.lucene.gdata.server.GDataResponse) 
+     */ 
+    @Override 
+    public BaseEntry deleteEntry(GDataRequest request, GDataResponse response) 
+            throws ServiceException { 
+        checkFeedIsRegisterd(request); 
+        String entryid = request.getEntryId(); 
+        String feedid = request.getFeedId(); 
+        try { 
+            this.storage.deleteEntry(entryid, feedid); 
+        } catch (Exception e) { 
+            ServiceException ex = new ServiceException( 
+                    "Could not delete entry", e); 
+            ex.setStackTrace(e.getStackTrace()); 
+            throw ex; 
+        } 
+        return null; 
+    } 
+ 
+    /** 
+     * @see org.apache.lucene.gdata.server.Service#updateEntry(org.apache.lucene.gdata.server.GDataRequest, 
+     *      org.apache.lucene.gdata.server.GDataResponse) 
+     */ 
+    @Override 
+    public BaseEntry updateEntry(GDataRequest request, GDataResponse response) 
+            throws ServiceException { 
+        checkFeedIsRegisterd(request); 
+ 
+        BaseEntry entry = buildEntry(request); 
+        String feedid = request.getFeedId(); 
+        if (LOGGER.isInfoEnabled()) 
+            LOGGER.info("update Entry" + entry.getId() + " for feedId: " 
+                    + feedid); 
+        setUpdateTime(entry); 
+        try { 
+            this.storage.updateEntry(entry, feedid); 
+        } catch (StorageException e) { 
+            ServiceException ex = new ServiceException( 
+                    "Could not update entry", e); 
+            ex.setStackTrace(e.getStackTrace()); 
+            throw ex; 
+        } 
+        return entry; 
+    } 
+ 
+    /** 
+     * @see org.apache.lucene.gdata.server.Service#getFeed(org.apache.lucene.gdata.server.GDataRequest, 
+     *      org.apache.lucene.gdata.server.GDataResponse) 
+     */ 
+    @SuppressWarnings("unchecked") 
+    @Override 
+    public BaseFeed getFeed(GDataRequest request, GDataResponse response) 
+            throws ServiceException { 
+        checkFeedIsRegisterd(request); 
+ 
+        try { 
+            // TODO remove when storing feeds is implemented just for 
+            // development 
+            BaseFeed feed = this.storage.getFeed(request.getFeedId(), request 
+                    .getStartIndex(), request.getItemsPerPage()); 
+            buildDynamicFeedElements(request, feed); 
+            List<BaseEntry> list = feed.getEntries(); 
+            addContextPath(list, request.getContextPath()); 
+            return feed; 
+        } catch (StorageException e) { 
+            ServiceException ex = new ServiceException("Could not get feed", e); 
+            ex.setStackTrace(e.getStackTrace()); 
+            throw ex; 
+        } 
+ 
+    } 
+ 
+    /* 
+     * build the dynamic elements like self link and next link 
+     */ 
+    private void buildDynamicFeedElements(final GDataRequest request, 
+            final BaseFeed feed) { 
+        feed.setGenerator(generator); 
+        feed.setItemsPerPage(request.getItemsPerPage()); 
+        feed.getLinks().add( 
+                buildLink(Link.Rel.SELF, Link.Type.ATOM, request.getSelfId())); 
+        // TODO add next link 
+    } 
+ 
+    private Link buildLink(String rel, String type, String href) { 
+        Link retVal = new Link(); 
+        retVal.setHref(href); 
+        retVal.setRel(rel); 
+        retVal.setType(type); 
+        return retVal; 
+    } 
+ 
+    /* 
+     * every entry has an ID which has to have a prefix. The prefix is the 
+     * context path of the requested feed. This will be used to request the 
+     * entry directly 
+     */ 
+    private void addContextPath(List<BaseEntry> list, final String contextPath) { 
+        for (BaseEntry entry : list) { 
+            addcontextPath(entry, contextPath); 
+        } 
+    } 
+ 
+    @SuppressWarnings("unchecked") 
+    private BaseEntry addcontextPath(final BaseEntry entry, 
+            final String contextPath) { 
+        String id = contextPath + entry.getId(); 
+        entry.setId(id); 
+        Link self = new Link(); 
+        self.setRel("self"); 
+        self.setHref(id); 
+        self.setType("application/atom+xml"); 
+        entry.getLinks().add(self); 
+        return entry; 
+    } 
+ 
+    private BaseEntry buildEntry(final GDataRequest request) 
+            throws ServiceException { 
+        try { 
+            return GDataEntityBuilder.buildEntry(request); 
+ 
+        } catch (ParseException e) { 
+            ServiceException ex = new ServiceException( 
+                    "Could not parse entry from incoming request", e); 
+            ex.setStackTrace(e.getStackTrace()); 
+            throw ex; 
+        } catch (IOException e) { 
+            ServiceException ex = new ServiceException( 
+                    "Could not read or open input stream", e); 
+            ex.setStackTrace(e.getStackTrace()); 
+            throw ex; 
+        } 
+    } 
+ 
+    /* 
+     * checks whether the reqeuested feed is registered 
+     */ 
+    private void checkFeedIsRegisterd(final GDataRequest request) 
+            throws FeedNotFoundException { 
+        if (!this.registry.isFeedRegistered(request.getFeedId())) 
+            throw new FeedNotFoundException( 
+                    "Feed could not be found - is not registed - Feed ID:" 
+                            + request.getFeedId()); 
+        this.storage.setExtensionProfile(request.getExtensionProfile()); 
+    } 
+ 
+    private BaseEntry setUpdateTime(final BaseEntry entry) { 
+        entry.setUpdated(DateTime.now()); 
+        return entry; 
+    } 
+ 
+    /** 
+     * @see org.apache.lucene.gdata.server.Service#getSingleEntry(org.apache.lucene.gdata.server.GDataRequest, 
+     *      org.apache.lucene.gdata.server.GDataResponse) 
+     */ 
+    @Override 
+    public BaseEntry getSingleEntry(GDataRequest request, GDataResponse response) 
+            throws ServiceException { 
+        checkFeedIsRegisterd(request); 
+ 
+        try { 
+            BaseEntry entry = this.storage.getEntry(request.getEntryId(), 
+                    request.getFeedId()); 
+            if(entry == null) 
+                return null; 
+            addcontextPath(entry, request.getContextPath()); 
+            return entry; 
+        } catch (StorageException e) { 
+            ServiceException ex = new ServiceException("Could not get feed", e); 
+            ex.setStackTrace(e.getStackTrace()); 
+            throw ex; 
+        } 
+    } 
+ 
+} 

Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/Service.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/Service.java?rev=412574&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/Service.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/Service.java Wed Jun  7 14:56:25 2006
@@ -0,0 +1,139 @@
+/** 
+ * Copyright 2004 The Apache Software Foundation 
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License. 
+ */ 
+ 
+package org.apache.lucene.gdata.server; 
+ 
+import com.google.gdata.data.BaseEntry; 
+import com.google.gdata.data.BaseFeed; 
+ 
+ 
+/** 
+ * The Service class represents an interface to access the GData service 
+ * componentes of the GData-Server. It encapsulates all interactions with the 
+ * GData client. 
+ * <p> 
+ * This class provides the base level common functionality required to access 
+ * the GData components. It is also designed to act as a base class that can be 
+ * extended for specific types of underlaying server components as different 
+ * indexing or storage components. 
+ * </p> 
+ * <p> 
+ * It could also encapsulate caching mechanismn build on top of the storage to 
+ * reduce load on the storage component 
+ * </p> 
+ *  
+ * @author Simon Willnauer 
+ *  
+ *  
+ */ 
+public abstract class Service { 
+ 
+    /** 
+     * Service method to create an entry in an already created and existing 
+     * feed. This method will create the entry and passes the entry to the 
+     * indexing component to make the new entry accessable via <i>get-queries</i>. 
+     * The response and the corresponding http status code will be added to the 
+     * given <code>FeedResponse</code>. 
+     *  
+     * @param request - 
+     *            the current FeedRequest 
+     * @param response - 
+     *            the current FeedResponse 
+     * @return - the entry which has been created  
+     * @throws ServiceException - 
+     *             if the corresponding feed does not exist or the storage can 
+     *             not be accessed 
+     */ 
+    public abstract BaseEntry createEntry(final GDataRequest request, 
+            final GDataResponse response) throws ServiceException; 
+ 
+    /** 
+     * Service Method to delete an entry specified in the given FeedRequest. 
+     * This method will remove the entry permanently. There will be no 
+     * possiblity to restore the entry. The response and the corresponding http 
+     * status code will be added to the given <code>FeedResponse</code>. 
+     *  
+     * @param request - 
+     *            the current FeedRequest 
+     * @param response - 
+     *            the current FeedResponse 
+     * @return - the entry wich has been deleted 
+     * @throws ServiceException - 
+     *             if the entry does not exist or the storage can not be 
+     *             accessed 
+     */ 
+    public abstract BaseEntry deleteEntry(GDataRequest request, final GDataResponse response) 
+            throws ServiceException; 
+ 
+    /** 
+     * Service method to update an existing entry in a existing feed context. 
+     * The entry version will be checked and a <code>ServiceException</code> 
+     * will be thrown if the version to update is outdated. The new entry will 
+     * be passed to the indexing component to make the version accessable via 
+     * <i>get-queries</i>. 
+     *  
+     * @param request - 
+     *            the current FeedRequest 
+     * @param response - 
+     *            the current FeedResponse 
+     * @return - the entry wich has been updated 
+     * @throws ServiceException - 
+     *             if the corresponding feed does not exist, the storage can not 
+     *             be accessed or the version to update is out of date. 
+     */ 
+    public abstract BaseEntry  updateEntry(final GDataRequest request, 
+            final GDataResponse response) throws ServiceException; 
+ 
+    /** 
+     * Service method to retrieve a requested Feed. The feed will also be added to 
+     * the given <code>FeedResponse</code> instance and can also be accessed 
+     * via the <code>FeedResponse</code> object. 
+     *  
+     * @param request - 
+     *            the current FeedRequest 
+     * @param response - 
+     *            the current FeedResponse 
+     * @return - the requested feed 
+     *  
+     * @throws ServiceException - 
+     *             If the storage can not be accessed or the requested feed does 
+     *             not exist. 
+     */ 
+    public abstract BaseFeed getFeed(final GDataRequest request, final GDataResponse response) 
+            throws ServiceException; 
+ 
+    /** 
+     * Service method to retrieve a requested entry. The entry will also be added to 
+     * the given <code>FeedResponse</code> instance and can also be accessed 
+     * via the <code>FeedResponse</code> object. 
+     *  
+     * @param request - 
+     *            the current FeedRequest 
+     * @param response - 
+     *            the current FeedResponse 
+     * @return - the requested entry 
+     *  
+     * @throws ServiceException - 
+     *             If the storage can not be accessed or the requested entry does 
+     *             not exist. 
+     */ 
+    public abstract BaseEntry getSingleEntry(final GDataRequest request, final GDataResponse response) 
+            throws ServiceException; 
+     
+     
+ 
+ 
+} 

Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/ServiceException.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/ServiceException.java?rev=412574&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/ServiceException.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/ServiceException.java Wed Jun  7 14:56:25 2006
@@ -0,0 +1,63 @@
+/** 
+ * Copyright 2004 The Apache Software Foundation 
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License. 
+ */ 
+ 
+package org.apache.lucene.gdata.server; 
+ 
+/** 
+ * @author Simon Willnauer 
+ * 
+ */ 
+public class ServiceException extends Exception { 
+ 
+    /** 
+     *  
+     */ 
+    private static final long serialVersionUID = -7099825107871876584L; 
+ 
+    /** 
+     *  
+     */ 
+    public ServiceException() { 
+        super(); 
+       
+    } 
+ 
+    /** 
+     * @param arg0 
+     */ 
+    public ServiceException(String arg0) { 
+        super(arg0); 
+       
+    } 
+ 
+    /** 
+     * @param arg0 
+     * @param arg1 
+     */ 
+    public ServiceException(String arg0, Throwable arg1) { 
+        super(arg0, arg1); 
+       
+    } 
+ 
+    /** 
+     * @param arg0 
+     */ 
+    public ServiceException(Throwable arg0) { 
+        super(arg0); 
+       
+    } 
+ 
+} 

Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/ServiceFactory.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/ServiceFactory.java?rev=412574&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/ServiceFactory.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/ServiceFactory.java Wed Jun  7 14:56:25 2006
@@ -0,0 +1,57 @@
+/** 
+ * Copyright 2004 The Apache Software Foundation 
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License. 
+ */ 
+package org.apache.lucene.gdata.server; 
+ 
+ 
+/** 
+ * The {@link ServiceFactory} creates {@link Service} implementations to access 
+ * the GData - Server components. 
+ *  
+ * @author Simon Willnauer 
+ *  
+ */ 
+public class ServiceFactory { 
+ 
+    private static ServiceFactory INSTANCE = null; 
+ 
+    /** 
+     * @return - a Singleton Instance of the factory 
+     */ 
+    public static synchronized ServiceFactory getInstance() { 
+        if (INSTANCE == null) 
+            INSTANCE = new ServiceFactory(); 
+        return INSTANCE; 
+ 
+    } 
+ 
+    private ServiceFactory() { 
+        // private constructor --> singleton 
+    } 
+ 
+    /** 
+     * Creates a {@link Service} implementation. 
+     *  
+     * @return a Service Implementation 
+     */ 
+    public Service getService() { 
+        try{ 
+        return new GDataService(); 
+        }catch (Exception e) { 
+            // 
+        } 
+        return null; 
+    } 
+} 

Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/package.html
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/package.html?rev=412574&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/package.html (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/package.html Wed Jun  7 14:56:25 2006
@@ -0,0 +1,10 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> 
+<html> 
+<head> 
+   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
+   <meta name="Author" content="Simon Willnauer"> 
+</head> 
+<body> 
+GData-Server classes encapsulation all protocol-level interactions and underlaying GData components. 
+</body> 
+</html> 
\ No newline at end of file

Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/DataBuilderException.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/DataBuilderException.java?rev=412574&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/DataBuilderException.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/DataBuilderException.java Wed Jun  7 14:56:25 2006
@@ -0,0 +1,62 @@
+/** 
+ * Copyright 2004 The Apache Software Foundation 
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License. 
+ */ 
+package org.apache.lucene.gdata.server.registry; 
+ 
+/** 
+ * @author Simon Willnauer 
+ * 
+ */ 
+public class DataBuilderException extends RuntimeException { 
+ 
+    /** 
+     *  
+     */ 
+    private static final long serialVersionUID = -3802958802500735198L; 
+ 
+    /** 
+     *  
+     */ 
+    public DataBuilderException() { 
+        super(); 
+        // TODO Auto-generated constructor stub 
+    } 
+ 
+    /** 
+     * @param message 
+     */ 
+    public DataBuilderException(String message) { 
+        super(message); 
+        // TODO Auto-generated constructor stub 
+    } 
+ 
+    /** 
+     * @param message 
+     * @param cause 
+     */ 
+    public DataBuilderException(String message, Throwable cause) { 
+        super(message, cause); 
+        // TODO Auto-generated constructor stub 
+    } 
+ 
+    /** 
+     * @param cause 
+     */ 
+    public DataBuilderException(Throwable cause) { 
+        super(cause); 
+        // TODO Auto-generated constructor stub 
+    } 
+ 
+} 

Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/FeedInstanceConfigurator.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/FeedInstanceConfigurator.java?rev=412574&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/FeedInstanceConfigurator.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/FeedInstanceConfigurator.java Wed Jun  7 14:56:25 2006
@@ -0,0 +1,66 @@
+/** 
+ * Copyright 2004 The Apache Software Foundation 
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License. 
+ */ 
+package org.apache.lucene.gdata.server.registry; 
+ 
+/** 
+ * @author Simon Willnauer 
+ * 
+ */ 
+public class FeedInstanceConfigurator { 
+    private Class feedType; 
+    private String feedId; 
+    private Class extensionProfileClass; 
+    /** 
+     * @return Returns the feedType. 
+     */ 
+    public Class getFeedType() { 
+        return this.feedType; 
+    } 
+    /** 
+     * @param feedType The feedType to set. 
+     */ 
+    public void setFeedType(Class feedType) { 
+        this.feedType = feedType; 
+    } 
+    /** 
+     * @return Returns the feedURL. 
+     */ 
+    public String getFeedId() { 
+        return this.feedId; 
+    } 
+    /** 
+     * @param feedURL The feedURL to set. 
+     */ 
+    public void setFeedId(String feedURL) { 
+        this.feedId = feedURL; 
+    } 
+     
+    /** 
+     * @return - the extension profile for this feed 
+     */ 
+    public Class getExtensionProfilClass(){ 
+        return this.extensionProfileClass; 
+    } 
+     
+    /** 
+     * @param extensionProfilClass 
+     */ 
+    public void setExtensionProfileClass(Class extensionProfilClass){ 
+        this.extensionProfileClass = extensionProfilClass; 
+    } 
+     
+ 
+} 

Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/GDataServerRegistry.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/GDataServerRegistry.java?rev=412574&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/GDataServerRegistry.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/GDataServerRegistry.java Wed Jun  7 14:56:25 2006
@@ -0,0 +1,154 @@
+/** 
+ * Copyright 2004 The Apache Software Foundation 
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License. 
+ */ 
+package org.apache.lucene.gdata.server.registry; 
+ 
+import java.util.HashMap; 
+import java.util.Map; 
+ 
+import org.apache.commons.logging.Log; 
+import org.apache.commons.logging.LogFactory; 
+import org.apache.lucene.gdata.storage.StorageController; 
+ 
+import com.google.gdata.data.ExtensionProfile; 
+ 
+/** 
+ *  
+ * The FeedRegistry represents the registry component of the GData Server. All 
+ * feed configurations will be registered here. Feed configurations contain 
+ * several informationsa about GData feed like: 
+ * <ol> 
+ * <li>the feed id - where the feed can be accessed via http methodes</li> 
+ * <li>the feed type - feed types are implementations of the abstract 
+ * {@link com.google.gdata.data.BaseFeed}</li> 
+ * </ol> 
+ * The registry will be set up at start up of the server application and can be 
+ * accessed from other components to get configurations according to incoming 
+ * requests. 
+ *  
+ * @author Simon Willnauer 
+ *  
+ */ 
+public class GDataServerRegistry { 
+    private static GDataServerRegistry INSTANCE; 
+ 
+    private StorageController storageInstance; 
+ 
+    private static final Log LOGGER = LogFactory 
+            .getLog(GDataServerRegistry.class); 
+ 
+    private final Map<String, FeedInstanceConfigurator> feedTypMap = new HashMap<String, FeedInstanceConfigurator>(); 
+ 
+    private GDataServerRegistry() { 
+        // private - singleton 
+    } 
+ 
+    /** 
+     * @return a Sinleton registry instance 
+     */ 
+    public static synchronized GDataServerRegistry getRegistry() { 
+        if (INSTANCE == null) 
+            INSTANCE = new GDataServerRegistry(); 
+        return INSTANCE; 
+    } 
+ 
+    /** 
+     * Registers a {@link FeedInstanceConfigurator} 
+     *  
+     * @param configurator - 
+     *            the configurator to register in the registry 
+     */ 
+    public void registerFeed(FeedInstanceConfigurator configurator) { 
+        if (configurator == null) { 
+            LOGGER.warn("Feedconfigurator is null -- skip registration"); 
+            return; 
+        } 
+        this.feedTypMap.put(configurator.getFeedId(), configurator); 
+    } 
+ 
+    /** 
+     * Looks up the {@link FeedInstanceConfigurator} by the given feed id. 
+     *  
+     * @param feedId 
+     * @return - the {@link FeedInstanceConfigurator} or <code>null</code> if 
+     *         the no configuration for this feed has been registered 
+     */ 
+    public FeedInstanceConfigurator getFeedConfigurator(String feedId) { 
+        if (feedId == null) 
+            throw new IllegalArgumentException( 
+                    "Feed URL is null - must not be null to get registered feedtype"); 
+        return this.feedTypMap.get(feedId); 
+    } 
+ 
+    protected void flushRegistry() { 
+        this.feedTypMap.clear(); 
+    } 
+ 
+    /** 
+     * @param feedId - 
+     *            the id of the feed as the feed is registered 
+     * @return - <code>true</code> if and only if the feed is registered, 
+     *         otherwise <code>false</code>. 
+     */ 
+    public boolean isFeedRegistered(String feedId) { 
+        return this.feedTypMap.containsKey(feedId); 
+ 
+    } 
+ 
+    /** 
+     * @param storage 
+     */ 
+    public void registerStorage(StorageController storage) { 
+        if (this.storageInstance != null) 
+            throw new IllegalStateException( 
+                    "Storage already registered -- Instance of " 
+                            + this.storageInstance.getClass()); 
+        this.storageInstance = storage; 
+    } 
+ 
+    /** 
+     * Destroys the registry and release all resources 
+     */ 
+    public void destroy() { 
+        flushRegistry(); 
+        this.storageInstance.destroy(); 
+        this.storageInstance = null; 
+ 
+    } 
+ 
+    /** 
+     * Creates the  {@link ExtensionProfile} for a registered feed 
+     * @param feedId - the feed id  
+     * @return - the extension profil for this feed of <code>null</code> if 
+     *         the feed is not registered or the extension profile could not be 
+     *         instanciated 
+     */ 
+    public ExtensionProfile getExtensionProfile(final String feedId) { 
+        FeedInstanceConfigurator configurator = this.feedTypMap.get(feedId); 
+        if (configurator == null) 
+            return null; 
+        Class clazz = configurator.getExtensionProfilClass(); 
+        try { 
+            return (ExtensionProfile) clazz.newInstance(); 
+        } catch (Exception e) { 
+            LOGGER 
+                    .error("Can not create instance of ExtensionProfil for class: " 
+                            + clazz + " -- feedId: " + feedId); 
+ 
+        } 
+        return null; 
+    } 
+ 
+} 

Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/RegistryBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/RegistryBuilder.java?rev=412574&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/RegistryBuilder.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/RegistryBuilder.java Wed Jun  7 14:56:25 2006
@@ -0,0 +1,41 @@
+/** 
+ * Copyright 2004 The Apache Software Foundation 
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License. 
+ */ 
+package org.apache.lucene.gdata.server.registry; 
+ 
+import com.google.gdata.data.ExtensionProfile; 
+import com.google.gdata.data.Feed; 
+ 
+/** 
+ * @author Simon Willnauer 
+ * 
+ */ 
+public class RegistryBuilder { 
+ 
+    /** 
+     *  
+     */ 
+    public static void buildRegistry(){ 
+        // TODO Implement this!! -- just for develping purposes 
+        GDataServerRegistry reg = GDataServerRegistry.getRegistry(); 
+        FeedInstanceConfigurator configurator = new FeedInstanceConfigurator(); 
+        configurator.setFeedType(Feed.class); 
+        configurator.setFeedId("weblog"); 
+        configurator.setExtensionProfileClass(ExtensionProfile.class); 
+        reg.registerFeed(configurator); 
+         
+    } 
+     
+} 



Mime
View raw message