Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make EJB example work, hacky version of EJB interceptor & postconstru…
…ct interception (want a better way of identifying which bean to postConstruct) git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@556 1c488680-804c-0410-94cd-c6b725194a0e
- Loading branch information
Showing
15 changed files
with
166 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,6 @@ public interface TranslatorController | |
|
||
public String getTranslatedText(); | ||
|
||
public void remove(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
examples/translator/webbeans-translator-ejb/src/main/resources/META-INF/ejb-jar.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" | ||
version="3.0"> | ||
|
||
<interceptors> | ||
<interceptor> | ||
<interceptor-class>org.jboss.webbeans.ejb.SessionBeanInterceptor</interceptor-class> | ||
</interceptor> | ||
</interceptors> | ||
|
||
<assembly-descriptor> | ||
<interceptor-binding> | ||
<ejb-name>*</ejb-name> | ||
<interceptor-class>org.jboss.webbeans.ejb.SessionBeanInterceptor</interceptor-class> | ||
</interceptor-binding> | ||
</assembly-descriptor> | ||
|
||
</ejb-jar> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
webbeans-ri/src/main/java/org/jboss/webbeans/ejb/SessionBeanInterceptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.jboss.webbeans.ejb; | ||
|
||
import javax.annotation.PostConstruct; | ||
import javax.interceptor.InvocationContext; | ||
import javax.webbeans.manager.Bean; | ||
|
||
import org.jboss.webbeans.CurrentManager; | ||
import org.jboss.webbeans.bean.EnterpriseBean; | ||
|
||
public class SessionBeanInterceptor | ||
{ | ||
|
||
@PostConstruct | ||
public void postConstruct(InvocationContext invocationContext) | ||
{ | ||
Class<?> beanClass = invocationContext.getTarget().getClass(); | ||
// TODO Don't like this | ||
Bean<?> bean = CurrentManager.rootManager().getBeanMap().get(beanClass); | ||
if (bean instanceof EnterpriseBean) | ||
{ | ||
EnterpriseBean<Object> enterpriseBean = (EnterpriseBean<Object>) bean; | ||
enterpriseBean.postConstruct(invocationContext.getTarget()); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters