[jboss-svn-commits] JBL Code SVN: r20123 - in labs/jbossesb/trunk/product: rosetta/src/org/jboss/internal/soa/esb/couriers/helpers and 8 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri May 23 08:31:36 EDT 2008
Author: mark.little at jboss.com
Date: 2008-05-23 08:31:35 -0400 (Fri, 23 May 2008)
New Revision: 20123
Modified:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/FileCourier.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/helpers/FtpFileHandler.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/helpers/JDBCEprDBResourceFactory.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/helpers/LocalFileHandler.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/filter/MetaDataFilter.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/FtpImpl.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/SecureFtpImpl.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/EPR.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/EmailEpr.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/FTPEpr.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/FileEpr.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/HTTPEpr.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/HibernateEpr.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JDBCEpr.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/SFTPEpr.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/filter/FilterManager.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/util/RemoteFileSystemFactory.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/JMSUtil.java
labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java
Log:
http://jira.jboss.com/jira/browse/JBESB-1386
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/FileCourier.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/FileCourier.java 2008-05-23 04:54:46 UTC (rev 20122)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/FileCourier.java 2008-05-23 12:31:35 UTC (rev 20123)
@@ -64,488 +64,449 @@
*/
public class FileCourier implements PickUpOnlyCourier, DeliverOnlyCourier
{
- /**
- * disable public default constructor
- */
- protected FileCourier()
- {
- }
+ /**
+ * disable public default constructor
+ */
+ protected FileCourier()
+ {
+ }
- /**
- * package protected constructor - Objects of this class should only be
- * instantiated by internal implementations
- *
- * @param epr
- */
- FileCourier(FileEpr epr) throws CourierException, MalformedEPRException
- {
- this(epr, false);
- }
+ /**
+ * package protected constructor - Objects of this class should only be
+ * instantiated by internal implementations
+ *
+ * @param epr
+ */
+ FileCourier(FileEpr epr) throws CourierException, MalformedEPRException
+ {
+ this(epr, false);
+ }
- /**
- * package protected constructor - Objects of this class should only be
- * instantiated by internal implementations
- *
- * @param epr
- * @param receiverOnly
- */
- FileCourier(FileEpr epr, boolean receiverOnly) throws CourierException, MalformedEPRException
- {
- _receiverOnly = receiverOnly;
- _epr = epr;
-
- checkEprParms();
- } // ________________________________
+ /**
+ * package protected constructor - Objects of this class should only be
+ * instantiated by internal implementations
+ *
+ * @param epr
+ * @param receiverOnly
+ */
+ FileCourier(FileEpr epr, boolean receiverOnly) throws CourierException, MalformedEPRException
+ {
+ _receiverOnly = receiverOnly;
+ _epr = epr;
+
+ checkEprParms();
+ } // ________________________________
- /**
- * See if we have everything we need in the EPR
- *
- * @throws CourierException
- */
- protected void checkEprParms() throws CourierException, MalformedEPRException
- {
- _inputSuffix = null;
-
- try
- {
- _inputSuffix = _epr.getInputSuffix();
- _logger.debug("input suffix set to "+_inputSuffix);
- }
- catch (URISyntaxException e)
- {
- _logger.warn("Malformed EPR");
- }
-
- // 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);
- if ((!_receiverOnly) && (!file.isDirectory()))
- throw new CourierException(
- "File for deliverAsync EPR must be a directory (file name will be MessageID)");
+ /**
+ * See if we have everything we need in the EPR
+ *
+ * @throws CourierException
+ */
+ protected void checkEprParms() throws CourierException, MalformedEPRException
+ {
+ _inputSuffix = _epr.getInputSuffix();
+ _logger.debug("input suffix set to "+_inputSuffix);
+
+ // 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);
+ if ((!_receiverOnly) && (!file.isDirectory()))
+ throw new CourierException(
+ "File for deliverAsync EPR must be a directory (file name will be MessageID)");
- File directory = (file.isDirectory()) ? file : file
- .getParentFile();
- if (null==directory)
- directory = new File("");
- if (!directory.canRead())
- throw new CourierException("Can't read directory "
- + directory.toString());
- // need to write even if it's readOnly - file will be renamed
- // during xfer
- if (!directory.canWrite())
- throw new CourierException("Can't write in directory "
- + directory.toString());
+ File directory = (file.isDirectory()) ? file : file
+ .getParentFile();
+ if (null==directory)
+ directory = new File("");
+ if (!directory.canRead())
+ throw new CourierException("Can't read directory "
+ + directory.toString());
+ // need to write even if it's readOnly - file will be renamed
+ // during xfer
+ if (!directory.canWrite())
+ throw new CourierException("Can't write in directory "
+ + directory.toString());
- return;
- }
- }
- catch (URISyntaxException e)
- {
- throw new MalformedEPRException(e);
- }
- } // ________________________________
+ return;
+ }
+ }
+ catch (Exception e)
+ {
+ throw new MalformedEPRException(e);
+ }
+ } // ________________________________
- /**
- * package the ESB message in a File
- *
- * @param message
- * Message - the message to deliverAsync
- * @return boolean - the result of the delivery
- * @throws CourierException -
- * if problems were encountered
- */
- public boolean deliver(Message message) throws CourierException, MalformedEPRException
- {
- if (_receiverOnly)
- throw new CourierException("This is a pickUp-only Courier");
+ /**
+ * package the ESB message in a File
+ *
+ * @param message
+ * Message - the message to deliverAsync
+ * @return boolean - the result of the delivery
+ * @throws CourierException -
+ * if problems were encountered
+ */
+ public boolean deliver(Message message) throws CourierException, MalformedEPRException
+ {
+ if (_receiverOnly)
+ throw new CourierException("This is a pickUp-only Courier");
- if (null == message)
- return false;
+ 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());
+ // 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;
+ 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);
+ 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));
+ 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);
- }
- }
+ 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 });
+ tmpFile = null;
+
+ try
+ {
+ Method upload = handler.getClass().getMethod("uploadFile",
+ new Class[]
+ { File.class });
- String sDir = ModulePropertyManager.getPropertyManager(
- ModulePropertyManager.TRANSPORTS_MODULE).getProperty(
- Environment.FTP_LOCALDIR, DEFAULT_TMP);
- File dir = new File(sDir);
- String name = message.getHeader().getCall().getMessageID().toString();
-
- name += _inputSuffix;
-
- tmpFile = CourierUtil.messageToLocalFile(dir, message);
+ String sDir = ModulePropertyManager.getPropertyManager(
+ ModulePropertyManager.TRANSPORTS_MODULE).getProperty(
+ Environment.FTP_LOCALDIR, DEFAULT_TMP);
+ File dir = new File(sDir);
+ String name = message.getHeader().getCall().getMessageID().toString();
+
+ name += _inputSuffix;
+
+ tmpFile = CourierUtil.messageToLocalFile(dir, message);
- File messageFile = new File(dir, name);
- FileUtil.renameTo(tmpFile, messageFile);
- tmpFile = messageFile;
+ File messageFile = new File(dir, name);
+ FileUtil.renameTo(tmpFile, messageFile);
+ tmpFile = messageFile;
- upload.invoke(handler, new Object[]
- { messageFile });
- return true;
- }
- catch (final IOException ex)
- {
- if (tmpFile == null)
- throw new CourierMarshalUnmarshalException(ex);
- else
- throw new CourierTransportException(ex);
- }
- catch (final Exception e)
- {
- throw new CourierException(e);
- }
- finally
- {
- if (null != tmpFile)
- tmpFile.delete();
- }
+ upload.invoke(handler, new Object[]
+ { messageFile });
+ return true;
+ }
+ catch (final IOException ex)
+ {
+ if (tmpFile == null)
+ throw new CourierMarshalUnmarshalException(ex);
+ else
+ throw new CourierTransportException(ex);
+ }
+ catch (final Exception e)
+ {
+ throw new CourierException(e);
+ }
+ finally
+ {
+ if (null != tmpFile)
+ tmpFile.delete();
+ }
- } // ________________________________
+ } // ________________________________
- public Message pickup(long millis) throws CourierException, CourierTimeoutException
- {
- Message result = null;
- long limit = System.currentTimeMillis()
- + ((millis < 100) ? 100 : millis);
-
- do
- {
- FileHandler handler = (null != _localFhandler) ? _localFhandler
- : FileHandlerFactory.getInstance().getFileHandler(_epr);
-
- File[] files = handler.getFileList();
+ public Message pickup(long millis) throws CourierException, CourierTimeoutException
+ {
+ Message result = null;
+ 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);
-
- /*
- * If this is fault message, then throw an exception with the contents. With the
- * exception of user-defined exceptions, faults will have nothing in the body, properties etc.
- */
-
- if (Type.isFaultMessage(result))
- Factory.createExceptionFromFault(result);
-
- return result;
- }
- try
- {
- long lSleep = limit - System.currentTimeMillis();
- if (_pollLatency < lSleep)
- lSleep = _pollLatency;
- if (lSleep > 0)
- Thread.sleep(lSleep);
- }
- catch (InterruptedException e)
- {
- return null;
- }
- } while (System.currentTimeMillis() <= limit);
- return null;
- } // ________________________________
+ 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);
+
+ /*
+ * If this is fault message, then throw an exception with the contents. With the
+ * exception of user-defined exceptions, faults will have nothing in the body, properties etc.
+ */
+
+ if (Type.isFaultMessage(result))
+ Factory.createExceptionFromFault(result);
+
+ return result;
+ }
+ try
+ {
+ long lSleep = limit - System.currentTimeMillis();
+ if (_pollLatency < lSleep)
+ lSleep = _pollLatency;
+ if (lSleep > 0)
+ Thread.sleep(lSleep);
+ }
+ catch (InterruptedException e)
+ {
+ return null;
+ }
+ } while (System.currentTimeMillis() <= limit);
+ return null;
+ } // ________________________________
- private Message readOneMessage(FileHandler handler, File work) throws CourierException
- {
- if (handler instanceof LocalFileHandler)
- {
- try
- {
- return CourierUtil.messageFromLocalFile(work);
- }
- catch (final FileNotFoundException ex)
- {
- throw new CourierTransportException(ex);
- }
- catch (final IOException ex)
- {
- throw new CourierMarshalUnmarshalException(ex);
- }
- catch (final CourierException ex)
- {
- throw ex;
- }
- catch (final Exception ex)
- {
- throw new CourierException(ex);
- }
- }
+ private Message readOneMessage(FileHandler handler, File work) throws CourierException
+ {
+ if (handler instanceof LocalFileHandler)
+ {
+ try
+ {
+ return CourierUtil.messageFromLocalFile(work);
+ }
+ catch (final FileNotFoundException ex)
+ {
+ throw new CourierTransportException(ex);
+ }
+ catch (final IOException ex)
+ {
+ throw new CourierMarshalUnmarshalException(ex);
+ }
+ catch (final CourierException ex)
+ {
+ throw ex;
+ }
+ catch (final Exception ex)
+ {
+ throw new CourierException(ex);
+ }
+ }
- File tmpFile = null;
- try
- {
- Method download = handler.getClass().getMethod("downloadFile",
- new Class[]
- { File.class });
- tmpFile = (File) download.invoke(handler, new Object[]
- { work });
- return CourierUtil.messageFromLocalFile(tmpFile);
- }
- catch (FileNotFoundException ex)
- {
- throw new CourierTransportException(ex);
- }
- catch (IOException ex)
- {
- throw new CourierTransportException(ex);
- }
- catch (final CourierException ex)
- {
- throw ex;
- }
- catch (Exception e)
- {
- throw new CourierTransportException(e);
- }
- finally
- {
- if (null != tmpFile)
- tmpFile.delete();
- }
- } // ________________________________
+ File tmpFile = null;
+ try
+ {
+ Method download = handler.getClass().getMethod("downloadFile",
+ new Class[]
+ { File.class });
+ tmpFile = (File) download.invoke(handler, new Object[]
+ { work });
+ return CourierUtil.messageFromLocalFile(tmpFile);
+ }
+ catch (FileNotFoundException ex)
+ {
+ throw new CourierTransportException(ex);
+ }
+ catch (IOException ex)
+ {
+ throw new CourierTransportException(ex);
+ }
+ catch (final CourierException ex)
+ {
+ throw ex;
+ }
+ catch (Exception e)
+ {
+ throw new CourierTransportException(e);
+ }
+ finally
+ {
+ if (null != tmpFile)
+ tmpFile.delete();
+ }
+ } // ________________________________
- protected File workFile(File input)
- {
- String sfx = null;
- try
- {
- sfx = _epr.getWorkSuffix();
- }
- catch (URISyntaxException e)
- {
- _logger.warn("Malformed EPR", e);
- }
+ protected File workFile(File input)
+ {
+ String sfx = _epr.getWorkSuffix();
- if (Util.isNullString(sfx))
- {
- sfx = ".esbInProcess";
- _logger
- .debug("No valid work suffix found in EPR - using default of "
- + sfx);
- }
-
- return new File(input.toString()+ sfx);
- } // ________________________________
+ if (Util.isNullString(sfx))
+ {
+ sfx = ".esbInProcess";
+ _logger
+ .debug("No valid work suffix found in EPR - using default of "
+ + sfx);
+ }
+
+ return new File(input.toString()+ sfx);
+ } // ________________________________
- protected File errorFile(File input)
- {
- try
- {
- if (_epr.getErrorDelete())
- return null;
- }
- catch (Exception e)
- {
- _logger.warn("Problems in FileEpr", e);
- }
+ protected File errorFile(File input)
+ {
+ try
+ {
+ if (_epr.getErrorDelete())
+ return null;
+ }
+ catch (Exception e)
+ {
+ _logger.warn("Problems in FileEpr", e);
+ }
- String sfx = null;
- try
- {
- sfx = _epr.getErrorSuffix();
- }
- catch (URISyntaxException e)
- {
- _logger.warn("Malformed EPR", e);
- }
+ String sfx = _epr.getErrorSuffix();
- if (Util.isNullString(sfx))
- {
- sfx = ".esbERROR";
- _logger
- .debug("No valid work suffix found in EPR - using default of "
- + sfx);
- }
- return new File(input.toString() + sfx);
- } // ________________________________
+ if (Util.isNullString(sfx))
+ {
+ sfx = ".esbERROR";
+ _logger
+ .debug("No valid work suffix found in EPR - using default of "
+ + sfx);
+ }
+ return new File(input.toString() + sfx);
+ } // ________________________________
- protected File postFile(File input)
- {
- try
- {
-// if (_epr instanceof FTPEpr || _epr.getPostDelete())
- if (_epr.getPostDelete())
- return null;
- }
- catch (Exception e)
- {
- _logger.warn("Problems in FileEpr", e);
- }
+ protected File postFile(File input)
+ {
+ try
+ {
+// if (_epr instanceof FTPEpr || _epr.getPostDelete())
+ if (_epr.getPostDelete())
+ return null;
+ }
+ catch (Exception e)
+ {
+ _logger.warn("Problems in FileEpr", e);
+ }
- String inputDir = new File(input.getAbsolutePath()).getParent();
- if (inputDir == null)
- {
- _logger.debug("Could not get parent directory for "+input);
- inputDir="";
- }
-
- String dir = null;
- try
- {
- dir = _epr.getPostDirectory();
- }
- catch (URISyntaxException e)
- {
- _logger.warn("Malformed EPR", e);
- }
- if (null==dir)
- {
- dir = inputDir;
- _logger
- .debug("No valid post process directory found in EPR - using same as input ("
- + dir + ")");
- }
+ String inputDir = new File(input.getAbsolutePath()).getParent();
+ if (inputDir == null)
+ {
+ _logger.debug("Could not get parent directory for "+input);
+ inputDir="";
+ }
+
+ String dir = _epr.getPostDirectory();
- String sfx = null;
- try
- {
- sfx = _epr.getPostSuffix();
- }
- catch (URISyntaxException e)
- {
- _logger.warn("Malformed EPR", e);
- }
- if (Util.isNullString(sfx))
- {
- if (dir == null) // means inputDir is also null!
- {
- /*
- * Aarrghh! We should be able to return an exception, but
- * can't. Not changing the signature at this stage. Post
- * GA.
- *
- * Plus we shouldn't be assuming getParent never returns null
- * in the first place.
- */
-
- _logger.error("No way to determine post process directory. Will use a default relative to cwd.");
- }
-
- if (dir.equals(inputDir))
- {
- sfx = ".esbProcessed";
- _logger
- .debug("No valid post suffix found in EPR - using default of "
- + sfx);
- }
- }
+ if (null==dir)
+ {
+ dir = inputDir;
+ _logger
+ .debug("No valid post process directory found in EPR - using same as input ("
+ + dir + ")");
+ }
- return new File(dir, input.getName() + sfx);
- } // ________________________________
-
- public void setPollLatency(Long millis)
- {
- if (millis <= 900)
- _logger.warn("Poll latency must be >= 900 milliseconds - Keeping old value of "+_pollLatency);
- else
- _pollLatency = millis;
- } // ________________________________
-
+ String sfx = _epr.getPostSuffix();
+
+ if (Util.isNullString(sfx))
+ {
+ if (dir == null) // means inputDir is also null!
+ {
+ /*
+ * Aarrghh! We should be able to return an exception, but
+ * can't. Not changing the signature at this stage. Post
+ * GA.
+ *
+ * Plus we shouldn't be assuming getParent never returns null
+ * in the first place.
+ */
+
+ _logger.error("No way to determine post process directory. Will use a default relative to cwd.");
+ }
+
+ if (dir.equals(inputDir))
+ {
+ sfx = ".esbProcessed";
+ _logger
+ .debug("No valid post suffix found in EPR - using default of "
+ + sfx);
+ }
+ }
+
+ return new File(dir, input.getName() + sfx);
+ } // ________________________________
+
+ public void setPollLatency(Long millis)
+ {
+ if (millis <= 900)
+ _logger.warn("Poll latency must be >= 900 milliseconds - Keeping old value of "+_pollLatency);
+ else
+ _pollLatency = millis;
+ } // ________________________________
+
public void cleanup()
{
}
- protected long _pollLatency = 900;
+ protected long _pollLatency = 900;
- protected static final String DEFAULT_TMP = System
- .getProperty("java.io.tmpdir");
+ protected static final String DEFAULT_TMP = System
+ .getProperty("java.io.tmpdir");
- protected String _inputSuffix;
+ protected String _inputSuffix;
- protected URI _uri;
+ protected URI _uri;
- protected boolean _receiverOnly;
+ protected boolean _receiverOnly;
- protected FileEpr _epr;
+ protected FileEpr _epr;
- protected LocalFileHandler _localFhandler;
+ protected LocalFileHandler _localFhandler;
- protected static Logger _logger = Logger.getLogger(FileCourier.class);
+ protected static Logger _logger = Logger.getLogger(FileCourier.class);
} // ____________________________________________________________________________
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java 2008-05-23 04:54:46 UTC (rev 20122)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java 2008-05-23 12:31:35 UTC (rev 20123)
@@ -359,9 +359,7 @@
throw new CourierException(ex);
}
- catch (URISyntaxException ex) {
- throw new CourierException(ex);
- } finally {
+ finally {
if (oJndiCtx != null) {
NamingContextPool.releaseNamingContext(oJndiCtx) ;
}
@@ -373,20 +371,11 @@
private JmsConnectionPool getConnectionPool() throws ConnectionException {
synchronized(this) {
if(jmsConnectionPool == null) {
- String sFactoryClass;
- Properties properties;
- String username;
- String password;
+ String sFactoryClass = _epr.getConnectionFactory();
+ Properties properties = _epr.getJndiEnvironment();
+ String username = _epr.getJMSSecurityPrincipal();
+ String password = _epr.getJMSSecurityCredential();
- try {
- sFactoryClass = _epr.getConnectionFactory();
- properties = _epr.getJndiEnvironment();
- username = _epr.getJMSSecurityPrincipal();
- password = _epr.getJMSSecurityCredential();
- } catch (URISyntaxException e) {
- throw new ConnectionException("Unexpected exception while getting JMS connection pool.", e);
- }
-
if (Util.isNullString(sFactoryClass)) {
sFactoryClass = "ConnectionFactory";
}
@@ -537,9 +526,6 @@
throw new CourierException(ex);
}
- catch (URISyntaxException ex) {
- throw new MalformedEPRException(ex);
- }
finally {
if (!success) {
closeSession();
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java 2008-05-23 04:54:46 UTC (rev 20122)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/SqlTableCourier.java 2008-05-23 12:31:35 UTC (rev 20123)
@@ -77,18 +77,12 @@
{
_isReceiver = isReceiver;
_sleepForRetries = 3000; // TODO magic number - configurable?
- try
- {
- deleteOnSuccess = Boolean.TRUE.equals(Boolean.valueOf(epr
- .getPostDelete()));
- deleteOnError = Boolean.TRUE.equals(Boolean.valueOf(epr
- .getErrorDelete()));
- }
- catch (URISyntaxException e)
- {
- throw new CourierException(e);
- }
+ deleteOnSuccess = Boolean.TRUE.equals(Boolean.valueOf(epr
+ .getPostDelete()));
+ deleteOnError = Boolean.TRUE.equals(Boolean.valueOf(epr
+ .getErrorDelete()));
+
jdbcFactory = new JDBCEprDBResourceFactory(epr);
}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/helpers/FtpFileHandler.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/helpers/FtpFileHandler.java 2008-05-23 04:54:46 UTC (rev 20122)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/helpers/FtpFileHandler.java 2008-05-23 12:31:35 UTC (rev 20123)
@@ -40,262 +40,252 @@
public class FtpFileHandler implements FileHandler
{
- FtpFileHandler(FTPEpr epr) throws CourierException
- {
- _epr = epr;
+ FtpFileHandler(FTPEpr epr) throws CourierException
+ {
+ _epr = epr;
- final URI uri ;
- try
- {
- uri = _epr.getURI();
- }
- catch (URISyntaxException e)
- {
- throw new CourierException(e);
- }
+ final URI uri ;
+ try
+ {
+ uri = _epr.getURI();
+ }
+ catch (URISyntaxException e)
+ {
+ throw new CourierException(e);
+ }
- _server = uri.getHost();
+ _server = uri.getHost();
- String[] sa = null;
-
- if (uri.getUserInfo() != null)
- sa = uri.getUserInfo().split(":");
-
- if (sa == null)
- sa = new String[]
- { "", "" };
- _user = (sa.length < 1) ? "" : sa[0];
- _passwd = (sa.length < 2) ? "" : sa[1];
+ String[] sa = null;
+
+ if (uri.getUserInfo() != null)
+ sa = uri.getUserInfo().split(":");
+
+ if (sa == null)
+ sa = new String[]
+ { "", "" };
+ _user = (sa.length < 1) ? "" : sa[0];
+ _passwd = (sa.length < 2) ? "" : sa[1];
- _remoteDir = uri.getPath();
-
- final String tmpdir = System.getProperty("java.io.tmpdir") ;
- if ((_remoteDir == null) || (_remoteDir.equals("")))
- _remoteDir = ModulePropertyManager.getPropertyManager(ModulePropertyManager.TRANSPORTS_MODULE).getProperty(Environment.FTP_REMOTEDIR, tmpdir);
+ _remoteDir = uri.getPath();
+
+ final String tmpdir = System.getProperty("java.io.tmpdir") ;
+ if ((_remoteDir == null) || (_remoteDir.equals("")))
+ _remoteDir = ModulePropertyManager.getPropertyManager(ModulePropertyManager.TRANSPORTS_MODULE).getProperty(Environment.FTP_REMOTEDIR, tmpdir);
- _port = uri.getPort();
+ _port = uri.getPort();
- _localDir = ModulePropertyManager.getPropertyManager(ModulePropertyManager.TRANSPORTS_MODULE).getProperty(Environment.FTP_LOCALDIR, tmpdir);
+ _localDir = ModulePropertyManager.getPropertyManager(ModulePropertyManager.TRANSPORTS_MODULE).getProperty(Environment.FTP_LOCALDIR, tmpdir);
- _isAscii = false;
- _isPassive = false;
-
- try
- {
- _isPassive = _epr.getPassive();
- }
- catch (URISyntaxException e)
- {
- _logger.warn(e);
- }
+ _isAscii = false;
+ _isPassive = _epr.getPassive();
+ }
- }
+ public boolean deleteFile(File file) throws CourierException
+ {
+ // TODO would be better to return false if the file did not exist and leave exceptions
+ // for other error conditions (such as permission denied).
+
+ final RemoteFileSystem handler = getHandler() ;
+ try
+ {
+ handler.deleteRemoteFile(file.getName());
+ return true;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+
+ throw new CourierException(e);
+ }
+ finally
+ {
+ handler.quit() ;
+ }
+ }
- public boolean deleteFile(File file) throws CourierException
- {
- // TODO would be better to return false if the file did not exist and leave exceptions
- // for other error conditions (such as permission denied).
-
- final RemoteFileSystem handler = getHandler() ;
- try
- {
- handler.deleteRemoteFile(file.getName());
- return true;
- }
- catch (Exception e)
- {
- e.printStackTrace();
-
- throw new CourierException(e);
- }
- finally
- {
- handler.quit() ;
- }
- }
+ public byte[] getFileContents(File file) throws CourierException
+ {
+ try
+ {
+ /*
+ * For some reason the code only works on the file name at this
+ * point, even if a dir is passed in. So, if it's a dir
+ * we will ignore it and return null.
+ */
- public byte[] getFileContents(File file) throws CourierException
- {
- try
- {
- /*
- * For some reason the code only works on the file name at this
- * point, even if a dir is passed in. So, if it's a dir
- * we will ignore it and return null.
- */
+ String name = file.getName();
+
+ if (file.toString().length() > name.length())
+ {
+ _logger.debug("FtpFileHandler.getFileContents on "+file+" will ignore because of directory.");
+
+ return null;
+ }
+
+ final RemoteFileSystem handler = getHandler() ;
+ try
+ {
+ handler.downloadFile(name, name);
+ }
+ finally
+ {
+ handler.quit() ;
+ }
+ File local = new File(_localDir, name);
+ byte[] ba = CourierUtil.bytesFromLocalFile(local);
+ local.delete();
+ return ba;
+ }
+ catch (Exception e)
+ {
+ // TODO better error handling, e.g., what if someone
+ // tries to download a directory?
+
+ throw new CourierException(e);
+ }
+ }
- String name = file.getName();
-
- if (file.toString().length() > name.length())
- {
- _logger.debug("FtpFileHandler.getFileContents on "+file+" will ignore because of directory.");
-
- return null;
- }
-
- final RemoteFileSystem handler = getHandler() ;
- try
- {
- handler.downloadFile(name, name);
- }
- finally
- {
- handler.quit() ;
- }
- File local = new File(_localDir, name);
- byte[] ba = CourierUtil.bytesFromLocalFile(local);
- local.delete();
- return ba;
- }
- catch (Exception e)
- {
- // TODO better error handling, e.g., what if someone
- // tries to download a directory?
-
- throw new CourierException(e);
- }
- }
+ // FileCourier will try to invoke the uploadFile(File) method using
+ // reflection
+ public void uploadFile(File file) throws CourierException
+ {
+ try
+ {
+ String name = file.getName();
+ final RemoteFileSystem handler = getHandler() ;
+ try
+ {
+ handler.uploadFile(file, name);
+ }
+ finally
+ {
+ handler.quit();
+ }
+ file.delete();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+
+ throw new CourierException(e);
+ }
+ }
- // FileCourier will try to invoke the uploadFile(File) method using
- // reflection
- public void uploadFile(File file) throws CourierException
- {
- try
- {
- String name = file.getName();
- final RemoteFileSystem handler = getHandler() ;
- try
- {
- handler.uploadFile(file, name);
- }
- finally
- {
- handler.quit();
- }
- file.delete();
- }
- catch (Exception e)
- {
- e.printStackTrace();
-
- throw new CourierException(e);
- }
- }
+ // FileCourier will try to invoke the downloadFile(File) method using
+ // reflection
+ public File downloadFile(File file) throws CourierException
+ {
+ try
+ {
+ String name = file.getName();
+ final RemoteFileSystem handler = getHandler() ;
+ try
+ {
+ handler.downloadFile(name, name);
+ }
+ finally
+ {
+ handler.quit() ;
+ }
+ return new File(_localDir,name);
+ }
+ catch (Exception e)
+ {
+ throw new CourierException(e);
+ }
+ }
- // FileCourier will try to invoke the downloadFile(File) method using
- // reflection
- public File downloadFile(File file) throws CourierException
- {
- try
- {
- String name = file.getName();
- final RemoteFileSystem handler = getHandler() ;
- try
- {
- handler.downloadFile(name, name);
- }
- finally
- {
- handler.quit() ;
- }
- return new File(_localDir,name);
- }
- catch (Exception e)
- {
- throw new CourierException(e);
- }
- }
+ public File[] getFileList() throws CourierException
+ {
+ String[] names = null;
- public File[] getFileList() throws CourierException
- {
- String[] names = null;
+ final RemoteFileSystem handler = getHandler() ;
+ try
+ {
+ names = handler.getFileListFromRemoteDir(_epr.getInputSuffix());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+
+ throw new CourierException(e);
+ }
+ finally
+ {
+ handler.quit() ;
+ }
- final RemoteFileSystem handler = getHandler() ;
- try
- {
- names = handler.getFileListFromRemoteDir(_epr.getInputSuffix());
- }
- catch (Exception e)
- {
- e.printStackTrace();
-
- throw new CourierException(e);
- }
- finally
- {
- handler.quit() ;
- }
+ if (null == names)
+ return null;
+ File[] files = new File[names.length];
+ int i = 0;
+ for (String file : names)
+ if (null != file)
+ files[i++] = new File(file);
+ return files;
+ }
- if (null == names)
- return null;
- File[] files = new File[names.length];
- int i = 0;
- for (String file : names)
- if (null != file)
- files[i++] = new File(file);
- return files;
- }
+ public boolean renameFile(File from, File to) throws CourierException
+ {
+ final RemoteFileSystem handler = getHandler() ;
+ try
+ {
+ handler.remoteRename(from, to);
- public boolean renameFile(File from, File to) throws CourierException
- {
- final RemoteFileSystem handler = getHandler() ;
- try
- {
- handler.remoteRename(from, to);
+ return true;
+ }
+ catch (IOException ex) // file not found
+ {
+ return false;
+ }
+ catch (Exception e)
+ {
+ throw new CourierException(e);
+ }
+ finally
+ {
+ handler.quit();
+ }
+ }
- return true;
- }
- catch (IOException ex) // file not found
- {
- return false;
- }
- catch (Exception e)
- {
- throw new CourierException(e);
- }
- finally
- {
- handler.quit();
- }
- }
+ // Because ftp connections are volatile, we are always getting a fresh
+ // handle
+ // TODO there's room for optimization here - not for GA though
+ protected RemoteFileSystem getHandler() throws CourierException
+ {
+ try
+ {
+ RemoteFileSystem rfs = RemoteFileSystemFactory.getRemoteFileSystem(
+ _epr, true);
+ try
+ {
+ rfs.setRemoteDir(_remoteDir);
+ }
+ catch (Exception e)
+ {
+ throw new CourierException(e);
+ }
- // Because ftp connections are volatile, we are always getting a fresh
- // handle
- // TODO there's room for optimization here - not for GA though
- protected RemoteFileSystem getHandler() throws CourierException
- {
- try
- {
- RemoteFileSystem rfs = RemoteFileSystemFactory.getRemoteFileSystem(
- _epr, true);
- try
- {
- rfs.setRemoteDir(_remoteDir);
- }
- catch (Exception e)
- {
- throw new CourierException(e);
- }
+ return rfs;
+ }
+ catch (RemoteFileSystemException e)
+ {
+ throw new CourierException(e);
+ }
+ }
- return rfs;
- }
- catch (RemoteFileSystemException e)
- {
- throw new CourierException(e);
- }
- }
+ private static final Logger _logger = Logger
+ .getLogger(FtpFileHandler.class);
- private static final Logger _logger = Logger
- .getLogger(FtpFileHandler.class);
-
- protected FTPEpr _epr;
- protected ConfigTree _tree;
- protected String _server;
- protected String _user;
- protected String _passwd;
- protected String _remoteDir;
- protected String _localDir;
- protected int _port;
- protected boolean _isAscii, _isPassive;
-
+ protected FTPEpr _epr;
+ protected ConfigTree _tree;
+ protected String _server;
+ protected String _user;
+ protected String _passwd;
+ protected String _remoteDir;
+ protected String _localDir;
+ protected int _port;
+ protected boolean _isAscii, _isPassive;
+
}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/helpers/JDBCEprDBResourceFactory.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/helpers/JDBCEprDBResourceFactory.java 2008-05-23 04:54:46 UTC (rev 20122)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/helpers/JDBCEprDBResourceFactory.java 2008-05-23 12:31:35 UTC (rev 20123)
@@ -29,7 +29,6 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
-import java.net.URISyntaxException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
@@ -59,15 +58,11 @@
if (epr.getDatasource() != null) {
lookupDataSource(epr);
} else {
- try {
try {
ClassUtil.forName(epr.getDriver(), getClass());
} catch (ClassNotFoundException e) {
throw new CourierServiceBindException("Database driver '" + epr.getDriver() + "' not available on classpath.");
}
- } catch (URISyntaxException e) {
- throw new RuntimeException("Unexpected URISyntaxException from EPR getter method.", e);
- }
}
}
@@ -79,11 +74,7 @@
if(dataSource != null) {
connection = dataSource.getConnection();
} else {
- try {
connection = DriverManager.getConnection(epr.getURL(), epr.getUserName(), epr.getPassword());
- } catch (URISyntaxException e) {
- throw new RuntimeException("Unexpected URISyntaxException from EPR getter method.", e);
- }
}
} catch (SQLException e) {
throw new CourierTransportException("Failed to connect to DataSource.", e);
@@ -143,48 +134,39 @@
private String buildSelect4UpdateStatementSQL() {
StringBuilder sb = new StringBuilder("select ");
- try {
- if (!epr.getURL().contains("hsqldb")) {
- sb = sb.append(
- epr.getDataColumn()).append(" from ").append(
- epr.getTableName()).append(" where ").append(
- epr.getMessageIdColumn()).append("=?").append(
- " and ").append(epr.getStatusColumn())
- .append("=?").append(" for update");
- } else {
- /*
- * HSQL does not support FOR UPDATE! All tables appear to
- * be inherently updatable!
- */
- sb = sb.append(
- epr.getDataColumn()).append(" from ").append(
- epr.getTableName()).append(" where ").append(
- epr.getMessageIdColumn()).append("=?").append(
- " and ").append(epr.getStatusColumn())
- .append("=?");
- }
- } catch (URISyntaxException e) {
- throw new RuntimeException("Unexpected URISyntaxException from EPR getter method.", e);
+ if (!epr.getURL().contains("hsqldb")) {
+ sb = sb.append(
+ epr.getDataColumn()).append(" from ").append(
+ epr.getTableName()).append(" where ").append(
+ epr.getMessageIdColumn()).append("=?").append(
+ " and ").append(epr.getStatusColumn())
+ .append("=?").append(" for update");
+ } else {
+ /*
+ * HSQL does not support FOR UPDATE! All tables appear to
+ * be inherently updatable!
+ */
+ sb = sb.append(
+ epr.getDataColumn()).append(" from ").append(
+ epr.getTableName()).append(" where ").append(
+ epr.getMessageIdColumn()).append("=?").append(
+ " and ").append(epr.getStatusColumn())
+ .append("=?");
}
return sb.toString();
}
private String buildUpdateStatusStatementSQL() {
- try {
StringBuilder sb = new StringBuilder("update ").append(
epr.getTableName()).append(" set ").append(
epr.getStatusColumn()).append("= ?").append(" where ")
.append(epr.getMessageIdColumn()).append("=?");
return sb.toString();
- } catch (URISyntaxException e) {
- throw new RuntimeException("Unexpected URISyntaxException from EPR getter method.", e);
- }
}
private String buildInsertStatementSQL() {
- try {
StringBuilder sb = new StringBuilder();
sb.append("insert into ").append(epr.getTableName());
@@ -196,39 +178,28 @@
sb.append(") values (?,?,?,?)");
return sb.toString();
- } catch (URISyntaxException e) {
- throw new RuntimeException("Unexpected URISyntaxException from EPR getter method.", e);
- }
}
private String buildListStatementSQL() {
StringBuilder sb = new StringBuilder();
- try {
- sb.append("select ");
- sb.append(epr.getMessageIdColumn()).append(", ");
- sb.append(epr.getTimestampColumn());
- sb.append(" from ").append(epr.getTableName());
- sb.append(" where ").append(epr.getStatusColumn());
- sb.append(" = '").append(SqlTableCourier.State.Pending.getColumnValue()).append("'");
- sb.append(" order by 2");
- } catch (URISyntaxException e) {
- throw new RuntimeException("Unexpected URISyntaxException from EPR getter method.", e);
- }
+ sb.append("select ");
+ sb.append(epr.getMessageIdColumn()).append(", ");
+ sb.append(epr.getTimestampColumn());
+ sb.append(" from ").append(epr.getTableName());
+ sb.append(" where ").append(epr.getStatusColumn());
+ sb.append(" = '").append(SqlTableCourier.State.Pending.getColumnValue()).append("'");
+ sb.append(" order by 2");
return sb.toString();
}
private String buildDeleteStatementSQL() {
- try {
StringBuilder sb = new StringBuilder("delete from ").append(
epr.getTableName()).append(" where ").append(
epr.getMessageIdColumn()).append(" =?");
return sb.toString();
- } catch (URISyntaxException e) {
- throw new RuntimeException("Unexpected URISyntaxException from EPR getter method.", e);
- }
}
private void lookupDataSource(JDBCEpr epr) throws CourierServiceBindException {
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/helpers/LocalFileHandler.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/helpers/LocalFileHandler.java 2008-05-23 04:54:46 UTC (rev 20122)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/helpers/LocalFileHandler.java 2008-05-23 12:31:35 UTC (rev 20123)
@@ -27,7 +27,6 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.net.URISyntaxException;
import org.apache.log4j.Logger;
import org.jboss.soa.esb.addressing.eprs.FileEpr;
@@ -37,109 +36,105 @@
public class LocalFileHandler implements FileHandler
{
- private LocalFileHandler()
- {
- }
+ private LocalFileHandler()
+ {
+ }
- LocalFileHandler(FileEpr epr)
- {
- _epr = epr;
- }
+ LocalFileHandler(FileEpr epr)
+ {
+ _epr = epr;
+ }
- public boolean deleteFile(File file) throws CourierException
- {
- return file.delete();
- }
+ public boolean deleteFile(File file) throws CourierException
+ {
+ return file.delete();
+ }
- public byte[] getFileContents(File file) throws CourierException
- {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- byte[] ba = new byte[1000]; // TODO MAGIC NUMBER
- int iQread;
+ public byte[] getFileContents(File file) throws CourierException
+ {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ byte[] ba = new byte[1000]; // TODO MAGIC NUMBER
+ int iQread;
- try
- {
- FileInputStream inp = new FileInputStream(file);
- while (-1 != (iQread = inp.read(ba)))
- if (iQread > 0)
- out.write(ba, 0, iQread);
- inp.close();
- out.close();
- return out.toByteArray();
- }
- catch (FileNotFoundException e)
- {
- throw new CourierException(e);
- }
- catch (IOException e)
- {
- throw new CourierException(e);
- }
- catch (Exception e)
- {
- throw new CourierException(e);
- }
- }
+ try
+ {
+ FileInputStream inp = new FileInputStream(file);
+ while (-1 != (iQread = inp.read(ba)))
+ if (iQread > 0)
+ out.write(ba, 0, iQread);
+ inp.close();
+ out.close();
+ return out.toByteArray();
+ }
+ catch (FileNotFoundException e)
+ {
+ throw new CourierException(e);
+ }
+ catch (IOException e)
+ {
+ throw new CourierException(e);
+ }
+ catch (Exception e)
+ {
+ throw new CourierException(e);
+ }
+ }
- public File[] getFileList() throws CourierException
- {
- try
- {
- File dir = new File(_epr.getURI());
- if (!dir.isDirectory())
- throw new CourierException(
- "Can't get file list if URL is not a directory");
+ public File[] getFileList() throws CourierException
+ {
+ try
+ {
+ File dir = new File(_epr.getURI());
+ if (!dir.isDirectory())
+ throw new CourierException(
+ "Can't get file list if URL is not a directory");
- FileFilter filter = new FileEndsWith(_epr.getInputSuffix());
- return dir.listFiles(filter);
- }
- catch (URISyntaxException e)
- {
- throw new CourierException(e);
- }
- catch (Exception e)
- {
- throw new CourierException(e);
- }
- }
+ FileFilter filter = new FileEndsWith(_epr.getInputSuffix());
+ return dir.listFiles(filter);
+ }
+ catch (Exception e)
+ {
+ throw new CourierException(e);
+ }
+ }
- public boolean renameFile(File from, File to) throws CourierException
- {
- try
- {
- if (to.exists())
- to.delete();
- if (!FileUtil.renameTo(from, to))
- throw new CourierException("Unable to rename from " + from
- + " to " + to);
-
- return true;
- }
- catch (Exception e)
- {
- throw new CourierException(e);
- }
- }
+ public boolean renameFile(File from, File to) throws CourierException
+ {
+ try
+ {
+ if (to.exists())
+ to.delete();
+ if (!FileUtil.renameTo(from, to))
+ throw new CourierException("Unable to rename from " + from
+ + " to " + to);
+
+ return true;
+ }
+ catch (Exception e)
+ {
+ throw new CourierException(e);
+ }
+ }
- private class FileEndsWith implements FileFilter
- {
- String m_sSuffix;
+ private class FileEndsWith implements FileFilter
+ {
+ String m_sSuffix;
- FileEndsWith(String p_sEnd) throws CourierException
- {
- m_sSuffix = p_sEnd;
- if (Util.isNullString(m_sSuffix))
- throw new CourierException(
- "A file suffix (or full Message id) must be specified for pickup");
- } // ______________________________
+ FileEndsWith(String p_sEnd) throws CourierException
+ {
+ m_sSuffix = p_sEnd;
+ if (Util.isNullString(m_sSuffix))
+ throw new CourierException(
+ "A file suffix (or full Message id) must be specified for pickup");
+ } // ______________________________
- public boolean accept(File p_f)
- {
- return (p_f.isFile()) ? p_f.toString().endsWith(m_sSuffix) : false;
- } // ______________________________
- } // ____________________________________________________
+ public boolean accept(File p_f)
+ {
+ return (p_f.isFile()) ? p_f.toString().endsWith(m_sSuffix) : false;
+ } // ______________________________
+ } // ____________________________________________________
- protected FileEpr _epr;
+ protected FileEpr _epr;
- static Logger _logger = Logger.getLogger(LocalFileHandler.class);
+ static Logger _logger = Logger.getLogger(LocalFileHandler.class);
}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/filter/MetaDataFilter.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/filter/MetaDataFilter.java 2008-05-23 04:54:46 UTC (rev 20122)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/message/filter/MetaDataFilter.java 2008-05-23 12:31:35 UTC (rev 20123)
@@ -23,7 +23,6 @@
package org.jboss.internal.soa.esb.message.filter;
import java.io.File;
-import java.net.URISyntaxException;
import java.util.Calendar;
import java.util.Map;
@@ -56,105 +55,105 @@
{
public Message onOutput (Message msg, Map<String, Object> params) throws CourierException
{
- final Environment.Transports type;
- final String name;
- EPR destination = msg.getHeader().getCall().getTo();
- if (destination != null)
- {
- if (destination instanceof FTPEpr)
- {
- try
- {
- type = Environment.Transports.FTP;
+ final Environment.Transports type;
+ final String name;
+ EPR destination = msg.getHeader().getCall().getTo();
+ if (destination != null)
+ {
+ if (destination instanceof FTPEpr)
+ {
+ try
+ {
+ type = Environment.Transports.FTP;
- String dir = ModulePropertyManager.getPropertyManager(
- ModulePropertyManager.TRANSPORTS_MODULE)
- .getProperty(Environment.FTP_LOCALDIR,
- System.getProperty("java.io.tmpdir"));
+ String dir = ModulePropertyManager.getPropertyManager(
+ ModulePropertyManager.TRANSPORTS_MODULE)
+ .getProperty(Environment.FTP_LOCALDIR,
+ System.getProperty("java.io.tmpdir"));
- name = dir
- + File.separator
- + msg.getHeader().getCall().getMessageID()
- .toString()
- + ((FTPEpr) destination).getPostDirectory();
- }
- catch (URISyntaxException ex)
- {
- throw new CourierException(ex);
- }
- }
- else if (destination instanceof FileEpr)
- {
- try
- {
- type = Environment.Transports.File;
+ name = dir
+ + File.separator
+ + msg.getHeader().getCall().getMessageID()
+ .toString()
+ + ((FTPEpr) destination).getPostDirectory();
+ }
+ catch (Exception ex)
+ {
+ throw new CourierException(ex);
+ }
+ }
+ else if (destination instanceof FileEpr)
+ {
+ try
+ {
+ type = Environment.Transports.File;
- name = destination.getURI()
- + File.separator
- + msg.getHeader().getCall().getMessageID()
- .toString()
- + ((FileEpr) destination).getInputSuffix();
- }
- catch (URISyntaxException ex)
- {
- throw new CourierException(ex);
- }
- }
- else if (destination instanceof JMSEpr)
- {
- type = Environment.Transports.JMS;
+ name = destination.getURI()
+ + File.separator
+ + msg.getHeader().getCall().getMessageID()
+ .toString()
+ + ((FileEpr) destination).getInputSuffix();
+ }
+ catch (Exception ex)
+ {
+ throw new CourierException(ex);
+ }
+ }
+ else if (destination instanceof JMSEpr)
+ {
+ type = Environment.Transports.JMS;
- name = destination.getAddr().toString();
- }
- else if (destination instanceof JDBCEpr)
- {
- type = Environment.Transports.SQL;
+ name = destination.getAddr().toString();
+ }
+ else if (destination instanceof JDBCEpr)
+ {
+ type = Environment.Transports.SQL;
- name = destination.getAddr().toString();
- }
- else if (destination instanceof HibernateEpr)
- {
- type = Environment.Transports.Hibernate;
- name = destination.getAddr().toString();
- }
- else
- {
- type = null;
- name = null;
- }
- }
- else
- {
- type = null;
- name = null;
- }
+ name = destination.getAddr().toString();
+ }
+ else if (destination instanceof HibernateEpr)
+ {
+ type = Environment.Transports.Hibernate;
+ name = destination.getAddr().toString();
+ }
+ else
+ {
+ type = null;
+ name = null;
+ }
+ }
+ else
+ {
+ type = null;
+ name = null;
+ }
- final Properties props = msg.getProperties();
- setProperty(props, Environment.TRANSPORT_TYPE, type);
- setProperty(props, Environment.MESSAGE_SOURCE, name);
- props.setProperty(Environment.MESSAGE_ENTRY_TIME, Calendar
- .getInstance().getTime().toString());
- return msg;
+ final Properties props = msg.getProperties();
+ setProperty(props, Environment.TRANSPORT_TYPE, type);
+ setProperty(props, Environment.MESSAGE_SOURCE, name);
+ props.setProperty(Environment.MESSAGE_ENTRY_TIME, Calendar
+ .getInstance().getTime().toString());
+ return msg;
}
public Message onInput (Message msg, Map<String, Object> params) throws CourierException
{
- msg.getProperties().setProperty(Environment.MESSAGE_EXIT_TIME,
- Calendar.getInstance().getTime().toString());
+ msg.getProperties().setProperty(Environment.MESSAGE_EXIT_TIME,
+ Calendar.getInstance().getTime().toString());
- return msg;
+ return msg;
}
private void setProperty (final Properties props, final String name,
- final Object value)
+ final Object value)
{
- if (value == null)
- {
- props.remove(name);
- }
- else
- {
- props.setProperty(name, value);
- }
+ if (value == null)
+ {
+ props.remove(name);
+ }
+ else
+ {
+ props.setProperty(name, value);
+ }
}
}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/FtpImpl.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/FtpImpl.java 2008-05-23 04:54:46 UTC (rev 20122)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/FtpImpl.java 2008-05-23 12:31:35 UTC (rev 20123)
@@ -166,17 +166,8 @@
+ ModulePropertyManager.TRANSPORTS_MODULE + ":" + Environment.FTP_LOCALDIR + "'");
}
- m_bPassive = false;
+ m_bPassive = m_oEpr.getPassive();
- try
- {
- m_bPassive = m_oEpr.getPassive();
- }
- catch (URISyntaxException e)
- {
- _logger.warn(e);
- }
-
String timeout = ModulePropertyManager.getPropertyManager(ModulePropertyManager.TRANSPORTS_MODULE).getProperty(Environment.FTP_SOCKET_TIMEOUT, null);
if (timeout != null)
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/SecureFtpImpl.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/SecureFtpImpl.java 2008-05-23 04:54:46 UTC (rev 20122)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/SecureFtpImpl.java 2008-05-23 12:31:35 UTC (rev 20123)
@@ -72,163 +72,162 @@
public class SecureFtpImpl implements RemoteFileSystem
{
- private static final Logger _logger = Logger.getLogger(SecureFtpImpl.class);
+ private static final Logger _logger = Logger.getLogger(SecureFtpImpl.class);
- private static final String TMP_SUFFIX = ".rosettaPart";
+ private static final String TMP_SUFFIX = ".rosettaPart";
- private static final String SECURE_CHANNEL = "sftp";
+ private static final String SECURE_CHANNEL = "sftp";
- // The objects implementing secure FTP over ssh
- private JSch m_oJSch = new JSch();
+ // The objects implementing secure FTP over ssh
+ private JSch m_oJSch = new JSch();
- private Session session = null;
+ private Session session = null;
- private ChannelSftp m_oSftpChannel = null;
+ private ChannelSftp m_oSftpChannel = null;
- private int m_iPort;
+ private int m_iPort;
- private SFTPEpr m_oEpr;
+ private SFTPEpr m_oEpr;
- private ConfigTree m_oParms;
+ private ConfigTree m_oParms;
- private String m_sFtpServer, m_sUser, m_sPasswd;
+ private String m_sFtpServer, m_sUser, m_sPasswd;
- private String m_sRemoteDir, m_sLocalDir;
+ private String m_sRemoteDir, m_sLocalDir;
- /*
- * Constructor
- *
- * @param p_oP Is a config treeThe used to initialize the object
- *
- * @param connect If true create a new sftp session
- *
- */
- public SecureFtpImpl(ConfigTree p_oP, boolean p_bConnect) throws ConfigurationException, RemoteFileSystemException
- {
- m_oParms = p_oP;
- initialize(p_bConnect);
- }
+ /*
+ * Constructor
+ *
+ * @param p_oP Is a config treeThe used to initialize the object
+ *
+ * @param connect If true create a new sftp session
+ *
+ */
+ public SecureFtpImpl(ConfigTree p_oP, boolean p_bConnect) throws ConfigurationException, RemoteFileSystemException
+ {
+ m_oParms = p_oP;
+ initialize(p_bConnect);
+ }
- /*
- * Constructor
- *
- * @param p_oP Is an EPR used to initialize the object
- *
- * @param connect If true create a new sftp session
- *
- */
- public SecureFtpImpl(SFTPEpr p_oP, boolean p_bConnect) throws ConfigurationException, RemoteFileSystemException
- {
+ /*
+ * Constructor
+ *
+ * @param p_oP Is an EPR used to initialize the object
+ *
+ * @param connect If true create a new sftp session
+ *
+ */
+ public SecureFtpImpl(SFTPEpr p_oP, boolean p_bConnect) throws ConfigurationException, RemoteFileSystemException
+ {
+ m_oEpr = p_oP;
- m_oEpr = p_oP;
+ final URI uri ;
+ try {
+ uri = m_oEpr.getURI();
+ } catch (URISyntaxException e) {
+ throw new RemoteFileSystemException(e);
+ }
- final URI uri ;
- try {
- uri = m_oEpr.getURI();
- } catch (URISyntaxException e) {
- throw new RemoteFileSystemException(e);
- }
+ m_sFtpServer = uri.getHost();
- m_sFtpServer = uri.getHost();
+ String[] sa = null;
- String[] sa = null;
+ if (uri.getUserInfo() != null)
+ sa = uri.getUserInfo().split(":");
- if (uri.getUserInfo() != null)
- sa = uri.getUserInfo().split(":");
+ final int saLen = (sa == null ? 0 : sa.length) ;
+ switch(saLen)
+ {
+ case 2:
+ m_sPasswd = sa[1] ;
+ case 1:
+ m_sUser = sa[0] ;
+ }
- final int saLen = (sa == null ? 0 : sa.length) ;
- switch(saLen)
- {
- case 2:
- m_sPasswd = sa[1] ;
- case 1:
- m_sUser = sa[0] ;
- }
+ m_sRemoteDir = uri.getPath();
- m_sRemoteDir = uri.getPath();
+ final String tmpdir = System.getProperty("java.io.tmpdir");
+ if ((m_sRemoteDir == null) || (m_sRemoteDir.equals("")))
+ m_sRemoteDir = ModulePropertyManager.getPropertyManager(
+ ModulePropertyManager.TRANSPORTS_MODULE).getProperty(
+ Environment.FTP_REMOTEDIR, tmpdir);
- final String tmpdir = System.getProperty("java.io.tmpdir");
- if ((m_sRemoteDir == null) || (m_sRemoteDir.equals("")))
- m_sRemoteDir = ModulePropertyManager.getPropertyManager(
- ModulePropertyManager.TRANSPORTS_MODULE).getProperty(
- Environment.FTP_REMOTEDIR, tmpdir);
+ m_iPort = uri.getPort();
- m_iPort = uri.getPort();
+ m_sLocalDir = ModulePropertyManager.getPropertyManager(
+ ModulePropertyManager.TRANSPORTS_MODULE).getProperty(
+ Environment.FTP_LOCALDIR, tmpdir);
- m_sLocalDir = ModulePropertyManager.getPropertyManager(
- ModulePropertyManager.TRANSPORTS_MODULE).getProperty(
- Environment.FTP_LOCALDIR, tmpdir);
+ configTreeFromEpr();
- configTreeFromEpr();
+ initialize(p_bConnect);
+ }
- initialize(p_bConnect);
- }
+ /*
+ * Constructor
+ *
+ * @param attribs The key/value pairs used to initialize the object
+ *
+ * @param connect If true create a new sftp session using attribs
+ *
+ */
+ public SecureFtpImpl(List<KeyValuePair> attribs, boolean connect)
+ throws ConfigurationException, RemoteFileSystemException
+ {
+ m_oParms = new ConfigTree("fromProps");
+ for (KeyValuePair oCurr : attribs)
+ m_oParms.setAttribute(oCurr.getKey(), oCurr.getValue());
+ initialize(connect);
+ }
- /*
- * Constructor
- *
- * @param attribs The key/value pairs used to initialize the object
- *
- * @param connect If true create a new sftp session using attribs
- *
- */
- public SecureFtpImpl(List<KeyValuePair> attribs, boolean connect)
- throws ConfigurationException, RemoteFileSystemException
- {
- m_oParms = new ConfigTree("fromProps");
- for (KeyValuePair oCurr : attribs)
- m_oParms.setAttribute(oCurr.getKey(), oCurr.getValue());
- initialize(connect);
- }
+ private void initialize(boolean bConnect) throws ConfigurationException, RemoteFileSystemException
+ {
+ checkParms();
+
+ if (bConnect)
+ {
+ try
+ {
+ if (m_iPort > 0)
+ session = m_oJSch.getSession(m_sUser, m_sFtpServer, m_iPort);
+ else
+ session = m_oJSch.getSession(m_sUser, m_sFtpServer);
+
+ if (m_sPasswd != null)
+ {
+ final UserInfo ui = new SecureFtpUserInfo(m_sPasswd);
+ session.setUserInfo(ui);
+ }
+
+ session.setConfig("StrictHostKeyChecking", "no") ;
+ session.setConfig("PreferredAuthentications", "password") ;
- private void initialize(boolean bConnect) throws ConfigurationException, RemoteFileSystemException
- {
- checkParms();
-
- if (bConnect)
- {
- try
- {
- if (m_iPort > 0)
- session = m_oJSch.getSession(m_sUser, m_sFtpServer, m_iPort);
- else
- session = m_oJSch.getSession(m_sUser, m_sFtpServer);
-
- if (m_sPasswd != null)
- {
- final UserInfo ui = new SecureFtpUserInfo(m_sPasswd);
- session.setUserInfo(ui);
- }
-
- session.setConfig("StrictHostKeyChecking", "no") ;
- session.setConfig("PreferredAuthentications", "password") ;
+ session.connect();
+
+ final Channel channel = session.openChannel(SECURE_CHANNEL);
+ channel.connect();
+
+ m_oSftpChannel = (ChannelSftp) channel;
+
+ if (!session.isConnected())
+ throw new RemoteFileSystemException("Can't connect to FTP server");
+ }
+ catch (JSchException ex)
+ {
+ if ((session != null) && session.isConnected())
+ {
+ session.disconnect() ;
+ }
+ _logger.error("Caught Secure FTP Exception.");
+ _logger.debug("Caught Secure FTP Exception.", ex);
+
+ throw new RemoteFileSystemException(ex);
+ }
+ }
+ }
- session.connect();
-
- final Channel channel = session.openChannel(SECURE_CHANNEL);
- channel.connect();
-
- m_oSftpChannel = (ChannelSftp) channel;
-
- if (!session.isConnected())
- throw new RemoteFileSystemException("Can't connect to FTP server");
- }
- catch (JSchException ex)
- {
- if ((session != null) && session.isConnected())
- {
- session.disconnect() ;
- }
- _logger.error("Caught Secure FTP Exception.");
- _logger.debug("Caught Secure FTP Exception.", ex);
-
- throw new RemoteFileSystemException(ex);
- }
- }
- }
-
- private void checkParms() throws ConfigurationException
- {
+ private void checkParms() throws ConfigurationException
+ {
String att = m_oParms.getAttribute(FileEpr.URL_TAG);
URI uri = null;
@@ -242,180 +241,180 @@
throw new ConfigurationException(ex);
}
- m_sFtpServer = (null != uri) ? uri.getHost() : m_oParms.getAttribute(PARMS_FTP_SERVER);
- if (null == m_sFtpServer)
- throw new ConfigurationException("No SFTP server specified");
+ m_sFtpServer = (null != uri) ? uri.getHost() : m_oParms.getAttribute(PARMS_FTP_SERVER);
+ if (null == m_sFtpServer)
+ throw new ConfigurationException("No SFTP server specified");
String[] sa = (null == uri) ? null : uri.getUserInfo().split(":");
- m_sUser = (null != sa) ? sa[0] : m_oParms.getAttribute(PARMS_USER);
- if (null == m_sUser)
- throw new ConfigurationException("No username specified for SFTP");
+ m_sUser = (null != sa) ? sa[0] : m_oParms.getAttribute(PARMS_USER);
+ if (null == m_sUser)
+ throw new ConfigurationException("No username specified for SFTP");
- m_sPasswd = (null != sa) ? sa[1] : m_oParms.getAttribute(PARMS_PASSWD);
+ m_sPasswd = (null != sa) ? sa[1] : m_oParms.getAttribute(PARMS_PASSWD);
- m_sRemoteDir = (null != uri) ? uri.getPath() : m_oParms.getAttribute(PARMS_REMOTE_DIR);
- if (null == m_sRemoteDir)
- m_sRemoteDir = "";
+ m_sRemoteDir = (null != uri) ? uri.getPath() : m_oParms.getAttribute(PARMS_REMOTE_DIR);
+ if (null == m_sRemoteDir)
+ m_sRemoteDir = "";
- m_sLocalDir = m_oParms.getAttribute(PARMS_LOCAL_DIR);
- if (null == m_sLocalDir)
- m_sLocalDir = ".";
+ m_sLocalDir = m_oParms.getAttribute(PARMS_LOCAL_DIR);
+ if (null == m_sLocalDir)
+ m_sLocalDir = ".";
- String sAux = m_oParms.getAttribute(PARMS_PORT);
-
- try
- {
- m_iPort = (null != uri) ? uri.getPort() : (null == sAux) ? 22 : Integer.parseInt(sAux);
- }
- catch (Exception ex)
- {
- throw new ConfigurationException(ex);
- }
- }
+ String sAux = m_oParms.getAttribute(PARMS_PORT);
+
+ try
+ {
+ m_iPort = (null != uri) ? uri.getPort() : (null == sAux) ? 22 : Integer.parseInt(sAux);
+ }
+ catch (Exception ex)
+ {
+ throw new ConfigurationException(ex);
+ }
+ }
- /*
- * Deletes a file on the SFTP-Server
- *
- * @param fileName The file's Name to be removed from the SFTP-Server
- *
- * @see org.jboss.soa.esb.util.RemoteFileSystem#deleteRemoteFile(java.lang.String)
- */
- public void deleteRemoteFile(String p_sFile) throws RemoteFileSystemException
- {
- try
- {
- m_oSftpChannel.cd(getRemoteDir()) ;
- m_oSftpChannel.rm(p_sFile);
- }
- catch (SftpException ex)
- {
- throw new RemoteFileSystemException(ex);
- }
- }
+ /*
+ * Deletes a file on the SFTP-Server
+ *
+ * @param fileName The file's Name to be removed from the SFTP-Server
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#deleteRemoteFile(java.lang.String)
+ */
+ public void deleteRemoteFile(String p_sFile) throws RemoteFileSystemException
+ {
+ try
+ {
+ m_oSftpChannel.cd(getRemoteDir()) ;
+ m_oSftpChannel.rm(p_sFile);
+ }
+ catch (SftpException ex)
+ {
+ throw new RemoteFileSystemException(ex);
+ }
+ }
- /*
- * Deletes a file on the SFTP-Server
- *
- * @param fileName The file to be removed from the SFTP-Server
- *
- * @see org.jboss.soa.esb.util.RemoteFileSystem#remoteDelete(java.io.File)
- */
- public void remoteDelete(File p_oFile) throws RemoteFileSystemException
- {
- try
- {
- m_oSftpChannel.rm(FtpUtils.fileToFtpString(p_oFile));
- }
- catch (SftpException ex)
- {
- throw new RemoteFileSystemException(ex);
- }
- }
+ /*
+ * Deletes a file on the SFTP-Server
+ *
+ * @param fileName The file to be removed from the SFTP-Server
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#remoteDelete(java.io.File)
+ */
+ public void remoteDelete(File p_oFile) throws RemoteFileSystemException
+ {
+ try
+ {
+ m_oSftpChannel.rm(FtpUtils.fileToFtpString(p_oFile));
+ }
+ catch (SftpException ex)
+ {
+ throw new RemoteFileSystemException(ex);
+ }
+ }
- /*
- * Returns a list of Filenames for the directory specified in p_Suffix
- *
- * @param p_sSuffix The remote directory path from the SFTP-Server
- *
- * @see org.jboss.soa.esb.util.RemoteFileSystem#getFileListFromRemoteDir(java.lang.String)
- */
- public String[] getFileListFromRemoteDir(String p_sSuffix) throws RemoteFileSystemException
- {
- try
- {
- m_oSftpChannel.cd(getRemoteDir()) ;
- String sSuffix = (null == p_sSuffix) ? "*" : "*" + p_sSuffix;
- List<String> lFileList = new ArrayList<String>();
- Vector vFileList = m_oSftpChannel.ls(sSuffix);
-
- if (vFileList != null)
- {
- for (int i = 0; i < vFileList.size(); i++)
- {
- Object obj = vFileList.elementAt(i);
-
- if (obj instanceof LsEntry)
- {
- SftpATTRS oSftAttr = ((LsEntry) obj).getAttrs();
- if (!oSftAttr.isDir())
- {
- lFileList.add(((LsEntry) obj).getFilename());
- }
- }
- }
- }
-
- return (String[]) lFileList.toArray(new String[lFileList.size()]);
- }
- catch (SftpException ex)
- {
- if (ex.id == ChannelSftp.SSH_FX_NO_SUCH_FILE)
- {
- return null ;
- }
- throw new RemoteFileSystemException(ex);
- }
- }
+ /*
+ * Returns a list of Filenames for the directory specified in p_Suffix
+ *
+ * @param p_sSuffix The remote directory path from the SFTP-Server
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#getFileListFromRemoteDir(java.lang.String)
+ */
+ public String[] getFileListFromRemoteDir(String p_sSuffix) throws RemoteFileSystemException
+ {
+ try
+ {
+ m_oSftpChannel.cd(getRemoteDir()) ;
+ String sSuffix = (null == p_sSuffix) ? "*" : "*" + p_sSuffix;
+ List<String> lFileList = new ArrayList<String>();
+ Vector vFileList = m_oSftpChannel.ls(sSuffix);
+
+ if (vFileList != null)
+ {
+ for (int i = 0; i < vFileList.size(); i++)
+ {
+ Object obj = vFileList.elementAt(i);
+
+ if (obj instanceof LsEntry)
+ {
+ SftpATTRS oSftAttr = ((LsEntry) obj).getAttrs();
+ if (!oSftAttr.isDir())
+ {
+ lFileList.add(((LsEntry) obj).getFilename());
+ }
+ }
+ }
+ }
+
+ return (String[]) lFileList.toArray(new String[lFileList.size()]);
+ }
+ catch (SftpException ex)
+ {
+ if (ex.id == ChannelSftp.SSH_FX_NO_SUCH_FILE)
+ {
+ return null ;
+ }
+ throw new RemoteFileSystemException(ex);
+ }
+ }
- /*
- * Set the new directory to p_SDir
- *
- * @param p_sDir The remote directory path name we want to "cd" to.
- *
- * @see org.jboss.soa.esb.util.RemoteFileSystem#setRemoteDir(java.lang.String)
- */
- public void setRemoteDir(String p_sDir) throws RemoteFileSystemException
- {
- m_sRemoteDir = p_sDir ;
- }
+ /*
+ * Set the new directory to p_SDir
+ *
+ * @param p_sDir The remote directory path name we want to "cd" to.
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#setRemoteDir(java.lang.String)
+ */
+ public void setRemoteDir(String p_sDir) throws RemoteFileSystemException
+ {
+ m_sRemoteDir = p_sDir ;
+ }
- /*
- * Rename the Remote Directory name p_sFrom with p_sTo
- *
- * @param p_sFrom The remote directory name we want to rename
- *
- * @param p_sTo The new remote directory name
- *
- * @see org.jboss.soa.esb.util.RemoteFileSystem#renameInRemoteDir(java.lang.String,
- * java.lang.String)
- */
- public void renameInRemoteDir(String p_sFrom, String p_sTo)
- throws RemoteFileSystemException
- {
- try
- {
- m_oSftpChannel.cd(getRemoteDir()) ;
- m_oSftpChannel.rename(p_sFrom, p_sTo) ;
- }
- catch (SftpException se)
- {
- throw new RemoteFileSystemException("Faile to rename file", se) ;
- }
- }
+ /*
+ * Rename the Remote Directory name p_sFrom with p_sTo
+ *
+ * @param p_sFrom The remote directory name we want to rename
+ *
+ * @param p_sTo The new remote directory name
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#renameInRemoteDir(java.lang.String,
+ * java.lang.String)
+ */
+ public void renameInRemoteDir(String p_sFrom, String p_sTo)
+ throws RemoteFileSystemException
+ {
+ try
+ {
+ m_oSftpChannel.cd(getRemoteDir()) ;
+ m_oSftpChannel.rename(p_sFrom, p_sTo) ;
+ }
+ catch (SftpException se)
+ {
+ throw new RemoteFileSystemException("Faile to rename file", se) ;
+ }
+ }
- /*
- * Rename the Remote File name p_sFrom with p_sTo
- *
- * @param p_oFrom The remote file name we want to rename
- *
- * @param p_oTo The new remote file name
- *
- * @see org.jboss.soa.esb.util.RemoteFileSystem#remoteRename(java.io.File,
- * java.io.File)
- */
- public void remoteRename(File p_oFrom, File p_oTo) throws RemoteFileSystemException
- {
- try
- {
- m_oSftpChannel.cd(getRemoteDir()) ;
- m_oSftpChannel.rename(FtpUtils.fileToFtpString(p_oFrom), FtpUtils
- .fileToFtpString(p_oTo));
- }
- catch (SftpException se)
- {
- throw new RemoteFileSystemException("Faile to rename file", se) ;
- }
- }
+ /*
+ * Rename the Remote File name p_sFrom with p_sTo
+ *
+ * @param p_oFrom The remote file name we want to rename
+ *
+ * @param p_oTo The new remote file name
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#remoteRename(java.io.File,
+ * java.io.File)
+ */
+ public void remoteRename(File p_oFrom, File p_oTo) throws RemoteFileSystemException
+ {
+ try
+ {
+ m_oSftpChannel.cd(getRemoteDir()) ;
+ m_oSftpChannel.rename(FtpUtils.fileToFtpString(p_oFrom), FtpUtils
+ .fileToFtpString(p_oTo));
+ }
+ catch (SftpException se)
+ {
+ throw new RemoteFileSystemException("Faile to rename file", se) ;
+ }
+ }
/*
* Upload the local File p_ofile to p_sRemoteName
@@ -518,51 +517,51 @@
}
}
- /*
- * Returns the current remote directory
- *
- * @see org.jboss.soa.esb.util.RemoteFileSystem#getRemoteDir()
- */
- public String getRemoteDir()
- {
- return m_sRemoteDir;
- }
+ /*
+ * Returns the current remote directory
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#getRemoteDir()
+ */
+ public String getRemoteDir()
+ {
+ return m_sRemoteDir;
+ }
- /*
- * Terminates the sftp session.
- *
- * @see org.jboss.soa.esb.util.RemoteFileSystem#quit()
- */
- public void quit()
- {
- m_oSftpChannel.disconnect() ;
- session.disconnect() ;
- }
+ /*
+ * Terminates the sftp session.
+ *
+ * @see org.jboss.soa.esb.util.RemoteFileSystem#quit()
+ */
+ public void quit()
+ {
+ m_oSftpChannel.disconnect() ;
+ session.disconnect() ;
+ }
- private void configTreeFromEpr() throws ConfigurationException
- {
- m_oParms = new ConfigTree("fromEpr");
- try
- {
- m_oParms.setAttribute(RemoteFileSystem.PARMS_FTP_SERVER,
- m_sFtpServer);
- m_oParms.setAttribute(RemoteFileSystem.PARMS_USER, m_sUser);
- if (m_sPasswd != null)
- m_oParms.setAttribute(RemoteFileSystem.PARMS_PASSWD, m_sPasswd);
- m_oParms.setAttribute(RemoteFileSystem.PARMS_REMOTE_DIR,
- m_sRemoteDir);
- if (m_iPort > 0)
- m_oParms.setAttribute(RemoteFileSystem.PARMS_PORT, Integer
- .toString(m_iPort));
- m_oParms.setAttribute(RemoteFileSystem.PARMS_LOCAL_DIR, m_sLocalDir);
- m_oParms.setAttribute(RemoteFileSystem.PARMS_ASCII, Boolean
- .toString(false));
- }
- catch (Exception e)
- {
- throw new ConfigurationException(e);
- }
- }
+ private void configTreeFromEpr() throws ConfigurationException
+ {
+ m_oParms = new ConfigTree("fromEpr");
+ try
+ {
+ m_oParms.setAttribute(RemoteFileSystem.PARMS_FTP_SERVER,
+ m_sFtpServer);
+ m_oParms.setAttribute(RemoteFileSystem.PARMS_USER, m_sUser);
+ if (m_sPasswd != null)
+ m_oParms.setAttribute(RemoteFileSystem.PARMS_PASSWD, m_sPasswd);
+ m_oParms.setAttribute(RemoteFileSystem.PARMS_REMOTE_DIR,
+ m_sRemoteDir);
+ if (m_iPort > 0)
+ m_oParms.setAttribute(RemoteFileSystem.PARMS_PORT, Integer
+ .toString(m_iPort));
+ m_oParms.setAttribute(RemoteFileSystem.PARMS_LOCAL_DIR, m_sLocalDir);
+ m_oParms.setAttribute(RemoteFileSystem.PARMS_ASCII, Boolean
+ .toString(false));
+ }
+ catch (Exception e)
+ {
+ throw new ConfigurationException(e);
+ }
+ }
private void copyStream(final InputStream is, final OutputStream os)
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/EPR.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/EPR.java 2008-05-23 04:54:46 UTC (rev 20122)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/EPR.java 2008-05-23 12:31:35 UTC (rev 20123)
@@ -29,6 +29,8 @@
import java.net.URI;
import java.net.URISyntaxException;
+import org.apache.log4j.Logger;
+
/**
* The Endpoint Reference class. All services (and clients) can be represented by
* an EPR, which is effectively an address. If using SOA principles then the ultimate
@@ -142,9 +144,6 @@
return new EPR(this);
}
-// public void setMetaData (MetaData md);
-// public MetaData getMetaData ();
-
public String toString ()
{
return "EPR: "+_addr.extendedToString();
@@ -163,6 +162,8 @@
return false;
}
+ static protected final Logger _logger = Logger.getLogger(EPR.class);
+
private PortReference _addr;
}
\ No newline at end of file
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/EmailEpr.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/EmailEpr.java 2008-05-23 04:54:46 UTC (rev 20122)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/EmailEpr.java 2008-05-23 12:31:35 UTC (rev 20123)
@@ -144,38 +144,62 @@
/**
* @return the email protocol used.
- * @throws URISyntaxException thrown if the address is malformed.
*/
- public final String getProtocol () throws URISyntaxException
+ public final String getProtocol ()
{
+ try
+ {
URI addr = new URI(getAddr().getAddress());
return addr.getScheme();
+ }
+ catch (URISyntaxException ex)
+ {
+ _logger.warn("Unexpected parsing exception!", ex);
+
+ return null;
+ }
}
/**
* @return the email host used.
- * @throws URISyntaxException thrown if the address is malformed.
*/
- public final String getHost () throws URISyntaxException
- {
+ public final String getHost ()
+ {
+ try
+ {
URI addr = new URI(getAddr().getAddress());
return addr.getHost();
+ }
+ catch (URISyntaxException ex)
+ {
+ _logger.warn("Unexpected parsing exception!", ex);
+
+ return null;
+ }
}
/**
* @return the email port used, or -1 if not specified.
- * @throws URISyntaxException thrown if the address is malformed.
*/
- public final int getPort () throws URISyntaxException
+ public final int getPort ()
{
+ try
+ {
URI addr = new URI(getAddr().getAddress());
return addr.getPort();
+ }
+ catch (URISyntaxException ex)
+ {
+ _logger.warn("Unexpected parsing exception!", ex);
+
+ return -1;
+ }
}
/*
@@ -184,20 +208,18 @@
/**
* @return the password for this EPR, or <code>null</code> if none is set.
- * @throws URISyntaxException thrown if the address is malformed.
*/
- public final String getPassword () throws URISyntaxException
+ public final String getPassword ()
{
return getAddr().getExtensionValue(PASSWORD_TAG);
}
/**
* @return the username for this EPR, or <code>null</code> if none is set.
- * @throws URISyntaxException thrown if the address is malformed.
*/
- public final String getUserName () throws URISyntaxException
+ public final String getUserName ()
{
return getAddr().getExtensionValue(USERNAME_TAG);
}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/FTPEpr.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/FTPEpr.java 2008-05-23 04:54:46 UTC (rev 20122)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/FTPEpr.java 2008-05-23 12:31:35 UTC (rev 20123)
@@ -26,7 +26,6 @@
* This class represents the endpoint reference for services.
*/
-import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
@@ -156,13 +155,21 @@
* Get the URL address.
*
* @return the address.
- * @throws URISyntaxException thrown if the address is invalid.
* @deprecated
*/
- public final URL getURL () throws MalformedURLException, URISyntaxException
+ public final URL getURL ()
{
+ try
+ {
return new URL(super.getAddr().getAddress());
+ }
+ catch (Exception ex)
+ {
+ _logger.warn("Unexpected parsing exception!", ex);
+
+ return null;
+ }
}
/**
@@ -186,10 +193,9 @@
/**
* @return the user's name associated with this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getUserName () throws URISyntaxException
+ public final String getUserName ()
{
return getAddr().getExtensionValue(USERNAME_TAG);
}
@@ -215,10 +221,9 @@
/**
* @return the password associated with this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getPassword () throws URISyntaxException
+ public final String getPassword ()
{
return getAddr().getExtensionValue(PASSWORD_TAG);
}
@@ -245,10 +250,9 @@
/**
* @return the passive value associated with this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final boolean getPassive () throws URISyntaxException
+ public final boolean getPassive ()
{
return "true".equals(getAddr().getExtensionValue(PASSIVE_TAG));
}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/FileEpr.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/FileEpr.java 2008-05-23 04:54:46 UTC (rev 20122)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/FileEpr.java 2008-05-23 12:31:35 UTC (rev 20123)
@@ -26,7 +26,6 @@
* This class represents the endpoint reference for services.
*/
-import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
@@ -201,13 +200,21 @@
* Get the URL address.
*
* @return the address.
- * @throws URISyntaxException thrown if the address is invalid.
* @deprecated
*/
- public URL getURL () throws MalformedURLException, URISyntaxException
+ public URL getURL ()
{
+ try
+ {
return new URL(super.getAddr().getAddress());
+ }
+ catch (Exception ex)
+ {
+ _logger.warn("Unexpected parsing exception!", ex);
+
+ return null;
+ }
}
/**
@@ -231,10 +238,9 @@
/**
* @return the input suffix associated with this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getInputSuffix () throws URISyntaxException
+ public final String getInputSuffix ()
{
return getAddr().getExtensionValue(INPUT_SUFFIX_TAG);
}
@@ -260,10 +266,9 @@
/**
* @return the work suffix associated with this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getWorkSuffix () throws URISyntaxException
+ public final String getWorkSuffix ()
{
return getAddr().getExtensionValue(WORK_SUFFIX_TAG);
}
@@ -289,10 +294,9 @@
/**
* @return the post directory associated with this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getPostDirectory () throws URISyntaxException
+ public final String getPostDirectory ()
{
return getAddr().getExtensionValue(POST_DIR_TAG);
}
@@ -318,10 +322,9 @@
/**
* @return the post suffix associated with this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getPostSuffix () throws URISyntaxException
+ public final String getPostSuffix ()
{
return getAddr().getExtensionValue(POST_SUFFIX_TAG);
}
@@ -365,17 +368,16 @@
/**
* @return the post rename value associated with this EPR.
*/
- public final boolean getPostRename () throws URISyntaxException
+ public final boolean getPostRename ()
{
return ("true".equals(getAddr().getExtensionValue(POST_RENAME_TAG)));
}
/**
* @return the delete vazlue associated with this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final boolean getPostDelete () throws URISyntaxException
+ public final boolean getPostDelete ()
{
return ("true".equals(getAddr().getExtensionValue(POST_DEL_TAG)));
}
@@ -401,10 +403,9 @@
/**
* @return the error directory associated with this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getErrorDirectory () throws URISyntaxException
+ public final String getErrorDirectory ()
{
return getAddr().getExtensionValue(ERROR_DIR_TAG);
}
@@ -430,10 +431,9 @@
/**
* @return the error suffix associated with this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getErrorSuffix () throws URISyntaxException
+ public final String getErrorSuffix ()
{
return getAddr().getExtensionValue(ERROR_SUFFIX_TAG);
}
@@ -461,10 +461,9 @@
/**
* Attention - Default
* @return the error delete value associated with this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final boolean getErrorDelete () throws URISyntaxException
+ public final boolean getErrorDelete ()
{
return (! "false".equals(getAddr().getExtensionValue(ERROR_DEL_TAG)));
}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/HTTPEpr.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/HTTPEpr.java 2008-05-23 04:54:46 UTC (rev 20122)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/HTTPEpr.java 2008-05-23 12:31:35 UTC (rev 20123)
@@ -26,7 +26,6 @@
* This class represents the endpoint reference for services.
*/
-import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
@@ -96,13 +95,21 @@
* Get the URL address.
*
* @return the address.
- * @throws URISyntaxException thrown if the address is invalid.
* @deprecated
*/
- public final URL getURL () throws MalformedURLException, URISyntaxException
+ public final URL getURL ()
{
+ try
+ {
return new URL(super.getAddr().getAddress());
+ }
+ catch (Exception ex)
+ {
+ _logger.warn("Unexpected parsing exception!", ex);
+
+ return null;
+ }
}
public String toString ()
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/HibernateEpr.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/HibernateEpr.java 2008-05-23 04:54:46 UTC (rev 20122)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/HibernateEpr.java 2008-05-23 12:31:35 UTC (rev 20123)
@@ -129,10 +129,9 @@
/**
* @return the driver used by this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getHibernateCfgFile () throws URISyntaxException
+ public final String getHibernateCfgFile ()
{
return getAddr().getExtensionValue(HIBERNATE_CFG_TAG);
}
@@ -177,17 +176,13 @@
/**
* @return the table name used by this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getClassName () throws URISyntaxException
+ public final String getClassName ()
{
return getAddr().getExtensionValue(CLASS_NAME_TAG);
}
-
-
-
-
+
/**
* Set the event that is used by this EPR.
*
@@ -209,10 +204,9 @@
/**
* @return the table name used by this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getEvent () throws URISyntaxException
+ public final String getEvent ()
{
return getAddr().getExtensionValue(EVENT_TAG);
}
@@ -238,10 +232,9 @@
/**
* @return the status column name used by this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getStatusField () throws URISyntaxException
+ public final String getStatusField ()
{
return getAddr().getExtensionValue(STATUS_FIELD_TAG);
}
@@ -266,10 +259,9 @@
/**
* @return the message id column used by this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getMessageField () throws URISyntaxException
+ public final String getMessageField ()
{
return getAddr().getExtensionValue(MESSAGE_FIELD_TAG);
}
@@ -296,10 +288,9 @@
/**
* @return the timestamp column name used by this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getTimestampColumn () throws URISyntaxException
+ public final String getTimestampColumn ()
{
return getAddr().getExtensionValue(TIMESTAMP_FIELD_TAG);
}
@@ -325,10 +316,9 @@
/**
* @return the data column name used by this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getDataField () throws URISyntaxException
+ public final String getDataField ()
{
return getAddr().getExtensionValue(DATA_FIELD_TAG);
}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JDBCEpr.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JDBCEpr.java 2008-05-23 04:54:46 UTC (rev 20122)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JDBCEpr.java 2008-05-23 12:31:35 UTC (rev 20123)
@@ -210,10 +210,9 @@
* Get the URL address.
*
* @return the address.
- * @throws URISyntaxException thrown if the address is invalid.
*/
- public final String getURL () throws URISyntaxException
+ public final String getURL ()
{
return getAddr().getAddress();
}
@@ -239,10 +238,9 @@
/**
* @return the user's name associated with this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getUserName () throws URISyntaxException
+ public final String getUserName ()
{
return getAddr().getExtensionValue(USERNAME_TAG);
}
@@ -268,10 +266,9 @@
/**
* @return the password associated with this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getPassword () throws URISyntaxException
+ public final String getPassword ()
{
return getAddr().getExtensionValue(PASSWORD_TAG);
}
@@ -313,10 +310,9 @@
/**
* @return the SQL statement for this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getSQL () throws URISyntaxException
+ public final String getSQL ()
{
return getAddr().getExtensionValue(SQL_TAG);
}
@@ -342,10 +338,9 @@
/**
* @return the driver used by this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getDriver () throws URISyntaxException
+ public final String getDriver ()
{
return getAddr().getExtensionValue(DRIVER_TAG);
}
@@ -371,10 +366,9 @@
/**
* @return the table name used by this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getTableName () throws URISyntaxException
+ public final String getTableName ()
{
return getAddr().getExtensionValue(TABLE_NAME_TAG);
}
@@ -400,10 +394,9 @@
/**
* @return the message id column used by this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getMessageIdColumn () throws URISyntaxException
+ public final String getMessageIdColumn ()
{
return getAddr().getExtensionValue(MESSAGE_ID_COLUMN_TAG);
}
@@ -429,10 +422,9 @@
/**
* @return the status column name used by this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getStatusColumn () throws URISyntaxException
+ public final String getStatusColumn ()
{
return getAddr().getExtensionValue(STATUS_COLUMN_TAG);
}
@@ -458,10 +450,9 @@
/**
* @return the data column name used by this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getDataColumn () throws URISyntaxException
+ public final String getDataColumn ()
{
return getAddr().getExtensionValue(DATA_COLUMN_TAG);
}
@@ -487,21 +478,20 @@
/**
* @return the timestamp column name used by this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
*/
- public final String getTimestampColumn () throws URISyntaxException
+ public final String getTimestampColumn ()
{
return getAddr().getExtensionValue(TIMESTAMP_COLUMN_TAG);
}
- public final String getPostDelete() throws URISyntaxException
+ public final String getPostDelete()
{
return getAddr().getExtensionValue(POST_DEL_TAG);
}
- public final String getErrorDelete() throws URISyntaxException
+ public final String getErrorDelete()
{
return getAddr().getExtensionValue(ERROR_DEL_TAG);
}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java 2008-05-23 04:54:46 UTC (rev 20122)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java 2008-05-23 12:31:35 UTC (rev 20123)
@@ -544,47 +544,48 @@
/**
* @return the destination type used.
- * @throws URISyntaxException
- * thrown if the address is malformed.
*/
- public final String getDestinationType() throws URISyntaxException
+ public final String getDestinationType()
{
return getAddr().getExtensionValue(DESTINATION_TYPE_TAG);
}
/**
* @return the specification version used.
- * @throws URISyntaxException
- * thrown if the address is malformed.
*/
- public final String getVersion() throws URISyntaxException
+ public final String getVersion()
{
return getAddr().getExtensionValue(SPECIFICATION_VERSION_TAG);
}
/**
* @return the destination name used.
- * @throws URISyntaxException
- * thrown if the address is malformed.
*/
- public final String getDestinationName() throws URISyntaxException
+ public final String getDestinationName()
{
+ try
+ {
URI uri = new URI(getAddr().getAddress());
return uri.getPath().substring(1);
+ }
+ catch (URISyntaxException ex)
+ {
+ _logger.warn("Unexpected parsing exception!", ex);
+
+ return null;
+ }
}
/**
* @return the connection factory for this EPR, or <code>null</code> if
* none is set.
- * @throws URISyntaxException
- * thrown if the address is malformed.
*/
- public final String getConnectionFactory() throws URISyntaxException
+ public final String getConnectionFactory()
{
return getAddr().getExtensionValue(CONNECTION_FACTORY_TAG);
}
@@ -592,11 +593,9 @@
/**
* @return the jndi context factory for this EPR, or <code>null</code> if
* none is set.
- * @throws URISyntaxException
- * thrown if the address is malformed.
*/
- public final Properties getJndiEnvironment() throws URISyntaxException
+ public final Properties getJndiEnvironment()
{
Properties properties = new Properties();
Iterator<Extension> iter = getAddr().getExtensions();
@@ -620,11 +619,9 @@
/**
* @return the message selector for this EPR, or <code>null</code> if none
* is set.
- * @throws URISyntaxException
- * thrown if the address is malformed.
*/
- public final String getMessageSelector() throws URISyntaxException
+ public final String getMessageSelector()
{
return getAddr().getExtensionValue(MESSAGE_SELECTOR_TAG);
}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/SFTPEpr.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/SFTPEpr.java 2008-05-23 04:54:46 UTC (rev 20122)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/addressing/eprs/SFTPEpr.java 2008-05-23 12:31:35 UTC (rev 20123)
@@ -40,44 +40,44 @@
*/
public class SFTPEpr extends FTPEpr
{
- public static final String CERTIFICATE_TAG = "certificate";
+ public static final String CERTIFICATE_TAG = "certificate";
- public SFTPEpr(EPR epr)
- {
- super(epr);
-
- if (epr instanceof SFTPEpr)
- certificateSet = ((SFTPEpr) epr).certificateSet;
- }
-
- public SFTPEpr (EPR epr, Element header)
- {
- super(epr, header);
-
- NodeList nl = header.getChildNodes();
+ public SFTPEpr(EPR epr)
+ {
+ super(epr);
+
+ if (epr instanceof SFTPEpr)
+ certificateSet = ((SFTPEpr) epr).certificateSet;
+ }
+
+ public SFTPEpr (EPR epr, Element header)
+ {
+ super(epr, header);
+
+ NodeList nl = header.getChildNodes();
- for (int i = 0; i < nl.getLength(); i++)
- {
- String prefix = nl.item(i).getPrefix();
- String tag = nl.item(i).getLocalName();
-
- try
- {
- if ((prefix != null) && (prefix.equals(XMLUtil.JBOSSESB_PREFIX)))
- {
- if ((tag != null) && (tag.equals(CERTIFICATE_TAG)))
- {
- getAddr().addExtension(CERTIFICATE_TAG, nl.item(i).getTextContent());
- certificateSet = true;
- }
- }
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
- }
+ for (int i = 0; i < nl.getLength(); i++)
+ {
+ String prefix = nl.item(i).getPrefix();
+ String tag = nl.item(i).getLocalName();
+
+ try
+ {
+ if ((prefix != null) && (prefix.equals(XMLUtil.JBOSSESB_PREFIX)))
+ {
+ if ((tag != null) && (tag.equals(CERTIFICATE_TAG)))
+ {
+ getAddr().addExtension(CERTIFICATE_TAG, nl.item(i).getTextContent());
+ certificateSet = true;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ }
/**
* Construct the SFTP EPR with the specified URI.
@@ -102,79 +102,86 @@
setCertificateURI(cert);
}
- public SFTPEpr(String url, String cert) throws URISyntaxException
- {
- super(url);
+ public SFTPEpr(String url, String cert) throws URISyntaxException
+ {
+ super(url);
- setCertificateURI(new URI(cert));
- }
+ setCertificateURI(new URI(cert));
+ }
- /**
- * Set the Certificate URI for this endpoint.
- *
- * @param cert
- * the address.
- * @throws URISyntaxException
- * thrown if this EPR is malformed.
- */
- public final void setCertificateURI(URI cert) throws URISyntaxException
- {
- if (cert == null)
- throw new IllegalArgumentException();
+ /**
+ * Set the Certificate URI for this endpoint.
+ *
+ * @param cert
+ * the address.
+ * @throws URISyntaxException
+ * thrown if this EPR is malformed.
+ */
+ public final void setCertificateURI(URI cert) throws URISyntaxException
+ {
+ if (cert == null)
+ throw new IllegalArgumentException();
- if (certificateSet)
- throw new IllegalStateException("Certificate URI already set.");
+ if (certificateSet)
+ throw new IllegalStateException("Certificate URI already set.");
- getAddr().addExtension(CERTIFICATE_TAG, cert.toASCIIString());
- certificateSet = true;
- }
+ getAddr().addExtension(CERTIFICATE_TAG, cert.toASCIIString());
+ certificateSet = true;
+ }
- /**
- * @return the certificate URI for this EPR.
- * @throws URISyntaxException
- * thrown if this EPR is malformed.
- */
+ /**
+ * @return the certificate URI for this EPR.
+ */
- public final URI getCertificateURI () throws URISyntaxException
- {
- String cert = getAddr().getExtensionValue(CERTIFICATE_TAG);
+ public final URI getCertificateURI () throws URISyntaxException
+ {
+ try
+ {
+ String cert = getAddr().getExtensionValue(CERTIFICATE_TAG);
- if (cert != null)
- return new URI(cert);
- else
- return null;
- }
+ if (cert != null)
+ return new URI(cert);
+ else
+ return null;
+ }
+ catch (Exception ex)
+ {
+ _logger.warn("Unexpected parsing exception!", ex);
+
+ return null;
+ }
+ }
- public EPR copy ()
- {
- return new SFTPEpr(this);
- }
-
- public String toString ()
- {
- return "SFTPEpr [ "+super.getAddr().extendedToString()+" ]";
- }
-
- public static URI type ()
- {
- return _type;
- }
+ public EPR copy ()
+ {
+ return new SFTPEpr(this);
+ }
+
+ public String toString ()
+ {
+ return "SFTPEpr [ "+super.getAddr().extendedToString()+" ]";
+ }
+
+ public static URI type ()
+ {
+ return _type;
+ }
- private boolean certificateSet = false;
+ private boolean certificateSet = false;
- private static URI _type;
+ private static URI _type;
- static
- {
- try
- {
- _type = new URI("urn:jboss/esb/epr/type/sftp");
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
+ static
+ {
+ try
+ {
+ _type = new URI("urn:jboss/esb/epr/type/sftp");
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
- throw new ExceptionInInitializerError(ex.toString());
- }
- }
+ throw new ExceptionInInitializerError(ex.toString());
+ }
+ }
}
\ No newline at end of file
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/filter/FilterManager.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/filter/FilterManager.java 2008-05-23 04:54:46 UTC (rev 20122)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/filter/FilterManager.java 2008-05-23 12:31:35 UTC (rev 20123)
@@ -78,7 +78,12 @@
for (int i = 0; i < _filters.length; i++)
{
if (_filters[i] != null)
+ {
+ if (_logger.isDebugEnabled())
+ _logger.debug("FilterManager calling "+_filters[i]+".onOutput");
+
msg = _filters[i].onOutput(msg, params);
+ }
}
return msg;
@@ -105,12 +110,17 @@
for (int i = 0; i < _filters.length; i++)
{
if (_filters[i] != null)
+ {
+ if (_logger.isDebugEnabled())
+ _logger.debug("FilterManager calling "+_filters[i]+".onInput");
+
msg = _filters[i].onInput(msg, params);
+ }
}
return msg;
}
-
+
private FilterManager()
{
PropertyManager pm = ModulePropertyManager
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/util/RemoteFileSystemFactory.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/util/RemoteFileSystemFactory.java 2008-05-23 04:54:46 UTC (rev 20122)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/util/RemoteFileSystemFactory.java 2008-05-23 12:31:35 UTC (rev 20123)
@@ -23,7 +23,6 @@
package org.jboss.soa.esb.util;
import java.net.URI;
-import java.net.URISyntaxException;
import org.jboss.internal.soa.esb.util.FtpImpl;
import org.jboss.internal.soa.esb.util.FtpsImpl;
@@ -35,45 +34,42 @@
public class RemoteFileSystemFactory
{
- // private default constructor
- private RemoteFileSystemFactory()
- {
- }
+ // private default constructor
+ private RemoteFileSystemFactory()
+ {
+ }
- /**
- * This method returns a RemoteFileSystem Implementation at runtime.
- * The implementation depends on which protocol is specified in the
- * URL of the RemoteFileSystem.
- * We currently support "ftp" and "sftp"
- * Refactoring related to JIRA Tasks: JBESB-127 and JBESB-197
- * @param p_oEpr
- * @param p_bConnect
- * @return RemoteFileSystem
- * @throws RemoteFileSystemException
- */
- public static RemoteFileSystem getRemoteFileSystem(FTPEpr p_oEpr,
- boolean p_bConnect) throws RemoteFileSystemException
- {
- URI uri = null;
- try
- {
- uri = p_oEpr.getURI();
- final String scheme = uri.getScheme();
- if (RemoteFileSystem.FTP_PROTOCOL.equals(scheme))
- return new FtpImpl((FTPEpr) p_oEpr, p_bConnect);
- else if (RemoteFileSystem.FTPS_PROTOCOL.equals(scheme))
- return new FtpsImpl((FTPSEpr) p_oEpr, p_bConnect);
- else if (RemoteFileSystem.SFTP_PROTOCOL.equals(scheme))
- return new SecureFtpImpl((SFTPEpr) p_oEpr, p_bConnect);
+ /**
+ * This method returns a RemoteFileSystem Implementation at runtime.
+ * The implementation depends on which protocol is specified in the
+ * URL of the RemoteFileSystem.
+ * We currently support "ftp" and "sftp"
+ * Refactoring related to JIRA Tasks: JBESB-127 and JBESB-197
+ * @param p_oEpr
+ * @param p_bConnect
+ * @return RemoteFileSystem
+ * @throws RemoteFileSystemException
+ */
+ public static RemoteFileSystem getRemoteFileSystem(FTPEpr p_oEpr,
+ boolean p_bConnect) throws RemoteFileSystemException
+ {
+ URI uri = null;
+ try
+ {
+ uri = p_oEpr.getURI();
+ final String scheme = uri.getScheme();
+ if (RemoteFileSystem.FTP_PROTOCOL.equals(scheme))
+ return new FtpImpl((FTPEpr) p_oEpr, p_bConnect);
+ else if (RemoteFileSystem.FTPS_PROTOCOL.equals(scheme))
+ return new FtpsImpl((FTPSEpr) p_oEpr, p_bConnect);
+ else if (RemoteFileSystem.SFTP_PROTOCOL.equals(scheme))
+ return new SecureFtpImpl((SFTPEpr) p_oEpr, p_bConnect);
+ }
+ catch (Exception e)
+ {
+ throw new RemoteFileSystemException(e);
+ }
+ throw new RemoteFileSystemException("Unknown or unsupported protocol");
+ }
- } catch (URISyntaxException e)
- {
- throw new RemoteFileSystemException(e);
- } catch (Exception e)
- {
- throw new RemoteFileSystemException(e);
- }
- throw new RemoteFileSystemException("Unknown or unsupported protocol");
- }
-
}
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/JMSUtil.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/JMSUtil.java 2008-05-23 04:54:46 UTC (rev 20122)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/JMSUtil.java 2008-05-23 12:31:35 UTC (rev 20123)
@@ -120,14 +120,9 @@
ObjectMessage jmsMessage = null;
addJndiExtensions(epr);
-
- try {
+
destType = epr.getDestinationType();
- destName = epr.getDestinationName();
- } catch (URISyntaxException e) {
- // An exception on a getter method??? That's an interesting/new approach!!
- throw new RuntimeException("Totally unexpected exception from a getter method: " + e.getMessage());
- }
+ destName = epr.getDestinationName();
try {
courier = new JmsCourier(epr);
Modified: labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java
===================================================================
--- labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java 2008-05-23 04:54:46 UTC (rev 20122)
+++ labs/jbossesb/trunk/product/services/jbossesb/src/main/java/org/jboss/internal/soa/esb/persistence/format/db/DBMessageStoreImpl.java 2008-05-23 12:31:35 UTC (rev 20123)
@@ -370,7 +370,6 @@
{
con = mgr.getConnection();
con.setAutoCommit(false);
- con.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
}
catch (final SQLException e)
{
More information about the jboss-svn-commits
mailing list