>This is how I would implement your example. A mailet/gemlets gets the
>email. JavaMail lets you split off attachments. java.net.URL or some FTP
>API let's you FTP them. JavaMail lets you send a message to a mailing
list
>with the URL. I agree it'd take less than 40 lines of code (assuming
you're
>not doing much error checking), and this would be a single mailet/gemlet.
The point I'm trying to make is if you *already* have a mailet that can
dump attachments to an ftp server, and you _already_ have a mailet that
can notify a group of people of an incoming mail, how do you leverage
those two existing pieces of code to build something more complex?
I hear what you're saying. You're saying, "why use this generic Mailet
API when we have these perfectly good, existing APIs like FTP or
javamail or PGP or whatever."
The reason I think is that these different APIs have very little in common
and don't plug together easily. They accept differing types of objects
as input and output and they need configuring in vastly different ways.
By abstracting the features of messages that get passed around we
build a bridge between these different API sets and vastly simplify
plugging together something complex. You could say that the good
part is not just the Gemlets themselves but the idea of standardising the
messages we pass between common sets of code. We also provide a standard
method for users to pass configuration to these differing components.
Standard not just in entering and storing the parameters, but also
in the names of the parameters because you generally talk to
a particular API through the same Gemlet.
>I don't like the idea of splitting this across multiple gemlets, because
>then I'm sticking parameters for my FTP action into a conf object that
gets
>passed as a dynamic configuration to a Gemlet.
Not sure what you're saying here. Each gemlet gets passed parameters
applicable to it. If you were to do config in XML it might look like...
<gemlet name=MailAndFtp>
<gemlet name=Ftp>
<parameter name=server>foo.com</parameter>
<parameter name=userid>bar</parameter>
<parameter name=password>baz</parameter>
</gemlet>
<gemlet name=SendMail>
<parameter name=from>[EMAIL PROTECTED]</parameter>
<parameter name=subject>Mail Has Arrived!</parameter>
</gemlet>
</gemlet>
>I have to ask myself, why not just call the FTP API?
* Because the FTP API and others are not that friendly.
* Because once you've built the Mailet that calls the FTP API, you have
no means of writing a second Mailet that leverages the abilities of the
first Mailet.
* Because the FTP and JavaMail APIs don't have anything in common
and glueing them together is hard.
* Because you can standardise configuration.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]