Question about when to use EJB

Hello All,
Right now, I am tasked with taking data out of the database and storing it on the mid-tier. We will be storing this static data in an XML file. We were hoping to read it in when starting the server and then persisting the data for the life of the server. Is this a good time to user EJB? All I have seen is examples using a database. We would like to take the database hit out of the equation when it comes to retrieving this data, but would also like to avoid parsing the XML doc every time someone logs in to the application. Is EJB a good answer here, or is it overkill?

If this is for use as a read-only dictionary for supporting an EJB application, by all means.
But to use EJB just to do this - I think that would be overkill.
A singleton would do the job fine - especially if the XML doesn't change - actually even if it does that doesn't matter.

Similar Messages

  • Design question about when to use inner classes for models

    This is a general design question about when to use inner classes or separate classes when dealing with table models and such. Typically I'd want to have everything related to a table within one classes, but looking at some tutorials that teach how to add a button to a table I'm finding that you have to implement quite a sophisticated tablemodel which, if nothing else, is somewhat unweildy to put as an inner class.
    The tutorial I'm following in particular is this one:
    http://www.devx.com/getHelpOn/10MinuteSolution/20425
    I was just wondering if somebody can give me their personal opinion as to when they would place that abstracttablemodel into a separate class and when they would just have it as an inner class. I guess re-usability is one consideration, but just wanted to get some good design suggestions.

    It's funny that you mention that because I was comparing how the example I linked to above creates a usable button in the table and how you implemented it in another thread where you used a ButtonColumn object. I was trying to compare both implementations, but being a newbie at this, they seemed entirely different from each other. The way I understand it with the example above is that it creates a TableRenderer which should be able to render any component object, then it sets the defaultRenderer to the default and JButton.Class' renderer to that custom renderer. I don't totally understand your design in the thread
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=680674
    quite yet, but it's implemented in quite a bit different way. Like I was saying the buttonClass that you created seem to be creating an object of which function I don't quite see. It looks more like a method, but I'm still trying to see how you did it, since it obviously worked.
    Man adding a button to a table is much more difficult than I imagined.
    Message was edited by:
    deadseasquirrels

  • When not using EJBs can I make BD a Singleton and cache facade instances?

    Hi,
    In an application which does not use EJBs can I make BD(Business Delegate) a singleton?
    I was very sure about doing this but when I tried Google on the same subject the answers were'nt supportive of this but that was in the context of applications which used EJBs. And also item 4 in Effective Java isnt very supportive of caching Objects at the drop of a hat.
    When not using EJBs would it be an unnecessary thing to make BD a singleton and cahce Facade instances in a BD and DAO instances in a Facade? I am planning to use a array based blocking bounded buffer for the purposes of caching. Or would it be better to make both BD and a facade as SIngletons and just cache DAOs in a Facade?
    Any suggestion would be of good help to me.
    Thanks a lot.

    Not sure I understand all your design, but you seem
    to describe an architecture where requests are queued
    and handled serially.Sorry if I messed up while explaining it. No, it will not be handled serially. Since the BD is a singleton multiple threads can pass messages to it simulteanously, a bit like an object of the Action class in Struts. Since I dont see having any synchronized methods in a BD requests will be handled simulteanously.
    The impact on throughput of handling requests
    serially (as opposed to parallelizing them) probably
    outweights by far the cost of instantiating one more
    object per request...Yes, I understand that but as I explained above the reqests wont be handled serially.
    To be more clear, I am thinking of using any one of these two things:
    1) BD(Singleton)-->Facade(Singleton, caches DAOs in a thread safe data structure)
    2)1) BD(Singleton, caches Facade instances in a thread safe data structure)-->Facade(caches DAOs in a thread safe data structure).
    the thread safe data structure I am planning to have is a array based bounded buffer which blocks using wait and notify mechanism.
    Thank you for the reply.

  • Question about openning files using SDK 10.

    I have written a Plug-In for SDK 9 that works wonderfully. One of the functions is for the user to be able to page (Next/Previous) between PDF files on our server. This functionality now longer works without crashing Acrobat 10. All I am doing is creating the URL path to the next/previous PDF, creating a CustomFileSys with the path and calling AVDocOpenFromFile.
    Does this no longer work with Acrobat 10 SDK?
    Thanks!

    Should work fine, AFAIK.
    For this level of issue, I would open a formal support request with developer support.
    From: Adobe Forums <[email protected]<mailto:[email protected]>>
    Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
    Date: Mon, 10 Oct 2011 08:51:08 -0700
    To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
    Subject: Question about openning files using SDK 10.
    Question about openning files using SDK 10.
    created by Greggars<http://forums.adobe.com/people/Greggars> in Acrobat SDK - View the full discussion<http://forums.adobe.com/message/3963065#3963065

  • When to use @Resource and when to use @EJB for dependency injection

    Hi,
    When do you use
    @Resource and when do you use @EJB for dependency injection?
    Thanks

    Captain obvious: Use @EJB for injection of EJBs, and @Resource for everything else.
    There was a discussion about this very topic quite recently, perhaps you can find it through the search.

  • Question about HTML files using TextEdit

    First off, I wanted to ask if this is the proper place to post a question about HTML/XHTML. I couldn't really find anywhere else that seemed to fit better, but please point me in the right direction if this is not the place. Thanks.
    Moving on -- here's my question:
    I'm having trouble with working with HTML files in TextEdit. I'm on a Mac, using TextEdit as my HTML editor (I can not afford one of these other HTML editors, and I like using a simple text editor like TextEdit for HTML). Here's my problem: I open a new rich text document in TextEdit and write my HTML and then choose File>Save As and choose "HTML" under the File Format drop-down box. Having saved this file as an HTML file, I then open Safari and choose File>Open File and select my HTML file; however, when I do this, my web page's text does not appear in the browser window. Instead, the HTML code itself appears in the browser window, as if the browser was not interpreting it as HTML and converting it. The same problem happens when saving the file as a .htm file using Microsoft Word for Mac.
    So, as another solution (at the suggestion of a helpful poster in a previous thread), I tried creating a plain text file in TextEdit (instead of a rich text file like before). Now, in TextEdit there is no option for saving plain text files as HTML files, so I simply save it as a Unicode-8 format and then find the file in Finder and change the extension to .htm myself (I've tried .html as well). This, fortunately enough, actually works! When I open the file in Safari I get to see my web page as expected. However, the first time I quit out of the application TextEdit and then try to reopen my .htm file in TextEdit, I no longer can see my HTML code. Instead, TextEdit shows me the actual web page text that I would expect to see when I open the file in a browser, and my HMTL code is lost.
    Can someone please help me here? There has to be a way to edit HTML in TextEdit without the code disappearing every time you quit out of the application and reopen the HTML file. Any help is greatly, greatly appreciated. Thank you.

    That's the problem -- once I convert it to plain text there is no longer an HTML option under the Save As drop down menu. The drop down menu's title is Plain Text Encoding instead of File Format and the only options I get are Unicode-8, Unicode-16, Western, Chinese, and so forth. I can save it as an HTML file, but only if the file is rich text, which doesn't work for HTML.
    So, I can save it as plain text (.txt) and then go and change the extension myself, and like I said, it works if I do that. I can edit HTML in TextEdit and open the file properly in Safari to view my web page. The problem is (I went over all this in my first post) that, after that, if I exit TextEdit and reopen it, my document is no longer HTML code -- it is now simply the text of the web site as if I had opened it in a broswer.
    What do you suggest I do?

  • Have to ask again:when to use ejb-ref ?

    hi, I asked this last week but nobody answered it.
    i am really curious about it and i checked some docs it said " it is useful
    coz beans can look each other up without needing to initialize JNDI to any
    particular driver".
    i wonder what means particular driver and when there will be great
    difference between using and not using.
    thanx in advance
    Ciao,
    zhxt

    In WLS you can have either global JNDI names that are visible throughout
    the server or JNDI names that are local to your application.
    The recommended best practice these days is to use ejb-refs and/or
    ejb-links to lookup your EJBs. For local EJBs, you don't need to have a
    global JNDI name since they are not visible to other applications.
    -- Rob
    scratchback wrote:
    hi, I asked this last week but nobody answered it.
    i am really curious about it and i checked some docs it said " it is useful
    coz beans can look each other up without needing to initialize JNDI to any
    particular driver".
    i wonder what means particular driver and when there will be great
    difference between using and not using.
    thanx in advance
    Ciao,
    zhxt

  • When to use ejb-ref?

    if i do not write <ejb-ref> in ejb-jar.xml,what will happen?the application
    can not run or performance is low?
    and is there any difference between bmp and cmp?i mean "does cmp need
    <ejb-ref>?"
    Ciao,
    zhxt

    In WLS you can have either global JNDI names that are visible throughout
    the server or JNDI names that are local to your application.
    The recommended best practice these days is to use ejb-refs and/or
    ejb-links to lookup your EJBs. For local EJBs, you don't need to have a
    global JNDI name since they are not visible to other applications.
    -- Rob
    scratchback wrote:
    hi, I asked this last week but nobody answered it.
    i am really curious about it and i checked some docs it said " it is useful
    coz beans can look each other up without needing to initialize JNDI to any
    particular driver".
    i wonder what means particular driver and when there will be great
    difference between using and not using.
    thanx in advance
    Ciao,
    zhxt

  • Questions about Indexing and Using an Indexing POA

    Although I have only about 50 users, at least 15 of them have in excess of 100,000 messages in their accounts and the POA (version 7.0.2) is regularly slowing to a crawl. (I just know that plans for revolution are fomenting!) I have embarked on a campaign to reduce these accounts by archiving everything off to get mail accounts down to 3000 or fewer pieces. I have achieved user buy-in, but have worked on only a few users so far.
    In another closely related thread, it was suggested to me that the PO speed issues relate to broken indexes. And I suspect that given so many messages, the indexes were never getting fully rebuilt with the default QF POA settings. I am trying to fix that situation in addition to reducing mail account sizes. So, I have set up a second POA on another server and dedicated it to the indexing task. The /qfinterval is set for 1 hour, other /qf switches at default. The POA-QF does no mail delivery, but it does do nightly user upkeep.
    The POA-QF seems to be steadily working away and making progress at reducing the number of unindexed messages. However, I have questions about what I am seeing and what more I can do:
    1. Is the progress I am seeing real progress? For example I have a user with over 100,000 messages to be indexed and every time I check the logs, the count drops by about 500 messages per hourly QF cycle. I assume that if I just let it keep running, it will eventually get caught up and fixed. Not only with this user, but with all the others as well. Will my patience (and theirs) be rewarded? Are there any gotchas I need to prepare for?
    2. One user has recently had virtually all of her messages successfully moved to archive. I can see them in the Archive, and do not see them in the online account. However, now over a week later, QF still shows >130,000 items still left to index for that user. The POA-QF is making slow, steady progress reducing that number, but why is this user's QF count still so high? Does it just need more time, or is there something amiss for this user?
    3. I may want to rebuild indexes for single users from scratch. I have seen the TID 3105742 which tells how to do this: Essentially you turn off mail delivery functions, and make some other switch changes to dedicate the POA to indexing for just a single user, and then you let the POA rebuild the indexes. The implication of that scenario is that the POA is now enjoying exclusive access to the user's databases.
    If I want to use my secondary POA-QF to rebuild a user's index from scratch, does the main POA have to be offline and the user out of GWise? That is, Does the QF process require exclusive access in order to rebuild indexes from scratch?
    Thanks for any thoughts or suggestions.
    Peter Smick

    pgsmick wrote:
    > 1. Is the progress I am seeing real progress? For example I have a user with
    > over 100,000 messages to be indexed and every time I check the logs, the count
    > drops by about 500 messages per hourly QF cycle. I assume that if I just let
    > it keep running, it will eventually get caught up and fixed. Not only with
    > this user, but with all the others as well. Will my patience (and theirs) be
    > rewarded? Are there any gotchas I need to prepare for?
    Set this switch for this indexing POA - /qflevel=999 - this will index
    everything in one run. It will take a long time, but with no qflevel switch you
    are indeed only indexing 500 messages at a time, and if the user has that much
    mail, it might never really catch up.
    >
    > 2. One user has recently had virtually all of her messages successfully moved
    > to archive. I can see them in the Archive, and do not see them in the online
    > account. However, now over a week later, QF still shows >130,000 items still
    > left to index for that user. The POA-QF is making slow, steady progress
    > reducing that number, but why is this user's QF count still so high? Does it
    > just need more time, or is there something amiss for this user?
    >
    This is odd, because really the index count should drop to nothing, but with the
    above switch this might get resolved as well.
    > 3. I may want to rebuild indexes for single users from scratch. I have seen
    > the TID 3105742 which tells how to do this: Essentially you turn off mail
    > delivery functions, and make some other switch changes to dedicate the POA to
    > indexing for just a single user, and then you let the POA rebuild the indexes.
    > The implication of that scenario is that the POA is now enjoying exclusive
    > access to the user's databases.
    Not really - the POA is not enjoying exclusive access to the user's database,
    the indexer is just avoiding an attempt to index anything else.
    > If I want to use my secondary POA-QF to rebuild a user's index from scratch,
    > does the main POA have to be offline and the user out of GWise? That is, Does
    > the QF process require exclusive access in order to rebuild indexes from
    > scratch?
    No - QF never requires exclusive access. That said, you may find that an
    extremely vigorous QF can cause slowdowns for the user.
    Danita
    Novell Knowledge Partner
    Moving GroupWise to Linux?
    http://www.caledonia.net/gwmove.html

  • Few questions about file sharing using airport

    I'm thinking about getting an AirPort Extreme, but I have a few questions:
    1- I (must) use Ubuntu Linux at work and I would like to be able to acess my home files hosted at AirPort remotly. Is this possible?
    2- Can I access my files on my iPhone using 3G connection (eg: download or stream mp3 files, photos, ...)?
    Thanks in advance!
    Marcio

    Yes.
    Yes. Use FileBrowser for iPad.

  • Question about when L3 sticky information is removed on CSS

    Hi everyone,
    I have a question about L3 sticky on CSS.
    I understand L3 sticky takes effect on the following situations,
    1: until expiring inactive timer
    2: until sticty table full
    and
    3: until the connection disconnect by receiving RST or FIN from client or real server
    The "3:" means that CSS maintains sticky connection between specific client IP address
    to real server (L3 stickty) when CSS has its information on sticky table.
    And CSS has removed it from sticky table if CSS receive RST or FIN even if the inactive timer
    abot its connection has not expired.
    That is, CSS removed L3 sticky information from sticky table when CSS receive
    RST or FIN from client or real server even if inactive timer has not expired and
    in this situation, the next new connection from same client IP address is processed with
    normal load balancing, in the result, the new connection from same client IP address
    forwards other real server.
    Is my understanding correct ?
    Or CSS maintains L3 sticky information on the sticky table until the situation meets
    "1:" or "2:" even if CSS receive RST or FIN ?
    Your information would be appreciated.
    Thank you in advance.
    Best Regards,

    What point number 3 means is the layer 3 sticky will take effect when a connection disconnect message is received from a client or a real server. This connection disconnect is received in the form of RST or FIN messages from the real server or the client.

  • When to use EJBs

    1) Does any one know where can I find documents that describe when EJBs should be used in an application? If I use a J2EE server like WebLogic, should I always try to use EJBS an my applications?
    2)Once I have decided to use EJBs in an application, should there be an entity bean corresponding to every table in the database??
    thanks

    Hi
    Well documentation can be found on sun's site and for EJB regarding the number based on table is not required.
    I have a project which had around 30 Tables in it and we were using EJB's for it and had grouped EJB's based on table or functionality.
    You could also make EJB's based on the tables logical grouping and can work it out.
    Based on that you can define ur Interface.
    Bye

  • Question about extend calendar using scal?  help,help

    recently, we received a mail from sap which saying about extending  calendar using scal;
    I have read sap notes:1529649 , 501670
    and my steps will be:
    1> in our qas system using scal
        change holiday calendar: choose CN China holiday calendar to change and then enter validation from 1995 to 2098(for example)
    2> change factory calendar: choose CN China factory calendar to change and then enter validation from 1995 to 2098(for example)
    3> in scal , choose menu: extras-->update calendar buffer
    4> transport this change to our prd system.
    5> go to scal in prd system to check
    6> update prd system `s calendar buffer in scal
    I do know whether my steps is right?
    I have two questions:
    1> we are a chinese compary, and we use several languages:TRADITIONAL CHINESE , SIMPLIFIED CHINESE and ENGLISH;
         whether i should change other holiday calendar,such as british calendar?
    2> Is there something wrong about my steps?
    thanks a lot.
    Edited by: victor on Nov 29, 2010 6:17 AM

    Hi,
    You are correct, But You can change it on QAS due to client will not modifiable.
    Goto Developement System and run scal.
    Most important is to change/extend factory calander and save it. Request will be generated as Workbench. Transport it to Production System.
    Rgds
    dk

  • When to use ejb's

    Hi there
    I just have the following question?
    What requirement would make you use ejb's?

    Hi there
    I just have the following question?
    What requirement would make you use ejb's?A single requirement? "Requirement 5. The system must use ejbs."
    (And I have seen a requirement that was basically like this.)
    Other than that it certainly can't be done with a single requirement.

  • EJB3 newbie - when to use EJB?

    If I just want to build a reusable module that does not have any business critical actions, such as a login module, or a blog module, should I use EJB?
    Also, am I correct that only EJBs can run on distributed servers, and that all other non-EJB components in a web applications can only run on a single server?

    If I just want to build a reusable module that does
    not have any business critical actions, such as a
    login module, or a blog module, should I use EJB?
    No. Any Java module can be made to be reusable, if designed to be so. Actually, by using EJBs, you'll be limiting the reusability of your modules, since those would need to run inside an EJB container.
    Also, am I correct that only EJBs can run on
    distributed servers, No, they can run in distributed as well as non-distributed environments.
    and that all other non-EJB
    components in a web applications can only run on a
    single server?No. Not sure where you got that idea from. I think you're confusing multiple server environment (clusters) with distributed[i] business objects. You can cluster applications that collocate all their components in a single JVM.
    There are actually very few cases where the use of EJB is to be considered (roughly 10% of cases):
    - if you really need object distribution - this is not the norm
    - if you need to use IIOP as the protocol for communication
    - MDBs are a good solution for some applications heavily based on messaging

Maybe you are looking for