Package org.jboss.internal.soa.esb.couriers.helpers

Examples of org.jboss.internal.soa.esb.couriers.helpers.FileHandler


               
                // Certain things can only be checked in local filesystem
                try
                {
                        _uri = _epr.getURI();
                        FileHandler handler = FileHandlerFactory.getInstance()
                                        .getFileHandler(_epr);
                        if (handler instanceof LocalFileHandler)
                        {
                                _localFhandler = (LocalFileHandler) handler;
                                File file = new File(_uri);
View Full Code Here


                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);
View Full Code Here

                long limit = System.currentTimeMillis()
                                + ((millis < 100) ? 100 : millis);
               
                do
                {
                        FileHandler handler = (null != _localFhandler) ? _localFhandler
                                        : FileHandlerFactory.getInstance().getFileHandler(_epr);
               
                        File[] files = handler.getFileList();

                        if (null != files && files.length > 0)
                        {
                                File input = files[0];
                                File work = workFile(input);
                                handler.renameFile(input, work);
                                try
                                {
                                        result = readOneMessage(handler, work);
                                }
                                catch (CourierException e)
                                {
                                    _logger.debug("FileCourier.pickup caught exception during readOneMessage: "+e);
                                   
                                        if (null == errorFile(input))
                                                handler.deleteFile(work);
                                        else
                                                handler.renameFile(work, errorFile(input));
                                        continue;
                                }
                                File done = postFile(input);
                                if (null == done)
                                        handler.deleteFile(work);
                                else
                                        handler.renameFile(work, done);
                               
                                return result;
                        }
                        try
                        {
View Full Code Here

TOP

Related Classes of org.jboss.internal.soa.esb.couriers.helpers.FileHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.