RE: EJB encapsulation (data hiding) pattern... Is there such a thing?

2001-03-11 Thread Jason Smith

If you have control over the deployment & assembly maybe you can use the
"run-as-specified-identity" security configuration for your Person, then
only allow that role to invoke methods on Phone.  I may be way off base here
since I have never tried to do this, but I thought I would throw it out.
-jason






RE: EJB encapsulation (data hiding) pattern... Is there such a thing?

2001-03-11 Thread Chris Bartling

You may want to take a look at the new J2EE patterns hosted at Sun's Java
Developer Connection:

http://developer.java.sun.com/developer/restricted/patterns/J2EEPatternsAtAG
lance.html

You'll need to login to view it, but there are some relevant patterns with
regard to your question (especially look at the Value Object Assembler and
Aggregate Entity).  Hope this helps.

-- chris --


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Alex Paransky
Sent: Sunday, March 11, 2001 3:56 AM
To: Orion-Interest
Subject: EJB encapsulation (data hiding) pattern... Is there such a
thing?


I am trying to model a Person having many Phones with two Entity beans.
Person and Phone are both entity beans.  But I do not want to allow anyone
to manipulate the Phone directly.  I only want Person to be able to:

Person.addPhone(PhoneValue)
Person.removePhone(PhoneKey)
Person.updatePhone(PhoneKey, PhoneValue)
Person.getPhones().

In other words, Phone is treated like a dependent (except on advice of
others, I have stopped using dependent objects).

Is there a way I can enforce this?  In other words, how can I stop any one
except Person, from using the PhoneHome/PhoneBean directly?  The reason I
need to do this, is because Person performs additional logic when phones are
added or removed or changed.  This logic, must always be performed, so I do
not want someone to use the PhoneHome to find the Phone and change it
without the person knowing.

-AP_
www: http://www.standardset.com
resume: http://www.standardset.com/resume_body.jsp
home: (818) 541-0029







EJB encapsulation (data hiding) pattern... Is there such a thing?

2001-03-11 Thread Alex Paransky

I am trying to model a Person having many Phones with two Entity beans.
Person and Phone are both entity beans.  But I do not want to allow anyone
to manipulate the Phone directly.  I only want Person to be able to:

Person.addPhone(PhoneValue)
Person.removePhone(PhoneKey)
Person.updatePhone(PhoneKey, PhoneValue)
Person.getPhones().

In other words, Phone is treated like a dependent (except on advice of
others, I have stopped using dependent objects).

Is there a way I can enforce this?  In other words, how can I stop any one
except Person, from using the PhoneHome/PhoneBean directly?  The reason I
need to do this, is because Person performs additional logic when phones are
added or removed or changed.  This logic, must always be performed, so I do
not want someone to use the PhoneHome to find the Phone and change it
without the person knowing.

-AP_
www: http://www.standardset.com
resume: http://www.standardset.com/resume_body.jsp
home: (818) 541-0029