Great! Thanks a lot Paul. I had already wrote some actions to do this by using 
RegEx and this way is much cleaner.

--Faranak
________________________________________
From: Ramirez, Paul M (388J) [[email protected]]
Sent: Wednesday, January 11, 2012 8:35 AM
To: [email protected]
Subject: Re: mimetype specific actions for a  crawler launcher

Hey Faranak,

Actually, that is exactly what the mimetype product crawler does. Here is a 
sample of an action that deletes a legend file. The key is that the action 
itself gets wrapped by another bean that sets which mimetypes apply for the 
actionToCall.

   <bean id="DeleteLegendFile" lazy-init="true" 
class="gov.nasa.jpl.lmmp.actions.DeleteFile">
        <property name="description" value="Deletes the legend file for the 
current data file."/>
        <property name="fileExtension" value="${legend.file.extension}"/>
        <property name="fileSuffix" value="${legend.file.suffix}"/>
        <property name="keepExistingExtension">
            <value type="java.lang.Boolean">false</value>
        </property>
        <property name="phases">
            <list>
                <value type="java.lang.String">postIngestSuccess</value>
            </list>
        </property>
    </bean>

<bean id="MiTy-DeleteLegendFile" lazy-init="true" 
class="gov.nasa.jpl.oodt.cas.crawl.action.MimeTypeCrawlerAction">
        <property name="actionToCall">
            <ref bean="DeleteLegendFile"/>
        </property>
        <property name="mimeTypes">
            <list>
                <value>product/mineralogy_visible</value>
                <value>product/colorhillshade</value>
                <value>product/radar</value>
                <value>product/grayscale</value>
                <value>product/confidence_visible</value>
                <value>product/temperature</value>
                <value>product/slope_colorized</value>
                <value>product/roughness_colorized</value>
                <value>product/colorshade</value>
                -->
            </list>
        </property>
    </bean>

So the first bean is the definition of the action while the second bean is 
associating the mimetypes with the action. Then in your launcher script you 
simply specify only the mimetype action (in this case MiTy-DeleteLegendFile" 
and it will only apply to the mimeTypes listed. The mimetypes.xml file merely 
describes how to identify a particular mimetype. The action bean that uses 
gov.nasa.jpl.oodt.cas.crawl.action.MimeTypeCrawlerAction makes the association 
of mimetype to action.

Thanks,
Paul

On Jan 10, 2012, at 5:37 PM, Davoodi, Faranak (388J) wrote:

> In OODT Crawlers, we usually have a launcher that has a series of actions 
> defined in the action bean. The actions could be run for any product 
> specified in the mimetypes.xml in the launcher script. However, we are not 
> able to say an specific action to be done just for one specific mimetype and 
> not the others.  I am wondering if we can specify a mimetype as an argument 
> in our actions that let the crawler know to run that action just for that 
> specific mimetype(s) only. Of course as a solution what we do now is to 
> specify the file extension or its regEx pattern and try it in the java action 
> first and if it was true, then we run that action.
>
> Thanks,
> Faranak
>
>

Reply via email to