cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1024499 - in /cxf/branches/2.2.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/service/invoker/
Date Wed, 20 Oct 2010 02:15:34 GMT
Author: dkulp
Date: Wed Oct 20 02:15:33 2010
New Revision: 1024499

URL: http://svn.apache.org/viewvc?rev=1024499&view=rev
Log:
Merged revisions 1023984 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.3.x-fixes

................
  r1023984 | dkulp | 2010-10-18 16:20:44 -0400 (Mon, 18 Oct 2010) | 11 lines
  
  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.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/FactoryInvoker.java
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/SessionFactory.java

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

Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/FactoryInvoker.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/FactoryInvoker.java?rev=1024499&r1=1024498&r2=1024499&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/FactoryInvoker.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/FactoryInvoker.java
Wed Oct 20 02:15:33 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.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties?rev=1024499&r1=1024498&r2=1024499&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/Messages.properties
Wed Oct 20 02:15:33 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.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/SessionFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/SessionFactory.java?rev=1024499&r1=1024498&r2=1024499&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/SessionFactory.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/invoker/SessionFactory.java
Wed Oct 20 02:15:33 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