I'm deep in this stuff right now in Scarab, so I'm going to quickly document
it because it comes up quite frequently on the list. If someone wants to
contribute a cleaned up version as an xdoc, that would be most excellent.
Define your User in your schema.xml file:
<table name="SCARAB_USER" javaName="ScarabUserImpl" alias="TurbineUser"
baseClass="org.apache.fulcrum.security.impl.db.entity.TurbineUser"
basePeer="org.apache.fulcrum.security.impl.db.entity.TurbineUserPeer">
<!--
Unique identifier.
-->
<column name="USER_ID" primaryKey="true" required="true"
type="INTEGER"/>
</table>
You only need to define the columns in which you are referring to as a
foreign key elsewhere in your database. In our case, that is just USER_ID.
Create an interface which describes the additional methods you are adding to
your User object:
public interface ScarabUser extends User
Have Torque create an implementation of ScarabUser. You should then fill it
with the methods that you defined in ScarabUser. It should extend the Base
class and look something like this:
public class ScarabUserImpl extends BaseScarabUserImpl implements ScarabUser
Have Torque create the appropriate Peer class (mine is empty so far):
public class ScarabUserImplPeer
extends org.tigris.scarab.om.BaseScarabUserImplPeer
{
}
In your TurbineResources.properties file modify the following properties to
tell Turbine to point at your specific implementations of the User
interface:
services.SecurityService.user.class=org.tigris.scarab.om.ScarabUserImpl
services.SecurityService.userPeer.class=org.tigris.scarab.om.ScarabUserImplP
eer
Lastly, in your application code, you should *always* refer (ie: cast) to
your specific interface. For example:
ScarabUser su = (ScarabUser) TurbineSecurity.getUser(1);
As you can see, it isn't real hard to override Turbine's concept of a User
with your own specific implementation. If you wish to rename column names
and what not, then you will need to do a bit more work and is beyond the
scope of this tutorial.
Thanks!
-jon
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]