Search the web
Sign In
New User? Sign Up
weblogic-workbook · WebLogic Workbook for EJB 3rd Edition
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Weblogic and special properties   Message List  
Reply | Forward Message #597 of 647 |
Re: Weblogic and special properties

Hmmm... I do not believe you really want to use property files in
EJB. I believe that property files require the java.io package which
an enterprise bean must not use. Check the Bean Provider's
responsibilities in Chapter 24 "Runtime Environment" in the EJB 2.0
spec.

EJB 2,0 provides a facility called Environment Entries that allow a
bean to lookup info at runtime using a JNDI lookup. I guess the EJB
designers were trying to find something that is both cross platform
and secure. Check out Chapter 20 Enterprise bean's environment in the
EJB 2.0 spec.

In your deployment descriptor
<entity>
....
<env-entry>
<description>Description provides facility for developer to
communicate intent to deployer</description>
<env-entry-name>pie</env-entry-name>
<env-entry-type>java.lang.Double</env-entry-type>
<env-entry-value>3.14</env-entry-value>
</env-entry>
<env-entry>
<description>Another place to provide info concerning deploy
time constant to bean deployer</description>
<env-entry-name>name</env-enty-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>Thermond</env-entry-value>
</env-entry>
...

In your bean,
....
import javax.ejb.*;
import javax.naming.*;

...
public void myBusinessMethod()
{
InitialContext ic = new InitialContext();
Double value = (Double) ic.lookup("java:comp/env/pie");
double pie = value.doubleValue();

String name = (String) ic.lookup("java:comp/env/name");
...
Your bean can access its JNDI environment in setSession/EntityContext
(), ejbCreate(), ejbRemove() ejbActivate(), ejbPassivate(), and
business methods. So I guess I should say that the JNDI environment
is accessible from every method of your session or entity bean but
the constructor.

I am assumed that you want just simple deployment time constants and
not something that should be a environment reference or a connection
factory.

If you want to do something similar with servlets and JSPs use <init-
param> or <context-param> in the web.xml. Feel free to ask about
them. I did not include them since this is mostly an EJB forum.

Good Luck
Thermond Adams

--- In weblogic-workbook@yahoogroups.com, "tramosde" <tramosde@y...>
wrote:
> I have the property file for my applications with some special
> definitions.
> How do I tell webLogic where the property file is????
>
> Thanks!!!




Mon May 3, 2004 5:40 pm

thermond1313
Offline Offline
Send Email Send Email

Forward
Message #597 of 647 |
Expand Messages Author Sort by Date

I have the property file for my applications with some special definitions. How do I tell webLogic where the property file is???? Thanks!!!...
tramosde
Offline Send Email
Apr 29, 2004
9:28 am

Hmmm... I do not believe you really want to use property files in EJB. I believe that property files require the java.io package which an enterprise bean must...
thermond1313
Offline Send Email
May 3, 2004
5:42 pm

Sorry, my english is not very good. First, thanks a lot for Your help. We are looking for the best among solutions. We have a project with the ejb-s that have...
Milan Tramosljanin
tramosde
Offline Send Email
Jun 17, 2004
1:09 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help