I am quite new to EJB but I have been interested in CBD and architecture for some time. As I am told, beans are registered and their interfaces are visible to "everyone".
I would like to have a means to create layers of visibility within the business logic so that I can shield "internal" interfaces from "external" interfaces.
There are a number of messages and articles on layered architecture in this forum but usually the term "layer" is used where I believe "tier" would be better (according to Herzum and Sims).
A layer is a logical "horizontal" separation within an architecture. As such it could be a design decision to deny the Web tier or clients to access EntityBeans directly, as an architect I would like to force this with visibility and not rely on conventions.
Is there a way of doing this in J2EE?
Rob .. u'r point is well understood but when someone told you that the interfaces(for a bean) are visible to everyone, he/she definately meant eveeryone who is inside the app server and not the user outside...From the outside what is visible are the applications that run on the web server(what u mention as EXTERNAL INTERFACES) and not on the app server (JSP's, Servlets, HTMLs).
This is where we get the handles to the beans(Internal Interfaces) and hence there is no way for any user to ever know what and where the bean is........J2EE does not enforce the access of the handles to beans from the user as the EJB's are an entity in itself and why should they always rely on some one else for performing....It is just the designer who makes this decision that a Server Side component not be made available to the user
Hope that helps
thanks for your reply. Sorry for expressing myself too loosely: read "every developer (in the project)" instead of "everyone". In an architecture where the choice has been made to wrap entity beans with session beans for client access the handles of the entity beans are equally accessible as the handles of the session beans. Or is there a way to shield layers explicitly, so that in the example I mentioned a client program developer simply cannot access the entity beans directly?
You must also take into consideration various develpoment tools that need to access these Entity interfaces along with
EjbMetaData classes and possibly reflection. Without the interfaces the Development tools will cease to exist.