cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1023984 - in /cxf/branches/2.3.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/service/factory/ rt/core/src/main/java/org/apache/cxf/service/invoker/
Date Mon, 18 Oct 2010 20:20:44 GMT
Author: dkulp
Date: Mon Oct 18 20:20:44 2010
New Revision: 1023984

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

........
  r1023971 | dkulp | 2010-10-18 16:04:18 -0400 (Mon, 18 Oct 2010) | 3 lines
  
  Fix some fault messages
  Add ability for SessionFactory to not create if not already in the
  session.
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
    cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/FactoryInvoker.java
    cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties
    cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/SessionFactory.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Oct 18 20:20:44 2010
@@ -1 +1 @@
-/cxf/trunk:1-1022129,1022154,1022194,1022401-1022402,1022911,1023068,1023121,1023804
+/cxf/trunk:1-1022129,1022154,1022194,1022401-1022402,1022911,1023068,1023121,1023804,1023971

Modified: cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java?rev=1023984&r1=1023983&r2=1023984&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/AnnotationsFactoryBeanListener.java
Mon Oct 18 20:20:44 2010
@@ -167,7 +167,11 @@ public class AnnotationsFactoryBeanListe
                 if (scope.factoryClass() == FactoryType.DEFAULT.class) {
                     switch (scope.value()) {
                     case Session:
-                        f = new SessionFactory(cls);
+                        if (scope.args().length > 0) {
+                            f = new SessionFactory(cls, Boolean.parseBoolean(scope.args()[0]));
+                        } else {
+                            f = new SessionFactory(cls);
+                        }
                         break;
                     case PerRequest:
                         f = new PerRequestFactory(cls);

Modified: cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/FactoryInvoker.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/FactoryInvoker.java?rev=1023984&r1=1023983&r2=1023984&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/FactoryInvoker.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/FactoryInvoker.java
Mon Oct 18 20:20:44 2010
@@ -31,7 +31,7 @@ import org.apache.cxf.message.Exchange;
  * 
  */
 public class FactoryInvoker extends AbstractInvoker {
-    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(FactoryInvoker.class);
+    static final ResourceBundle BUNDLE = BundleUtils.getBundle(FactoryInvoker.class);
 
     private Factory factory;
 

Modified: cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties?rev=1023984&r1=1023983&r2=1023984&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties
(original)
+++ cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties
Mon Oct 18 20:20:44 2010
@@ -20,9 +20,9 @@
 #
 SVC_CLASS_IS_INTERFACE=Could not instantiate service class {0} because it is an interface.
 SVC_CLASS_IS_ABSTRACT=Could not instantiate service class {0} because it is abstract.
-COULD_NOT_INSTANTIATE=Couldn't instantiate service object.
-ILLEGAL_ACCESS=Couldn't access service object.
-CREATE_SERVICE_OBJECT_EXC=Couldn't instantiate service object.
+COULD_NOT_INSTANTIATE=Could not instantiate service object.
+ILLEGAL_ACCESS=Could not access service object.
+CREATE_SERVICE_OBJECT_EXC=Could not instantiate service object.
 EXCEPTION_INVOKING_OBJECT={0} while invoking {1} with params {2}.
 SUSPENDED_INVOCATION_EXCEPTION=Invocation of method {1} on object {0} with params {2} has
been suspended.
 INVOKING_METHOD=Invoking method {1} on object {0} with params {2}.

Modified: cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/SessionFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/SessionFactory.java?rev=1023984&r1=1023983&r2=1023984&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/SessionFactory.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/SessionFactory.java
Mon Oct 18 20:20:44 2010
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.service.invoker;
 
+import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.service.Service;
 
@@ -29,12 +30,22 @@ import org.apache.cxf.service.Service;
  * some session implementations require the beans to be Serializable
  */
 public class SessionFactory implements Factory {
+    
     Factory factory;
+    boolean createIfNotExist;
+    
     public SessionFactory(Class<?> svcClass) {
-        this(new PerRequestFactory(svcClass));
+        this(new PerRequestFactory(svcClass), true);
     }
     public SessionFactory(Factory f) {
+        this(f, true);
+    }
+    public SessionFactory(Class<?> svcClass, boolean createOnDemand) {
+        this(new PerRequestFactory(svcClass), createOnDemand);
+    }
+    public SessionFactory(Factory f, boolean createOnDemand) {
         factory = f;
+        createIfNotExist = createOnDemand;
     }
 
     /** {@inheritDoc}*/
@@ -44,8 +55,12 @@ public class SessionFactory implements F
         synchronized (serv) {
             o = e.getSession().get(serv.getName().toString());
             if (o == null) {
-                o = factory.create(e);
-                e.getSession().put(serv.getName().toString(), o);
+                if (createIfNotExist) {
+                    o = factory.create(e);
+                    e.getSession().put(serv.getName().toString(), o);
+                } else {
+                    throw new Fault("COULD_NOT_INSTANTIATE", FactoryInvoker.BUNDLE);
+                }
             }
         }
         return o;



Mime
View raw message