[jboss-cvs] jboss-seam/src/main/org/jboss/seam ...
Gavin King
gavin.king at jboss.com
Tue Oct 31 20:52:08 EST 2006
User: gavin
Date: 06/10/31 20:52:08
Modified: src/main/org/jboss/seam Component.java Seam.java
Log:
insulate core from EJB dependencies JBSEAM-414
Revision Changes Path
1.200 +28 -24 jboss-seam/src/main/org/jboss/seam/Component.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Component.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/Component.java,v
retrieving revision 1.199
retrieving revision 1.200
diff -u -b -r1.199 -r1.200
--- Component.java 31 Oct 2006 06:40:23 -0000 1.199
+++ Component.java 1 Nov 2006 01:52:08 -0000 1.200
@@ -17,6 +17,14 @@
import static org.jboss.seam.ScopeType.SESSION;
import static org.jboss.seam.ScopeType.STATELESS;
import static org.jboss.seam.ScopeType.UNSPECIFIED;
+import static org.jboss.seam.util.EJB.LOCAL;
+import static org.jboss.seam.util.EJB.POST_ACTIVATE;
+import static org.jboss.seam.util.EJB.POST_CONSTRUCT;
+import static org.jboss.seam.util.EJB.PRE_DESTROY;
+import static org.jboss.seam.util.EJB.PRE_PASSIVATE;
+import static org.jboss.seam.util.EJB.REMOTE;
+import static org.jboss.seam.util.EJB.REMOVE;
+import static org.jboss.seam.util.EJB.value;
import java.io.Serializable;
import java.lang.annotation.Annotation;
@@ -33,13 +41,6 @@
import java.util.Map;
import java.util.Set;
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.ejb.Local;
-import javax.ejb.PostActivate;
-import javax.ejb.PrePassivate;
-import javax.ejb.Remote;
-import javax.ejb.Remove;
import javax.interceptor.Interceptors;
import javax.naming.NamingException;
import javax.servlet.http.HttpSessionActivationListener;
@@ -117,7 +118,7 @@
*
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
* @author Gavin King
- * @version $Revision: 1.199 $
+ * @version $Revision: 1.200 $
*/
@Scope(ScopeType.APPLICATION)
@SuppressWarnings("deprecation")
@@ -386,7 +387,7 @@
{
validateMethods.add(method);
}
- if ( method.isAnnotationPresent(Remove.class) )
+ if ( method.isAnnotationPresent(REMOVE) )
{
removeMethods.add(method);
}
@@ -453,19 +454,19 @@
{
parameterSetters.add(method);
}
- if ( method.isAnnotationPresent(PrePassivate.class) )
+ if ( method.isAnnotationPresent(PRE_PASSIVATE) )
{
prePassivateMethod = method;
}
- if ( method.isAnnotationPresent(PostActivate.class) )
+ if ( method.isAnnotationPresent(POST_ACTIVATE) )
{
postActivateMethod = method;
}
- if ( method.isAnnotationPresent(PostConstruct.class) )
+ if ( method.isAnnotationPresent(POST_CONSTRUCT) )
{
postConstructMethod = method;
}
- if ( method.isAnnotationPresent(PreDestroy.class) )
+ if ( method.isAnnotationPresent(PRE_DESTROY) )
{
preDestroyMethod = method;
}
@@ -1001,12 +1002,17 @@
protected Object instantiateJavaBean() throws Exception
{
Object bean = beanClass.newInstance();
+ if (interceptionType==InterceptionType.NEVER)
+ {
initialize(bean);
- if (interceptionType!=InterceptionType.NEVER)
+ callPostConstructMethod(bean);
+ }
+ else
{
- bean = wrap( bean, new JavaBeanInterceptor(bean, this) );
+ JavaBeanInterceptor interceptor = new JavaBeanInterceptor(bean, this);
+ bean = wrap(bean, interceptor);
+ interceptor.postConstruct();
}
- callPostConstructMethod(bean);
return bean;
}
@@ -1408,18 +1414,16 @@
{
Set<Class> result = new HashSet<Class>();
- if ( clazz.isAnnotationPresent(Local.class) )
+ if ( clazz.isAnnotationPresent(LOCAL) )
{
- Local local = (Local) clazz.getAnnotation(Local.class);
- for ( Class iface: local.value() ) {
+ for ( Class iface: value( clazz.getAnnotation(LOCAL) ) ) {
result.add(iface);
}
}
- if ( clazz.isAnnotationPresent(Remote.class) )
+ if ( clazz.isAnnotationPresent(REMOTE) )
{
- Remote remote = (Remote) clazz.getAnnotation(Remote.class);
- for ( Class iface: remote.value() )
+ for ( Class iface: value( clazz.getAnnotation(REMOTE) ) )
{
result.add(iface);
}
@@ -1427,7 +1431,7 @@
for ( Class iface: clazz.getInterfaces() )
{
- if ( iface.isAnnotationPresent(Local.class) || iface.isAnnotationPresent(Remote.class) )
+ if ( iface.isAnnotationPresent(LOCAL) || iface.isAnnotationPresent(REMOTE) )
{
result.add(iface);
}
1.25 +15 -14 jboss-seam/src/main/org/jboss/seam/Seam.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Seam.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/Seam.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- Seam.java 27 Sep 2006 03:53:48 -0000 1.24
+++ Seam.java 1 Nov 2006 01:52:08 -0000 1.25
@@ -1,15 +1,16 @@
-//$Id: Seam.java,v 1.24 2006/09/27 03:53:48 gavin Exp $
+//$Id: Seam.java,v 1.25 2006/11/01 01:52:08 gavin Exp $
package org.jboss.seam;
import static org.jboss.seam.ComponentType.ENTITY_BEAN;
import static org.jboss.seam.ComponentType.JAVA_BEAN;
+import static org.jboss.seam.ComponentType.MESSAGE_DRIVEN_BEAN;
import static org.jboss.seam.ComponentType.STATEFUL_SESSION_BEAN;
import static org.jboss.seam.ComponentType.STATELESS_SESSION_BEAN;
-import static org.jboss.seam.ComponentType.MESSAGE_DRIVEN_BEAN;
+import static org.jboss.seam.util.EJB.MESSAGE_DRIVEN;
+import static org.jboss.seam.util.EJB.STATEFUL;
+import static org.jboss.seam.util.EJB.STATELESS;
+import static org.jboss.seam.util.EJB.name;
-import javax.ejb.MessageDriven;
-import javax.ejb.Stateful;
-import javax.ejb.Stateless;
import javax.persistence.Entity;
import org.jboss.seam.annotations.Intercept;
@@ -58,15 +59,15 @@
*/
public static ComponentType getComponentType(Class<?> clazz)
{
- if ( clazz.isAnnotationPresent(Stateful.class) )
+ if ( clazz.isAnnotationPresent(STATEFUL) )
{
return STATEFUL_SESSION_BEAN;
}
- else if ( clazz.isAnnotationPresent(Stateless.class) )
+ else if ( clazz.isAnnotationPresent(STATELESS) )
{
return STATELESS_SESSION_BEAN;
}
- else if ( clazz.isAnnotationPresent(MessageDriven.class) )
+ else if ( clazz.isAnnotationPresent(MESSAGE_DRIVEN) )
{
return MESSAGE_DRIVEN_BEAN;
}
@@ -132,14 +133,14 @@
case JAVA_BEAN:
return null;
case STATEFUL_SESSION_BEAN:
- Stateful stateful = clazz.getAnnotation(Stateful.class);
- return stateful.name().equals("") ? unqualifyClassName(clazz) : stateful.name();
+ String statefulName = name( clazz.getAnnotation(STATEFUL) );
+ return statefulName.equals("") ? unqualifyClassName(clazz) : statefulName;
case STATELESS_SESSION_BEAN:
- Stateless stateless = clazz.getAnnotation(Stateless.class);
- return stateless.name().equals("") ? unqualifyClassName(clazz) : stateless.name();
+ String statelessName = name( clazz.getAnnotation(STATELESS) );
+ return statelessName.equals("") ? unqualifyClassName(clazz) : statelessName;
case MESSAGE_DRIVEN_BEAN:
- MessageDriven md = clazz.getAnnotation(MessageDriven.class);
- return md.name().equals("") ? unqualifyClassName(clazz) : md.name();
+ String mdName = name( clazz.getAnnotation(MESSAGE_DRIVEN) );
+ return mdName.equals("") ? unqualifyClassName(clazz) : mdName;
default:
throw new IllegalArgumentException();
}
More information about the jboss-cvs-commits
mailing list