This should certainly work. It's basically using a very relational database-like structure, and although that's not the common pattern for XML there's nothing wrong with using it - it's just a little fluffier. The drawback, as you said, is that you need to have objects to handle the associations.

 - Dennis

michael simons wrote:

Hi Dennis et al,

what do you think of the following solution of the problem:

<import>
...
<roles>
<role name="Admin" />
<role name="Programmer">
<description>Programmer role</description>
</role>
</roles>
<users>
<user name="Dana Scully" login="scully" pwd="~~~" language="US/us" />
<user name="Fox Mulder" login="mulder" pwd="~~~" language="US/us" />
</users>
<users_roles>
<user_role user="mgs" role="Admin" />
<user_role user="mgs" role="Programmer" />
<user_role user="mulder" role="Admin" />
</users_roles>
<roles_actions>
<item role="Admin" action="toggleTourCommander" />
<item role="Programmer" action="toggleTourCommander" />
<item role="Admin" action="configure" />
</roles_actions>
</import>


<binding>
<mapping name="user" class="net.uniopt.domain.usrmngmt.LoginUser" value-style="attribute">
<value name="name" field="name" />
<value name="login" field="login" ident="def" />
<value name="pwd" field="passwd" />
<value name="language" field="language" ident="ref" />
</mapping>
<mapping name="role" class="net.uniopt.domain.usrmngmt.LoginRole" value-style="attribute">
<value name="name" field="name" ident="def" />
<value name="description" field="description" style="element" usage="optional" />
</mapping>
<mapping name="import" class="net.uniopt.eval.jibx.Import">
<collection name="roles" field="roles" item-type="net.uniopt.domain.usrmngmt.LoginRole" add-method="add" iter-method="iterator" />
<collection name="users" field="users" item-type="net.uniopt.domain.usrmngmt.LoginUser" add-method="add" iter-method="iterator" />
<collection name="users_roles" field="userRoleAssociations">
<structure name="user_role" value-style="attribute" type="net.uniopt.eval.jibx.UserRoleAssociation" post-set="postSet">
<value name="user" field="user" ident="ref" />
<value name="role" field="role" ident="ref" />
</structure>
</collection>
</mapping>
</binding>


I have to program one simple class UserRoleAssociation that holds a user and a role and has to implement the post-set method.
I think this isn't typical XML style, but it's easy to implement and easy to use. At the moment I think about a possibility to get rid of the UserRoleAssociation by introducing a more abstract one that can handle any bidirectional association.


Please let me know what you think about this solution, even if you think it's utterly stupid.

Thanks,
Michael






-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to