You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Simon Moore <Si...@condisline.com> on 2002/04/18 08:23:19 UTC

RE: Extending TurbineUser in TDK 2.2b1

Hi Diederik,


I need to be able to reference the TurbineUser (and possibly extend it)
table in my other tables so I've tried the following:

1. The Scarab approach using fulcrum:

<table name="TURBINE_USER" javaName="MyUserImpl" alias="TurbineUser" 
    baseClass="org.apache.fulcrum.security.impl.db.entity.TurbineUser"
    basePeer="org.apache.fulcrum.security.impl.db.entity.TurbineUserPeer">
    <column name="USER_ID" primaryKey="true" required="true"
type="INTEGER"/>
</table>

<table name="MY_TABLE" >
    <column name="USER_ID" primaryKey="true" required="true"
type="INTEGER"/>
    <column name="my_column" primaryKey="true" required="true"
type="TIMESTAMP"/>

    <foreign-key foreignTable="TURBINE_USER">
        <reference local="USER_ID" foreign="USER_ID"/>
    </foreign-key>
</table>


Torque created all the OM objects and everything compile correctly!

I then commented out the security service entries in my tr.props and enabled
them in Fulcrum.properties
making reference to MyUserImpl and MyUserImplPeer where appropriate...

When I tried to access http://localhost:8080/secur/servlet/secur I got a
horrible exception complaining that Turbine (the turbine broker service)
could not find the security service.

Question 1: I was under the impression that commenting out services in
tr.props and uncommenting them in fulcrum.properties enabled the fulcrum
services rather than the turbine services, is this wrong?
Question 2: What's the equivalent of the MapBrokerService and the
PoolBrokerService in Fulcrum, or do we still need them in tdk-2.2.b1?

Question 3: I noticed in scarab's tr.props that there was a fulcrum database
service but I can't find this in tdk-2.2-b. 

Note:scarab is an excellant guide but as it uses turbine 3 it's a pain to
figure out what is applicable to turbine 2.x and what is not!


As you can see, There are various questions that I need clearing up as
regards the change over to using fulcrum (it's not as simple as changing the
import statements)

After this first attempt I then decided to revert to using turbines security
service:

<table name="TURBINE_USER" javaName="MyUserImpl" alias="TurbineUser" 
    baseClass="org.apache.turbine.om.security.TurbineUser"
    basePeer="org.apache.turbine.om.security.peer.TurbineUserPeer">
    <column name="USER_ID" primaryKey="true" required="true"
type="INTEGER"/>
</table>

<table name="MY_TABLE" >
    <column name="USER_ID" primaryKey="true" required="true"
type="INTEGER"/>
    <column name="my_column" primaryKey="true" required="true"
type="TIMESTAMP"/>

    <foreign-key foreignTable="TURBINE_USER">
        <reference local="USER_ID" foreign="USER_ID"/>
    </foreign-key>
</table>

Torque created all the om code but I got many compilation errors complaining
about not find methods in TurbineUser/Peer etc...

I didn't write any adapters as per the extended-users howto because i wasn't
extending the user-table (for the moment), I just wanted to reference it in
my other tables. 

Question 4: Do I still need to write adapters in 2.2-b1 (You mention that
this is not necessary)?
Question 5: What services in turbine are redundant if fulcrum is used?
Question 6: Could somebody clear up this mess I've gotten into ;)?


I appreciate any advice you or others can offer.

Saimon



> -----Mensaje original-----
> De:	Diederik de Groot [SMTP:ddegroot@talon.nl]
> Enviado el:	jueves 21 de marzo de 2002 20:02
> Para:	Turbine Users List
> Asunto:	RE: Extending TurbineUser in TDK 2.2b1
> 
> 
> >Hi Cameron,
> 
> >You might have seen that i too have been stuggling under the previous
> >version to extend the User. I had everything working fine until 2.2b1
> came
> >about. I found you van at least do without the TurbineUserAdapters now
> >because you can directly access the extended TurbineUsers. That is what i
> >have done at least. I need the Aliased table only for refering to
> >foreignkeys. I know it's not a good solution but it works for me.
> 
> >I'm not a hunderd percent sure this is the way it was meant to be but it
> >seems to work fine.
> >Just Change everything over to torque where criteria are involved and you
> >seem to be fine.
> >I can't answer your actually question about things being in flux at the
> >moment. Let's see what the creators say :-)
> >Lots of success,
> 
> >Diederik de Groot
> 
> > -----Original Message-----
> > From: root@cr327147-a.lndn1.on.wave.home.com
> > [mailto:root@cr327147-a.lndn1.on.wave.home.com]On Behalf Of Cameron Cole
> > Sent: donderdag 21 maart 2002 19:26
> > To: Turbine Users List
> > Subject: Extending TurbineUser in TDK 2.2b1
> >
> >
> > Hello again everyone,
> >
> > Previously with version 2.1 I successfully extended TurbineUser but ran
> > into some difficulty when attempting to add a foreign key to my extended
> > user so I could place them on teams. I decided to put the project aside
> > for a bit and return when 2.2b1 came out. Well 2.2b1 has come out
> > (Congrats btw! :) and I have again started to revisit the problem and
> > have run into a few interesting issues. TurbineUserPeer extends the
> > org.apache.turbine.om.peer.BasePeer where as all of my om objects
> > (including the ExtendedBaseUser) extend the torque.util.BasePeer. As
> > such when I attempt to compile my ExtendedBasePeer all of the
> > doSelect(Criteria, DBConnection) methods no longer compile b/c the
> > turbine BasePeer expects a turbine Criteria and my generated
> > BaseUserPeer is passing a torque criteria. This is also true of the
> > retrieveByPK methods.
> >
> > I have two main questions:
> >
> > 1. Is the user/security system in a state of flux and should I just
> > holdoff? If so, where can I get more information? (I have read the
> > archives, but haven't seen any conclusions as yet)
> >
> > 2. Is there another/better way I could go about this? If there is a
> > newer/better way to do this, and someone can kick me in the right
> > direction I'll try to document my trials and tribulations and see if it
> > makes a reasonable how-to... (or how-not-to :) I understand from the
> > archives and current mail threads that the security system is undergoing
> > review and rewrite, but I don't know where to get more information...
> >
> > Thanks,
> >
> > -cam.
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Extending TurbineUser in TDK 2.2b1

Posted by Diederik de Groot <dd...@talon.nl>.
Hi Simon,

I'm not sure about all you questions, i can show you what i did and maybe
you can derive the solution for you case from that.

Instead of extending user I actually deminished TurbineUser to
(Turbine-schema.xml):

  <table name="TURBINE_USER" idMethod="idbroker">
    <column name="USER_ID" required="true" primaryKey="true"
type="INTEGER"/>
    <column name="LOGIN_NAME" required="true" size="32" type="VARCHAR"/>
    <column name="PASSWORD_VALUE" required="true" size="32" type="VARCHAR"/>
    <column name="MODIFIED" type="TIMESTAMP"/>
    <column name="CREATED" type="TIMESTAMP"/>
    <column name="LAST_LOGIN" type="TIMESTAMP"/>
    <column name="OBJECTDATA" type="VARBINARY"/>
    <unique>
        <unique-column name="LOGIN_NAME"/>
    </unique>
  </table>

Now I have a pure User Implementation without FirstName and LastName stuff.
It only holds the necessary User Entries.

Then I added an Alias to Turbine User in my Application-schema.xml (Note
that i have not specified anything but just this)

  <table name="APP_USER" javaName="APPUser" alias="TurbineUser">
    <column name="USER_ID" primaryKey="true" required="true"
type="INTEGER"/>
  </table>

Now i don't really extend the user but actually create a new object called
Member with all the fields that i need to define a real live person.

  <table name="MEMBER" idMethod="none">
    <column name="MEMBER_ID" primaryKey="true" required="true"
type="INTEGER"/>
    <column name="NICK_NAME" size="35" type="VARCHAR"/>
    <column name="INITIALS" size="8" type="VARCHAR"/>
    <column name="FIRST_NAME" required="true" size="99" type="VARCHAR"/>
    <column name="MIDDLE_NAME" size="15" type="VARCHAR"/>
    <column name="LAST_NAME" required="true" size="99" type="VARCHAR"/>
    <column name="CONFIRM_VALUE" size="99" type="VARCHAR"/>
    <column name="MODIFIED" type="TIMESTAMP"/>
    <column name="CREATED" type="TIMESTAMP"/>
    <column name="LAST_LOGIN" type="TIMESTAMP"/>
    <column name="LAST_PASSWORD_CHANGE" type="TIMESTAMP"/>
    <column name="STREET" size="70" type="VARCHAR"/>
    <column name="HOUSE_NUMBER" size="5" type="VARCHAR"/>
    <column name="POSTAL_CODE" size="7" type="VARCHAR"/>
    <column name="CITY" size="35" type="VARCHAR"/>
    <column name="PROVINCE_ID" type="INTEGER"/>
    <column name="COUNTRY_ID" type="INTEGER"/>
    <column name="PHONE_NUMBER" size="15" type="VARCHAR"/>
    <column name="MOBILE_NUMBER" size="15" type="VARCHAR"/>
    <column name="EMAIL" size="99" type="VARCHAR"/>
    <column name="HOME_PAGE" size="35" type="VARCHAR"/>
    <column name="GENDER" size="1" type="BOOLEANINT" default="0"/>
    <column name="BIRTH_DATE" size="10" type="VARCHAR"/>
    <column name="PLACE_OF_BIRTH" size="35" type="VARCHAR"/>
    <column name="PAYMENT_METHOD" type="CHAR" size="1"/>
    <column name="MEMBERSHIP_TYPE" size="1" type="BOOLEANINT" default="0"/>
    <column name="BANK_ACCOUNT_NUMBER" type="VARCHAR" size="16"/>
    <column name="CARD_NUMBER" type="VARCHAR" size="16"/>
    <column name="CARD_HOLDER_NAME" type="VARCHAR" size="35"/>
    <column name="EXPIRATION_DATE" type="DATE"/>
    <column name="COMPANY_ID" type="INTEGER"/>
    <column name="POINTS" type="INTEGER" default="0"/>
    <column name="BRANCH_ID" type="INTEGER" description=""/>
    <column name="INFO" type="LONGVARCHAR" description=""/>
    <column name="LOOKING_FOR" type="LONGVARCHAR" description=""/>
    <column name="PHOTO_ID" type="INTEGER" description=""/>
    <index name="IX_USER_NAME">
        <index-column name="FIRST_NAME"/>
        <index-column name="MIDDLE_NAME"/>
        <index-column name="LAST_NAME"/>
    </index>
    <index name="IX_MEMBER_PREFERENCE_BRANCH">
        <index-column name="BRANCH_ID"/>
    </index>
    <foreign-key foreignTable="APP_USER">
      <reference local="MEMBER_ID" foreign="USER_ID"/>
    </foreign-key>
    <foreign-key foreignTable="COMPANY">
      <reference local="COMPANY_ID" foreign="COMPANY_ID"/>
    </foreign-key>
    <foreign-key foreignTable="PROVINCE">
    	<reference local="PROVINCE_ID" foreign="PROVINCE_ID"/>
    </foreign-key>
    <foreign-key foreignTable="COUNTRY">
    	<reference local="COUNTRY_ID" foreign="COUNTRY_ID"/>
    </foreign-key>
    <foreign-key foreignTable="BRANCH">
    	<reference local="BRANCH_ID" foreign="BRANCH_ID"/>
    </foreign-key>
    <foreign-key foreignTable="PHOTO">
    	<reference local="PHOTO_ID" foreign="PHOTO_ID"/>
    </foreign-key>
  </table>

As you can see this Member has a one-to-one relation to APP_USER, which
makes the connection to the security system. It might look like a dirty fix
but i must say that i use this model in other situation outside turbine
aswell. When defining our network security system i have a seperation in
real live people and userid's aswell. My Person account can have several
UserId's to log on to the network, but I remain to be the same person. I can
log in to turbine as a standard user, a developer or an administrator. And i
don't like to mix those users for logging purposes.

This model works for me.

> Question 1: I was under the impression that commenting out services in
> tr.props and uncommenting them in fulcrum.properties enabled the fulcrum
> services rather than the turbine services, is this wrong?

As far as i can see the fullcrum properties file is loaded at the end of
TR.props and will therefore overload the previously set properties. Therefor
i think i'm using the Fullcrum properties.  I actually set both to the new
path in my sources.

> Question 2: What's the equivalent of the MapBrokerService and the
> PoolBrokerService in Fulcrum, or do we still need them in tdk-2.2.b1?

I Don't know. There must be someone else able to answer this one.

> Note:scarab is an excellant guide but as it uses turbine 3 it's a pain to
> figure out what is applicable to turbine 2.x and what is not!

It's a shame that there is no extensive standard sample for turbine like the
PetShop example for J2EE. That would be so nice to have. Maybe we should
initiate something like this. It would be better than any Howto in my eyes.

> Question 4: Do I still need to write adapters in 2.2-b1 (You mention that
> this is not necessary)?

If you go back to turbine security i think you do. I made a little
adaptation to torque to generate this for me in 2.1 maybe that is still
applicable. I would go fo Fulcrum though, as this is supposedly the new
standard.

> Question 5: What services in turbine are redundant if fulcrum is used?

Maybe do a little pattern match and find out :-) I think quite a lot as
fullcrum has been derived from the original. Maybe someone could go through
turbine and remove the old fulcrum stuff.

> Question 6: Could somebody clear up this mess I've gotten into ;)?

We are all in the same trouble here. I'm in a big mess as we are running a
live application in 2.1 and i'm trying to adapt it to 2.2 but at the
sametinme the still want additions made to 2.1. Getting a little confused
here too.

Lot's of success and i hope my comments help a little,

Diederik de Groot
Talon v.o.f





> -----Original Message-----
> From: Simon Moore [mailto:Simon_Moore@condisline.com]
> Sent: donderdag 18 april 2002 8:23
> To: Turbine Users List
> Subject: RE: Extending TurbineUser in TDK 2.2b1
>
>
> Hi Diederik,
>
>
> I need to be able to reference the TurbineUser (and possibly extend it)
> table in my other tables so I've tried the following:
>
> 1. The Scarab approach using fulcrum:
>
> <table name="TURBINE_USER" javaName="MyUserImpl" alias="TurbineUser"
>     baseClass="org.apache.fulcrum.security.impl.db.entity.TurbineUser"
>     basePeer="org.apache.fulcrum.security.impl.db.entity.TurbineUserPeer">
>     <column name="USER_ID" primaryKey="true" required="true"
> type="INTEGER"/>
> </table>
>
> <table name="MY_TABLE" >
>     <column name="USER_ID" primaryKey="true" required="true"
> type="INTEGER"/>
>     <column name="my_column" primaryKey="true" required="true"
> type="TIMESTAMP"/>
>
>     <foreign-key foreignTable="TURBINE_USER">
>         <reference local="USER_ID" foreign="USER_ID"/>
>     </foreign-key>
> </table>
>
>
> Torque created all the OM objects and everything compile correctly!
>
> I then commented out the security service entries in my tr.props
> and enabled
> them in Fulcrum.properties
> making reference to MyUserImpl and MyUserImplPeer where appropriate...
>
> When I tried to access http://localhost:8080/secur/servlet/secur I got a
> horrible exception complaining that Turbine (the turbine broker service)
> could not find the security service.
>
> Question 1: I was under the impression that commenting out services in
> tr.props and uncommenting them in fulcrum.properties enabled the fulcrum
> services rather than the turbine services, is this wrong?
> Question 2: What's the equivalent of the MapBrokerService and the
> PoolBrokerService in Fulcrum, or do we still need them in tdk-2.2.b1?
>
> Question 3: I noticed in scarab's tr.props that there was a
> fulcrum database
> service but I can't find this in tdk-2.2-b.
>
> Note:scarab is an excellant guide but as it uses turbine 3 it's a pain to
> figure out what is applicable to turbine 2.x and what is not!
>
>
> As you can see, There are various questions that I need clearing up as
> regards the change over to using fulcrum (it's not as simple as
> changing the
> import statements)
>
> After this first attempt I then decided to revert to using
> turbines security
> service:
>
> <table name="TURBINE_USER" javaName="MyUserImpl" alias="TurbineUser"
>     baseClass="org.apache.turbine.om.security.TurbineUser"
>     basePeer="org.apache.turbine.om.security.peer.TurbineUserPeer">
>     <column name="USER_ID" primaryKey="true" required="true"
> type="INTEGER"/>
> </table>
>
> <table name="MY_TABLE" >
>     <column name="USER_ID" primaryKey="true" required="true"
> type="INTEGER"/>
>     <column name="my_column" primaryKey="true" required="true"
> type="TIMESTAMP"/>
>
>     <foreign-key foreignTable="TURBINE_USER">
>         <reference local="USER_ID" foreign="USER_ID"/>
>     </foreign-key>
> </table>
>
> Torque created all the om code but I got many compilation errors
> complaining
> about not find methods in TurbineUser/Peer etc...
>
> I didn't write any adapters as per the extended-users howto
> because i wasn't
> extending the user-table (for the moment), I just wanted to
> reference it in
> my other tables.
>
> Question 4: Do I still need to write adapters in 2.2-b1 (You mention that
> this is not necessary)?
> Question 5: What services in turbine are redundant if fulcrum is used?
> Question 6: Could somebody clear up this mess I've gotten into ;)?
>
>
> I appreciate any advice you or others can offer.
>
> Saimon
>
>
>
> > -----Mensaje original-----
> > De:	Diederik de Groot [SMTP:ddegroot@talon.nl]
> > Enviado el:	jueves 21 de marzo de 2002 20:02
> > Para:	Turbine Users List
> > Asunto:	RE: Extending TurbineUser in TDK 2.2b1
> >
> >
> > >Hi Cameron,
> >
> > >You might have seen that i too have been stuggling under the previous
> > >version to extend the User. I had everything working fine until 2.2b1
> > came
> > >about. I found you van at least do without the TurbineUserAdapters now
> > >because you can directly access the extended TurbineUsers.
> That is what i
> > >have done at least. I need the Aliased table only for refering to
> > >foreignkeys. I know it's not a good solution but it works for me.
> >
> > >I'm not a hunderd percent sure this is the way it was meant to
> be but it
> > >seems to work fine.
> > >Just Change everything over to torque where criteria are
> involved and you
> > >seem to be fine.
> > >I can't answer your actually question about things being in flux at the
> > >moment. Let's see what the creators say :-)
> > >Lots of success,
> >
> > >Diederik de Groot
> >
> > > -----Original Message-----
> > > From: root@cr327147-a.lndn1.on.wave.home.com
> > > [mailto:root@cr327147-a.lndn1.on.wave.home.com]On Behalf Of
> Cameron Cole
> > > Sent: donderdag 21 maart 2002 19:26
> > > To: Turbine Users List
> > > Subject: Extending TurbineUser in TDK 2.2b1
> > >
> > >
> > > Hello again everyone,
> > >
> > > Previously with version 2.1 I successfully extended
> TurbineUser but ran
> > > into some difficulty when attempting to add a foreign key to
> my extended
> > > user so I could place them on teams. I decided to put the
> project aside
> > > for a bit and return when 2.2b1 came out. Well 2.2b1 has come out
> > > (Congrats btw! :) and I have again started to revisit the problem and
> > > have run into a few interesting issues. TurbineUserPeer extends the
> > > org.apache.turbine.om.peer.BasePeer where as all of my om objects
> > > (including the ExtendedBaseUser) extend the torque.util.BasePeer. As
> > > such when I attempt to compile my ExtendedBasePeer all of the
> > > doSelect(Criteria, DBConnection) methods no longer compile b/c the
> > > turbine BasePeer expects a turbine Criteria and my generated
> > > BaseUserPeer is passing a torque criteria. This is also true of the
> > > retrieveByPK methods.
> > >
> > > I have two main questions:
> > >
> > > 1. Is the user/security system in a state of flux and should I just
> > > holdoff? If so, where can I get more information? (I have read the
> > > archives, but haven't seen any conclusions as yet)
> > >
> > > 2. Is there another/better way I could go about this? If there is a
> > > newer/better way to do this, and someone can kick me in the right
> > > direction I'll try to document my trials and tribulations and
> see if it
> > > makes a reasonable how-to... (or how-not-to :) I understand from the
> > > archives and current mail threads that the security system is
> undergoing
> > > review and rewrite, but I don't know where to get more information...
> > >
> > > Thanks,
> > >
> > > -cam.
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> > > <ma...@jakarta.apache.org>
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>