But EJBs are components. If you look at the OO theory involving
modeling like UML and processes such as RUP, EJBs fit into their
notion of components nicely.
>From: Justin Couch <[EMAIL PROTECTED]>
>Reply-To: Justin Couch <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: WHY EJB
>Date: Thu, 18 Oct 2001 22:17:27 +1000
>
> > Amarnath P wrote:
> >
> > hi andrea,
> >
> > can u explain more clearly about the lack of OO principles, that
> > u have mentioned below ?????
>
>The basic principle of having a factory class that creates unknown
>instance objects with a common base class. For example, I have a factory
>
>public class ShapeFactory {
> public Shape createShape(String name);
>}
>
>and
>
>public interface Shape {
>}
>
>And a bunch of shape objects:
>
>public class Cone extends Shape {}
>public class Box extends Shape {}
>public class Sphere extends Shape {}
>
>I cannot create an EJB home interface that generates me a different
>instance object depending on the parameter that I pass to the
>ejbCreate() method. That is, the following home interface is illegal:
>
>public interface ShapeHome extends EJBHome {
> public Shape create(String name);
>}
>
>because it is required to return an instance of the Shape class eg
>
>public class ShapeEJB implements EntityBean {}
>
>These classes cannot be cast to a narrower definition to get something
>more useful.
>
>EJBs do allow something similar, but not quite as flexible. What you
>would have to do is create a bunch of home interfaces that were similar,
>but registered under different JDNI context names. This would given you
>almost a factory, but instead of using a method that takes a string name
>in the create, you would have to look up the home interface for a
>dynamically created context name. eg
>
>public class MyShapeUtils {
>
> public static Shape createShape(string name) {
> String ctx_name = "ejb/shapes/" + name;
>
> InitialContext ctx = new InitialContext();
> ShapeHome home = (ShapeHome)ctx.lookup(ctx_name);
>
> Shape shape = home.create();
>
> return shape;
> }
>}
>
>
>--
>Justin Couch http://www.vlc.com.au/~justin/
>Freelance Java Consultant http://www.yumetech.com/
>Author, Java 3D FAQ Maintainer http://www.j3d.org/
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".