Nico74,

I am not sure if I understood you correctly.

Via the file marshaler you can do almost everything what is needed.

Lets have a look at an example:

public class MyFileMarshaler extends MarshalerSupport implements FileMarshaler 
{ 
    private void fillContent(NormalizedMessage message, String path) throws 
IOException, JBIException, ParserConfigurationException
        {
        // HERE YOU CONVERT THE FILE INTO A JBI MESSAGE
        // FILL THE JBI MESSAGE AS YOU LIKE...IT'S UP TO YOU
        }

    public String getOutputName(MessageExchange exchange, NormalizedMessage 
message) throws MessagingException
        {
        // HERE YOU GENERATE THE FILE NAME FOR WRITING TO FS (PROVIDER 
ENDPOINT)
        }

    /**
     * 
     */
    public void readMessage(MessageExchange exchange, NormalizedMessage 
message, InputStream in, String path)
            throws IOException, JBIException
        {
        try
            {
            // HERE YOU CALL THE FILL CONTENT METHOD FROM ABOVE
            fillContent(message, path);
            }
        catch (ParserConfigurationException pcEx)
            {
            throw new JBIException("MyFileMarshaler.readMessage(): Error 
building JBI message for " + path, pcEx);
            }
        }

    /**
     * 
     */
    public void writeMessage(MessageExchange exchange, NormalizedMessage 
message, OutputStream out, String path)
            throws IOException, JBIException
        {
        // HERE YOU CONVERT FROM THE JBI MESSAGE INTO A FILE
        }
}

Hopefully this clarifies a bit.

Regards,
Lars


Am Mittwoch, 5. März 2008 14:25:21 schrieb Nico74:
> Hum,
>
> you are right but I think that the base information that the file component
> treat is the canonical path of the file. In specific case you may have to
> have different strategy and targets to apply in function of owner, size ...
> (etl) and it's very convenient to have all thoses informations from the
> file pool component.
>
> lhe77 wrote:
> > Nico74,
> >
> > what you said is not correct. It makes no sense to rewrite a new file
> > component. The file component is only the bridge between the file system
> > and the jbi bus. This file component is very customizable via the
> > marshaler
> > logic. To achieve the wanted behaviour it is simply enough to write your
> > own
> > file marshaler. Thats it.
> >
> > Regards,
> > Lars
> >
> > Am Mittwoch, 5. März 2008 14:03:46 schrieb Nico74:
> >> You need to create a binding component like servicemix-file (watch
> >> source code to have an idea).  Yours new component just send message
> >> with file path to the NMR.


Reply via email to