[Commits] (bcm) add cosmo-specific implementation of jackrabbit's DavResourceFactory which

commits at osafoundation.org commits at osafoundation.org
Wed Apr 6 12:17:51 PDT 2005


Commit by: bcm
Modified files:
server/webapps/webdav/etc/applicationContext-webdav-adapter.xml 1.6 1.7
server/webapps/webdav/src/org/osaf/cosmo/webdav/CosmoWebdavServlet.java 1.2 1.3
server/webapps/webdav/src/org/osaf/cosmo/webdav/CosmoDavSessionProvider.java 1.9 None
server/webapps/webdav/src/org/osaf/cosmo/webdav/impl/CosmoDavResourceFactoryImpl.java None 1.1
server/webapps/webdav/src/org/osaf/cosmo/webdav/impl/CosmoDavResourceImpl.java None 1.1
server/webapps/webdav/src/org/osaf/cosmo/webdav/impl/CosmoDavSessionProviderImpl.java None 1.1

Log message:
add cosmo-specific implementation of jackrabbit's DavResourceFactory which
returns instances of a cosmo subclass of DavResourceImpl. use the resource
subclass to override DavResourceImpl's importXML "feature". put these impl
classes in an impl subdir and move the DavSessionProvider impl there as well.


ViewCVS links:
http://cvs.osafoundation.org/index.cgi/server/webapps/webdav/etc/applicationContext-webdav-adapter.xml.diff?r1=text&tr1=1.6&r2=text&tr2=1.7
http://cvs.osafoundation.org/index.cgi/server/webapps/webdav/src/org/osaf/cosmo/webdav/CosmoWebdavServlet.java.diff?r1=text&tr1=1.2&r2=text&tr2=1.3
http://cvs.osafoundation.org/index.cgi/server/webapps/webdav/src/org/osaf/cosmo/webdav/CosmoDavSessionProvider.java.diff?r1=text&tr1=1.9&r2=text&tr2=None
http://cvs.osafoundation.org/index.cgi/server/webapps/webdav/src/org/osaf/cosmo/webdav/impl/CosmoDavResourceFactoryImpl.java?rev=1.1&content-type=text/vnd.viewcvs-markup
http://cvs.osafoundation.org/index.cgi/server/webapps/webdav/src/org/osaf/cosmo/webdav/impl/CosmoDavResourceImpl.java?rev=1.1&content-type=text/vnd.viewcvs-markup
http://cvs.osafoundation.org/index.cgi/server/webapps/webdav/src/org/osaf/cosmo/webdav/impl/CosmoDavSessionProviderImpl.java?rev=1.1&content-type=text/vnd.viewcvs-markup

Index: server/webapps/webdav/etc/applicationContext-webdav-adapter.xml
diff -u server/webapps/webdav/etc/applicationContext-webdav-adapter.xml:1.6 server/webapps/webdav/etc/applicationContext-webdav-adapter.xml:1.7
--- server/webapps/webdav/etc/applicationContext-webdav-adapter.xml:1.6	Wed Mar 30 11:35:30 2005
+++ server/webapps/webdav/etc/applicationContext-webdav-adapter.xml	Wed Apr  6 12:17:47 2005
@@ -18,8 +18,8 @@
     </property>
   </bean>
 
-  <bean id="davSessionProvider"
-        class="org.osaf.cosmo.webdav.CosmoDavSessionProvider">
+  <bean id="sessionProvider"
+        class="org.osaf.cosmo.webdav.impl.CosmoDavSessionProviderImpl">
     <property name="repository">
       <ref local="jcrRepository"/>
     </property>
@@ -31,4 +31,14 @@
     </property>
   </bean>
 
+  <bean id="lockManager"
+        class="org.apache.jackrabbit.server.simple.dav.lock.SimpleLockManager"/>
+
+  <bean id="resourceFactory"
+        class="org.osaf.cosmo.webdav.impl.CosmoDavResourceFactoryImpl">
+    <property name="lockManager">
+      <ref local="lockManager"/>
+    </property>
+  </bean>
+
 </beans>

Index: server/webapps/webdav/src/org/osaf/cosmo/webdav/CosmoWebdavServlet.java
diff -u server/webapps/webdav/src/org/osaf/cosmo/webdav/CosmoWebdavServlet.java:1.2 server/webapps/webdav/src/org/osaf/cosmo/webdav/CosmoWebdavServlet.java:1.3
--- server/webapps/webdav/src/org/osaf/cosmo/webdav/CosmoWebdavServlet.java:1.2	Thu Mar 17 13:32:10 2005
+++ server/webapps/webdav/src/org/osaf/cosmo/webdav/CosmoWebdavServlet.java	Wed Apr  6 12:17:48 2005
@@ -3,6 +3,7 @@
 import javax.servlet.ServletException;
 
 import org.apache.jackrabbit.server.simple.WebdavServlet;
+import org.apache.jackrabbit.webdav.DavResourceFactory;
 import org.apache.jackrabbit.webdav.DavSessionProvider;
 
 import org.apache.log4j.Logger;
@@ -12,24 +13,31 @@
 import org.springframework.web.context.support.WebApplicationContextUtils;
 
 /**
- * An extension of Jackrabbit's jcr-server @{link WebdavServlet} which
- * integrates the Spring Framework for configuring objects such as
- * the @{link Repository} and @{link DavSessionProvider}.
+ * An extension of Jackrabbit's 
+ * {@link org.apache.jackrabbit.server.simple.WebdavServlet} which
+ * integrates the Spring Framework for configuring support objects.
  */
 public class CosmoWebdavServlet extends WebdavServlet {
     private static final Logger log =
         Logger.getLogger(CosmoWebdavServlet.class);
 
     /** The name of the Spring bean identifying the servlet's
-     * @{link DavSessionProvider} */
+     * {@link org.apache.jackrabbit.webdav.DavResourceFactory}
+     */
+    public static final String BEAN_DAV_RESOURCE_FACTORY =
+        "resourceFactory";
+    /** The name of the Spring bean identifying the servlet's
+     * {@link org.apache.jackrabbit.webdav.DavSessionProvider}
+     */
     public static final String BEAN_DAV_SESSION_PROVIDER =
-        "davSessionProvider";
+        "sessionProvider";
 
     private WebApplicationContext wac;
 
     /**
-     * Load the servlet context's @{link WebApplicationContext} and
-     * find the @{link DavSessionProvider} within it.
+     * Load the servlet context's
+     * {@link org.springframework.web.context.WebApplicationContext}
+     * and look up support objects.
      *
      * @throws ServletException
      */
@@ -38,13 +46,32 @@
         wac = WebApplicationContextUtils.
             getRequiredWebApplicationContext(getServletContext());
 
+        DavSessionProvider sessionProvider = (DavSessionProvider)
+            getBean(BEAN_DAV_SESSION_PROVIDER,
+                    DavSessionProvider.class);
+        setSessionProvider(sessionProvider);
+
+        DavResourceFactory resourceFactory = (DavResourceFactory)
+            getBean(BEAN_DAV_RESOURCE_FACTORY,
+                    DavResourceFactory.class);
+        setResourceFactory(resourceFactory);
+    }
+
+    /**
+     * Looks up the bean with given name and class in the web
+     * application context.
+     *
+     * @param name the bean's name
+     * @param clazz the bean's class
+     */
+    protected Object getBean(String name, Class clazz)
+        throws ServletException {
         try {
-            DavSessionProvider sessionProvider = (DavSessionProvider)
-                wac.getBean(BEAN_DAV_SESSION_PROVIDER,
-                            DavSessionProvider.class);
-            setDavSessionProvider(sessionProvider);
+            return wac.getBean(name, clazz);
         } catch (BeansException e) {
-            throw new ServletException("Error retrieving session provider", e);
+            throw new ServletException("Error retrieving bean " + name +
+                                       " of type " + clazz +
+                                       " from web application context", e);
         }
     }
 



More information about the Commits mailing list