aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Ejb Project Plan Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Ejb Project Plan" Watch "Ejb Project Plan" New topic
Author

Ejb Project Plan

priya shankar
Greenhorn

Joined: May 12, 2003
Posts: 21
Hi all
In my company ,we are going to start a new project on Ejb...

The project deals with the , details of travel information and expenses if an employee of the company goes for an official trip..
The aim of projet is to allow the employee to submit the details of his
trip and expenses so that the company will make the reimbursement..
So our Boss asked every one in the team to give an outline of project architecture.....
My architecture is as follows, also i have some probs ..so u people guide me..

a)Employee details---Module 1
i)New employeee Registration(after regn will get an id ,which he will use later)

ii)User authentication
b)Trip details --Module 2
i)Employee gives full details...
It may take two forms...
c)Controller receives request and going to despatch to corresponding
beans which then calls Ejb components ,which do some business process
like calculating total expenses ,where entity bean persisits data.
ii)Planned to use command pattern, so as to avoid which action to take place
iii)Planned to use session facade
d)finally controller servlet redirect the appropriate JSP ,which inturn gets data from Bean...

My doubts
---------
1)In which module the controller can be included
2)I heard abut sub controller ...in proj where it can come to and what may it do
3)Huv the bean will call Ejb components...
4)As session facade pattern is going to wrap the entity beans ,the numbers calls and network overhead is redueced...
i)Will the session facade pattern will contain all entity bean or particular bean...
ii)can a session bean use data of an entity bean ...
iii)also the result of some processes say total amt has to stored ithe database...huv to do..thro' entity bean i guess...
5)Huv java bean will receive the data to be displyed in jsp , from Ejb..
6)Huv java bean maintain the state
7)Here what is the role of TagLib..as we r planning to use it...
8)As trip details can contain more the two pages...huv can i submit..seperately or both at a time,,considering the network overhead..
Then huv many controller i can (usually one) in this scenario..
Its an intranet project...
Planned to use Weblogic 5.1 ejb 1.1.(I can't to do nothing with this as its been finalized)
So, Experts i expect ur valueable as this is my first proj is EJb
Thanks
priya
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Priya, I didn't quite understand the architecture you described but that's probably due to me having had only a couple of hours of sleep last night...
First of all, what kind of requirements you have except for "it has to manage travel expenses"? For example, is a web interface enough or do you need to be able to write desktop applications (and if you do, then for which platforms)? Or is a desktop application actually the must-have due to mobility and/or lack of network access?
If we're talking about a desktop application, I would probably start with the following combination of components:
  • Desktop GUI application capable of storing data locally for later synchronization with the server using SOAP over HTTP.
  • SOAP/HTTP interface delegating incoming requests to the backend logic.
  • Backend logic implemented using EJBs (I think exposing EJBs as web services is more widely supported by existing appservers than exposing plain old Java objects, but I might be wrong).
  • Relational database for storing all the data.


  • Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
    priya shankar
    Greenhorn

    Joined: May 12, 2003
    Posts: 21
    Hi Lasse
    Thanks a lot...
    Actually the appln is for the employess of a company...May be in future it may come an internet oriented..but timebeing its going to be developed as an intranet appln using Http...
    Hope this will an idea
    thanks
    priya
    Lasse Koskela
    author
    Sheriff

    Joined: Jan 23, 2002
    Posts: 11962
        
        5
    Ok. Webapp it is then.
    You could consider the following components to implement the business functionality you mentioned earlier:
    UserManagementBean (stateless session bean) for providing registration and other user management services such as "new user", "remove user", "update user info" and so on.
    ExpenseBean (entity bean) for representing the domain entity of a (travel) expense. If this is too fine grained, you can add a TripBean for encapsulating a set of related ExpenseBeans.
    Implement user authentication in the web container using a JAAS LoginModule against a database or an LDAP server.
    Have your controller (servlet or its delegate) translate incoming requests to actions. The action objects can then perform the necessary operations by invoking the EJB layer (session facade). The controller may redirect the HttpServletRequest to a JSP for view presentation using data put into the HttpSession by the action object.
    Now to answer some of your doubts:
    Will the session facade pattern will contain all entity bean or particular bean?
    The session facade should expose a cohesive set of methods related to some particular area of business functionality. Basically, the UserManagementBean I suggested could act as a session facade for entities such as User, UserGroup, and so on.
    can a session bean use data of an entity bean?
    Sure.
    also the result of some processes say total amt has to stored ithe database...huv to do..thro' entity bean i guess...
    Yes, you can do it with an entity bean. However, I would suggest letting the TripBean handle storing the total amount along with the individual expenses.
    Here what is the role of TagLib..as we r planning to use it...
    Taglibs can be used to keep Java scriptlets from cluttering your JSPs.
    As trip details can contain more the two pages...huv can i submit..seperately or both at a time,,considering the network overhead..
    You can store the page data into HttpSession while moving between the pages of a multi-page form. I wouldn't suggest submitting an incomplete set of data into the database.
    Then huv many controller i can (usually one) in this scenario..
    As many as you wish. You could save a lot of trouble if you can use Jakarta Struts, though, as it will provide you the necessary framework for the controller/action based front end.
    Planned to use Weblogic 5.1 ejb 1.1.(I can't to do nothing with this as its been finalized)

    Uh-oh. I only noticed now that you have to use EJB 1.1. I'll take back everything I wrote about entity beans because the EJB 1.1 specification easily results in a bad performing architecture unless you make heavy use of optimizing design patterns such as Data Transfer Objects etc. It would be probably easier to start the EJB journey by using a combination of bession beans and Data Access Objects (instead of session beans and entity beans).
    priya shankar
    Ranch Hand

    Joined: May 12, 2003
    Posts: 51
    Thanks Lasse again,

    Ok with Ejb5.1 ,there is going to be some performance issues...
    Ok let it be there..those things are upto my Boss..
    again,
    1)Where the data(user input if new user) are going to be sent
    --To Controller or javabean
    If it is Controller ,it has to retrive all the data and sent to the corresponding bean which inturn to Ejb Layer...
    What i feel is instead sending data to controller , send to javabean and let the bean store data and send it to Ejb ,when Controller
    calls the bean..
    Is this pattern allowed..
    Thanks Lasse..
    But other than Lasse are seem to be ignoring this issue...why experts
    I expect results from various people....
    I will come with some other doubts later..
    priya
    Lasse Koskela
    author
    Sheriff

    Joined: Jan 23, 2002
    Posts: 11962
        
        5
    Where the data(user input if new user) are going to be sent --To Controller or javabean
    If it is Controller ,it has to retrive all the data and sent to the corresponding bean which inturn to Ejb Layer...
    What i feel is instead sending data to controller , send to javabean and let the bean store data and send it to Ejb ,when Controller calls the bean..

    How about the following sequence (for processing a form submit):
    1. The controller servlet receives the form submit, locates a suitable JavaBean for processing the request, and hands the processing responsibility to it.
    2. The JavaBean parses the submitted data from the given HttpServletRequest object and creates an entity bean using that data (i.e. inserts the data into database).
    3. The JavaBean finishes processing and returns control to the controller who forwards the request to some JSP.
    Oh, good luck with the project!
    Avianu Sud
    Ranch Hand

    Joined: Jan 20, 2002
    Posts: 55
    Here is how I see it working:
    Use case level:
    -----------------
    use case 1: User -> Add Travel Info -> Add Expenses
    User ->View Expenses
    use case 2: Admin -> Add User
    use case 3: HR Admin -> View Travel Info -> View Expenses
    Arch. Level:
    --------------
    4 Layes: 1. Presentaion 2. Services(EJB+Helpers) 3. Persistence(Storage of Data) 4. Domain (Common objects shared by All Layers)
    - Domain Objects are User, Expense, Trip.
    - Presentation Layer prepares all forms, has Java classes for the forms, calls EJB Layer for information and retrive data.
    - Services Layer has 2 Delagate classes(ExpensesDelagate, UserDelegate), which are called from Presintation Layer classes(They wrap all EJB calls).
    There are 2 coresponding EJB's UserEJB, ExpenseEJB.
    They have calls to Persistence classes (which can use JDBC or JDO) for finding/setting data into database.
    Services layer also performs Business Logic such as Calclate Expense Total, Show expense Summary for users, etc.
    - Persistence classes set domain objects which are returned to the Presentation via the delegates.

    Notes:
    - Using Entity Beans is still a performance bottleneck in my opinion.
    - EJB's help in transaction managements, remote calls, database connection cashing for JDBC calls, business logic separation, possibly authentication.
    Hope this helps.
    [ August 11, 2003: Message edited by: Avianu Sud ]
    priya shankar
    Ranch Hand

    Joined: May 12, 2003
    Posts: 51
    Thanks Sud
    ----------------------------------------------------------------------------
    Presentation Layer prepares all forms, has Java classes for the forms, calls EJB Layer for information and retrive data.
    ----------------------------------------------------------------------------
    1)what role java classes have with the presentaion layer
    2)what u mean by Services...I think its controller(If no correct me)
    ----------------------------------------------------------------------------
    Persistence classes set domain objects which are returned to the Presentation via the delegates
    ----------------------------------------------------------------------------
    1)What's going to be there in Domain Objects..i think they are java classes

    2)Delegae classes are sub conroller(Am i righ if no clear me)

    3)what could be the maximum number of Beans(Session,entity) in the proj

    Expecting clarification
    thanks
    pria
    Rohit Ahuja
    Ranch Hand

    Joined: Oct 04, 2001
    Posts: 121
    Priya,
    Assuming that ur organisation has around 5000 Employees ( If u r working in Oracle/Accenture/TCS of course ) i dont see any reason why u shud be going in for EJBs. Using plain simple Java Beans along with Jsps would be a much more wiser and faster option.
    The reason i say this is, ur server, both Web and Database wud be at one single place. I dont see a possibility that ur WebServer is in Asia and Database in Europe.
    Secondly, at the most at any given one point of time i bet ur site wont be accessed by more than 1000 people.
    As for privilages, u wud be giving that based on role, not even on the designations, so i dont think u wud be using the role based EJB security.
    Why then, go for EJBs.
    Simple Javabeans and Jsp combination is deadlier for small application purposes.
    Wat u say guys ?? Contradict me if i am wrong.


    Face Off.
    Lasse Koskela
    author
    Sheriff

    Joined: Jan 23, 2002
    Posts: 11962
        
        5
    Deepak, it is very much true that a lot of EJB applications should've been written using plain servlets and JSPs. However, I got the impression that The Powers That Be were *dictating* the use of EJBs for this project...
    dhiraj mudgil
    Greenhorn

    Joined: Aug 08, 2003
    Posts: 2
    Dear Group,
    I have been working with EJB's since last 2.5 years and i fully agree with what deepak is saying?
    If your application is a small one and may require small and simple transactions and security not like "Fort Knox" , then why to increase development & maintenance overhead and burden on resources besides compromising on performance.
    If you have to make a good application, and want to learn designing, You can use the following:

    1) JSP/ HTML with Java Beans or Tag Library for generating views ( Personally i found java beans more flexible and easy to use than tag libs)
    2) Servlet as a controller( if u have time learn the struts framework and customise it ur needs and make ur own framework by removing unnecessary details from it).
    3) Use DAO Patten to access the database ( Later if you need to convert it to EJB for some reason , may be utilise this project as a service, it will be easy for you then).
    4) create all ur java beans using factory methods and liberating ur JSP or servlet code from object creation code. It will agian help u change the technology of ur business logic without chaning ur JSP's.
    Hope it helps.
    Dheeraj
    Andres Gonzalez
    Ranch Hand

    Joined: Nov 27, 2001
    Posts: 1561
    Originally posted by Lasse Koskela:
    Deepak, it is very much true that a lot of EJB applications should've been written using plain servlets and JSPs. However, I got the impression that The Powers That Be were *dictating* the use of EJBs for this project...

    Bingo!
    The aim of projet is to allow the employee to submit the details of his
    trip and expenses so that the company will make the reimbursement..

    I will not go with EJB's, I think it's adding too much complexity.
    Is there gonna be a lot of concurrent users, how important transactions are, how about security, etc..
    I'd ask, what is the reason for choosing EJB over plain servlets/jsp (struts)?
    have a look at this article
    http://www.javaworld.com/javaworld/jw-12-2001/jw-1207-yesnoejb.html
    any opinions?
    [ August 12, 2003: Message edited by: Andres Gonzalez ]

    I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
    Lasse Koskela
    author
    Sheriff

    Joined: Jan 23, 2002
    Posts: 11962
        
        5
    Additional source for decision making (a discussion thread based on an article on the subject):
    http://www.theserverside.com/home/thread.jsp?thread_id=8961
    Avianu Sud
    Ranch Hand

    Joined: Jan 20, 2002
    Posts: 55
    I definately Agree. For Simple Applications(like this one), where Transactions are minimal, Pooling is not critical, databases are not distributed, the only reason for EJB's will be distributed access to Classes, ie. If the Presentation and App server were on different servers, or could be on different servers (Due to security, firewall issues or access by multiple clients).
    If that is not the case, EJB's can slow down development time and performance of the application.
    priya shankar
    Ranch Hand

    Joined: May 12, 2003
    Posts: 51
    Thank u All ,
    First let me tell one thing...
    The decision to for EJB ,for this is not ours...Its our Client's requirement..
    Ofcourse the proj is Intranet, But may be converted to Internet appln..
    So here nothing we can do.
    So Can anybody clear the following doubts...
    ----------------------------------------------------------------------------
    Presentation Layer prepares all forms, has Java classes for the forms, calls EJB Layer for information and retrive data.
    ----------------------------------------------------------------------------
    1)what role java classes have with the presentaion layer
    2)what u mean by Services...I think its controller(If no correct me)
    ----------------------------------------------------------------------------
    Persistence classes set domain objects which are returned to the Presentation via the delegates
    ----------------------------------------------------------------------------
    1)What's going to be there in Domain Objects..i think they are java classes

    2)Delegae classes are sub conroller(Am i righ if no clear me)

    3)what could be the maximum number of Beans(Session,entity) in the proj

    Expecting clarification
    thanks
    Priya
    Andres Gonzalez
    Ranch Hand

    Joined: Nov 27, 2001
    Posts: 1561
    The decision to for EJB ,for this is not ours...Its our Client's requirement..
    I don't get it.. I believe this is one of the many reasons EJB gets a bad reputation. People don't know when to use it and think is the ultimate solution to all problems. Does your client know what he's talking about? or did he read somewhere about EJB and decided to choose that technology because it was cool?
    Ofcourse the proj is Intranet, But may be converted to Internet appln..
    So?
    I think our mission here as developers is to explain with arguments why we think X technology is not appropiate, and the risks we are facing if we don't evaluate all these possibilities from the very beginning. Hope you've done that priya, and sorry for not answering your question, I just felt I needed to say this
    good luck
    priya shankar
    Greenhorn

    Joined: May 12, 2003
    Posts: 16
    all
    Pradeep bhatt
    Ranch Hand

    Joined: Feb 27, 2002
    Posts: 8919

    How come Priya member # is different in different posts?
    Sorry for deviating from the thread
    [ August 14, 2003: Message edited by: Pradeep Bhat ]

    Groovy
    priya shankar
    Greenhorn

    Joined: May 12, 2003
    Posts: 16
    Hi all
    Thanks for all..I am very happy as i am getting various suggestion from various people...

    Though ur suggestions like (why ejb for this proj, usual model is enough) are acceptable, i can't do anything with this decision ...
    Here Are my doubts again,
    1)Planned to use 2 Session facade pattern as LASSE'S ADVICE
    a)First session facade is going to contain all beans for new user
    ,update user,remove user..Here i planned to use a stateless session bean ,which directly involves database operaion.

    b)Second one is for Expense ...this bean is a stateful one.Its going to contain entity beans like
    i)TransportationExpenseBean---for storing detailed trans expense
    ii)BoardingExpenseBean
    iii)FoodExpensesBean
    iv)MiscellBean
    Finally a business method to calculate the total expense.
    Here my doubt is
    1)user is going to enter TransportExpenses ---TransportExpense form

    Then he submits it...
    Controller is going to call the correct bean , and then the statefule session(facade) ,which inturn calls the TransportExpensesBean for updating
    2)the same thing happens when he enter other expense through various forms
    But if , everytime when enter the details and call the session facade(3 times(for trans,food,boarding)) won't it make meaningless ...

    Moreover there is not going to be any relation with all these entity beans..
    Hope u people understand my point...
    I will come with lots of doubts...My next topic is on DTO
    thanks
    priya
    priya shankar
    Greenhorn

    Joined: May 12, 2003
    Posts: 16
    Great Bhat
    Actually i couldn't login to my account(don't no the probs)..so i just renamed my another account to priya shankar..
    Thanks
    priya
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Ejb Project Plan