[jboss-cvs] jboss-seam/src/ioc/org/jboss/seam/ioc/spring ...
Norman Richards
norman.richards at jboss.com
Sun Feb 18 18:09:34 EST 2007
User: nrichards
Date: 07/02/18 18:09:34
Modified: src/ioc/org/jboss/seam/ioc/spring
SeamComponentPostProcessor.java
SeamFactoryBean.java SeamNamespaceHandler.java
SeamScope.java SeamTargetSource.java
SpringComponent.java
Log:
use valuebinding on expressions
Revision Changes Path
1.3 +7 -8 jboss-seam/src/ioc/org/jboss/seam/ioc/spring/SeamComponentPostProcessor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SeamComponentPostProcessor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/ioc/org/jboss/seam/ioc/spring/SeamComponentPostProcessor.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- SeamComponentPostProcessor.java 18 Feb 2007 17:17:54 -0000 1.2
+++ SeamComponentPostProcessor.java 18 Feb 2007 23:09:34 -0000 1.3
@@ -39,8 +39,7 @@
return bean;
}
// Wrap our bean instance in an object factory for the SpringComponent to use
- SpringComponent.setObjectFactory(new ObjectFactory()
- {
+ SpringComponent.setObjectFactory(new ObjectFactory() {
public Object getObject() throws BeansException
{
return bean;
1.3 +1 -1 jboss-seam/src/ioc/org/jboss/seam/ioc/spring/SeamFactoryBean.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SeamFactoryBean.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/ioc/org/jboss/seam/ioc/spring/SeamFactoryBean.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- SeamFactoryBean.java 18 Feb 2007 17:17:54 -0000 1.2
+++ SeamFactoryBean.java 18 Feb 2007 23:09:34 -0000 1.3
@@ -67,7 +67,7 @@
// to our proxy.
List<Class> interfaces = new ArrayList<Class>();
Component component = targetSource.getComponent();
- if (component.getInterceptionType() != InterceptionType.NEVER)
+ if (component!=null && component.getInterceptionType() != InterceptionType.NEVER)
{
if (component.getType().isSessionBean())
{
1.4 +2 -4 jboss-seam/src/ioc/org/jboss/seam/ioc/spring/SeamNamespaceHandler.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SeamNamespaceHandler.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/ioc/org/jboss/seam/ioc/spring/SeamNamespaceHandler.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- SeamNamespaceHandler.java 18 Feb 2007 17:17:54 -0000 1.3
+++ SeamNamespaceHandler.java 18 Feb 2007 23:09:34 -0000 1.4
@@ -26,9 +26,7 @@
extends NamespaceHandlerSupport
{
public static final String SEAM_SCOPE_POST_PROCESSOR = "org.jboss.seam.ioc.spring.SeamScopePostProcessor";
-
public static final String SEAM_COMPONENT_POST_PROCESSOR = "org.jboss.seam.ioc.spring.SeamComponentPostProcessor";
-
public static final String SEAM_COMPONENT_POST_PROCESSOR_BEAN_NAME = "org.jboss.seam.ioc.spring.seamComponentPostProcessor";
/**
1.4 +6 -6 jboss-seam/src/ioc/org/jboss/seam/ioc/spring/SeamScope.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SeamScope.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/ioc/org/jboss/seam/ioc/spring/SeamScope.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
1.4 +114 -107 jboss-seam/src/ioc/org/jboss/seam/ioc/spring/SeamTargetSource.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SeamTargetSource.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/ioc/org/jboss/seam/ioc/spring/SeamTargetSource.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- SeamTargetSource.java 18 Feb 2007 17:17:54 -0000 1.3
+++ SeamTargetSource.java 18 Feb 2007 23:09:34 -0000 1.4
@@ -6,6 +6,8 @@
import org.jboss.seam.ScopeType;
import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.contexts.Lifecycle;
+import org.jboss.seam.core.Expressions;
+import org.jboss.seam.core.Expressions.ValueBinding;
import org.springframework.aop.TargetSource;
/**
@@ -17,12 +19,11 @@
@SuppressWarnings("serial")
public class SeamTargetSource implements TargetSource, Serializable
{
-
private ScopeType scope;
-
private String name;
-
private Boolean create;
+ private ValueBinding valueBinding;
+
/**
* @param name Name of the component: required
@@ -38,6 +39,10 @@
this.name = name;
this.scope = scope;
this.create = create;
+
+ if (name.startsWith("#")) {
+ this.valueBinding = Expressions.instance().createValueBinding(name);
+ }
}
/**
@@ -45,25 +50,23 @@
*
* @see org.springframework.aop.TargetSource#getTarget()
*/
- public Object getTarget() throws Exception
- {
- if (scope == null && create == null)
+ public Object getTarget()
+ throws Exception
{
+ if (valueBinding != null) {
+ return valueBinding.getValue();
+ } else {
+ if (scope == null && create == null) {
return Component.getInstance(name);
- }
- else if (scope == null)
- {
+ } else if (scope == null){
return Component.getInstance(name, create);
- }
- else if (create == null)
- {
+ } else if (create == null) {
return Component.getInstance(name, scope);
- }
- else
- {
+ } else{
return Component.getInstance(name, scope, create);
}
}
+ }
/**
* Obtains the seam component beanClass for this TargetSource.
@@ -72,8 +75,12 @@
*/
public Class getTargetClass()
{
+ if (valueBinding != null) {
+ return valueBinding.getClass();
+ } else {
return getComponent().getBeanClass();
}
+ }
/**
* Get the component for this TargetSource
@@ -82,10 +89,12 @@
*/
public Component getComponent()
{
+ if (valueBinding == null) {
+ return null;
+ } else {
// TODO reuse
boolean unmockApplication = false;
- if (!Contexts.isApplicationContextActive())
- {
+ if (!Contexts.isApplicationContextActive()) {
Lifecycle.mockApplication();
unmockApplication = true;
}
@@ -97,15 +106,13 @@
+ ". Make sure Seam is being configured before Spring.");
}
return component;
- }
- finally
- {
- if (unmockApplication)
- {
+ } finally {
+ if (unmockApplication) {
Lifecycle.unmockApplication();
}
}
}
+ }
/**
* @see org.springframework.aop.TargetSource#isStatic()
1.4 +257 -257 jboss-seam/src/ioc/org/jboss/seam/ioc/spring/SpringComponent.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SpringComponent.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/ioc/org/jboss/seam/ioc/spring/SpringComponent.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
More information about the jboss-cvs-commits
mailing list