abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r567843 - in /incubator/abdera/java/trunk: ./ build/ dependencies/ server/src/main/java/org/apache/abdera/protocol/server/impl/ spring/ spring/src/ spring/src/main/ spring/src/main/java/ spring/src/main/java/org/ spring/src/main/java/org/ap...
Date Mon, 20 Aug 2007 21:58:58 GMT
Author: jmsnell
Date: Mon Aug 20 14:58:54 2007
New Revision: 567843

URL: http://svn.apache.org/viewvc?rev=567843&view=rev
Log:
Swing integration from Dan Diephouse. Thx!

to build using Ant, set the ABDERA_SPRING=true environment variable prior to building.

Added:
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/SingletonProviderManager.java
    incubator/abdera/java/trunk/spring/
    incubator/abdera/java/trunk/spring/pom.xml
    incubator/abdera/java/trunk/spring/src/
    incubator/abdera/java/trunk/spring/src/main/
    incubator/abdera/java/trunk/spring/src/main/java/
    incubator/abdera/java/trunk/spring/src/main/java/org/
    incubator/abdera/java/trunk/spring/src/main/java/org/apache/
    incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/
    incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/
    incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/AbstractSingleBeanDefinitionParser.java
    incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/NamespaceHandler.java
    incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/RegexTargetResolverDefinitionParser.java
    incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/RegexTargetResolverFactoryBean.java
    incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/ServiceContextDefinitionParser.java
    incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/SpringAbderaServlet.java
    incubator/abdera/java/trunk/spring/src/main/resources/
    incubator/abdera/java/trunk/spring/src/main/resources/META-INF/
    incubator/abdera/java/trunk/spring/src/main/resources/META-INF/schemas/
    incubator/abdera/java/trunk/spring/src/main/resources/META-INF/schemas/abdera-spring.xsd
    incubator/abdera/java/trunk/spring/src/main/resources/META-INF/spring.handlers
    incubator/abdera/java/trunk/spring/src/main/resources/META-INF/spring.schemas
    incubator/abdera/java/trunk/spring/src/test/
    incubator/abdera/java/trunk/spring/src/test/java/
    incubator/abdera/java/trunk/spring/src/test/java/org/
    incubator/abdera/java/trunk/spring/src/test/java/org/apache/
    incubator/abdera/java/trunk/spring/src/test/java/org/apache/abdera/
    incubator/abdera/java/trunk/spring/src/test/java/org/apache/abdera/spring/
    incubator/abdera/java/trunk/spring/src/test/java/org/apache/abdera/spring/ServiceContextDefinitionParserTest.java
    incubator/abdera/java/trunk/spring/src/test/java/org/apache/abdera/spring/TestProvider.java
    incubator/abdera/java/trunk/spring/src/test/java/org/apache/abdera/spring/beans.xml
    incubator/abdera/java/trunk/spring/src/test/resources/
Modified:
    incubator/abdera/java/trunk/build/build.xml
    incubator/abdera/java/trunk/dependencies/deps.properties
    incubator/abdera/java/trunk/pom.xml

Modified: incubator/abdera/java/trunk/build/build.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/build/build.xml?rev=567843&r1=567842&r2=567843&view=diff
==============================================================================
--- incubator/abdera/java/trunk/build/build.xml (original)
+++ incubator/abdera/java/trunk/build/build.xml Mon Aug 20 14:58:54 2007
@@ -26,6 +26,7 @@
       * docs  (build the javadocs)
       
    Set the ABDERA_XMLSECURITY=yes environment variable to build the security module
+   Set the ABDERA_SPRING=yes environment variable to build the spring module
    
 -->
   <property name="version" value="0.3.0-incubating-SNAPSHOT" />
@@ -66,6 +67,13 @@
   <property name="server.src" value="${server}/src/main/java" />
   <property name="server.work" value="${work}/server" />
   <property name="server.jar" value="${dist}/${ant.project.name}.server.${version}.jar" />
+  <property name="spring" value="${basedir}/spring" />
+  <property name="spring.src" value="${spring}/src/main/java" />
+  <property name="spring.resources" value="${spring}/src/main/resources" />
+  <property name="spring.test.src" value="${spring}/src/test/java" />
+  <property name="spring.test.resources" value="${spring}/src/test/resources" />
+  <property name="spring.work" value="${work}/spring" />
+  <property name="spring.jar" value="${dist}/${ant.project.name}.spring.${version}.jar" />
   <property name="security" value="${basedir}/security" />
   <property name="security.src" value="${security}/src/main/java" />
   <property name="security.work" value="${work}/security" />
@@ -80,6 +88,7 @@
   <property name="examples" value="${basedir}/examples" />
   <property name="examples.work" value="${work}/examples" />
   <property name="examples.src" value="${examples}/src/main/java" />
+  
   <property name="debug" value="on" />
 
   <property environment="env" />
@@ -94,7 +103,7 @@
   <property name="i18n.src" value="${dependencies}/i18n/src" />
   <property name="i18n.src.java" value="${i18n.src}/main/java" />
   <property name="i18n.src.resources" value="${i18n.src}/main/resources" />
-  <property name="i18n.version" value="0.2.2" />
+  <property name="i18n.version" value="${version}" />
   <property name="i18n.jar" value="${dependencies}/abdera-i18n-${i18n.version}.jar" />
 
   <property file="${dependencies}/deps.properties" />
@@ -180,6 +189,19 @@
         </not>
       </and>
     </condition>
+    <condition property="do.spring">
+      <istrue value="${env.ABDERA_SPRING}" />
+    </condition>
+    <condition property="do.download.spring">
+      <and>
+        <istrue value="${do.spring}" />
+        <not>
+          <and>
+            <available file="${basedir}/build/tools/${spring.zip}" />
+          </and>
+        </not>
+      </and>
+    </condition>
 
     <mkdir dir="${work}" />
     <manifest file="${work}/MANIFEST.MF">
@@ -192,9 +214,11 @@
     </manifest>
 
     <echo>Building Security? ${do.security}</echo>
+    <echo>Building Spring? ${do.spring}</echo>
 
     <antcall target="download" />
     <antcall target="downloadsecurity" />
+    <antcall target="downloadspring" />
   </target>
 
   <target name="compile.core" depends="init,compile.dependencies">
@@ -279,6 +303,27 @@
       </fileset>
     </copy>
   </target>
+  
+  <target name="compile.spring" depends="compile.server" if="do.spring">
+    <path id="spring.dependencies">
+      <path refid="jar.dependencies" />
+      <fileset dir="${basedir}/build/tools/${spring.name}/dist" includes="**/*.jar" />
+      <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}" />
+    <mkdir dir="${spring.work}/META-INF" />
+    <copy todir="${test}">
+      <fileset dir="${spring.test.resources}" includes="**/*" />
+    </copy>
+    <copy todir="${spring.work}/META-INF">
+      <fileset dir="${basedir}">
+        <include name="LICENSE" />
+        <include name="NOTICE" />
+      </fileset>
+    </copy>
+  </target>
 
   <target name="compile.security" depends="init, compile.core, compile.server" if="do.security">
     <mkdir dir="${security.work}" />
@@ -318,11 +363,11 @@
     <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">
+  <target name="build" depends="init,compile.core,compile.parser,compile.protocol,compile.server,compile.extensions,compile.client,compile.security,compile.examples,compile.spring">
   </target>
 
   <target name="docs" depends="init">
-    <javadoc packagenames="org.apache.abdera.*" excludepackagenames="org.apache.abdera.util,org.apache.abdera.ext.*.impl,org.apache.abdera.parser.**,org.apache.abdera.security.**" sourcepath="${core.src}:${extensions.src}:${security.src}:${server.src}:${parser.src}:${client.src}:${protocol.src}" destdir="${javadocs}" windowtitle="Abdera" classpathref="jar.dependencies" />
+    <javadoc packagenames="org.apache.abdera.*" excludepackagenames="org.apache.abdera.util,org.apache.abdera.parser.**,org.apache.abdera.security.**" sourcepath="${core.src}:${extensions.src}:${security.src}:${server.src}:${parser.src}:${client.src}:${protocol.src}:${spring.src}" destdir="${javadocs}" windowtitle="Abdera" classpathref="jar.dependencies" />
     <replaceregexp match="Generated by javadoc (.*) on (.*) --" replace="Generated by javadoc --" flags="g" byline="true">
       <fileset dir="${javadocs}" includes="**/*.html" />
     </replaceregexp>
@@ -378,6 +423,7 @@
     <jar destfile="${extensions.jar}" basedir="${extensions.work}" manifest="${work}/MANIFEST.MF" />
     <jar destfile="${client.jar}" basedir="${client.work}" manifest="${work}/MANIFEST.MF" />
     <antcall target="dist.security" />
+    <antcall target="dist.spring" />
     <copy todir="${dist_lib}">
       <fileset dir="${dependencies}" />
     </copy>
@@ -388,6 +434,10 @@
   <target name="dist.security" if="do.security">
     <jar destfile="${security.jar}" basedir="${security.work}" manifest="${work}/MANIFEST.MF" />
   </target>
+  
+  <target name="dist.spring" if="do.spring">
+    <jar destfile="${spring.jar}" basedir="${spring.work}" manifest="${work}/MANIFEST.MF" />
+  </target>
 
   <target name="zip" depends="retro">
     <mkdir dir="${work}/dist/${ant.project.name}.${version}" />
@@ -406,6 +456,8 @@
         <exclude name="**/${junit.jar}" />
         <exclude name="**/retroweaver-rt-${retroweaver.version}.jar" />
         <exclude name="**/${xmlsecurity.jar}" unless="do.security" />
+        <exclude name="**/${spring.mock.dir}" unless="do.spring" />
+        <exclude name="**/${spring.web.dir}"  unless="do.spring" />
       </fileset>
       <fileset dir="${docs}" includes="**/*" />
       <fileset dir="${basedir}">
@@ -434,6 +486,8 @@
         <exclude name="**/${jetty.jar}}" />
         <exclude name="**/${junit.jar}" />
         <exclude name="**/${xmlsecurity.jar}" unless="do.security" />
+        <exclude name="**/${spring.mock.dir}" unless="do.spring" />
+        <exclude name="**/${spring.web.dir}"  unless="do.spring" />
       </fileset>
       <fileset dir="${docs}" includes="**/*" />
       <fileset dir="${basedir}">
@@ -476,6 +530,13 @@
       <get src="${bouncycastle.dir}/${bouncycastle.jar}" dest="${dependencies}/${bouncycastle.jar}" usetimestamp="true" />
     </parallel>
   </target>
+  
+  <target name="downloadspring" if="do.download.spring">
+    <mkdir dir="${basedir}/build/tools"/>
+    <get src="${spring.dir}/${spring.zip}" dest="${basedir}/build/tools/${spring.zip}" />
+    <unzip src="${basedir}/build/tools/${spring.zip}" dest="${basedir}/build/tools/" overwrite="true" />
+  </target>
+  
   <target name="download" if="do.download">
     <echo>Downloading project dependencies.  This may take a moment</echo>
     <parallel>
@@ -485,9 +546,6 @@
       <get src="${axiom.dir}/${axiom.impl.jar}" dest="${dependencies}/${axiom.impl.jar}" usetimestamp="true" />
       <get src="${jaxen.dir}/${jaxen.jar}" dest="${dependencies}/${jaxen.jar}" usetimestamp="true" />
       <get src="${log4j.dir}/${log4j.jar}" dest="${dependencies}/${log4j.jar}" usetimestamp="true" />
-      <!--get src="${stax.dir}/${stax.jar}"
-           dest="${dependencies}/${stax.jar}"
-           usetimestamp="true" /-->
       <get src="${stax.dir}/${stax.api.jar}" dest="${dependencies}/${stax.api.jar}" usetimestamp="true" />
       <get src="${commons.logging.dir}/${commons.logging.jar}" dest="${dependencies}/${commons.logging.jar}" usetimestamp="true" />
       <get src="${commons.codec.dir}/${commons.codec.jar}" dest="${dependencies}/${commons.codec.jar}" usetimestamp="true" />
@@ -528,6 +586,7 @@
     <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" />
+    <property name="retro_spring.jar" value="${dist}/${ant.project.name}.spring.${version}.retro.jar" />
     <condition property="do.download.retroweaver">
       <not>
         <available file="${retrozip}" />
@@ -557,6 +616,7 @@
       <arg line="-jar &quot;${client.jar}&quot; &quot;${retro_client.jar}&quot;" />
     </java>
     <antcall target="retro.security" />
+    <antcall target="retro.spring" />
     <copy todir="${dist_lib}" file="${retro}/release/retroweaver-rt-${retroweaver.version}.jar" />
   </target>
 
@@ -566,6 +626,13 @@
       <arg line="-jar &quot;${security.jar}&quot; &quot;${retro_security.jar}&quot;" />
     </java>
     <get src="${bouncycastle.dir}/${bouncycastle.jar.retro}" dest="${dependencies}/${bouncycastle.jar.retro}" usetimestamp="true" ignoreerrors="true" />
+  </target>
+  
+  <target name="retro.spring" if="do.spring">
+    <property name="retro_spring.jar" value="${dist}/${ant.project.name}.spring.${version}.retro.jar" />
+    <java classpathref="jar.retro" classname="net.sourceforge.retroweaver.Weaver" fork="yes">
+      <arg line="-jar &quot;${spring.jar}&quot; &quot;${retro_spring.jar}&quot;" />
+    </java>
   </target>
 
   <target name="go_retro" if="do.download.retroweaver">

Modified: incubator/abdera/java/trunk/dependencies/deps.properties
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/deps.properties?rev=567843&r1=567842&r2=567843&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/deps.properties (original)
+++ incubator/abdera/java/trunk/dependencies/deps.properties Mon Aug 20 14:58:54 2007
@@ -52,3 +52,8 @@
 
 json.dir=http://json.org/java
 json.zip=apache.zip
+
+
+spring.dir=http://downloads.sourceforge.net/springframework
+spring.zip=spring-framework-2.0.6.zip
+spring.name=spring-framework-2.0.6
\ No newline at end of file

Modified: incubator/abdera/java/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/pom.xml?rev=567843&r1=567842&r2=567843&view=diff
==============================================================================
--- incubator/abdera/java/trunk/pom.xml (original)
+++ incubator/abdera/java/trunk/pom.xml Mon Aug 20 14:58:54 2007
@@ -277,6 +277,7 @@
     <module>server</module>
     <module>client</module>
     <module>extensions</module>
+    <module>spring</module>
     <module>examples</module>
   </modules>
   

Added: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/SingletonProviderManager.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/SingletonProviderManager.java?rev=567843&view=auto
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/SingletonProviderManager.java (added)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/SingletonProviderManager.java Mon Aug 20 14:58:54 2007
@@ -0,0 +1,33 @@
+/*
+* 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.server.impl;
+
+import org.apache.abdera.protocol.server.Provider;
+
+public class SingletonProviderManager 
+  extends AbstractSingletonProviderManager {
+
+  @Override
+  protected Provider initProvider() {
+    return provider;
+  }
+
+  public void setProvider(Provider provider) {
+    this.provider = provider;
+  }
+}

Added: incubator/abdera/java/trunk/spring/pom.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/spring/pom.xml?rev=567843&view=auto
==============================================================================
--- incubator/abdera/java/trunk/spring/pom.xml (added)
+++ incubator/abdera/java/trunk/spring/pom.xml Mon Aug 20 14:58:54 2007
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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. -->
+<project 
+  xmlns="http://maven.apache.org/POM/4.0.0" 
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>org.apache.abdera</groupId>
+    <artifactId>abdera</artifactId>
+    <version>0.3.0-incubating-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>abdera-spring</artifactId>
+  <packaging>jar</packaging>  
+  <name>Abdera Spring Integration</name>  
+  <version>0.3.0-incubating-SNAPSHOT</version>
+  <description>Spring Integration Code for Abdera</description>  
+  <inceptionYear>2006</inceptionYear>
+  <url>http://incubator.apache.org/abdera</url>
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/abdera/java/trunk/spring/</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/abdera/java/trunk/spring/</developerConnection>
+    <url>http://svn.apache.org/repos/asf/incubator/abdera/java/trunk/spring/</url>
+  </scm>
+  <dependencies>
+      <dependency>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+      </dependency>
+    <dependency>
+      <groupId>org.apache.abdera</groupId>
+      <artifactId>abdera-server</artifactId>
+      <version>0.3.0-incubating-SNAPSHOT</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <version>2.4</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-web</artifactId>
+      <version>2.0.6</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-mock</artifactId>
+      <version>2.0.6</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>
+<!--
+  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. -->
+<project 
+  xmlns="http://maven.apache.org/POM/4.0.0" 
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>org.apache.abdera</groupId>
+    <artifactId>abdera</artifactId>
+    <version>0.3.0-incubating-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>abdera-spring</artifactId>
+  <packaging>jar</packaging>  
+  <name>Abdera Spring Integration</name>  
+  <version>0.3.0-incubating-SNAPSHOT</version>
+  <description>Spring Integration Code for Abdera</description>  
+  <inceptionYear>2006</inceptionYear>
+  <url>http://incubator.apache.org/abdera</url>
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/abdera/java/trunk/spring/</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/abdera/java/trunk/spring/</developerConnection>
+    <url>http://svn.apache.org/repos/asf/incubator/abdera/java/trunk/spring/</url>
+  </scm>
+  <dependencies>
+      <dependency>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+      </dependency>
+    <dependency>
+      <groupId>org.apache.abdera</groupId>
+      <artifactId>abdera-server</artifactId>
+      <version>0.3.0-incubating-SNAPSHOT</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <version>2.4</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-web</artifactId>
+      <version>2.0.6</version>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-mock</artifactId>
+      <version>2.0.6</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>

Added: incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/AbstractSingleBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/AbstractSingleBeanDefinitionParser.java?rev=567843&view=auto
==============================================================================
--- incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/AbstractSingleBeanDefinitionParser.java (added)
+++ incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/AbstractSingleBeanDefinitionParser.java Mon Aug 20 14:58:54 2007
@@ -0,0 +1,132 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. 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.
+ */
+package org.apache.abdera.spring;
+
+import org.apache.abdera.protocol.server.impl.SingletonProviderManager;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.config.BeanDefinitionHolder;
+import org.springframework.beans.factory.support.AbstractBeanDefinition;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
+import org.springframework.beans.factory.xml.ParserContext;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public abstract class AbstractSingleBeanDefinitionParser 
+    extends org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser {
+
+    public AbstractSingleBeanDefinitionParser() {
+        super();
+    }
+
+    @Override
+    protected void doParse(Element element, ParserContext ctx, BeanDefinitionBuilder bean) {
+        NamedNodeMap atts = element.getAttributes();
+        for (int i = 0; i < atts.getLength(); i++) {
+            Attr node = (Attr) atts.item(i);
+            String val = node.getValue();
+            String name = node.getLocalName();
+            
+            if ("abstract".equals(name)) {
+                bean.setAbstract(true);
+            } else if (!"id".equals(name) && !"name".equals(name)) {
+                mapAttribute(bean, element, name, val);
+            }
+        }
+        
+        NodeList children = element.getChildNodes();
+        for (int i = 0; i < children.getLength(); i++) {
+            Node n = children.item(i);
+            if (n.getNodeType() == Node.ELEMENT_NODE) {
+                String name = n.getLocalName();
+                
+                mapElement(ctx, bean, (Element) n, name);
+            }
+        }
+    }
+
+    protected void mapElement(ParserContext ctx, BeanDefinitionBuilder bean, Element element, String name) {
+        
+    }
+
+    protected void mapAttribute(BeanDefinitionBuilder bean, Element element, String name, String val) {
+
+    }
+    
+    protected void setFirstChildAsProperty(Element element, ParserContext ctx, BeanDefinitionBuilder bean, String propertyName) {
+        String id = getAndRegisterFirstChild(element, ctx, bean, propertyName);
+        bean.addPropertyReference(propertyName, id);
+        
+    }
+
+    protected String getAndRegisterFirstChild(Element element, ParserContext ctx, BeanDefinitionBuilder bean, String propertyName) {
+        Element first = getFirstChild(element);
+        
+        if (first == null) {
+            throw new IllegalStateException(propertyName + " property must have child elements!");
+        }
+        
+        // Seems odd that we have to do the registration, I wonder if there is a better way
+        String id;
+        BeanDefinition child;
+        if (first.getNamespaceURI().equals(BeanDefinitionParserDelegate.BEANS_NAMESPACE_URI)) {
+            String name = first.getLocalName();
+            if ("ref".equals(name)) {
+                id = first.getAttribute("bean");
+                if (id == null) {
+                    throw new IllegalStateException("<ref> elements must have a \"bean\" attribute!");
+                }
+                return id;
+            } else if ("bean".equals(name)) {
+                BeanDefinitionHolder bdh = ctx.getDelegate().parseBeanDefinitionElement(first);
+                child = bdh.getBeanDefinition();
+                id = bdh.getBeanName();
+            } else {
+                throw new UnsupportedOperationException("Elements with the name " + name  
+                                                        + " are not currently "
+                                                        + "supported as sub elements of " 
+                                                        + element.getLocalName());
+            }
+            
+        } else {
+            child = ctx.getDelegate().parseCustomElement(first, bean.getBeanDefinition());
+            id = child.toString();
+        }
+    
+        ctx.getRegistry().registerBeanDefinition(id, child);
+        return id;
+    }
+
+    protected Element getFirstChild(Element element) {
+        Element first = null;
+        NodeList children = element.getChildNodes();
+        for (int i = 0; i < children.getLength(); i++) {
+            Node n = children.item(i);
+            if (n.getNodeType() == Node.ELEMENT_NODE) {
+                first = (Element) n;
+            }
+        }
+        return first;
+    }
+
+}

Added: incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/NamespaceHandler.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/NamespaceHandler.java?rev=567843&view=auto
==============================================================================
--- incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/NamespaceHandler.java (added)
+++ incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/NamespaceHandler.java Mon Aug 20 14:58:54 2007
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. 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.
+ */
+package org.apache.abdera.spring;
+
+import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
+
+public class NamespaceHandler extends NamespaceHandlerSupport {
+    public void init() {
+        registerBeanDefinitionParser("serviceContext", new ServiceContextDefinitionParser());
+        registerBeanDefinitionParser("regexTargetResolver", new RegexTargetResolverDefinitionParser());
+    }
+}

Added: incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/RegexTargetResolverDefinitionParser.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/RegexTargetResolverDefinitionParser.java?rev=567843&view=auto
==============================================================================
--- incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/RegexTargetResolverDefinitionParser.java (added)
+++ incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/RegexTargetResolverDefinitionParser.java Mon Aug 20 14:58:54 2007
@@ -0,0 +1,131 @@
+/*
+* 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.spring;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.beans.factory.BeanDefinitionStoreException;
+import org.springframework.beans.factory.support.AbstractBeanDefinition;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.xml.ParserContext;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class RegexTargetResolverDefinitionParser 
+    extends org.apache.abdera.spring.AbstractSingleBeanDefinitionParser {
+
+    @Override
+    protected void doParse(Element element, ParserContext ctx, BeanDefinitionBuilder bean) {
+        NamedNodeMap atts = element.getAttributes();
+        for (int i = 0; i < atts.getLength(); i++) {
+            Attr node = (Attr) atts.item(i);
+            String val = node.getValue();
+            String name = node.getLocalName();
+            
+            if ("abstract".equals(name)) {
+                bean.setAbstract(true);
+            } else if (!"id".equals(name) && !"name".equals(name)) {
+                mapAttribute(bean, element, name, val);
+            }
+        }
+        
+        List<String> collection = new ArrayList<String>();
+        List<String> category = new ArrayList<String>();
+        List<String> entry = new ArrayList<String>();
+        List<String> service = new ArrayList<String>();
+        List<String> media = new ArrayList<String>();
+        
+        NodeList children = element.getChildNodes();
+        for (int i = 0; i < children.getLength(); i++) {
+            Node n = children.item(i);
+            if (n.getNodeType() == Node.ELEMENT_NODE) {
+                String name = n.getLocalName();
+                
+                if (name.equals("collection")) {
+                    collection.add(getText(n));
+                } else if (name.equals("category")) {
+                    category.add(getText(n));
+                } else if (name.equals("entry")) {
+                    entry.add(getText(n));
+                } else if (name.equals("media")) {
+                    media.add(getText(n));
+                } else if (name.equals("service")) {
+                    service.add(getText(n));
+                }
+            }
+        }
+        
+        bean.addPropertyValue("categories", category);
+        bean.addPropertyValue("collections", collection);
+        bean.addPropertyValue("entries", entry);
+        bean.addPropertyValue("media", media);
+        bean.addPropertyValue("services", service);
+    }
+
+    private String getText(Node n) {
+        if (n == null) {
+            return null;
+        }
+
+        Node n1 = getChild(n, Node.TEXT_NODE);
+
+        if (n1 == null) {
+            return null;
+        }
+
+        return n1.getNodeValue().trim();
+    }
+
+    public static Node getChild(Node parent, int type) {
+        Node n = parent.getFirstChild();
+        while (n != null && type != n.getNodeType()) {
+            n = n.getNextSibling();
+        }
+        if (n == null) {
+            return null;
+        }
+        return n;
+    }
+    
+    @Override
+    protected String getBeanClassName(Element arg0) {
+        String cls = super.getBeanClassName(arg0);
+        
+        if (cls == null) {
+            cls = RegexTargetResolverFactoryBean.class.getName();
+        }
+        
+        return cls;
+    }
+
+    @Override
+    protected String resolveId(Element arg0, AbstractBeanDefinition arg1, ParserContext arg2) throws BeanDefinitionStoreException {
+        String id = super.resolveId(arg0, arg1, arg2);
+        
+        if (id == null) {
+            id = RegexTargetResolverFactoryBean.class.getName() + new Object().hashCode();
+        }
+        return id;
+    }
+    
+}

Added: incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/RegexTargetResolverFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/RegexTargetResolverFactoryBean.java?rev=567843&view=auto
==============================================================================
--- incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/RegexTargetResolverFactoryBean.java (added)
+++ incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/RegexTargetResolverFactoryBean.java Mon Aug 20 14:58:54 2007
@@ -0,0 +1,92 @@
+/*
+* 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.spring;
+
+import java.util.List;
+
+import org.apache.abdera.protocol.server.TargetType;
+import org.apache.abdera.protocol.server.impl.RegexTargetResolver;
+import org.springframework.beans.factory.FactoryBean;
+
+public class RegexTargetResolverFactoryBean implements FactoryBean {
+    private List<String> services;
+    private List<String> collections;
+    private List<String> entries;
+    private List<String> media;
+    private List<String> categories;
+    
+    public Object getObject() throws Exception {
+        RegexTargetResolver resolver = new RegexTargetResolver();
+        
+        init(resolver, services, TargetType.TYPE_SERVICE);
+        init(resolver, collections, TargetType.TYPE_COLLECTION);
+        init(resolver, entries, TargetType.TYPE_ENTRY);
+        init(resolver, media, TargetType.TYPE_MEDIA);
+        init(resolver, categories, TargetType.TYPE_CATEGORIES);
+        return resolver;
+    }
+    
+    private void init(RegexTargetResolver resolver, List<String> patterns,
+                      TargetType t) {
+        if (patterns == null) return;
+        
+        for (String s : patterns) {
+            resolver.setPattern(s, t);
+        }
+    }
+    public Class getObjectType() {
+        return RegexTargetResolver.class;
+    }
+    
+    public boolean isSingleton() {
+        return true;
+    }
+    
+    public List<String> getCollections() {
+        return collections;
+    }
+    public void setCollections(List<String> collections) {
+        this.collections = collections;
+    }
+    public List<String> getEntries() {
+        return entries;
+    }
+    public void setEntries(List<String> entries) {
+        this.entries = entries;
+    }
+    public List<String> getServices() {
+        return services;
+    }
+    public void setServices(List<String> services) {
+        this.services = services;
+    }
+    public List<String> getCategories() {
+        return categories;
+    }
+    public void setCategories(List<String> categories) {
+        this.categories = categories;
+    }
+    public List<String> getMedia() {
+        return media;
+    }
+    public void setMedia(List<String> media) {
+        this.media = media;
+    }
+    
+    
+}

Added: incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/ServiceContextDefinitionParser.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/ServiceContextDefinitionParser.java?rev=567843&view=auto
==============================================================================
--- incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/ServiceContextDefinitionParser.java (added)
+++ incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/ServiceContextDefinitionParser.java Mon Aug 20 14:58:54 2007
@@ -0,0 +1,87 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. 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.
+ */
+package org.apache.abdera.spring;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import org.apache.abdera.protocol.server.ServiceContext;
+import org.apache.abdera.protocol.server.impl.DefaultServiceContext;
+import org.apache.abdera.protocol.server.impl.SingletonProviderManager;
+import org.springframework.beans.factory.BeanDefinitionStoreException;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.config.BeanDefinitionHolder;
+import org.springframework.beans.factory.support.AbstractBeanDefinition;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
+import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
+import org.springframework.beans.factory.xml.ParserContext;
+
+public class ServiceContextDefinitionParser 
+    extends org.apache.abdera.spring.AbstractSingleBeanDefinitionParser {
+
+    @Override
+    protected void mapElement(ParserContext ctx, BeanDefinitionBuilder bean, Element element, String name) {
+        if (name.equals("provider")) {
+            String id = getAndRegisterFirstChild(element, ctx, bean, "provider");
+            
+            BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(SingletonProviderManager.class);
+            builder.addPropertyReference("provider", id);
+            AbstractBeanDefinition singletonBean = builder.getBeanDefinition();
+            ctx.getRegistry().registerBeanDefinition(SingletonProviderManager.class.getName() + hashCode(), 
+                                                     singletonBean);
+            
+            bean.addPropertyValue("providerManager", singletonBean);
+        } else if (name.equals("providerManager")) {
+            setFirstChildAsProperty(element, ctx, bean, "providerManager");
+        } else if (name.equals("targetResolver")) {
+            setFirstChildAsProperty(element, ctx, bean, "targetResolver");
+        } else if (name.equals("subjectResolver")) {
+            setFirstChildAsProperty(element, ctx, bean, "subjectResolver");
+        }
+    }
+
+    @Override
+    protected String getBeanClassName(Element arg0) {
+        String cls = super.getBeanClassName(arg0);
+        
+        if (cls == null) {
+            cls = DefaultServiceContext.class.getName();
+        }
+        
+        return cls;
+    }
+
+    @Override
+    protected String resolveId(Element element, AbstractBeanDefinition arg1, ParserContext arg2) throws BeanDefinitionStoreException {
+        String id = element.getAttribute("id");
+        
+        if (id == null || "".equals(id)) {
+            id = ServiceContext.class.getName();
+        }
+        
+        
+        return id;
+    }
+    
+}
+ 
\ No newline at end of file

Added: incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/SpringAbderaServlet.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/SpringAbderaServlet.java?rev=567843&view=auto
==============================================================================
--- incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/SpringAbderaServlet.java (added)
+++ incubator/abdera/java/trunk/spring/src/main/java/org/apache/abdera/spring/SpringAbderaServlet.java Mon Aug 20 14:58:54 2007
@@ -0,0 +1,45 @@
+/**
+ * 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.spring;
+
+import org.apache.abdera.protocol.server.ServiceContext;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+/**
+ * Loads a Spring ServiceContext from a Spring WebApplicationContext.
+ * By default it looks for a bean with the name "org.apache.abdera.protocol.server.ServiceContext". 
+ * This can be overridden by supplying the "serviceContextBeanName" initialization
+ * parameter.
+ */
+public class SpringAbderaServlet extends org.apache.abdera.protocol.server.servlet.AbderaServlet {
+    
+    protected ServiceContext createServiceContext() {
+        String contextName = getInitParameter("serviceContextBeanName");
+        if (contextName == null) {
+            contextName = ServiceContext.class.getName();
+        }
+        
+        WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
+        
+        ServiceContext sc = (ServiceContext) ctx.getBean(contextName);
+        sc.init(getAbdera(), getProperties(getServletConfig()));
+        return sc;
+    }
+}
+ 
\ No newline at end of file

Added: incubator/abdera/java/trunk/spring/src/main/resources/META-INF/schemas/abdera-spring.xsd
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/spring/src/main/resources/META-INF/schemas/abdera-spring.xsd?rev=567843&view=auto
==============================================================================
--- incubator/abdera/java/trunk/spring/src/main/resources/META-INF/schemas/abdera-spring.xsd (added)
+++ incubator/abdera/java/trunk/spring/src/main/resources/META-INF/schemas/abdera-spring.xsd Mon Aug 20 14:58:54 2007
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. 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.
+-->
+<xsd:schema
+  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+  xmlns:beans="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"
+  targetNamespace="http://abdera.apache.org" 
+  elementFormDefault="qualified"
+  attributeFormDefault="unqualified"  >
+
+  <xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans.xsd"/>
+
+  <xsd:element name="serviceContext">
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:extension base="beans:identifiedType">
+          <xsd:sequence>
+            <xsd:element name="provider" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="providerManager" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="targetResolver" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="subjectResolver" type="xsd:anyType" minOccurs="0"/>
+          </xsd:sequence>
+          <xsd:attribute name="class" type="xsd:string" />
+        </xsd:extension>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="regexTargetResolver">
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:extension base="beans:identifiedType">
+          <xsd:sequence>
+            <xsd:element name="category" type="xsd:anyType" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element name="collection" type="xsd:anyType" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element name="entry" type="xsd:anyType" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element name="media" type="xsd:anyType" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element name="service" type="xsd:anyType" minOccurs="0" maxOccurs="unbounded"/>
+          </xsd:sequence>
+        </xsd:extension>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+</xsd:schema>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. 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.
+-->
+<xsd:schema
+  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+  xmlns:beans="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"
+  targetNamespace="http://abdera.apache.org" 
+  elementFormDefault="qualified"
+  attributeFormDefault="unqualified"  >
+
+  <xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans.xsd"/>
+
+  <xsd:element name="serviceContext">
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:extension base="beans:identifiedType">
+          <xsd:sequence>
+            <xsd:element name="provider" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="providerManager" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="targetResolver" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="subjectResolver" type="xsd:anyType" minOccurs="0"/>
+          </xsd:sequence>
+          <xsd:attribute name="class" type="xsd:string" />
+        </xsd:extension>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+
+  <xsd:element name="regexTargetResolver">
+    <xsd:complexType>
+      <xsd:complexContent>
+        <xsd:extension base="beans:identifiedType">
+          <xsd:sequence>
+            <xsd:element name="category" type="xsd:anyType" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element name="collection" type="xsd:anyType" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element name="entry" type="xsd:anyType" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element name="media" type="xsd:anyType" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element name="service" type="xsd:anyType" minOccurs="0" maxOccurs="unbounded"/>
+          </xsd:sequence>
+        </xsd:extension>
+      </xsd:complexContent>
+    </xsd:complexType>
+  </xsd:element>
+</xsd:schema>

Added: incubator/abdera/java/trunk/spring/src/main/resources/META-INF/spring.handlers
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/spring/src/main/resources/META-INF/spring.handlers?rev=567843&view=auto
==============================================================================
--- incubator/abdera/java/trunk/spring/src/main/resources/META-INF/spring.handlers (added)
+++ incubator/abdera/java/trunk/spring/src/main/resources/META-INF/spring.handlers Mon Aug 20 14:58:54 2007
@@ -0,0 +1,41 @@
+#
+#
+#
+#    Licensed to the Apache Software Foundation (ASF) under one
+#    or more contributor license agreements. See the NOTICE file
+#    distributed with this work for additional information
+#    regarding copyright ownership. 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.
+#
+#
+http\://abdera.apache.org=org.apache.abdera.spring.NamespaceHandler#
+#    Licensed to the Apache Software Foundation (ASF) under one
+#    or more contributor license agreements. See the NOTICE file
+#    distributed with this work for additional information
+#    regarding copyright ownership. 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.
+#
+#
+http\://abdera.apache.org=org.apache.abdera.spring.NamespaceHandler
\ No newline at end of file

Added: incubator/abdera/java/trunk/spring/src/main/resources/META-INF/spring.schemas
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/spring/src/main/resources/META-INF/spring.schemas?rev=567843&view=auto
==============================================================================
--- incubator/abdera/java/trunk/spring/src/main/resources/META-INF/spring.schemas (added)
+++ incubator/abdera/java/trunk/spring/src/main/resources/META-INF/spring.schemas Mon Aug 20 14:58:54 2007
@@ -0,0 +1,41 @@
+#
+#
+#
+#    Licensed to the Apache Software Foundation (ASF) under one
+#    or more contributor license agreements. See the NOTICE file
+#    distributed with this work for additional information
+#    regarding copyright ownership. 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.
+#
+#
+http\://abdera.apache.org/schemas/abdera-spring.xsd=META-INF/schemas/abdera-spring.xsd#
+#    Licensed to the Apache Software Foundation (ASF) under one
+#    or more contributor license agreements. See the NOTICE file
+#    distributed with this work for additional information
+#    regarding copyright ownership. 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.
+#
+#
+http\://abdera.apache.org/schemas/abdera-spring.xsd=META-INF/schemas/abdera-spring.xsd
\ No newline at end of file

Added: incubator/abdera/java/trunk/spring/src/test/java/org/apache/abdera/spring/ServiceContextDefinitionParserTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/spring/src/test/java/org/apache/abdera/spring/ServiceContextDefinitionParserTest.java?rev=567843&view=auto
==============================================================================
--- incubator/abdera/java/trunk/spring/src/test/java/org/apache/abdera/spring/ServiceContextDefinitionParserTest.java (added)
+++ incubator/abdera/java/trunk/spring/src/test/java/org/apache/abdera/spring/ServiceContextDefinitionParserTest.java Mon Aug 20 14:58:54 2007
@@ -0,0 +1,53 @@
+/**
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. 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.
+ */
+package org.apache.abdera.spring;
+
+import org.apache.abdera.protocol.ItemManager;
+import org.apache.abdera.protocol.Resolver;
+import org.apache.abdera.protocol.server.Provider;
+import org.apache.abdera.protocol.server.ServiceContext;
+import org.apache.abdera.protocol.server.Target;
+import org.apache.abdera.protocol.server.impl.RegexTargetResolver;
+import org.apache.abdera.protocol.server.impl.SingletonProviderManager;
+import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
+
+public class ServiceContextDefinitionParserTest 
+    extends AbstractDependencyInjectionSpringContextTests {
+
+    public void testParser() throws Exception {
+        ServiceContext ctx = (ServiceContext) applicationContext.getBean(ServiceContext.class.getName());
+        
+        ItemManager<Provider> pm = ctx.getProviderManager();
+        assertTrue(pm instanceof SingletonProviderManager);
+        
+        Provider provider = pm.get(null);
+        assertTrue(provider instanceof TestProvider);
+        
+        Resolver<Target> tresolver = ctx.getTargetResolver("/path");
+        assertTrue(tresolver instanceof RegexTargetResolver);
+    }
+    
+    @Override
+    protected String getConfigPath() {
+        return "/org/apache/abdera/spring/beans.xml";
+    }
+    
+}
+ 
\ No newline at end of file

Added: incubator/abdera/java/trunk/spring/src/test/java/org/apache/abdera/spring/TestProvider.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/spring/src/test/java/org/apache/abdera/spring/TestProvider.java?rev=567843&view=auto
==============================================================================
--- incubator/abdera/java/trunk/spring/src/test/java/org/apache/abdera/spring/TestProvider.java (added)
+++ incubator/abdera/java/trunk/spring/src/test/java/org/apache/abdera/spring/TestProvider.java Mon Aug 20 14:58:54 2007
@@ -0,0 +1,40 @@
+package org.apache.abdera.spring;
+
+import org.apache.abdera.protocol.server.Provider;
+import org.apache.abdera.protocol.server.RequestContext;
+import org.apache.abdera.protocol.server.ResponseContext;
+import org.apache.abdera.protocol.server.impl.AbstractProvider;
+
+public class TestProvider extends AbstractProvider {
+
+    public ResponseContext createEntry(RequestContext request) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public ResponseContext deleteEntry(RequestContext request) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public ResponseContext getEntry(RequestContext request) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public ResponseContext getFeed(RequestContext request) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public ResponseContext getService(RequestContext request) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public ResponseContext updateEntry(RequestContext request) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Added: incubator/abdera/java/trunk/spring/src/test/java/org/apache/abdera/spring/beans.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/spring/src/test/java/org/apache/abdera/spring/beans.xml?rev=567843&view=auto
==============================================================================
--- incubator/abdera/java/trunk/spring/src/test/java/org/apache/abdera/spring/beans.xml (added)
+++ incubator/abdera/java/trunk/spring/src/test/java/org/apache/abdera/spring/beans.xml Mon Aug 20 14:58:54 2007
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:a="http://abdera.apache.org"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="
+    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+    http://abdera.apache.org http://abdera.apache.org/schemas/abdera-spring.xsd">
+
+  <!-- Abdera -->
+  <a:serviceContext>
+  
+    <a:provider>
+      <ref bean="provider"/>
+    </a:provider>
+    
+    <a:targetResolver>
+      <a:regexTargetResolver>
+        <a:collection>/atom/feed(\\?[^#]*)?</a:collection>
+        <a:entry>/atom/feed/([^/#?]+)(\\?[^#]*)?</a:entry>
+        <a:service>/atom(\\?[^#]*)?</a:service>
+      </a:regexTargetResolver>
+    </a:targetResolver>
+    
+  </a:serviceContext>
+
+  
+  <bean id="provider" class="org.apache.abdera.spring.TestProvider">
+  </bean>
+
+</beans><beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:a="http://abdera.apache.org"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="
+    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+    http://abdera.apache.org http://abdera.apache.org/schemas/abdera-spring.xsd">
+
+  <!-- Abdera -->
+  <a:serviceContext>
+  
+    <a:provider>
+      <ref bean="provider"/>
+    </a:provider>
+    
+    <a:targetResolver>
+      <a:regexTargetResolver>
+        <a:collection>/atom/feed(\\?[^#]*)?</a:collection>
+        <a:entry>/atom/feed/([^/#?]+)(\\?[^#]*)?</a:entry>
+        <a:service>/atom(\\?[^#]*)?</a:service>
+      </a:regexTargetResolver>
+    </a:targetResolver>
+    
+  </a:serviceContext>
+
+  
+  <bean id="provider" class="org.apache.abdera.spring.TestProvider">
+  </bean>
+
+</beans>
\ No newline at end of file



Mime
View raw message