What if you could use OSX Spotlight as a cheap but very intelligent SAN solution?
Here's a crazy idea. I know is not exactly Java related but is sweet:)
A non too hypothetical scenario:
- you have a large set of files, let's say images, JPGs whatever. And you build a web site where you want to show them as thumbnails maybe and further on to deliver them as high resolution products or such. To offer them for download respectively.
To do this you'll have to have some Storage Area Networks (SANs) in place or a large hard drive and at the bottom of your domain model a ... simple map linking your domain model with the physical address of the files. So if you have an Image object, one of the methods you have for sure will be getPath(), correct? Unless you go crazy with BLOBS and images stored in db fields .. which in real life .. trust me .. doesn't work .. just like that!
So, when you create an Image object you'll have to have business logic identifying the link between your Image ID and a folder path. Most of the solutions I saw had a db table with a field containing image codes and a field containing a fully qualified path to the file representing that image. Well, that table needs to be maintained. Every time you add, delete a file ... you have to update your table, inform your web app that something is changed and of course you have to refresh the Image objects already in memory and populating your html pages for preview or download.
Of course you can do all these in various ways and even the Object management is somehow easy, if you're using a smart persistence framework, but there are a lot of work units required. More than that, if you don't have a DAM (Digital Asset Management) solution then you'll depend on a human operator to remember to update that table when the files are deleted, updated, etc. or on a tool which is doing file monitoring in case your admin application supports this API already ;)
The idea is ... if you're using OSX, why can't you eliminate the need for maintaining that table and related processes if you can get the same functionality in an elegant way, right out of the box?
Spotlight can do this job for you. Every time an image file is added it will be indexed and available even as a Terminal command with its new mdfind , mdls , mdimport , and mdutil commands. Like a regular Spotlight search, the mdfind command lets you quickly find files on your Mac. I am not aware if there is a Java API ready to support this, but its an idea?
So think about, no file monitoring tool .. is included, no need to index the image repository (but who said you are limited to images only) ... is included, no middle table required somewhere at the bottom of your domain model, no event scheduler or service manager to interrogate the status of your image repository .. this is happening in near time, no constraints in naming the files, no extra clicks in an Admin module to update the links between your Image objects and physical file location, etc. just a simple API between your app and Spotlight. What if you need a thumbnail of an image just added, so you can use it on your site right away? You can use OSX for that too! What if you want to add meta data to your file? You can do that too!!! Isn't that sweet?
You've got the picture?
If you guys thought about something similar, please drop me a line, I'll be more than curious to see if others are finding this idea .. exploreeeeeable;)
Cheers,
A non too hypothetical scenario:
- you have a large set of files, let's say images, JPGs whatever. And you build a web site where you want to show them as thumbnails maybe and further on to deliver them as high resolution products or such. To offer them for download respectively.
To do this you'll have to have some Storage Area Networks (SANs) in place or a large hard drive and at the bottom of your domain model a ... simple map linking your domain model with the physical address of the files. So if you have an Image object, one of the methods you have for sure will be getPath(), correct? Unless you go crazy with BLOBS and images stored in db fields .. which in real life .. trust me .. doesn't work .. just like that!
So, when you create an Image object you'll have to have business logic identifying the link between your Image ID and a folder path. Most of the solutions I saw had a db table with a field containing image codes and a field containing a fully qualified path to the file representing that image. Well, that table needs to be maintained. Every time you add, delete a file ... you have to update your table, inform your web app that something is changed and of course you have to refresh the Image objects already in memory and populating your html pages for preview or download.
Of course you can do all these in various ways and even the Object management is somehow easy, if you're using a smart persistence framework, but there are a lot of work units required. More than that, if you don't have a DAM (Digital Asset Management) solution then you'll depend on a human operator to remember to update that table when the files are deleted, updated, etc. or on a tool which is doing file monitoring in case your admin application supports this API already ;)
The idea is ... if you're using OSX, why can't you eliminate the need for maintaining that table and related processes if you can get the same functionality in an elegant way, right out of the box?
Spotlight can do this job for you. Every time an image file is added it will be indexed and available even as a Terminal command with its new mdfind , mdls , mdimport , and mdutil commands. Like a regular Spotlight search, the mdfind command lets you quickly find files on your Mac. I am not aware if there is a Java API ready to support this, but its an idea?
So think about, no file monitoring tool .. is included, no need to index the image repository (but who said you are limited to images only) ... is included, no middle table required somewhere at the bottom of your domain model, no event scheduler or service manager to interrogate the status of your image repository .. this is happening in near time, no constraints in naming the files, no extra clicks in an Admin module to update the links between your Image objects and physical file location, etc. just a simple API between your app and Spotlight. What if you need a thumbnail of an image just added, so you can use it on your site right away? You can use OSX for that too! What if you want to add meta data to your file? You can do that too!!! Isn't that sweet?
You've got the picture?
If you guys thought about something similar, please drop me a line, I'll be more than curious to see if others are finding this idea .. exploreeeeeable;)
Cheers,
Google Desktop also works
As an alternative to Apple's Spotlight (since I don't have anymore an Apple computer) I am currently playing with the GDS SDK and so far I am impressed. To "play" with GDS, I am using the GDS Java API plug-in
Kudos to Gato for starting this GDS-Java integration plug-in.
Cheers,
