cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1081303 - in /cxf/branches/2.3.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/lifecycle/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/
Date Mon, 14 Mar 2011 10:15:00 GMT
Author: sergeyb
Date: Mon Mar 14 10:15:00 2011
New Revision: 1081303

URL: http://svn.apache.org/viewvc?rev=1081303&view=rev
Log:
Merged revisions 1081299 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1081299 | sergeyb | 2011-03-14 10:08:12 +0000 (Mon, 14 Mar 2011) | 1 line
  
  JAX-RS: Documenting the ResourceProvider interface and implementations
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/lifecycle/PerRequestResourceProvider.java
    cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/lifecycle/ResourceProvider.java
    cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/lifecycle/SingletonResourceProvider.java
    cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/SpringResourceFactory.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
    svn:mergeinfo = /cxf/trunk:1081299

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/lifecycle/PerRequestResourceProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/lifecycle/PerRequestResourceProvider.java?rev=1081303&r1=1081302&r2=1081303&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/lifecycle/PerRequestResourceProvider.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/lifecycle/PerRequestResourceProvider.java
Mon Mar 14 10:15:00 2011
@@ -30,6 +30,10 @@ import org.apache.cxf.jaxrs.utils.Inject
 import org.apache.cxf.jaxrs.utils.ResourceUtils;
 import org.apache.cxf.message.Message;
 
+/**
+ * The default per-request resource provider which creates 
+ * a new resource instance per every request
+ */
 public class PerRequestResourceProvider implements ResourceProvider {
     private Constructor<?> c;
     private Method postConstructMethod;
@@ -45,15 +49,20 @@ public class PerRequestResourceProvider 
         preDestroyMethod = ResourceUtils.findPreDestroyMethod(clazz);
     }
     
+    /**
+     * {@inheritDoc}
+     */
     public boolean isSingleton() {
         return false;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Object getInstance(Message m) {  
         return createInstance(m);
     }
     
-        
     protected Object createInstance(Message m) {
         
         Object[] values = ResourceUtils.createConstructorArguments(c, m);
@@ -77,10 +86,16 @@ public class PerRequestResourceProvider 
         
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void releaseInstance(Message m, Object o) {
         InjectionUtils.invokeLifeCycleMethod(o, preDestroyMethod);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Class<?> getResourceClass() {
         return c.getDeclaringClass();
     }

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/lifecycle/ResourceProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/lifecycle/ResourceProvider.java?rev=1081303&r1=1081302&r2=1081303&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/lifecycle/ResourceProvider.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/lifecycle/ResourceProvider.java
Mon Mar 14 10:15:00 2011
@@ -22,13 +22,33 @@ package org.apache.cxf.jaxrs.lifecycle;
 import org.apache.cxf.message.Message;
 
 /**
- * ResourceProviders are used to specify the lifecycle 
- * (per-request or singleton primarily) of root resources.
+ * ResourceProvider controls the life-cycle of the JAX-RS root resources.
  */
 public interface ResourceProvider {
 
+    /**
+     * Returns the resource instance which will handle the current request 
+     * @param m the current request message
+     * @return resource instance
+     */
     Object getInstance(Message m);
+    
+    /**
+     * Releases the resource instance if needed
+     * @param m the current request message
+     * @param o resource instance
+     */
     void releaseInstance(Message m, Object o);
+    
+    /**
+     * Returns the Class of the resource
+     * @return
+     */
     Class<?> getResourceClass();
+    
+    /**
+     * Indicates if the managed resource is a singleton
+     * @return
+     */
     boolean isSingleton();
 }

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/lifecycle/SingletonResourceProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/lifecycle/SingletonResourceProvider.java?rev=1081303&r1=1081302&r2=1081303&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/lifecycle/SingletonResourceProvider.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/lifecycle/SingletonResourceProvider.java
Mon Mar 14 10:15:00 2011
@@ -24,6 +24,10 @@ import org.apache.cxf.jaxrs.utils.Inject
 import org.apache.cxf.jaxrs.utils.ResourceUtils;
 import org.apache.cxf.message.Message;
 
+/**
+ * The default singleton resource provider which returns 
+ * the same resource instance per every request
+ */
 public class SingletonResourceProvider implements ResourceProvider {
     private Object resourceInstance;
     
@@ -39,18 +43,30 @@ public class SingletonResourceProvider i
         this(o, false);
     }
     
+    /**
+     * {@inheritDoc}
+     */
     public boolean isSingleton() {
         return true;
     }
     
+    /**
+     * {@inheritDoc}
+     */
     public Object getInstance(Message m) {
         return resourceInstance;
     }
     
+    /**
+     * {@inheritDoc}
+     */
     public void releaseInstance(Message m, Object o) {
-        // TODO Auto-generated method stub
+        // complete
     }
     
+    /**
+     * {@inheritDoc}
+     */
     public Class<?> getResourceClass() {
         return ClassHelper.getRealClass(resourceInstance);
     }

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/SpringResourceFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/SpringResourceFactory.java?rev=1081303&r1=1081302&r2=1081303&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/SpringResourceFactory.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/SpringResourceFactory.java
Mon Mar 14 10:15:00 2011
@@ -31,6 +31,10 @@ import org.springframework.beans.BeansEx
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
 
+/**
+ * The ResourceProvider implementation which delegates to 
+ * ApplicationContext to manage the life-cycle of the resource
+ */
 public class SpringResourceFactory implements ResourceProvider, ApplicationContextAware {
 
     private Constructor<?> c;
@@ -63,6 +67,9 @@ public class SpringResourceFactory imple
         isSingleton = ac.isSingleton(beanId);
     }
     
+    /**
+     * {@inheritDoc}
+     */
     public Object getInstance(Message m) {
         Object[] values = ResourceUtils.createConstructorArguments(c, m);
         Object instance = values.length > 0 ? ac.getBean(beanId, values) : ac.getBean(beanId);
@@ -72,10 +79,16 @@ public class SpringResourceFactory imple
         return instance;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isSingleton() {
         return isSingleton; 
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void releaseInstance(Message m, Object o) {
         if (!isSingleton) {
             InjectionUtils.invokeLifeCycleMethod(o, preDestroyMethod);
@@ -99,6 +112,9 @@ public class SpringResourceFactory imple
         return c;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public Class<?> getResourceClass() {
         return c.getDeclaringClass();
     }



Mime
View raw message