On Sat, 11 Aug 2001 01:05, giacomo wrote:
> > Another way I have about doing it is something like
> >
> > <targets>
> >   <target name="file:dev/logs/classloader.log"/>
> >
> >   <target name="console:stderr"/>
> >
> >   <target name="db:my-table">
> >     <parameter name="username" value="dbsa"/>
> >     <parameter name="password" value="secret"/>
> >   </target>
> >
> > </targets>
>
> And the next step would be:
>
> <targets>
>   <target name="file" class="logtarget.FileFactory">
>     <parameter name="filename" value="dev/logs/classloader.log/>
>   </target>
>
>   <target name="console" class="logtarget.FileFactory">
>     <parameter name="device" value="stderr"/>
>   </target>
>
>   <target name="db" class="logtarget.DBFactory">
>     <parameter name="table" valuer="my-table"/>
>     <parameter name="username" value="dbsa"/>
>     <parameter name="password" value="secret"/>
>   </target>
>
> </targets>
>
> and thus we have a full Selector/Component specification. So the
> TargetFactory interface can be reduced to
>
> interface TargetFactory
> {
>   LogTarget createTarget( String name,
>                           Parameter parameters );
> }

I would prefer a full Configuration object be passed because some log targets 
will potentially have non-flat configuration (db target, jms target etc).
Other than that I like. However I am not sure I know why you need to provide 
name to target if you specify factory class. Couldn't something simpler such 
as the following work? Or do you see targets as potentially creating multiple 
different types or something?

interface TargetFactory
{
  LogTarget createTarget( Configuration configuration );
}

Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to