Create your own "naming context" class that will delegate to javax.naming.InitialContext when running from an EJB, or otherwise will delegate to some custom naming service.
Mike Dunbar wrote: > Hello, > I am wondering if some of you have already fought this battle and could > help me out before I do my own brainstorming. Basically, we don't want > to "hard-code" our business logic components into the EJB model. We > would like to develop the core components in plain ol' Java and > "wrap"/deploy them as EJBs when it makes sense. Basically, the EJB > would just delegate to the "wrapped" Java component. Sounds simply > enough, right? > > The part I need help with is: how to give the components access to > configurable properties in a way that works both when they are deployed > as an EJB, and when they are not deployed as an EJB? The most straight > forward way would seem to be putting such properties a Java properties > file, but I believe EJBs are not allowed to do file I/O - right? I > think EJBs usually get such information from JNDI entries specified > in the EJB's deployment descriptor as <env-entry>'s. Is there a uniform > mechanism that will work both when the components are deploy as EJBs > and when they are not? For example, maybe the components could always > access the properties via JNDI. Sometimes an application server would > have put them there (when deployed as an EJB), sometimes they would've > got there via another mechanism (when they are not deployed as an EJB). > But, I've heard that JNDI lookup's give pretty bad performance. This > would also require a naming server to present whenever they are > Deployed, which I think is more demanding than something like a simple > properties file. > > Has anyone else tried to do this? Could you point me in the right > dirction? This seems like a common approach people would want to use - > not tying your code to a given component model so it could be used > outside of that model also. > > Much Thanks for Your Help! > Mike > > __________________________________________________ > Do You Yahoo!? > Yahoo! - Official partner of 2002 FIFA World Cup > http://fifaworldcup.yahoo.com > > =========================================================================== > 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". > > > -- _______________________________________________________________________________ Evan Ireland Sybase EAServer Engineering [EMAIL PROTECTED] Wellington, New Zealand +64 4 934-5856 =========================================================================== 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".
