abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r632977 [1/2] - in /incubator/abdera/java/trunk: ./ build/ client/ core/ core/src/main/java/org/apache/abdera/protocol/ core/src/main/java/org/apache/abdera/protocol/error/ core/src/main/java/org/apache/abdera/protocol/util/ core/src/main/r...
Date Mon, 03 Mar 2008 08:11:08 GMT
Author: jmsnell
Date: Mon Mar  3 00:11:04 2008
New Revision: 632977

URL: http://svn.apache.org/viewvc?rev=632977&view=rev
Log:
merge the protocol module into the core module. there was no really good reason to keep this out as a separate module and merging reduces the overall number of jars we have to build and keep track of,
making life easier for everyone

Added:
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/EntityProvider.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/ItemManager.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/Message.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/Request.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/Resolver.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/Response.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/error/
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/error/Error.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/error/ErrorExtensionFactory.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/error/ProtocolException.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractEntityProvider.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractItemManager.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractMessage.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractRequest.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractResponse.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/CacheControlUtil.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/EncodingUtil.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/PoolManager.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/ProtocolConstants.java
    incubator/abdera/java/trunk/core/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory
Removed:
    incubator/abdera/java/trunk/protocol/
Modified:
    incubator/abdera/java/trunk/build/build.xml
    incubator/abdera/java/trunk/client/pom.xml
    incubator/abdera/java/trunk/core/pom.xml
    incubator/abdera/java/trunk/examples/pom.xml
    incubator/abdera/java/trunk/extensions/gdata/pom.xml
    incubator/abdera/java/trunk/extensions/geo/pom.xml
    incubator/abdera/java/trunk/extensions/html/pom.xml
    incubator/abdera/java/trunk/extensions/json/pom.xml
    incubator/abdera/java/trunk/extensions/main/pom.xml
    incubator/abdera/java/trunk/extensions/media/pom.xml
    incubator/abdera/java/trunk/extensions/oauth/pom.xml
    incubator/abdera/java/trunk/extensions/opensearch/pom.xml
    incubator/abdera/java/trunk/extensions/serializer/pom.xml
    incubator/abdera/java/trunk/extensions/sharing/pom.xml
    incubator/abdera/java/trunk/extensions/wsse/pom.xml
    incubator/abdera/java/trunk/pom.xml
    incubator/abdera/java/trunk/security/pom.xml
    incubator/abdera/java/trunk/server/pom.xml

Modified: incubator/abdera/java/trunk/build/build.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/build/build.xml?rev=632977&r1=632976&r2=632977&view=diff
==============================================================================
--- incubator/abdera/java/trunk/build/build.xml (original)
+++ incubator/abdera/java/trunk/build/build.xml Mon Mar  3 00:11:04 2008
@@ -44,11 +44,6 @@
   <property name="core.test.resources" value="${core}/src/test/resources" />
   <property name="core.work" value="${work}/core" />
   <property name="core.jar" value="${dist}/${ant.project.name}.core.${version}.jar" />
-  <property name="protocol" value="${basedir}/protocol" />
-  <property name="protocol.src" value="${protocol}/src/main/java" />
-  <property name="protocol.work" value="${work}/protocol" />
-  <property name="protocol.resources" value="${protocol}/src/main/resources" />
-  <property name="protocol.jar" value="${dist}/${ant.project.name}.protocol.${version}.jar" />
   <property name="parser" value="${basedir}/parser" />
   <property name="parser.src" value="${parser}/src/main/java" />
   <property name="parser.resources" value="${parser}/src/main/resources" />
@@ -253,21 +248,6 @@
     </copy>
   </target>
 
-  <target name="compile.protocol" depends="init,compile.core">
-    <mkdir dir="${protocol.work}" />
-    <javac srcdir="${protocol.src}" destdir="${protocol.work}" classpathref="jar.dependencies" classpath="${core.work}" debug="${debug}" />
-    <mkdir dir="${protocol.work}/META-INF" />
-    <copy todir="${protocol.work}">
-      <fileset dir="${protocol.resources}" includes="**/*" />
-    </copy>
-    <copy todir="${protocol.work}/META-INF">
-      <fileset dir="${basedir}">
-        <include name="LICENSE" />
-        <include name="NOTICE" />
-      </fileset>
-    </copy>
-  </target>
-
   <target name="compile.parser" depends="init,compile.core">
     <mkdir dir="${parser.work}" />
     <javac srcdir="${parser.src}" destdir="${parser.work}" classpathref="jar.dependencies" classpath="${core.work}" debug="${debug}" />
@@ -289,10 +269,10 @@
     </copy>
   </target>
 
-  <target name="compile.server" depends="init, compile.core, compile.protocol, compile.client">
+  <target name="compile.server" depends="init, compile.core, compile.client">
     <mkdir dir="${server.work}" />
-    <javac srcdir="${server.src}" destdir="${server.work}" classpathref="jar.dependencies" classpath="${core.work};${protocol.work}" debug="${debug}" />
-    <javac srcdir="${server.test.java}" destdir="${test}" classpathref="jar.dependencies" classpath="${core.work};${server.work};${protocol.work};${client.work}" debug="${debug}" />
+    <javac srcdir="${server.src}" destdir="${server.work}" classpathref="jar.dependencies" classpath="${core.work}" debug="${debug}" />
+    <javac srcdir="${server.test.java}" destdir="${test}" classpathref="jar.dependencies" classpath="${core.work};${server.work};${client.work}" debug="${debug}" />
     <mkdir dir="${server.work}/META-INF" />
     <copy todir="${server.work}/META-INF">
       <fileset dir="${basedir}">
@@ -314,8 +294,8 @@
       <fileset dir="${basedir}/build/tools/${spring.name}/dist/modules" includes="**/*.jar" />
     </path>
     <mkdir dir="${spring.work}" />
-    <javac srcdir="${spring.src}" destdir="${spring.work}" classpathref="spring.dependencies" classpath="${core.work};${protocol.work};${server.work}" debug="${debug}" />
-    <javac srcdir="${spring.test.src}" destdir="${test}" classpathref="spring.dependencies" classpath="${core.work};${parser.work};${spring.work};${protocol.work};${server.work}" debug="${debug}" />
+    <javac srcdir="${spring.src}" destdir="${spring.work}" classpathref="spring.dependencies" classpath="${core.work};${server.work}" debug="${debug}" />
+    <javac srcdir="${spring.test.src}" destdir="${test}" classpathref="spring.dependencies" classpath="${core.work};${parser.work};${spring.work};${server.work}" debug="${debug}" />
     <mkdir dir="${spring.work}/META-INF" />
     <copy todir="${spring.work}">
       <fileset dir="${spring.resources}" includes="**/*" />
@@ -333,8 +313,8 @@
 
   <target name="compile.security" depends="init, compile.core, compile.server" if="do.security">
     <mkdir dir="${security.work}" />
-    <javac srcdir="${security.src}" destdir="${security.work}" classpathref="jar.dependencies" classpath="${core.work};${parser.work};${protocol.work};${client.work};${server.work}" debug="${debug}" />
-    <javac srcdir="${security.test.java}" destdir="${test}" classpathref="jar.dependencies" classpath="${core.work};${parser.work};${security.work};${protocol.work};${client.work};${server.work}" debug="${debug}" />
+    <javac srcdir="${security.src}" destdir="${security.work}" classpathref="jar.dependencies" classpath="${core.work};${parser.work};${client.work};${server.work}" debug="${debug}" />
+    <javac srcdir="${security.test.java}" destdir="${test}" classpathref="jar.dependencies" classpath="${core.work};${parser.work};${security.work};${client.work};${server.work}" debug="${debug}" />
     <mkdir dir="${security.work}/META-INF" />
     <copy todir="${test}">
       <fileset dir="${security.test.resources}" includes="**/*" />
@@ -347,10 +327,10 @@
     </copy>
   </target>
 
-  <target name="compile.client" depends="init,compile.core, compile.protocol">
+  <target name="compile.client" depends="init,compile.core">
     <mkdir dir="${client.work}" />
-    <javac srcdir="${client.src}" destdir="${client.work}" classpathref="jar.dependencies" classpath="${core.work};${protocol.work}" debug="${debug}" />
-    <javac srcdir="${client.test.java}" destdir="${test}" classpathref="jar.dependencies" classpath="${core.work};${parser.work};${extensions.work};${client.work};${protocol.work}" debug="${debug}" />
+    <javac srcdir="${client.src}" destdir="${client.work}" classpathref="jar.dependencies" classpath="${core.work};" debug="${debug}" />
+    <javac srcdir="${client.test.java}" destdir="${test}" classpathref="jar.dependencies" classpath="${core.work};${parser.work};${extensions.work};${client.work}" debug="${debug}" />
     <mkdir dir="${client.work}/META-INF" />
     <copy todir="${client.work}/META-INF">
       <fileset dir="${basedir}">
@@ -360,23 +340,23 @@
     </copy>
   </target>
 
-  <target name="compile.examples" depends="init,compile.core,compile.parser,compile.protocol,compile.server,compile.extensions,compile.security">
+  <target name="compile.examples" depends="init,compile.core,compile.parser,compile.server,compile.extensions,compile.security">
     <echo>Make sure the example code compiles...</echo>
     <mkdir dir="${examples.work}" />
     <javac srcdir="${examples.src}" destdir="${examples.work}" classpathref="jar.dependencies" 
-      classpath="${core.work};${parser.work};${protocol.work};${client.work};${server.work};${extensions.work}/gdata;${extensions.work}/main;${security.work};${extensions.work}/sharing;${extensions.work}/geo;${extensions.work}/serializer" debug="${debug}">
+      classpath="${core.work};${parser.work};${client.work};${server.work};${extensions.work}/gdata;${extensions.work}/main;${security.work};${extensions.work}/sharing;${extensions.work}/geo;${extensions.work}/serializer" debug="${debug}">
       <exclude unless="do.security" name="**/security/*.java" />
     </javac>
     <delete dir="${examples.work}" />
   </target>
 
-  <target name="build" depends="init,compile.core,compile.parser,compile.protocol,compile.server,compile.extensions,compile.client,compile.security,compile.examples,compile.spring">
+  <target name="build" depends="init,compile.core,compile.parser,compile.server,compile.extensions,compile.client,compile.security,compile.examples,compile.spring">
   </target>
 
   <target name="docs" depends="init">
     <javadoc 
       packagenames="org.apache.abdera.*" 
-      sourcepath="${core.src}:${security.src}:${server.src}:${client.src}:${protocol.src}:${spring.src}:${i18n.src.java}:${extensions}/gdata/src/main/java:${extensions}/geo/src/main/java:${extensions}/html/src/main/java:${extensions}/json/src/main/java:${extensions}/main/src/main/java:${extensions}/media/src/main/java:${extensions}/oauth/src/main/java:${extensions}/opensearch/src/main/java:${extensions}/serializer/src/main/java:${extensions}/sharing/src/main/java:${extensions}/wsse/src/main/java" 
+      sourcepath="${core.src}:${security.src}:${server.src}:${client.src}:${spring.src}:${i18n.src.java}:${extensions}/gdata/src/main/java:${extensions}/geo/src/main/java:${extensions}/html/src/main/java:${extensions}/json/src/main/java:${extensions}/main/src/main/java:${extensions}/media/src/main/java:${extensions}/oauth/src/main/java:${extensions}/opensearch/src/main/java:${extensions}/serializer/src/main/java:${extensions}/sharing/src/main/java:${extensions}/wsse/src/main/java" 
       destdir="${javadocs}" 
       windowtitle="Abdera" 
       classpathref="jar.dependencies" />
@@ -400,10 +380,10 @@
     <java classpathref="jar.dependencies" classpath="${core.work}:${parser.work}:${server.work}:${test}" classname="org.apache.abdera.test.parser.stax.TestSuite" fork="yes" />
 
     <echo>Running Client Tests...</echo>
-    <java classpathref="jar.dependencies" classpath="${core.work}:${parser.work}:${server.work}:${client.work}:${protocol.work}:${test}" classname="org.apache.abdera.test.client.TestSuite" fork="yes" />
+    <java classpathref="jar.dependencies" classpath="${core.work}:${parser.work}:${server.work}:${client.work}:${test}" classname="org.apache.abdera.test.client.TestSuite" fork="yes" />
 
     <echo>Running Server Tests...</echo>
-    <java classpathref="jar.dependencies" classpath="${core.work}:${parser.work}:${server.work}:${client.work}:${protocol.work}:${test}" classname="org.apache.abdera.protocol.server.test.TestSuite" fork="yes" />
+    <java classpathref="jar.dependencies" classpath="${core.work}:${parser.work}:${server.work}:${client.work}:${test}" classname="org.apache.abdera.protocol.server.test.TestSuite" fork="yes" />
     
     <antcall target="test.extensions" />
     
@@ -413,7 +393,7 @@
 
   <target name="test.security" if="do.security">
     <echo>Running Security Tests...</echo>
-    <java classpathref="jar.dependencies" classpath="${core.work}:${parser.work}:${server.work}:${security.work}:${client.work}:${protocol.work}:${test}" classname="org.apache.abdera.test.security.TestSuite" fork="yes">
+    <java classpathref="jar.dependencies" classpath="${core.work}:${parser.work}:${server.work}:${security.work}:${client.work}:${test}" classname="org.apache.abdera.test.security.TestSuite" fork="yes">
       <arg line="${bouncycastle.provider}" />
     </java>
   </target>
@@ -425,7 +405,7 @@
 		      <fileset dir="${basedir}/build/tools/${spring.name}/dist" includes="**/*.jar" />
 		      <fileset dir="${basedir}/build/tools/${spring.name}/dist/modules" includes="**/*.jar" />
 		    </path>
-		<java classpathref="spring.dependencies" classpath="${core.work}:${parser.work}:${server.work}:${security.work}:${client.work}:${protocol.work}:${spring.work}:${test}" classname="org.apache.abdera.spring.TestSuite" fork="yes">
+		<java classpathref="spring.dependencies" classpath="${core.work}:${parser.work}:${server.work}:${security.work}:${client.work}:${spring.work}:${test}" classname="org.apache.abdera.spring.TestSuite" fork="yes">
 	    </java>
 	</target>
 
@@ -449,7 +429,6 @@
       <fileset dir="${core.work}" includes="**/*" excludes="META-INF/**/*"/>
       <fileset dir="${core.work}" includes="META-INF/LICENSE,META-INF/NOTICE"/>
       <fileset dir="${parser.work}" includes="**/*" excludes="META-INF/**/*"/>
-      <fileset dir="${protocol.work}" includes="**/*" excludes="META-INF/**/*"/>
       <fileset dir="${server.work}" includes="**/*" excludes="META-INF/**/*"/>
       <fileset dir="${client.work}" includes="**/*" excludes="META-INF/**/*"/>
       <fileset dir="${dependencies.work}/i18n" includes="**/*" excludes="META-INF/**/*"/>
@@ -471,7 +450,6 @@
     
     <jar destfile="${core.jar}" basedir="${core.work}" manifest="${work}/MANIFEST.MF" />
     <jar destfile="${parser.jar}" basedir="${parser.work}" manifest="${work}/MANIFEST.MF" />
-    <jar destfile="${protocol.jar}" basedir="${protocol.work}" manifest="${work}/MANIFEST.MF" />
     <jar destfile="${server.jar}" basedir="${server.work}" manifest="${work}/MANIFEST.MF" />
     <jar destfile="${client.jar}" basedir="${client.work}" manifest="${work}/MANIFEST.MF" />
     <antcall target="dist.extensions" />
@@ -638,7 +616,6 @@
     <property name="retro" value="${basedir}/build/tools/retroweaver-${retroweaver.version}" />
     <property name="retro_core.jar" value="${dist}/${ant.project.name}.core.${version}.retro.jar" />
     <property name="retro_parser.jar" value="${dist}/${ant.project.name}.parser.${version}.retro.jar" />
-    <property name="retro_protocol.jar" value="${dist}/${ant.project.name}.protocol.${version}.retro.jar" />
     <property name="retro_extensions.jar" value="${dist}/${ant.project.name}.extensions.${version}.retro.jar" />
     <property name="retro_server.jar" value="${dist}/${ant.project.name}.server.${version}.retro.jar" />
     <property name="retro_client.jar" value="${dist}/${ant.project.name}.client.${version}.retro.jar" />
@@ -663,9 +640,6 @@
       <arg line="-jar &quot;${parser.jar}&quot; &quot;${retro_parser.jar}&quot;" />
     </java>
     <java classpathref="jar.retro" classname="net.sourceforge.retroweaver.Weaver" fork="yes">
-      <arg line="-jar &quot;${protocol.jar}&quot; &quot;${retro_protocol.jar}&quot;" />
-    </java>
-    <java classpathref="jar.retro" classname="net.sourceforge.retroweaver.Weaver" fork="yes">
       <arg line="-jar &quot;${server.jar}&quot; &quot;${retro_server.jar}&quot;" />
     </java>
     <java classpathref="jar.retro" classname="net.sourceforge.retroweaver.Weaver" fork="yes">
@@ -773,7 +747,7 @@
     <echo>Compiling extension ${ext}...</echo>
     <mkdir dir="${extensions.work}/${ext}" />
     <mkdir dir="${extensions.work}/${ext}/META-INF" />
-    <javac srcdir="${extensions}/${ext}/src/main/java" destdir="${extensions.work}/${ext}" classpathref="jar.dependencies" classpath="${core.work};${parser.work};${client.work};${protocol.work};${server.work};${extensions.work}/main;${extensions.work}/html" debug="${debug}" />
+    <javac srcdir="${extensions}/${ext}/src/main/java" destdir="${extensions.work}/${ext}" classpathref="jar.dependencies" classpath="${core.work};${parser.work};${client.work};${server.work};${extensions.work}/main;${extensions.work}/html" debug="${debug}" />
 
     <available file="${extensions}/${ext}/src/test/java" property="is.available.${ext}.test" />
     
@@ -794,7 +768,7 @@
   
   <target name="compile.extension.test" if="is.available.${ext}.test">
     <echo>Compiling tests for extension ${ext}...</echo>
-    <javac srcdir="${extensions}/${ext}/src/test/java" destdir="${test}" classpathref="jar.dependencies" classpath="${core.work};${parser.work};${extensions.work}/${ext};${client.work};${protocol.work}" debug="${debug}" />
+    <javac srcdir="${extensions}/${ext}/src/test/java" destdir="${test}" classpathref="jar.dependencies" classpath="${core.work};${parser.work};${extensions.work}/${ext};${client.work}" debug="${debug}" />
       <copy todir="${test}">
         <fileset dir="${extensions}/${ext}/src/test/resources" includes="**/*" />
       </copy>

Modified: incubator/abdera/java/trunk/client/pom.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/pom.xml?rev=632977&r1=632976&r2=632977&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/pom.xml (original)
+++ incubator/abdera/java/trunk/client/pom.xml Mon Mar  3 00:11:04 2008
@@ -55,12 +55,6 @@
       <scope>compile</scope>
     </dependency>    
     <dependency>
-      <groupId>org.apache.abdera</groupId>
-      <artifactId>abdera-protocol</artifactId>
-      <version>0.4.0-incubating-SNAPSHOT</version>
-      <scope>compile</scope>
-    </dependency>  
-    <dependency>
       <groupId>commons-httpclient</groupId>
       <artifactId>commons-httpclient</artifactId>
     </dependency>

Modified: incubator/abdera/java/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/pom.xml?rev=632977&r1=632976&r2=632977&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/pom.xml (original)
+++ incubator/abdera/java/trunk/core/pom.xml Mon Mar  3 00:11:04 2008
@@ -48,7 +48,6 @@
   	<dependency>
   		<groupId>commons-codec</groupId>
   		<artifactId>commons-codec</artifactId>
-  		<version>1.3</version>
   	</dependency>
   </dependencies>
 </project>

Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/EntityProvider.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/EntityProvider.java?rev=632977&view=auto
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/EntityProvider.java (added)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/EntityProvider.java Mon Mar  3 00:11:04 2008
@@ -0,0 +1,57 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol;
+
+import java.util.Date;
+
+import org.apache.abdera.util.EntityTag;
+import org.apache.abdera.writer.StreamWriter;
+
+/**
+ * An EntityProvider is used to serialize entities using the StreamWriter
+ * interface.  The EntityProvider interface can be implemented by applications
+ * to provide an efficient means of serializing non-FOM objects to Atom/XML. 
+ */
+public interface EntityProvider {
+
+  /**
+   * Write to the specified StreamWriter
+   */
+  void writeTo(StreamWriter sw);
+ 
+  /**
+   * True if the serialization is repeatable. 
+   */
+  boolean isRepeatable();
+  
+  /**
+   * Return the mime content type of the serialized entity
+   */
+  String getContentType();
+  
+  /**
+   * Return the EntityTag of the entity,
+   */
+  EntityTag getEntityTag();
+  
+  /**
+   * Return the Last-Modified date of the entity
+   */
+  Date getLastModified();
+  
+}

Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/ItemManager.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/ItemManager.java?rev=632977&view=auto
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/ItemManager.java (added)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/ItemManager.java Mon Mar  3 00:11:04 2008
@@ -0,0 +1,36 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol;
+
+/**
+ * ItemManager is an internal utility class that provides a simple get/release
+ * interface.  It is used primarily to control access to pooled resources.
+ */
+public interface ItemManager<T> {
+
+  /**
+   * Get an item based on the specified request
+   */
+  T get(Request request);
+  
+  /**
+   * Release an item 
+   */
+  void release(T item);
+  
+}

Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/Message.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/Message.java?rev=632977&view=auto
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/Message.java (added)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/Message.java Mon Mar  3 00:11:04 2008
@@ -0,0 +1,108 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol;
+
+import java.util.Date;
+
+import javax.activation.MimeType;
+
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.protocol.util.ProtocolConstants;
+
+/**
+ * A protocol message. This is used as the basis for both request and response
+ * objects in order to provide a consistent interface. 
+ */
+public interface Message extends ProtocolConstants {
+
+  /**
+   * Get the value of the specified header
+   */
+  String getHeader(String name);
+  
+  /**
+   * Get the decoded value of a RFC 2047 header
+   */
+  String getDecodedHeader(String name);
+  
+  /**
+   * Return multiple values for the specified header
+   */
+  Object[] getHeaders(String name);
+  
+  /**
+   * Return multiple decoded values for the specified header
+   */
+  String[] getDecodedHeaders(String name);
+  
+  /**
+   * Return a listing of header names
+   */
+  String[] getHeaderNames();
+  
+  /**
+   * Return the value of the Cache-Control header
+   */
+  String getCacheControl();
+  
+  /**
+   * Return the value of the Slug header
+   */
+  String getSlug();
+  
+  /**
+   * Return the value of the Content-Type header
+   */
+  MimeType getContentType();
+  
+  /**
+   * Return the value of the Content-Location header
+   */
+  IRI getContentLocation();
+  
+  /**
+   * Return the value of the Content-Language header
+   */
+  String getContentLanguage();
+  
+  /**
+   * Return the value of a Date header
+   */
+  Date getDateHeader(String name);
+  
+  /**
+   * Return the maximum-age as specified by the Cache-Control header
+   */
+  long getMaxAge();
+  
+  /**
+   * Return true if the Cache-Control header contains no-cache
+   */
+  boolean isNoCache();
+  
+  /**
+   * Return true if the Cache-Control header contains no-store
+   */
+  boolean isNoStore();
+  
+  /**
+   * Return true if the Cache-Control header contains no-transform
+   */
+  boolean isNoTransform();
+  
+}

Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/Request.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/Request.java?rev=632977&view=auto
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/Request.java (added)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/Request.java Mon Mar  3 00:11:04 2008
@@ -0,0 +1,90 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol;
+
+import java.util.Date;
+
+import org.apache.abdera.util.EntityTag;
+
+
+/**
+ * A protocol request. This is used as a base for both server and client requests 
+ */
+public interface Request extends Message {
+
+  /**
+   * Get the value of the Accept header
+   */
+  String getAccept();
+
+  /**
+   * Get the value of the Accept-Charset header
+   */
+  String getAcceptCharset();
+
+  /**
+   * Get the value of the Accept-Encoding header
+   */
+  String getAcceptEncoding();
+
+  /**
+   * Get the value of the Accept-Language header
+   */
+  String getAcceptLanguage();
+
+  /**
+   * Get the value of the Authorization header
+   */
+  String getAuthorization();
+
+  /**
+   * Get a listing of Etags from the If-Match header
+   */
+  EntityTag[] getIfMatch();
+
+  /**
+   * Get the value of the If-Modified-Since header
+   */
+  Date getIfModifiedSince();
+
+  /**
+   * Get a listing of ETags from the If-None-Match header 
+   */
+  EntityTag[] getIfNoneMatch();
+
+  /**
+   * Get the value of the If-Unmodified-Since header
+   */
+  Date getIfUnmodifiedSince();
+
+  /**
+   * Get the max-stale value from the Cache-Control header
+   */
+  long getMaxStale();
+
+  /**
+   * Get the min-fresh value from the Cache-Control header
+   */
+  long getMinFresh();
+
+  /**
+   * True if the only-if-cached directive is set in the Cache-Control header
+   */
+  boolean isOnlyIfCached();
+  
+}

Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/Resolver.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/Resolver.java?rev=632977&view=auto
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/Resolver.java (added)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/Resolver.java Mon Mar  3 00:11:04 2008
@@ -0,0 +1,29 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol;
+
+/**
+ * The Resolver interface is a utility class used to resolve objects based on
+ * a request.  It is used internally by Abdera as the basis for Target and Subject 
+ * resolvers.
+ */
+public interface Resolver<T> {
+
+  T resolve(Request request);
+  
+}

Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/Response.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/Response.java?rev=632977&view=auto
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/Response.java (added)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/Response.java Mon Mar  3 00:11:04 2008
@@ -0,0 +1,123 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol;
+
+import java.util.Date;
+
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.util.EntityTag;
+
+/**
+ * Base interface for an Atompub protocol response message
+ */
+public interface Response
+  extends Message {
+
+  /**
+   * High level classifications of response types
+   */
+  public static enum ResponseType {
+    SUCCESS, REDIRECTION, CLIENT_ERROR, SERVER_ERROR, UNKNOWN;
+    
+    public static ResponseType select(int status) {
+      if (status >= 200 && status < 300) return SUCCESS;
+      if (status >= 300 && status < 400) return REDIRECTION;
+      if (status >= 400 && status < 500) return CLIENT_ERROR;
+      if (status >= 500 && status < 600) return SERVER_ERROR;
+      return UNKNOWN;
+    }
+    
+  }
+  
+  /**
+   * Get the Entity Tag returned by the server
+   */
+  EntityTag getEntityTag();
+    
+  /**
+   * Get the response type classification
+   */
+  ResponseType getType();
+  
+  /**
+   * Get the specific response status code
+   */
+  int getStatus();
+  
+  /**
+   * Get the response status text
+   */
+  String getStatusText();
+  
+  /**
+   * Get the value of the Last-Modified response header
+   */
+  Date getLastModified();
+  
+  /**
+   * Get the value of the Content-Length response header
+   */
+  long getContentLength();
+  
+  /**
+   * Get the value of the Allow response header
+   */
+  String getAllow();
+  
+  /**
+   * Get the value of the Location response header
+   */
+  IRI getLocation();
+  
+  /**
+   * True if the Cache-Control header specifies the private directive
+   */
+  boolean isPrivate();
+  
+  /**
+   * True if the Cache-Control header specified the public directive
+   */
+  boolean isPublic();
+  
+  /**
+   * True if the Cache-Control header specifies the must-revalidate directive
+   */
+  boolean isMustRevalidate();
+  
+  /**
+   * True if the Cache-Control header specifies the proxy-revalidate directive
+   */
+  boolean isProxyRevalidate();
+  
+  long getSMaxAge();
+  
+  /**
+   * Get the age of this response as specified by the server
+   */
+  long getAge();
+  
+  /**
+   * Get the date/time this response expires
+   */
+  Date getExpires();
+  
+  String[] getNoCacheHeaders();
+  
+  String[] getPrivateHeaders();
+  
+}

Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/error/Error.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/error/Error.java?rev=632977&view=auto
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/error/Error.java (added)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/error/Error.java Mon Mar  3 00:11:04 2008
@@ -0,0 +1,133 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol.error;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.Abdera;
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Document;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ExtensibleElementWrapper;
+import org.apache.abdera.writer.StreamWriter;
+
+/**
+ * Abdera protocol error element.  The Abdera error document provides a 
+ * simple structure for reporting errors back to Abdera clients.
+ */
+public class Error
+  extends ExtensibleElementWrapper {
+
+  public static final String NS        = "http://incubator.apache.org/abdera";
+  public static final QName ERROR         = new QName(NS, "error");
+  public static final QName CODE          = new QName(NS, "code");
+  public static final QName MESSAGE       = new QName(NS, "message");
+  
+  public Error(Element internal) {
+    super(internal);
+  }
+
+  public Error(Factory factory, QName qname) {
+    super(factory, qname);
+  }
+  
+  /**
+   * The code should typically match the HTTP status code; however, certain
+   * application scenarios may require the use of a different code
+   */
+  public int getCode() {
+    String code = getSimpleExtension(CODE);
+    return code != null ? Integer.parseInt(code) : -1;
+  }
+
+  /**
+   * The code should typically match the HTTP status code; however, certain
+   * application scenarios may require the use of a different code
+   */
+  public Error setCode(int code) {
+    if (code > -1) {
+      Element element = getExtension(CODE);
+      if (element != null) {
+        element.setText(Integer.toString(code));
+      } else {
+        addSimpleExtension(CODE,Integer.toString(code));
+      }
+    } else {
+      Element element = getExtension(CODE);
+      if (element != null) element.discard();
+    }
+    return this;
+  }
+ 
+  /**
+   * Human-readable, language-sensitive description of the error
+   */
+  public String getMessage() {
+    return getSimpleExtension(MESSAGE);
+  }
+
+  /**
+   * Human-readable, language-sensitive description of the error
+   */
+  public Error setMessage(String message) {
+    if (message != null) {
+      Element element = getExtension(MESSAGE);
+      if (element != null) {
+        element.setText(message);
+      } else {
+        addSimpleExtension(MESSAGE,message);
+      }
+    } else {
+      Element element = getExtension(MESSAGE);
+      if (element != null) element.discard();
+    }
+    return this;
+  }
+  
+  /**
+   * Will throw a ProtocolException that wraps this element. This is 
+   * useful on the client side to surface error responses
+   */
+  public void throwException() {
+    throw new ProtocolException(this);
+  }
+  
+  /**
+   * Create a new Error object
+   */
+  public static Error create(Abdera abdera, int code, String message) {
+    return create(abdera,code,message,null);
+  }
+  
+  public static Error create(Abdera abdera, int code, String message, Throwable t) {
+    Document<Error> doc = abdera.getFactory().newDocument();
+    Error error = abdera.getFactory().newElement(ERROR,doc);
+    error.setCode(code)
+         .setMessage(message);
+    return error;
+  }
+  
+  public static void create(StreamWriter sw, int code, String message, Throwable t) {
+    sw.startDocument()
+      .startElement(ERROR)
+      .startElement(CODE).writeElementText(code).endElement()
+      .startElement(MESSAGE).writeElementText(message).endElement()
+      .endElement()
+      .endDocument();
+  }
+}

Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/error/ErrorExtensionFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/error/ErrorExtensionFactory.java?rev=632977&view=auto
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/error/ErrorExtensionFactory.java (added)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/error/ErrorExtensionFactory.java Mon Mar  3 00:11:04 2008
@@ -0,0 +1,30 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol.error;
+
+import org.apache.abdera.util.AbstractExtensionFactory;
+
+public class ErrorExtensionFactory
+    extends AbstractExtensionFactory {
+
+  public ErrorExtensionFactory() {
+    super(Error.NS);
+    addImpl(Error.ERROR, Error.class);
+  }
+  
+}

Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/error/ProtocolException.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/error/ProtocolException.java?rev=632977&view=auto
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/error/ProtocolException.java (added)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/error/ProtocolException.java Mon Mar  3 00:11:04 2008
@@ -0,0 +1,71 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol.error;
+
+import org.apache.abdera.Abdera;
+
+public class ProtocolException
+    extends RuntimeException {
+
+  private static final long serialVersionUID = 1017447143200419489L;
+  private final Error error;
+  
+  public ProtocolException(Error error) {
+    super(error.getCode() + "::" + error.getMessage());
+    this.error = error;
+  }
+  
+  public ProtocolException(Abdera abdera, int code, String message) {
+    super(code + "::" + message);
+    this.error = Error.create(abdera, code, message);
+  }
+  
+  public Error getError() {
+    return error;
+  }
+  
+  @Override 
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    String message = error != null ? error.getMessage() : null;
+    int code = error != null ? error.getCode() : 0;
+    result = prime * result + ((message == null) ? 0 : message.hashCode());
+    result = prime * result + code;
+    return result;
+  }
+
+  @Override 
+  public boolean equals(Object obj) {
+    if (this == obj) return true;
+    if (obj == null) return false;
+    if (getClass() != obj.getClass()) return false;
+    final ProtocolException other = (ProtocolException) obj;
+    String message = error != null ? error.getMessage() : null;
+    int code = error != null ? error.getCode() : 0;
+    String omessage = other.error != null ? other.error.getMessage() : null;
+    int ocode = other.error != null ? other.error.getCode() : 0;    
+    if (message == null) {
+      if (omessage != null) return false;
+    } else if (!message.equals(omessage)) return false;
+    if (code != ocode) return false;
+    return true;
+  }
+
+  
+}

Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractEntityProvider.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractEntityProvider.java?rev=632977&view=auto
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractEntityProvider.java (added)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractEntityProvider.java Mon Mar  3 00:11:04 2008
@@ -0,0 +1,36 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol.util;
+
+import java.util.Date;
+
+import org.apache.abdera.protocol.EntityProvider;
+import org.apache.abdera.util.EntityTag;
+
+public abstract class AbstractEntityProvider 
+  implements EntityProvider {
+  
+  public String getContentType() {
+    return "application/xml";
+  }
+  
+  public EntityTag getEntityTag() { return null; }
+  
+  public Date getLastModified() { return null; }
+  
+}

Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractItemManager.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractItemManager.java?rev=632977&view=auto
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractItemManager.java (added)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractItemManager.java Mon Mar  3 00:11:04 2008
@@ -0,0 +1,39 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol.util;
+
+import org.apache.abdera.protocol.ItemManager;
+import org.apache.abdera.protocol.Request;
+
+public abstract class AbstractItemManager<T>
+  extends PoolManager<T>
+  implements ItemManager<T> {
+
+  public AbstractItemManager() {
+    super();
+  }
+
+  public AbstractItemManager(int max) {
+    super(max);
+  }
+
+  public T get(Request request) {
+    return getInstance();
+  }
+
+}

Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractMessage.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractMessage.java?rev=632977&view=auto
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractMessage.java (added)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractMessage.java Mon Mar  3 00:11:04 2008
@@ -0,0 +1,111 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol.util;
+
+import javax.activation.MimeType;
+
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.i18n.text.UrlEncoding;
+import org.apache.abdera.protocol.Message;
+
+/**
+ * Root impl for Message interface impls. This is provided solely as a way of
+ * keeping the interface and impl's consistent across the Request and Response 
+ * objects.
+ */
+public abstract class AbstractMessage 
+  implements Message {
+  
+  protected int flags = 0;
+  protected long max_age = -1;
+
+  
+  public String getCacheControl() {
+    return getHeader("Cache-Control");
+  }
+  
+  public String getContentLanguage() {
+    return getHeader("Content-Language");
+  }
+  
+  public IRI getContentLocation() {
+    String value = getHeader("Content-Location");
+    return (value != null) ? new IRI(value) : null;
+  }
+  
+  public MimeType getContentType() {
+    try {
+      String value = getHeader("Content-Type");
+      return (value != null) ? new MimeType(value) : null;
+    } catch (javax.activation.MimeTypeParseException e) {
+      throw new org.apache.abdera.util.MimeTypeParseException(e);
+    }
+  }
+  
+  public String getDecodedHeader(String header) {
+    return UrlEncoding.decode(EncodingUtil.decode(getHeader(header)));
+  }
+  
+  public String[] getDecodedHeaders(String header) {
+    Object[] headers = getHeaders(header);
+    for (int n = 0; n < headers.length; n++) {
+      headers[n] = UrlEncoding.decode(EncodingUtil.decode(headers[n].toString()));
+    }
+    return (String[])headers;
+  }
+  
+  public String getSlug() {
+    return getDecodedHeader("Slug");
+  }
+ 
+
+  protected boolean check(int flag) {
+    return (flags & flag) == flag;
+  }
+  
+  protected void toggle(boolean val, int flag) {
+    if (val) flags |= flag;
+    else flags &= ~flag;
+  }
+  
+  public boolean isNoCache() {
+    if (check(NOCACHE)) return true;    
+    Object[] pragma = getHeaders("Pragma");
+    if (pragma != null) {
+      for (Object o: pragma) {
+        String s = (String)o;
+        if (s.equalsIgnoreCase("no-cache")) {
+          return true;
+        }
+      }
+    }
+    return false;
+  }
+
+  public boolean isNoStore() {
+    return check(NOSTORE);
+  }
+  
+  public boolean isNoTransform() {
+    return check(NOTRANSFORM);
+  }
+  
+  public long getMaxAge() {
+    return max_age;
+  }
+}

Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractRequest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractRequest.java?rev=632977&view=auto
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractRequest.java (added)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractRequest.java Mon Mar  3 00:11:04 2008
@@ -0,0 +1,115 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol.util;
+
+import java.util.Date;
+
+import org.apache.abdera.protocol.Request;
+import org.apache.abdera.util.EntityTag;
+
+public abstract class AbstractRequest
+  extends AbstractMessage 
+  implements Request {
+
+  protected long max_stale = -1;
+  protected long min_fresh = -1;
+  
+  public String getAccept() {
+    return getHeader("Accept");
+  }
+
+  public String getAcceptCharset() {
+    return getHeader("Accept-Charset");
+  }
+
+  public String getAcceptEncoding() {
+    return getHeader("Accept-Encoding");
+  }
+
+  public String getAcceptLanguage() {
+    return getHeader("Accept-Language");
+  }
+
+  public String getAuthorization() {
+    return getHeader("Authorization");
+  }
+
+  public EntityTag[] getIfMatch() {
+    return EntityTag.parseTags(getHeader("If-Match"));
+  }
+
+  public Date getIfModifiedSince() {
+    return getDateHeader("If-Modified-Since");
+  }
+
+  public EntityTag[] getIfNoneMatch() {
+    return EntityTag.parseTags(getHeader("If-None-Match"));
+  }
+
+  public Date getIfUnmodifiedSince() {
+    return getDateHeader("If-Unmodified-Since");
+  }
+
+  public long getMaxStale() {
+    return max_stale;
+  }
+
+  public long getMinFresh() {
+    return min_fresh;
+  }
+
+  public boolean isOnlyIfCached() {
+    return check(ONLYIFCACHED);
+  }
+
+  public AbstractRequest setMaxAge(long max_age) {
+    this.max_age = max_age;
+    return this;
+  }
+  
+  public AbstractRequest setMaxStale(long max_stale) {
+    this.max_stale = max_stale;
+    return this;
+  }
+  
+  public AbstractRequest setMinFresh(long min_fresh) {
+    this.min_fresh = min_fresh;
+    return this;
+  }
+
+  public AbstractRequest setNoCache(boolean val) {
+    toggle(val, NOCACHE);
+    return this;
+  }
+  
+  public AbstractRequest setNoStore(boolean val) {
+    toggle(val, NOSTORE);
+    return this;
+  }
+  
+  public AbstractRequest setNoTransform(boolean val) {
+    toggle(val, NOTRANSFORM);
+    return this;
+  }
+  
+  public AbstractRequest setOnlyIfCached(boolean val) {
+    toggle(val, ONLYIFCACHED);
+    return this;
+  }
+
+}

Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractResponse.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractResponse.java?rev=632977&view=auto
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractResponse.java (added)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/AbstractResponse.java Mon Mar  3 00:11:04 2008
@@ -0,0 +1,157 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol.util;
+
+import java.util.Date;
+
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.protocol.Response;
+import org.apache.abdera.util.EntityTag;
+
+public abstract class AbstractResponse
+  extends AbstractMessage
+  implements Response {
+
+  protected String[] nocache_headers = null;
+  protected String[] private_headers = null;
+  protected long smax_age = -1;
+  
+  public long getAge() {
+    String value = getHeader("Age");
+    try {
+      return (value != null) ? Long.parseLong(value) : -1;
+    } catch (NumberFormatException e) {
+      return -1;
+    }
+  }
+
+  public String getAllow() {
+    return getHeader("Allow");
+  }
+
+  public long getContentLength() {
+    String value = getHeader("Content-Length");
+    try {
+      return (value != null) ? Long.parseLong(value) : -1;
+    } catch (NumberFormatException e) {
+      return -1;
+    }
+  }
+
+  public EntityTag getEntityTag() {
+    String etag = getHeader("ETag");
+    return (etag != null) ? EntityTag.parse(getHeader("ETag")) : null;
+  }
+
+  public Date getExpires() {
+    return getDateHeader("Expires");
+  }
+
+  public Date getLastModified() {
+    return getDateHeader("Last-Modified");
+  }
+
+  public IRI getLocation() {
+    String l = getHeader("Location");
+    return l != null ? new IRI(l) : null;
+  }
+
+  public String[] getNoCacheHeaders() {
+    return nocache_headers;
+  }
+
+  public String[] getPrivateHeaders() {
+    return private_headers;
+  }
+
+  public long getSMaxAge() {
+    return smax_age;
+  }
+
+  public ResponseType getType() {
+    return ResponseType.select(getStatus());
+  }
+
+  public boolean isMustRevalidate() {
+    return check(REVALIDATE);
+  }
+
+  public boolean isPrivate() {
+    return check(PRIVATE);
+  }
+
+  public boolean isProxyRevalidate() {
+    return check(PROXYREVALIDATE);
+  }
+
+  public boolean isPublic() {
+    return check(PUBLIC);
+  }
+
+  public AbstractResponse setMaxAge(long max_age) {
+    this.max_age = max_age;
+    return this;
+  }
+  
+  public AbstractResponse setMustRevalidate(boolean val) {
+    toggle(val, REVALIDATE);
+    return this;
+  }
+  
+  public AbstractResponse setProxyRevalidate(boolean val) {
+    toggle(val, PROXYREVALIDATE);
+    return this;
+  }
+  
+  public AbstractResponse setNoCache(boolean val) {
+    toggle(val, NOCACHE);
+    return this;
+  }
+  
+  public AbstractResponse setNoStore(boolean val) {
+    toggle(val, NOSTORE);
+    return this;
+  }
+  
+  public AbstractResponse setNoTransform(boolean val) {
+    toggle(val, NOTRANSFORM);
+    return this;
+  }
+  
+  public AbstractResponse setPublic(boolean val) {
+    toggle(val, PUBLIC);
+    return this;
+  }
+  
+  public AbstractResponse setPrivate(boolean val) {
+    if (val) flags |= PRIVATE;
+    else if (isPrivate()) flags ^= PRIVATE;
+    return this;
+  }
+  
+  public AbstractResponse setPrivateHeaders(String... headers) {
+    this.private_headers = headers;
+    return this;
+  }
+  
+  public AbstractResponse setNoCacheHeaders(String... headers) {
+    this.nocache_headers = headers;
+    return this;
+  }
+
+}

Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/CacheControlUtil.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/CacheControlUtil.java?rev=632977&view=auto
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/CacheControlUtil.java (added)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/CacheControlUtil.java Mon Mar  3 00:11:04 2008
@@ -0,0 +1,213 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol.util;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Provides parsing and properly handling of the HTTP Cache-Control header.
+ */
+public class CacheControlUtil {
+
+  private static enum Idempotent { GET, HEAD, OPTIONS }
+  
+  /**
+   * Idempotent methods are handled differently in caches than other methods
+   */
+  public static boolean isIdempotent(String method) {
+    try {
+      Idempotent.valueOf(method.toUpperCase());
+      return true;
+    } catch (Exception e) {
+      return false;
+    }
+  }
+  
+  private static long value(String val) {
+    return (val != null) ? Long.parseLong(val) : -1; 
+  }
+  
+  private static void append(StringBuilder buf, String value) {
+    if (buf.length() > 0) buf.append(", ");
+    buf.append(value);
+  }
+
+  /**
+   * Construct the Cache-Control header from info in the request object
+   */
+  public static String buildCacheControl(AbstractRequest request) {
+    StringBuilder buf = new StringBuilder();
+    if (request.isNoCache()) append(buf,"no-cache");
+    if (request.isNoStore()) append(buf,"no-store");
+    if (request.isNoTransform()) append(buf, "no-transform");
+    if (request.isOnlyIfCached()) append(buf, "only-if-cached");
+    if (request.getMaxAge() != -1) append(buf, "max-age=" + request.getMaxAge());
+    if (request.getMaxStale() != -1) append(buf, "max-stale=" + request.getMaxStale());
+    if (request.getMinFresh() != -1) append(buf, "min-fresh=" + request.getMinFresh());
+    return buf.toString();
+  }
+  
+  /**
+   * Parse the Cache-Control header
+   */
+  public static void parseCacheControl(
+    String cc, 
+    AbstractRequest request) {
+      if (cc == null || cc.length() == 0) return;
+      CacheControlParser parser = new CacheControlParser(cc);
+      request.setNoCache(false);
+      request.setNoStore(false);
+      request.setNoTransform(false);
+      request.setOnlyIfCached(false);
+      request.setMaxAge(-1);
+      request.setMaxStale(-1);
+      request.setMinFresh(-1);
+      for (Directive directive : parser) {
+        switch(directive) {
+          case NOCACHE:      request.setNoCache(true); break;
+          case NOSTORE:      request.setNoStore(true); break;
+          case NOTRANSFORM:  request.setNoTransform(true); break;
+          case ONLYIFCACHED: request.setOnlyIfCached(true); break;
+          case MAXAGE:       request.setMaxAge(value(parser.getValue(directive))); break;
+          case MAXSTALE:     request.setMaxStale(value(parser.getValue(directive))); break;
+          case MINFRESH:     request.setMinFresh(value(parser.getValue(directive))); break;
+        }
+      }
+  }
+  
+  /**
+   * Parse the Cache-Control header
+   */
+  public static void parseCacheControl(
+    String cc, 
+    AbstractResponse response) {
+      if (cc == null) return;
+      CacheControlParser parser = new CacheControlParser(cc);
+      response.setNoCache(false);
+      response.setNoStore(false);
+      response.setNoTransform(false);
+      response.setMustRevalidate(false);
+      response.setPrivate(false);
+      response.setPublic(false);
+      response.setMaxAge(-1);
+      for (Directive directive : parser) {
+        switch(directive) {
+          case NOCACHE:
+            response.setNoCache(true);
+            response.setNoCacheHeaders(parser.getValues(directive));
+            break;
+          case NOSTORE:
+            response.setNoStore(true); break;
+          case NOTRANSFORM:
+            response.setNoTransform(true); break;
+          case MUSTREVALIDATE:
+            response.setMustRevalidate(true); break;
+          case PUBLIC:
+            response.setPublic(true); break;
+          case PRIVATE:
+            response.setPrivate(true);
+            response.setPrivateHeaders(parser.getValues(directive));
+            break;
+          case MAXAGE:
+            response.setMaxAge(value(parser.getValue(directive)));
+            break;
+        }
+      }
+  }
+
+  /**
+   * Cache Control Directives
+   */
+  public enum Directive {
+    MAXAGE, MAXSTALE, MINFRESH, NOCACHE, NOSTORE, NOTRANSFORM, ONLYIFCACHED,
+    MUSTREVALIDATE, PRIVATE, PROXYREVALIDATE, PUBLIC, SMAXAGE, UNKNOWN;
+    
+    public static Directive select(String d) {
+      try {
+        d = d.toUpperCase().replaceAll("-", "");
+        return Directive.valueOf(d);
+      } catch (Exception e) {}
+      return UNKNOWN;
+    }
+  }
+
+  /**
+   * Parser for the Cache-Control header
+   */
+  public static class CacheControlParser 
+    implements Iterable<Directive> {
+        
+    private static final String REGEX = 
+      "\\s*([\\w\\-]+)\\s*(=)?\\s*(\\d+|\\\"([^\"\\\\]*(\\\\.[^\"\\\\]*)*)+\\\")?\\s*";
+
+    private static final Pattern pattern = Pattern.compile(REGEX);
+
+    private HashMap<Directive, String> values = new HashMap<Directive, String>();
+
+    public CacheControlParser(String value) {
+      Matcher matcher = pattern.matcher(value);
+      while (matcher.find()) {
+        String d = matcher.group(1);
+        Directive directive = Directive.select(d);
+        if (directive != Directive.UNKNOWN) {
+          values.put(directive, matcher.group(3));
+        }
+      }
+    }
+
+    public Map<Directive,String> getValues() {
+      return values;
+    }
+
+    public String getValue(Directive directive) {
+      return values.get(directive);
+    }
+    
+    public Iterator<Directive> iterator() {
+      return values.keySet().iterator();
+    }
+    
+    public String[] getValues(Directive directive) {
+      String value = getValue(directive);
+      if (value != null) {
+        return splitAndTrim(value, ",", true);
+      }
+      return null;
+    }
+    
+    private static String unquote(String s) {
+      if (s == null || s.length() == 0) return s;
+      if (s.startsWith("\"")) s = s.substring(1);
+      if (s.endsWith("\"")) s = s.substring(0, s.length() - 1);
+      return s;
+    }
+      
+    public static String[] splitAndTrim(String value, String delim, boolean unquote) {
+      String[] headers = (unquote) ? unquote(value).split(delim) : value.split(delim);
+      for (int n = 0; n < headers.length; n++) {
+        headers[n] = headers[n].trim();
+      }
+      return headers;
+    }
+
+  }
+}

Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/EncodingUtil.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/EncodingUtil.java?rev=632977&view=auto
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/EncodingUtil.java (added)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/EncodingUtil.java Mon Mar  3 00:11:04 2008
@@ -0,0 +1,164 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.abdera.i18n.text.Normalizer;
+import org.apache.abdera.i18n.text.Sanitizer;
+import org.apache.abdera.util.CompressionUtil;
+import org.apache.abdera.util.CompressionUtil.CompressionCodec;
+import org.apache.commons.codec.DecoderException;
+import org.apache.commons.codec.net.BCodec;
+import org.apache.commons.codec.net.QCodec;
+
+public class EncodingUtil {
+
+  public static final String SANITIZE_PATTERN = "[^A-Za-z0-9\\%!$&\\\\'()*+,;=]+";
+  
+  /**
+   * @deprecated
+   * @see org.apache.abdera.i18n.text.Sanitizer
+   */
+  public static String sanitize(String slug) {
+    return Sanitizer.sanitize(slug, null, false, null, SANITIZE_PATTERN);
+  }
+  
+  /**
+   * @deprecated
+   * @see org.apache.abdera.i18n.text.Sanitizer
+   */
+  public static String sanitize(String slug, String filler) {
+    return Sanitizer.sanitize(slug, filler, false, null, SANITIZE_PATTERN);
+  }
+  
+  /**
+   * @deprecated
+   * @see org.apache.abdera.i18n.text.Sanitizer
+   */
+  public static String sanitize(String slug, String filler, boolean lower) {
+    return Sanitizer.sanitize(slug, filler, lower, null, SANITIZE_PATTERN);
+  }
+  
+  /**
+   * @deprecated
+   * @see org.apache.abdera.i18n.text.Sanitizer
+   */
+  public static String sanitize(String slug, String filler, String pattern) {
+    return Sanitizer.sanitize(slug, filler, false, null, pattern);
+  }
+  
+  /**
+   * @deprecated
+   * @see org.apache.abdera.i18n.text.Sanitizer
+   */
+  public static String sanitize(String slug, String filler, boolean lower, String pattern) {
+    return Sanitizer.sanitize(slug, filler, lower, null, pattern);
+  }
+
+  /**
+   * @deprecated
+   * @see org.apache.abdera.i18n.text.Sanitizer
+   */
+  public static String sanitize(
+      String slug, 
+      String filler, 
+      boolean lower, 
+      Normalizer.Form form) {
+    return Sanitizer.sanitize(slug,filler,lower,form,SANITIZE_PATTERN);
+  }
+  
+  /**
+   * Used to sanitize a string.  Optionally performs Unicode Form KD normalization
+   * on a string to break extended characters down, then replaces non alphanumeric
+   * characters with a specified filler replacement.
+   * @param slug The source string
+   * @param filler The replacement string
+   * @param lower True if the result should be lowercase
+   * @param form Unicode Normalization form to use (or null)
+   * @deprecated
+   * @see org.apache.abdera.i18n.text.Sanitizer
+   */
+  public static String sanitize(
+    String slug, 
+    String filler, 
+    boolean lower, 
+    Normalizer.Form form,
+    String pattern) {
+      return Sanitizer.sanitize(slug,filler,lower,form,pattern);
+  }
+  
+  public static enum Codec { B, Q };
+  
+  public static String encode(String value) {
+    return encode(value, "UTF-8", Codec.B);
+  }
+  
+  public static String encode(String value, String charset) {
+    return encode(value, charset, Codec.B);
+  }
+  
+  /**
+   * Used to encode a string as specified by RFC 2047
+   * @param value The string to encode
+   * @param charset The character set to use for the encoding
+   */
+  public static String encode(String value, String charset, Codec codec) {
+    if (value == null) return null;
+    try {
+      switch(codec) {
+        case Q:  return (new QCodec(charset)).encode(value);
+        case B:
+        default: return (new BCodec(charset)).encode(value);
+      }
+    } catch (Exception e) {
+      return value;
+    }
+  }
+  
+  /**
+   * Used to decode a string as specified by RFC 2047
+   * @param value The encoded string
+   */
+  public static String decode(String value) {
+    if (value == null) return null;
+    try {
+      // try BCodec first
+      return (new BCodec()).decode(value);
+    } catch (DecoderException de) {
+      // try QCodec next
+      try {
+        return (new QCodec()).decode(value);
+      } catch (Exception ex) {
+        return value;
+      }
+    } catch (Exception e) {
+      return value;
+    }
+  }
+  
+  public static InputStream getDecodingInputStream(InputStream in, String ce) throws IOException {
+    String[] encodings = CacheControlUtil.CacheControlParser.splitAndTrim(ce, ",", false);
+    for (int n = encodings.length -1; n >= 0; n--) {
+      CompressionCodec encoding = CompressionCodec.valueOf(encodings[n].toUpperCase().replaceAll("-", ""));
+      in = CompressionUtil.getDecodingInputStream(in, encoding);
+    }
+    return in;
+  }
+}

Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/PoolManager.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/PoolManager.java?rev=632977&view=auto
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/PoolManager.java (added)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/PoolManager.java Mon Mar  3 00:11:04 2008
@@ -0,0 +1,71 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol.util;
+
+import java.util.Stack;
+
+import org.apache.abdera.protocol.ItemManager;
+
+/**
+ * Implements a simple pool manager.
+ * 
+ * By default, an upper limit to the pool is set at 25 entries.  
+ * New items can always be created, but if more than 25 entries
+ * are released back to the pool, the extras are discarded. 
+ * Items added to the stack should never maintain any kind of 
+ * state as it is entirely possible that different threads will
+ * be grabbing items from the pool
+ */
+public abstract class PoolManager<T> 
+  implements ItemManager<T> {
+
+  private static final int DEFAULT_SIZE = 25;
+  private final Stack<T> pool;
+  
+  protected PoolManager() {
+    this(DEFAULT_SIZE);
+  }
+  
+  protected PoolManager(int max) {
+    this.pool = initStack(max);
+  }
+  
+  private Stack<T> initStack(final int max) {
+    return new Stack<T>() {
+      private static final long serialVersionUID = -6647024253014661104L;
+      @Override
+      public T push(T item) {
+        T obj = super.push(item);
+        if (this.size() > max) this.removeElementAt(0);
+        return obj;
+      }
+    };
+  }
+  
+  protected synchronized T getInstance() {
+    return (!pool.empty()) ? pool.pop() : internalNewInstance();
+  }
+
+  public synchronized void release(T t) {
+    if (t == null || pool.contains(t)) return;
+    pool.push(t);
+  }
+  
+  protected abstract T internalNewInstance();
+ 
+}

Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/ProtocolConstants.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/ProtocolConstants.java?rev=632977&view=auto
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/ProtocolConstants.java (added)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/protocol/util/ProtocolConstants.java Mon Mar  3 00:11:04 2008
@@ -0,0 +1,32 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.protocol.util;
+
+public interface ProtocolConstants {
+
+  public final static int NOCACHE         = 1;
+  public final static int NOSTORE         = 2;
+  public final static int NOTRANSFORM     = 4;
+  public final static int PUBLIC          = 8;
+  public final static int PRIVATE         = 16;
+  public final static int REVALIDATE      = 32;
+  public final static int PROXYREVALIDATE = 64;
+  public final static int ONLYIFCACHED    = 128;
+
+  
+}

Added: incubator/abdera/java/trunk/core/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory?rev=632977&view=auto
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory (added)
+++ incubator/abdera/java/trunk/core/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory Mon Mar  3 00:11:04 2008
@@ -0,0 +1 @@
+org.apache.abdera.protocol.error.ErrorExtensionFactory
\ No newline at end of file

Modified: incubator/abdera/java/trunk/examples/pom.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/examples/pom.xml?rev=632977&r1=632976&r2=632977&view=diff
==============================================================================
--- incubator/abdera/java/trunk/examples/pom.xml (original)
+++ incubator/abdera/java/trunk/examples/pom.xml Mon Mar  3 00:11:04 2008
@@ -53,13 +53,7 @@
       <artifactId>abdera-parser</artifactId>
       <version>0.4.0-incubating-SNAPSHOT</version>
       <scope>compile</scope>
-    </dependency> 
-    <dependency>
-      <groupId>org.apache.abdera</groupId>
-      <artifactId>abdera-protocol</artifactId>
-      <version>0.4.0-incubating-SNAPSHOT</version>
-      <scope>compile</scope>
-    </dependency>       
+    </dependency>      
     <dependency>
       <groupId>org.apache.abdera</groupId>
       <artifactId>abdera-client</artifactId>

Modified: incubator/abdera/java/trunk/extensions/gdata/pom.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/gdata/pom.xml?rev=632977&r1=632976&r2=632977&view=diff
==============================================================================
--- incubator/abdera/java/trunk/extensions/gdata/pom.xml (original)
+++ incubator/abdera/java/trunk/extensions/gdata/pom.xml Mon Mar  3 00:11:04 2008
@@ -52,12 +52,6 @@
     </dependency>   
     <dependency>
       <groupId>org.apache.abdera</groupId>
-      <artifactId>abdera-protocol</artifactId>
-      <version>0.4.0-incubating-SNAPSHOT</version>
-      <scope>compile</scope>
-    </dependency>  
-    <dependency>
-      <groupId>org.apache.abdera</groupId>
       <artifactId>abdera-client</artifactId>
       <version>0.4.0-incubating-SNAPSHOT</version>
       <scope>compile</scope>

Modified: incubator/abdera/java/trunk/extensions/geo/pom.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/geo/pom.xml?rev=632977&r1=632976&r2=632977&view=diff
==============================================================================
--- incubator/abdera/java/trunk/extensions/geo/pom.xml (original)
+++ incubator/abdera/java/trunk/extensions/geo/pom.xml Mon Mar  3 00:11:04 2008
@@ -52,12 +52,6 @@
     </dependency>   
     <dependency>
       <groupId>org.apache.abdera</groupId>
-      <artifactId>abdera-protocol</artifactId>
-      <version>0.4.0-incubating-SNAPSHOT</version>
-      <scope>compile</scope>
-    </dependency>  
-    <dependency>
-      <groupId>org.apache.abdera</groupId>
       <artifactId>abdera-client</artifactId>
       <version>0.4.0-incubating-SNAPSHOT</version>
       <scope>compile</scope>

Modified: incubator/abdera/java/trunk/extensions/html/pom.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/html/pom.xml?rev=632977&r1=632976&r2=632977&view=diff
==============================================================================
--- incubator/abdera/java/trunk/extensions/html/pom.xml (original)
+++ incubator/abdera/java/trunk/extensions/html/pom.xml Mon Mar  3 00:11:04 2008
@@ -52,12 +52,6 @@
     </dependency>   
     <dependency>
       <groupId>org.apache.abdera</groupId>
-      <artifactId>abdera-protocol</artifactId>
-      <version>0.4.0-incubating-SNAPSHOT</version>
-      <scope>compile</scope>
-    </dependency>  
-    <dependency>
-      <groupId>org.apache.abdera</groupId>
       <artifactId>abdera-client</artifactId>
       <version>0.4.0-incubating-SNAPSHOT</version>
       <scope>compile</scope>

Modified: incubator/abdera/java/trunk/extensions/json/pom.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/json/pom.xml?rev=632977&r1=632976&r2=632977&view=diff
==============================================================================
--- incubator/abdera/java/trunk/extensions/json/pom.xml (original)
+++ incubator/abdera/java/trunk/extensions/json/pom.xml Mon Mar  3 00:11:04 2008
@@ -50,11 +50,6 @@
     </dependency>   
     <dependency>
       <groupId>org.apache.abdera</groupId>
-      <artifactId>abdera-protocol</artifactId>
-      <version>0.4.0-incubating-SNAPSHOT</version>
-    </dependency> 
-    <dependency>
-      <groupId>org.apache.abdera</groupId>
       <artifactId>abdera-server</artifactId>
       <version>0.4.0-incubating-SNAPSHOT</version>
     </dependency>  

Modified: incubator/abdera/java/trunk/extensions/main/pom.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/main/pom.xml?rev=632977&r1=632976&r2=632977&view=diff
==============================================================================
--- incubator/abdera/java/trunk/extensions/main/pom.xml (original)
+++ incubator/abdera/java/trunk/extensions/main/pom.xml Mon Mar  3 00:11:04 2008
@@ -52,12 +52,6 @@
     </dependency>   
     <dependency>
       <groupId>org.apache.abdera</groupId>
-      <artifactId>abdera-protocol</artifactId>
-      <version>0.4.0-incubating-SNAPSHOT</version>
-      <scope>compile</scope>
-    </dependency>  
-    <dependency>
-      <groupId>org.apache.abdera</groupId>
       <artifactId>abdera-client</artifactId>
       <version>0.4.0-incubating-SNAPSHOT</version>
       <scope>compile</scope>

Modified: incubator/abdera/java/trunk/extensions/media/pom.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/media/pom.xml?rev=632977&r1=632976&r2=632977&view=diff
==============================================================================
--- incubator/abdera/java/trunk/extensions/media/pom.xml (original)
+++ incubator/abdera/java/trunk/extensions/media/pom.xml Mon Mar  3 00:11:04 2008
@@ -52,12 +52,6 @@
     </dependency>   
     <dependency>
       <groupId>org.apache.abdera</groupId>
-      <artifactId>abdera-protocol</artifactId>
-      <version>0.4.0-incubating-SNAPSHOT</version>
-      <scope>compile</scope>
-    </dependency>  
-    <dependency>
-      <groupId>org.apache.abdera</groupId>
       <artifactId>abdera-client</artifactId>
       <version>0.4.0-incubating-SNAPSHOT</version>
       <scope>compile</scope>

Modified: incubator/abdera/java/trunk/extensions/oauth/pom.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/oauth/pom.xml?rev=632977&r1=632976&r2=632977&view=diff
==============================================================================
--- incubator/abdera/java/trunk/extensions/oauth/pom.xml (original)
+++ incubator/abdera/java/trunk/extensions/oauth/pom.xml Mon Mar  3 00:11:04 2008
@@ -52,12 +52,6 @@
     </dependency>   
     <dependency>
       <groupId>org.apache.abdera</groupId>
-      <artifactId>abdera-protocol</artifactId>
-      <version>0.4.0-incubating-SNAPSHOT</version>
-      <scope>compile</scope>
-    </dependency>  
-    <dependency>
-      <groupId>org.apache.abdera</groupId>
       <artifactId>abdera-client</artifactId>
       <version>0.4.0-incubating-SNAPSHOT</version>
       <scope>compile</scope>

Modified: incubator/abdera/java/trunk/extensions/opensearch/pom.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/opensearch/pom.xml?rev=632977&r1=632976&r2=632977&view=diff
==============================================================================
--- incubator/abdera/java/trunk/extensions/opensearch/pom.xml (original)
+++ incubator/abdera/java/trunk/extensions/opensearch/pom.xml Mon Mar  3 00:11:04 2008
@@ -52,12 +52,6 @@
     </dependency>   
     <dependency>
       <groupId>org.apache.abdera</groupId>
-      <artifactId>abdera-protocol</artifactId>
-      <version>0.4.0-incubating-SNAPSHOT</version>
-      <scope>compile</scope>
-    </dependency>  
-    <dependency>
-      <groupId>org.apache.abdera</groupId>
       <artifactId>abdera-client</artifactId>
       <version>0.4.0-incubating-SNAPSHOT</version>
       <scope>compile</scope>

Modified: incubator/abdera/java/trunk/extensions/serializer/pom.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/serializer/pom.xml?rev=632977&r1=632976&r2=632977&view=diff
==============================================================================
--- incubator/abdera/java/trunk/extensions/serializer/pom.xml (original)
+++ incubator/abdera/java/trunk/extensions/serializer/pom.xml Mon Mar  3 00:11:04 2008
@@ -52,12 +52,6 @@
     </dependency>   
     <dependency>
       <groupId>org.apache.abdera</groupId>
-      <artifactId>abdera-protocol</artifactId>
-      <version>0.4.0-incubating-SNAPSHOT</version>
-      <scope>compile</scope>
-    </dependency>  
-    <dependency>
-      <groupId>org.apache.abdera</groupId>
       <artifactId>abdera-server</artifactId>
       <version>0.4.0-incubating-SNAPSHOT</version>
       <scope>compile</scope>



Mime
View raw message