Hi Joshua,
currently there is no extension mechanism for this, but I'm willing
to look into any proposals since this rigidness has always troubled
me. With the enum mechanism that we use in RIFE, you can add any
other MimeType but the constructor is currently too closed down,
maybe it should just be made public. This means that you would be
able to add new MimeTypes.
One thing that you have to realize though, is that MimeType entries
specify how they they are validated and formatted, they don't however
indicate where they need to be stored. This is a tricky thing to
solve since the content storage back-ends are abstracted away and
currently detect directly on the MimeType enum elements (they provide
a collection of MimeTypes that they're able to handle). When you add
your custom MimeTypes, those storage backe-end wouldn't be able to
handle them though. This is sadly currently hardcoded in the
constructor of the DatabaseContent class and ideally it should be
opened up. Doing this, you could add your own content store (that
could extend an existing one) and add the MimeTypes that this one
supports.
I'm curious to see what you want to do with a custom IMAGE_JPEG
loader/formatter? What actually happens is that RIFE tried to load
any possible image, not just JPEGS. To do this is goes over the image
loader backends it knows about. These are setup in
ImageContentLoader. Ideally, this order should also become
configurable. The JPEG type is only used for the format of the final
image storage (the loaded image will be transformed into the target
type). If you just want to store anything as-is, use the RAW type.
Note that you can always change and interact with your content by
using a ContentTransformer. We chose to use the standard
java.awt.Image type as the format into which to load the images
before writing them out again. If you want another type, you can use
the RAW type with your own ContentTransform to handle it the way you
want.
Hope this helps.
Best regards,
Geert
On 08 Dec 2006, at 17:56, Joshua Hansen wrote:
Hi Geert (and others),
I've been working a little with the CMF and I was wondering: is it
possible to specify a custom MimeType class? I can't extend it
because the constructor is private, and I can't reset the static
enum defs (IMAGE_JPEG, IMAGE_PNG, etc) with custom versions for the
same reason.
I'd like to add new MimeTypes, and or replace existing types, such
as to use a custom IMAGE_JPEG loader/formatter. A specific example
would be to use a more efficient third party or native library for
image manipulation/handling (instead of java.awt.Image).
I'm using RIFE 1.4.
Shalom (complete peace),
Josh
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users
--
Geert Bevin
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users