[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-2221) Introduce way to retrieve proxy object of a Seam JavaBean Component
by Wolfgang Schwendt (JIRA)
Introduce way to retrieve proxy object of a Seam JavaBean Component
-------------------------------------------------------------------
Key: JBSEAM-2221
URL: http://jira.jboss.com/jira/browse/JBSEAM-2221
Project: JBoss Seam
Issue Type: Feature Request
Reporter: Wolfgang Schwendt
The EJB programming model requires that a Session Bean never passes a "this"-pointer to other client objects. Instead,
javax.ejb.SessionContext provides a method getBusinessObject(). If a SessionBean wants to pass a reference pointing to itself to other clients, it first has to retrieve its own EJB object reference by calling SessionContext.getBusinessObject() which it then can pass to other beans. This reference returned by javax.ejb.SessionContext.getBusinessObject() is the equivalent to Java's this pointer.
With respect to Seam's interceptor framework, such a feature is missing as far as normal JavaBean components are concerned. It leads to subtle programming errors:
Consider the implementation of org.jboss.seam.framework.Query. getDataModel():
/**
* Wrap the result set in a JSF {@link DataModel}
*
* Delegates to {@link DataModels#getDataModel(Query)}
*
*/
@Transactional
public DataModel getDataModel()
{
if (dataModel==null)
{
dataModel = DataModels.instance().getDataModel(this);
}
return dataModel;
}
This method method passes a "this"-reference to the org.jboss.seam.faces.dataModels Seam-component.
But this can lead to a behavior not expected by the programmer. If the (Entity)Query-component gets instantiated as a conversation-scoped component, Seam wraps the ManagedEntityIdentityInterceptor around this Query component.
After each method invocation intercepted by the ManagedEntityIdentityInterceptor, the ManagedEntityIdentityInterceptor saves wrappers for all contained Entity references in the conversation context and sets the corresponding reference fields in the Query component to null.
Now, consider again above implementation of Query.getDataModel(). Because a "this" pointer is passed to the dataModels-component, any calls conducted by the datamodel-component via this reference won't (!) be routed through the ManagedEntityIdentity interceptor. Hence, when the datamodel-component calls the Query-component via the Java-this pointer it received previously, the ManagedEntityIdentity won't be invoked and in turn the Entity reference fields in the Query-component won't be restored.
This leads to a bug as described in JBSEAM-1814. In order to fix that bug, we would have to change the implementation of Query. getDataModel(). Rather than passing the Java-this pointer to the dataModels component, the correct implementation would be as follows. The Query component would first have to retrieve a reference to its own proxy object, which it then could pass to the dataModels component.
Summary: For JavaBean Seam components we need a feature similar to SessionContext.getBusinessObject(), to enable a JavaBean Seam component to pass a proxy reference to itself to other Seam components instead of passing directly the Java-this pointer.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 11 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-2201) include <generic-type> in components.xml
by Dan Hinojosa (JIRA)
include <generic-type> in components.xml
----------------------------------------
Key: JBSEAM-2201
URL: http://jira.jboss.com/jira/browse/JBSEAM-2201
Project: JBoss Seam
Issue Type: Feature Request
Reporter: Dan Hinojosa
I would like a generic-type allowed in components.xml so that we can have genericized beans.
For example
<component name="productManagerBean"
scope="SESSION"
class="com.xyzcorp.session.SimplePersistenceManagementBean"
generic-type="com.xyzcorp.entity.Product"
/>
This would be great so we could do some kick ass stuff like this
@Stateful
public class SimplePersistenceManagementBean<E> {
private E entity;
@PersistenceContext(....)
private EntityManager em;
public void setEntity(E entity) {
this.entity = entity;
}
public void create() {
em.persist(e);
}
public void update() {
em.merge(e);
}
.......
}
Now, ain't that sexy?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 11 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-1680) Have a way to "bootsrap" the seam engine for batch processes
by Denis Forveille (JIRA)
Have a way to "bootsrap" the seam engine for batch processes
------------------------------------------------------------
Key: JBSEAM-1680
URL: http://jira.jboss.com/jira/browse/JBSEAM-1680
Project: JBoss Seam
Issue Type: Feature Request
Affects Versions: 2.0.0.BETA1, 1.2.1.GA
Reporter: Denis Forveille
It should be possible to write a "pure" batch processes that uses seam components. Seam should provide a way to "bootstrap" the "seam engine" outside any web/jee container to allow programmers to reuse seam components outside a war, typically from a standard "main" method, run with a standard j2se class.
Typical scenario/usage for this:
- an online application build around seam, POJOs and hibernate.
- the business seam components ("managers" + "model" classes) are isolated into a separate jar file (common.jar)
- the "view controllers", which are seam components (aka "backing beans") are directly held into the war module
- the war module uses the business components held into the common.jar module.
- a batch process, which is standard j2se class with a main method, performs some business process by calling the "business" seam components defined in the common.jar file.
The high-level algorithm of this "batch" process is the following
- bootstrap the seam engine
- for each business item to process (maybe tens of thousand or more...):
- begin transaction
- do some business stuff by calling the seam components in common.jar that read/update the database
- commit
- shutdown the seam engine
For this, we need a class or harness to "boostrap" the seam engine. This harness should not depends on any of the services provided by a typical web/ jee container, this includes:
- naming/jndi
- security
- jsf/jsp/facelets
- ...etc
The harness should be able to manage injection/bijection of user defined components and also to provide the injection of some non-web dependent object like the hibernate session and the logger. Of course none of the "web" functions are required (Conversation managment, @DataModel etc...)
At a minimun, this harness should be able to handle the @Name, @In, @Out, @Create, @Destroy, @Factory, @Transactional, @Logger annotations
Big Thanks...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 11 months