You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by Atul Dambalkar <At...@xoriant.com> on 2001/07/12 02:20:48 UTC
RE: org.apache.turbine.om.security TurbineUser/Group/Role classes
need to override "equals"
> -----Original Message-----
> From: David Sean Taylor [mailto:david@bluesunrise.com]
> Sent: Wednesday, July 11, 2001 4:46 PM
> To: jetspeed-dev@jakarta.apache.org
> Subject: RE: org.apache.turbine.om.security TurbineUser/Group/Role
> classes need to override "equals"
>
>
> I thought you were using a WeakHashMap.
> Then you just do:
>
> map.put( role.getName(), role )
>
> However its not ordered. Does it need to be?
No, it need not be ordered, so it really doesn't need Comparable interface.
How about me implementing it in BaseProfileLocator for equality?
Role gets compared on role.getName()
Group gets compared on group.getName(),
and same goes withe the user..or do I have to use "user.getUserName()"
Language/Country is simple String equality.
-Atul
>
>
>
>
> > -----Original Message-----
> > From: Atul Dambalkar [mailto:adambalk@cisco.com]
> > Sent: Wednesday, July 11, 2001 4:37 PM
> > To: jetspeed-dev@jakarta.apache.org
> > Subject: org.apache.turbine.om.security
> TurbineUser/Group/Role classes
> > need to override "equals"
> >
> >
> > Hi David/Raphael,
> >
> > This can be a low priority..as I do have a work around.
> >
> > TurbineUser/Group/Role classes need to override "boolean
> > equals(Object obj)
> > method from java.lang.Object, so as it to be comparable in a
> > java.util.Map
> > and may also implement java.lang.Comparable interface.
> >
> > -Atul
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> jetspeed-dev-help@jakarta.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org
RE: org.apache.turbine.om.security TurbineUser/Group/Role
classes need to override "equals"
Posted by Atul Dambalkar <ad...@cisco.com>.
At 05:37 PM 7/11/01 -0700, you wrote:
> > > I thought you were using a WeakHashMap.
> > > Then you just do:
> > >
> > > map.put( role.getName(), role )
> > >
> > > However its not ordered. Does it need to be?
> >
> > No, it need not be ordered, so it really doesn't need
> > Comparable interface.
> >
> > How about me implementing it in BaseProfileLocator for equality?
> >
>
>What are we trying to order, ProfileLocators?
>If that is the case, then it has to be ordered in the same order as the
>primary key that you defined.
>Perhaps a TreeMap is better?
>Actually Im not sure what exactly it is your are trying to do.
>Are you creating a cache like in the CastorPSMLmanager?
Yes. I am trying to implement caching mechanism just like you did in
CastorPsmlManager. When we put, ProfileLocator into Map, it needs a unique
key. For FilePsmlManager it is trivial as the FileURL is going to be
unique. But in case of ProfileLocator objects, when we put them in Map, the
key can't be just Object now. B'cse it can happen that, there is a PSML
available in the cache and only b'cse ProfileObject reference value is
something different, the PsmlManager will go to the database to fetch the
PSML. We don't want to do that. So while we check it in the Map, the key
object if it has equals method, then the Map will properly search the value.
>Then, the only reason it would need to be orderd would be for queries,
>right?
Actually, it really need not be ordered. For all such queries, I don't
think we should be using cache, as cache may not have all the necessary
records, satisfying the query.
>For all other PSMLManager methods, I dont see a need for ordering...
True.
>Perhaps its best to let the db handle queries, return Profile IDs (as
>discussed in my previous email to Anil), and then go to your hashmap to get
>the objects for a little performance gain.
Perfect.
> > Role gets compared on role.getName()
> > Group gets compared on group.getName(),
> > and same goes withe the user..or do I have to use "user.getUserName()"
> > Language/Country is simple String equality.
> >
> > -Atul
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org
RE: org.apache.turbine.om.security TurbineUser/Group/Role classes need to override "equals"
Posted by David Sean Taylor <da...@bluesunrise.com>.
> > I thought you were using a WeakHashMap.
> > Then you just do:
> >
> > map.put( role.getName(), role )
> >
> > However its not ordered. Does it need to be?
>
> No, it need not be ordered, so it really doesn't need
> Comparable interface.
>
> How about me implementing it in BaseProfileLocator for equality?
>
What are we trying to order, ProfileLocators?
If that is the case, then it has to be ordered in the same order as the
primary key that you defined.
Perhaps a TreeMap is better?
Actually Im not sure what exactly it is your are trying to do.
Are you creating a cache like in the CastorPSMLmanager?
Then, the only reason it would need to be orderd would be for queries,
right?
For all other PSMLManager methods, I dont see a need for ordering...
Perhaps its best to let the db handle queries, return Profile IDs (as
discussed in my previous email to Anil), and then go to your hashmap to get
the objects for a little performance gain.
> Role gets compared on role.getName()
> Group gets compared on group.getName(),
> and same goes withe the user..or do I have to use "user.getUserName()"
> Language/Country is simple String equality.
>
> -Atul
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org