if (null == message)
return false;
// FileHandler is durable only for local filesystem (see
// checkEprParms())
FileHandler handler = (null != _localFhandler) ? _localFhandler
: FileHandlerFactory.getInstance().getFileHandler(_epr);
if (null == handler)
throw new CourierServiceBindException(
"Can't find appropriate file handler for "
+ _uri.toASCIIString());
Call call = message.getHeader().getCall();
if (null==call)
message.getHeader().setCall(call=new Call());
try
{
if (null==call.getMessageID())
call.setMessageID(new URI(UUID.randomUUID().toString()));
}
catch (URISyntaxException e)
{
throw new MalformedEPRException("Problems with message header ",e);
}
File tmpFile = null;
if (handler instanceof LocalFileHandler)
{
try
{
File dir = new File(_uri);
String name = message.getHeader().getCall().getMessageID()
.toString();
name += _inputSuffix;
tmpFile = CourierUtil.messageToLocalFile(dir, message);
handler.renameFile(tmpFile, new File(dir, name));
return true;
}
catch (final CourierException e)
{
throw new CourierTransportException(e);
}
catch (final IOException e)
{
throw new CourierMarshalUnmarshalException(e);
}
catch (final ParserConfigurationException e) // it's no longer thrown so we can ignore it!
{
throw new CourierException(e);
}
}
tmpFile = null;
try
{
Method upload = handler.getClass().getMethod("uploadFile",
new Class[]
{ File.class });
String sDir = FtpUtils.getLocalDir();
File dir = new File(sDir);