Sorry for starting a new thread on this. But I believe this needs som new input.
I've read some hundreds posts/articles about this subject - but not yet found a good example/solution. The EJB 1.1 spec (and 2.0) says it cannot be done. Maybe this is true?
What I want to do is to make an J2EE component that can be expanded without having to make changes in the component.
So, let's say, for an example:
This is a Report component.
To simplify, this component has got a CMP EJB called Report.
Users of this component may want a more specialized Report - they want to make a new EJB - lets say TaxReport.
How to implement this without component inheritance?
-
EJB inheritance / Component design (8 messages)
- Posted by: Bj?rn Erik Pedersen
- Posted on: March 30 2001 03:59 EST
Threaded Messages (8)
- EJB inheritance / Component design by Lofi Dewanto on March 30 2001 08:45 EST
- EJB inheritance / Component design by gautam gupta on April 05 2001 12:51 EDT
- EJB inheritance / Component design by Omar G?mez on April 06 2001 18:50 EDT
- EJB inheritance / Component design by David Daw on April 08 2001 21:56 EDT
- EJB inheritance / Component design by Justin Van Vorst on March 30 2001 09:21 EST
- EJB inheritance / Component design by Bj?rn Erik Pedersen on March 30 2001 09:52 EST
- EJB inheritance / Component design by Lofi Dewanto on March 30 2001 12:22 EST
- EJB inheritance / Component design by Lakshminarayanan Muralidharan on April 05 2001 06:53 EDT
- EJB inheritance / Component design by Lofi Dewanto on March 30 2001 12:22 EST
-
EJB inheritance / Component design[ Go to top ]
- Posted by: Lofi Dewanto
- Posted on: March 30 2001 08:45 EST
- in response to Bj?rn Erik Pedersen
You can use inheritance in ejb spec 1.1 or 2.0
I have an open source example on this.
- Please download the developer's manual of OpenUSS at:
ftp://openuss.sourceforge.net/pub/openuss/openuss-developer-manual.pdf
- Download the sourcecode at:
ftp://openuss.sourceforge.net/pub/openuss/openuss-discussion.zip
- And read my comment on that stuffs (from OpenUSS
mailinglist). This is how I want to reach a
plug&play component architecture with ejb.
It also uses inheritance.
- You have to give me your e-mail address, if you
want to have the uml diagram. It's easier to
understand if you can take a look at the uml
diagram.
Have fun!
Lofi.
Hi Mike,
Thanx for your question. I sent you the developer
manual of OpenUSS and the sourcecode for the
newsgroup directly to your email address,
so the other list member won't be angry with me
(It's about 1,5 MB) ;-)
For all of you, don't download the current version
of OpenUSS. It's too old. Wait until 1st April
and I'll update the download.
This documentation could be a good base for
developing the "plug-in" Extension Components.
Important in this architecture is this structure:
- Business Components (EJBs)
+ Foundation Components (BFC)
+ Extension Components (BEC)
- Presentation Components (Enhydra's PO)
+ Foundation Components (PFC)
+ Extension Components (PEC)
These are the steps writing an Business Extension
Component (BEC):
"Business Extension Components (BEC) - EJBs"
This is the most important part. Because the reuse
in this area should be the bigest part in the
OpenUSS architecture.
- First of all you just define your BEC totally
independent from the BFC. Let's say we want
to build a newsgroup component. It's important
that you write this component as if no BFC existed.
This is really important because I also want
to develop this newsgroup component as
a standalone component. A newsgroup component
can be used overall on the web sites not only
in a e-Learning platform.
- After you finish your BEC (test, etc.)
you create the "glue code" betweeen
your BEC and the existed BFC.
This means that you just use "inheritance".
You can extend your BEC and put some properties to
link it to the existed BFC.
- That's it.
You can see this in the UML diagram enclosed in
this mail.
Okay, it's sound really easy. The problem is that
inheritance is not that easy by using EJBs. But
actually it is also not sooo complicated ;-)
These are the steps:
- This is the code snippets of the BEC for the newsgroup
component. You just first define the interface and
afterwards you can write the home, bean and object
classes respectively. (The sourcecode of this
newsgroup is also included - Actually I call this
component, discussion component ;-))
...
public interface DiscussionItemBase {
public String getSubject() throws RemoteException;
public void setSubject(String subject) throws RemoteException;
...
- You write the "glue code". In this case we want to link
the Enrollment component (this is on of the Business
Foundation Components). This means that we want
to have a newsgroup for each enrollment.
...
public interface DiscussionItem extends DiscussionItemBase {
public Enrollment getEnrollment() throws RemoteException;
public void setEnrollment(Enrollment enrollment) throws
RemoteException;
...
You have to write the home, bean and object classes for
this glue code as well.
That's it. It's really easy to write such a "plug-in"
component within the EJB architecture.
Some problems you encounter here:
- If I delete an enrollment, how can I know
that I also have to delete the newsgroup belongs
to that enrollment? Or How can I know that
there is a newsgroup already exists for
this enrollment? Because this is a one direction
relationship between the newsgroup/discussion
and the enrollment. The enrollment component
cannot know, what kind of Extension Components
are installed at one time. I wonder whether
an observer pattern can be done in this case?
- I use the Facade Pattern for Session Beans and
Entity Beans. Building a glue code for Session
Beans is not that useful :-( You can see it
in the sourcecode.
With this architecture I can provide many standalone
components to the OpenUSS Foundation Components.
You can write any standalone Extension Components.
After you finish it you can plug it in into
the Foundation Components. You can take a ready
to use component (must be an ejb one) as well and
build the glue code to plug it into the Foundation
Components.
I would like to hear your opinion about this and
next time we can talk about the presentation layer,
because the presentation layer should be reusable
as well.
Greets,
--
---------------------------------------------------
Blasius Lofi Dewanto
---------------------------------------------------
OpenUSS - Open University Support System
http://openuss.sourceforge.net
--------------------------------------------------- -
EJB inheritance / Component design[ Go to top ]
- Posted by: gautam gupta
- Posted on: April 05 2001 12:51 EDT
- in response to Lofi Dewanto
Hi,
I would also be interested in the UML diagram. My email-id is kgupta at covad dot com.
Thanks
Gautam -
EJB inheritance / Component design[ Go to top ]
- Posted by: Omar G?mez
- Posted on: April 06 2001 18:50 EDT
- in response to Lofi Dewanto
Your comments seem interesting, but I couldn't get the file at
ftp://openuss.sourceforge.net/pub/openuss/openuss-developer-manual.pdf
It's there a problem?
Thanks!
::Omar
-
EJB inheritance / Component design[ Go to top ]
- Posted by: David Daw
- Posted on: April 08 2001 21:56 EDT
- in response to Lofi Dewanto
Hi,
I can not get all the files you mentioned,any suggestion?
Thanks! -
EJB inheritance / Component design[ Go to top ]
- Posted by: Justin Van Vorst
- Posted on: March 30 2001 09:21 EST
- in response to Bj?rn Erik Pedersen
hehe, my response won't be as long...
Take a look at my reponse to previous thread
href"http://www2.theserverside.com/discussion/thread.jsp?thread_id=5303
If you have any questions I'll be happy to elaborate.
-JC -
EJB inheritance / Component design[ Go to top ]
- Posted by: Bj?rn Erik Pedersen
- Posted on: March 30 2001 09:52 EST
- in response to Bj?rn Erik Pedersen
my e-mail is:
b dot e at pedersen dot cc
I would be greatful for the UML diagrams.
-
EJB inheritance / Component design[ Go to top ]
- Posted by: Lofi Dewanto
- Posted on: March 30 2001 12:22 EST
- in response to Bj?rn Erik Pedersen
Done!
Lofi. -
EJB inheritance / Component design[ Go to top ]
- Posted by: Lakshminarayanan Muralidharan
- Posted on: April 05 2001 06:53 EDT
- in response to Lofi Dewanto
Hi Lofi,
Is it possible for you to send me the UML diagram as well as I also trying to figure out EJB inheritance..
My email address is : murali dot muralidharan at etc dot co dot uk
Regards,
Murali