[jboss-svn-commits] JBL Code SVN: r23023 - in labs/jbossesb/workspace/maeste: product/docs and 7 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Sep 23 17:17:48 EDT 2008


Author: maeste
Date: 2008-09-23 17:17:48 -0400 (Tue, 23 Sep 2008)
New Revision: 23023

Added:
   labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/DeploymentComponent.java
   labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ESBComponent.java
   labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ServiceDiscoveryComponent.java
Modified:
   labs/jbossesb/workspace/maeste/
   labs/jbossesb/workspace/maeste/product/docs/AdministrationGuide.odt
   labs/jbossesb/workspace/maeste/product/rosetta/src/org/jboss/internal/soa/esb/util/FtpImpl.java
   labs/jbossesb/workspace/maeste/product/rosetta/src/org/jboss/soa/esb/common/Environment.java
   labs/jbossesb/workspace/maeste/product/rosetta/src/org/jboss/soa/esb/util/FtpClientUtil.java
   labs/jbossesb/workspace/maeste/product/rosetta/src/org/jboss/soa/esb/util/RemoteFileSystem.java
   labs/jbossesb/workspace/maeste/product/samples/quickstarts/transform_CSV2XML/readme.txt
   labs/jbossesb/workspace/maeste/product/tools/jonplugin/install.sh
   labs/jbossesb/workspace/maeste/product/tools/jonplugin/pom.xml
   labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ActionComponent.java
   labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ActionDiscoveryComponent.java
   labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ESBDiscoveryComponent.java
   labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ListenerComponent.java
   labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ServiceComponent.java
   labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/resources/META-INF/rhq-plugin.xml
Log:
Merged revisions 22741-23022 via svnmerge from 
https://svn.jboss.org/repos/labs/labs/jbossesb/trunk

........
  r22745 | mark.little at jboss.com | 2008-09-13 23:38:30 +0200 (Sat, 13 Sep 2008) | 1 line
  
  https://jira.jboss.org/jira/browse/JBESB-1995
........
  r22752 | mark.little at jboss.com | 2008-09-14 10:49:15 +0200 (Sun, 14 Sep 2008) | 1 line
  
  https://jira.jboss.org/jira/browse/JBESB-1995 (fixed some potential logic bombs).
........
  r22800 | mark.little at jboss.com | 2008-09-16 12:34:59 +0200 (Tue, 16 Sep 2008) | 1 line
  
  https://jira.jboss.org/jira/browse/JBESB-2045
........
  r22826 | tcunning | 2008-09-17 04:11:54 +0200 (Wed, 17 Sep 2008) | 3 lines
  
  JBESB-668
  Commit fixes for deployment.
........
  r22992 | tcunning | 2008-09-22 22:01:51 +0200 (Mon, 22 Sep 2008) | 3 lines
  
  JBESB-2039
  Add per-minute metrics and metric totals.
........



Property changes on: labs/jbossesb/workspace/maeste
___________________________________________________________________
Name: svnmerge-integrated
   - /labs/jbossesb/trunk:1-22740
   + /labs/jbossesb/trunk:1-23022

Modified: labs/jbossesb/workspace/maeste/product/docs/AdministrationGuide.odt
===================================================================
(Binary files differ)

Modified: labs/jbossesb/workspace/maeste/product/rosetta/src/org/jboss/internal/soa/esb/util/FtpImpl.java
===================================================================
--- labs/jbossesb/workspace/maeste/product/rosetta/src/org/jboss/internal/soa/esb/util/FtpImpl.java	2008-09-23 20:58:25 UTC (rev 23022)
+++ labs/jbossesb/workspace/maeste/product/rosetta/src/org/jboss/internal/soa/esb/util/FtpImpl.java	2008-09-23 21:17:48 UTC (rev 23023)
@@ -60,76 +60,78 @@
 
 public class FtpImpl implements RemoteFileSystem
 {
-	private static final Logger _logger = Logger.getLogger(FtpImpl.class);
+        private static final Logger _logger = Logger.getLogger(FtpImpl.class);
 
-	private static final String TMP_SUFFIX = ".rosettaPart";
+        private static final String TMP_SUFFIX = ".rosettaPart";
 
-	private boolean m_bPassive;
+        private boolean m_bPassive;
 
-	private int m_iPort;
-	private int _timeout = 0;
+        private int m_iPort;
+        private int _timeout = 0;
 
-	protected FTPClient m_oConn ;
+        protected FTPClient m_oConn ;
 
-	private FTPEpr m_oEpr;
+        private FTPEpr m_oEpr;
 
-	protected ConfigTree m_oParms;
+        protected 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;
+        
+        private int renameRetry;
 
-	/**
-	 * Checks validity and completeness of parameters, and keeps the info
-	 * internally for subsequent FTP requests
-	 * 
-	 * @param p_oP
-	 *            ConfigTree
-	 * @throws ConfigurationException :
-	 *             if parameters are invalid or incomplete
-	 *             <li>Parameters: (XML attributes at the root level) </li>
-	 *             <li> ftpServer = name or IP of FTP server </li>
-	 *             <li> ftpUser = login ID for server </li>
-	 *             <li> ftpPassword </li>
-	 *             <li> localDirURI = absolute path in the local filesystem
-	 *             </li>
-	 *             <li> remoteDirURI = remote path is relative to ftp user home
-	 *             in remote computer </li>
-	 */
+        /**
+         * Checks validity and completeness of parameters, and keeps the info
+         * internally for subsequent FTP requests
+         * 
+         * @param p_oP
+         *            ConfigTree
+         * @throws ConfigurationException :
+         *             if parameters are invalid or incomplete
+         *             <li>Parameters: (XML attributes at the root level) </li>
+         *             <li> ftpServer = name or IP of FTP server </li>
+         *             <li> ftpUser = login ID for server </li>
+         *             <li> ftpPassword </li>
+         *             <li> localDirURI = absolute path in the local filesystem
+         *             </li>
+         *             <li> remoteDirURI = remote path is relative to ftp user home
+         *             in remote computer </li>
+         */
 
-	public FtpImpl (ConfigTree p_oP, boolean p_bConnect)
-			throws ConfigurationException, RemoteFileSystemException
-	{
-		m_oParms = p_oP;
-		initialize(p_bConnect);
-	}
+        public FtpImpl (ConfigTree p_oP, boolean p_bConnect)
+                        throws ConfigurationException, RemoteFileSystemException
+        {
+                m_oParms = p_oP;
+                initialize(p_bConnect);
+        }
 
-	public FtpImpl (FTPEpr p_oP, boolean p_bConnect)
-			throws ConfigurationException, RemoteFileSystemException
-	{
-		this(p_oP) ;
-		// TODO there is still a bit of space for improvements here.
-		configTreeFromEpr() ;
-		
-		initialize(p_bConnect) ;
-	}
+        public FtpImpl (FTPEpr p_oP, boolean p_bConnect)
+                        throws ConfigurationException, RemoteFileSystemException
+        {
+                this(p_oP) ;
+                // TODO there is still a bit of space for improvements here.
+                configTreeFromEpr() ;
+                
+                initialize(p_bConnect) ;
+        }
 
-	public FtpImpl (FTPEpr p_oP)
-			throws ConfigurationException
-	{
-		m_oEpr = p_oP;
+        public FtpImpl (FTPEpr p_oP)
+                        throws ConfigurationException
+        {
+                m_oEpr = p_oP;
 
-		final URI uri;
-		try
-		{
-			uri = m_oEpr.getURI();
-		}
-		catch (URISyntaxException e)
-		{
-			throw new ConfigurationException(e);
-		}
+                final URI uri;
+                try
+                {
+                        uri = m_oEpr.getURI();
+                }
+                catch (URISyntaxException e)
+                {
+                        throw new ConfigurationException(e);
+                }
 
-		m_sFtpServer = uri.getHost();
+                m_sFtpServer = uri.getHost();
 
                 String[] sa = null;
 
@@ -145,19 +147,19 @@
                     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);
 
         File oLocalDir = new File(m_sLocalDir);
         if(!oLocalDir.exists()) {
@@ -168,106 +170,125 @@
 
         m_bPassive = m_oEpr.getPassive();
 
-		String timeout = ModulePropertyManager.getPropertyManager(ModulePropertyManager.TRANSPORTS_MODULE).getProperty(Environment.FTP_SOCKET_TIMEOUT, null);
-		
-		if (timeout != null)
-		{
-			try
-			{
-				_timeout = Integer.parseInt(timeout);
-			}
-			catch (NumberFormatException ex)
-			{
-				throw new ConfigurationException("Invalid timeout specified.", ex);
-			}
-		}
-		else
-			_timeout = 0;
-	}
+                String timeout = ModulePropertyManager.getPropertyManager(ModulePropertyManager.TRANSPORTS_MODULE).getProperty(Environment.FTP_SOCKET_TIMEOUT, null);
+                
+                if (timeout != null)
+                {
+                        try
+                        {
+                                _timeout = Integer.parseInt(timeout);
+                        }
+                        catch (NumberFormatException ex)
+                        {
+                                throw new ConfigurationException("Invalid timeout specified.", ex);
+                        }
+                }
+                else
+                        _timeout = 0;
+        }
 
-	public FtpImpl (List<KeyValuePair> p_oAttribs, boolean p_bConnect)
-			throws ConfigurationException, RemoteFileSystemException
-	{
-		m_oParms = new ConfigTree("fromProps");
-		for (KeyValuePair oCurr : p_oAttribs)
-			m_oParms.setAttribute(oCurr.getKey(), oCurr.getValue());
-		initialize(p_bConnect);
-	}
+        public FtpImpl (List<KeyValuePair> p_oAttribs, boolean p_bConnect)
+                        throws ConfigurationException, RemoteFileSystemException
+        {
+                m_oParms = new ConfigTree("fromProps");
+                for (KeyValuePair oCurr : p_oAttribs)
+                        m_oParms.setAttribute(oCurr.getKey(), oCurr.getValue());
+                initialize(p_bConnect);
+        }
 
-	protected void checkParms () throws ConfigurationException
-	{
-		String att = m_oParms.getAttribute(FileEpr.URL_TAG);
-		URI uri = null;
-		
-		try
-		{
-			if (att != null)
-				uri = new URI(att);
-		}
-		catch (URISyntaxException ex)
-		{
-			throw new ConfigurationException(ex);
-		}
-		
-		m_sFtpServer = (null != uri) ? uri.getHost() : m_oParms
-				.getAttribute(PARMS_FTP_SERVER);
-		if (null == m_sFtpServer)
-			throw new ConfigurationException("No FTP server specified");
+        protected void checkParms () throws ConfigurationException
+        {
+                String att = m_oParms.getAttribute(FileEpr.URL_TAG);
+                URI uri = null;
+                
+                try
+                {
+                        if (att != null)
+                                uri = new URI(att);
+                }
+                catch (URISyntaxException ex)
+                {
+                        throw new ConfigurationException(ex);
+                }
+                
+                m_sFtpServer = (null != uri) ? uri.getHost() : m_oParms
+                                .getAttribute(PARMS_FTP_SERVER);
+                if (null == m_sFtpServer)
+                        throw new ConfigurationException("No FTP 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 FTP");
+                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 FTP");
 
-		m_sPasswd = ((null != sa) && (sa.length > 1)) ? sa[1] : m_oParms.getAttribute(PARMS_PASSWD);
+                m_sPasswd = ((null != sa) && (sa.length > 1)) ? 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);
-		m_iPort = (null != uri) ? uri.getPort() : (null == sAux) ? 21 : Integer
-				.parseInt(sAux);
-		
-		m_bPassive = false;
-		sAux = m_oParms.getAttribute(PARMS_PASSIVE);
-		m_bPassive = (null != sAux) && Boolean.parseBoolean(sAux);
+                String sAux = m_oParms.getAttribute(PARMS_PORT);
+                m_iPort = (null != uri) ? uri.getPort() : (null == sAux) ? 21 : Integer
+                                .parseInt(sAux);
+                
+                m_bPassive = false;
+                sAux = m_oParms.getAttribute(PARMS_PASSIVE);
+                m_bPassive = (null != sAux) && Boolean.parseBoolean(sAux);
+                
+                String renameRetryString = ModulePropertyManager.getPropertyManager(
+                        ModulePropertyManager.TRANSPORTS_MODULE).getProperty(
+                        Environment.FTP_RENAME_RETRY, null);
 
-		return;
-	}
+                if (renameRetryString != null)
+                {
+                    try
+                    {
+                        renameRetry = Integer.parseInt(renameRetryString);
+                    }
+                    catch (Exception ex)
+                    {
+                        throw new ConfigurationException("Invalid rename retry limit: "+renameRetryString);
+                    }
+                }
+                else
+                    renameRetry = DEFAULT_RENAME_RETRY_NUMBER;
+                
+                if (renameRetry < 1)
+                    renameRetry = 1;
+        }
 
-	protected void configTreeFromEpr () throws RemoteFileSystemException
-	{
-		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));
-			m_oParms.setAttribute(RemoteFileSystem.PARMS_PASSIVE, Boolean
-					.toString(m_bPassive));
-		}
-		catch (Exception e)
-		{
-			throw new RemoteFileSystemException(e);
-		}
-	}
+        protected void configTreeFromEpr () throws RemoteFileSystemException
+        {
+                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));
+                        m_oParms.setAttribute(RemoteFileSystem.PARMS_PASSIVE, Boolean
+                                        .toString(m_bPassive));
+                }
+                catch (Exception e)
+                {
+                        throw new RemoteFileSystemException(e);
+                }
+        }
 
         /*
          * (non-Javadoc)
@@ -369,15 +390,15 @@
                 }
         }
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.jboss.soa.esb.util.RemoteFileSystem#getRemoteDir()
-	 */
-	public String getRemoteDir ()
-	{
-		return m_sRemoteDir;
-	}
+        /*
+         * (non-Javadoc)
+         * 
+         * @see org.jboss.soa.esb.util.RemoteFileSystem#getRemoteDir()
+         */
+        public String getRemoteDir ()
+        {
+                return m_sRemoteDir;
+        }
 
         protected void initialize (boolean bConnect)
             throws ConfigurationException, RemoteFileSystemException
@@ -444,25 +465,25 @@
             }
         }
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.jboss.soa.esb.util.RemoteFileSystem#quit()
-	 */
-	public void quit ()
-	{
-		if (null != m_oConn)
-		{
-			try
-			{
-				m_oConn.quit();
-				m_oConn.disconnect() ;
-			}
-			catch (Exception e)
-			{
-			}
-		}
-	}
+        /*
+         * (non-Javadoc)
+         * 
+         * @see org.jboss.soa.esb.util.RemoteFileSystem#quit()
+         */
+        public void quit ()
+        {
+                if (null != m_oConn)
+                {
+                        try
+                        {
+                                m_oConn.quit();
+                                m_oConn.disconnect() ;
+                        }
+                        catch (Exception e)
+                        {
+                        }
+                }
+        }
 
         /*
          * (non-Javadoc)
@@ -586,10 +607,34 @@
                 {
                     throw new RemoteFileSystemException("Failed to upload contents: " + m_oConn.getReplyString()) ;
                 }
-                if (!m_oConn.rename(sRemoteTmp, p_sRemoteName))
+                
+                boolean retryProblem = true;  // https://jira.jboss.org/jira/browse/JBESB-1995
+
+                for (int i = 0; i < renameRetry; i++)
                 {
+                    if (m_oConn.rename(sRemoteTmp, p_sRemoteName))
+                    {
+                        retryProblem = false;
+                        
+                        break;
+                    }
+                    else
+                    {
+                        if (i+1 < renameRetry)
+                        {
+                            try
+                            {
+                                Thread.sleep(DEFAULT_RENAME_RETRY_TIMEOUT);
+                            }
+                            catch (final Exception ex)
+                            {
+                            }
+                        }
+                    }
+                }
+                
+                if (retryProblem)
                     throw new RemoteFileSystemException("Failed to rename file: " + m_oConn.getReplyString());
-                }
             }
             catch (final IOException ioe)
             {

Modified: labs/jbossesb/workspace/maeste/product/rosetta/src/org/jboss/soa/esb/common/Environment.java
===================================================================
--- labs/jbossesb/workspace/maeste/product/rosetta/src/org/jboss/soa/esb/common/Environment.java	2008-09-23 20:58:25 UTC (rev 23022)
+++ labs/jbossesb/workspace/maeste/product/rosetta/src/org/jboss/soa/esb/common/Environment.java	2008-09-23 21:17:48 UTC (rev 23023)
@@ -24,90 +24,93 @@
 
 public class Environment
 {
-	public enum Transports
-	{
-		File, FTP, JMS, SQL, Hibernate;
-	}
-	
-	public static final String PROPERTIES_FILE = "org.jboss.soa.esb.propertyFile";
-	
-	/**
-	 * Binding properties
-	 */
-	public static final String ESB_BIND_ADDRESS = "jboss.esb.bind.address" ;
-	/*
-	 * Transport specific properties.
-	 */
+        public enum Transports
+        {
+                File, FTP, JMS, SQL, Hibernate;
+        }
 
+        public static final String PROPERTIES_FILE = "org.jboss.soa.esb.propertyFile";
+
+        /**
+         * Binding properties
+         */
+        public static final String ESB_BIND_ADDRESS = "jboss.esb.bind.address" ;
+        /*
+         * Transport specific properties.
+         */
+
     public static final String DEFAULT_INVM_SCOPE     = "jboss.esb.invm.scope.default";
 
     public static final String SMTP_HOST     = "org.jboss.soa.esb.mail.smtp.host";
-	public static final String SMTP_USERNAME = "org.jboss.soa.esb.mail.smtp.user";
-	public static final String SMTP_PASSWORD = "org.jboss.soa.esb.mail.smtp.password";
-	public static final String SMTP_PORT     = "org.jboss.soa.esb.mail.smtp.port";
-	public static final String SMTP_FROM     = "org.jboss.soa.esb.mail.smtp.from";
-	public static final String SMTP_AUTH     = "org.jboss.soa.esb.mail.smtp.auth";
-	
-	public static final String FTP_LOCALDIR  = "org.jboss.soa.esb.ftp.localdir";
-	public static final String FTP_REMOTEDIR = "org.jboss.soa.esb.ftp.remotedir";
-	public static final String FTP_SOCKET_TIMEOUT = "org.jboss.soa.esb.ftp.timeout";
-	
-	public static final String JMS_CONNECTION_POOL_SIZE = "org.jboss.soa.esb.jms.connectionPool";
-	public static final String JMS_SESSION_SLEEP        = "org.jboss.soa.esb.jms.sessionSleep";
-	
-	/*
-	 * Core properties
-	 */
-	public static final String JNDI_SERVER_URL                = "org.jboss.soa.esb.jndi.server.url";
-	public static final String JNDI_SERVER_CONTEXT_FACTORY    = "org.jboss.soa.esb.jndi.server.context.factory";
-	public static final String JNDI_SERVER_PKG_PREFIX         = "org.jboss.soa.esb.jndi.server.pkg.prefix";
-	public static final String JNDI_SERVER_TEST_LOOKUP         = "org.jboss.soa.esb.jndi.test.lookup";
-	public static final String PARAMS_REPOS_IMPL_CLASS        = "org.jboss.soa.esb.paramsRepository.class";
-	public static final String OBJECT_STORE_CONFIG_FILE       = "org.jboss.soa.esb.objStore.configFile";
-	public static final String ENCRYPT_FACTORY_CLASS          = "org.jboss.soa.esb.encryption.factory.class";
+        public static final String SMTP_USERNAME = "org.jboss.soa.esb.mail.smtp.user";
+        public static final String SMTP_PASSWORD = "org.jboss.soa.esb.mail.smtp.password";
+        public static final String SMTP_PORT     = "org.jboss.soa.esb.mail.smtp.port";
+        public static final String SMTP_FROM     = "org.jboss.soa.esb.mail.smtp.from";
+        public static final String SMTP_AUTH     = "org.jboss.soa.esb.mail.smtp.auth";
+
+        public static final String FTP_LOCALDIR  = "org.jboss.soa.esb.ftp.localdir";
+        public static final String FTP_REMOTEDIR = "org.jboss.soa.esb.ftp.remotedir";
+        public static final String FTP_SOCKET_TIMEOUT = "org.jboss.soa.esb.ftp.timeout";
+        public static final String FTP_RENAME_RETRY = "org.jboss.soa.esb.ftp.renameretry";
+
+        public static final String JMS_CONNECTION_POOL_SIZE = "org.jboss.soa.esb.jms.connectionPool";
+        public static final String JMS_SESSION_SLEEP        = "org.jboss.soa.esb.jms.sessionSleep";
+
+        public static final String WS_RETURN_STACK_TRACE = "org.jboss.soa.esb.ws.returnStackTrace";
+        public static final String WS_TIMEOUT = "org.jboss.soa.esb.ws.timeout" ;
+        /*
+         * Core properties
+         */
+        public static final String JNDI_SERVER_URL                = "org.jboss.soa.esb.jndi.server.url";
+        public static final String JNDI_SERVER_CONTEXT_FACTORY    = "org.jboss.soa.esb.jndi.server.context.factory";
+        public static final String JNDI_SERVER_PKG_PREFIX         = "org.jboss.soa.esb.jndi.server.pkg.prefix";
+        public static final String JNDI_SERVER_TEST_LOOKUP         = "org.jboss.soa.esb.jndi.test.lookup";
+        public static final String PARAMS_REPOS_IMPL_CLASS        = "org.jboss.soa.esb.paramsRepository.class";
+        public static final String OBJECT_STORE_CONFIG_FILE       = "org.jboss.soa.esb.objStore.configFile";
+        public static final String ENCRYPT_FACTORY_CLASS          = "org.jboss.soa.esb.encryption.factory.class";
     public static final String LOAD_BALANCER_POLICY           = "org.jboss.soa.esb.loadbalancer.policy";
     public static final String REDELIVER_DLS_SERVICE_ON       = "org.jboss.soa.esb.dls.redeliver";
     public static final String REGISTRY_CACHE_LIFE_MILLIS    = "org.jboss.soa.esb.registry.cache.life";
     public static final String REMOVE_DEAD_EPR                = "org.jboss.soa.esb.failure.detect.removeDeadEPR";
-    	public static final String EXCEPTION_ON_DELIVERY_FAILURE = "org.jboss.soa.esb.exceptionOnDeliverFailure";
-    	
-	/** 
-	 * The Registry Query Manager URI defines the endPoint where registry queries can be made. 
-	 */
-	public static final String REGISTRY_QUERY_MANAGER_URI     = "org.jboss.soa.esb.registry.queryManagerURI";
-	/** 
-	 * The Registry Lifecycle Manager URI defines the endPoint where service information can be published to.
-	 */
-	public static final String REGISTRY_LIFECYCLE_MANAGER_URI = "org.jboss.soa.esb.registry.lifeCycleManagerURI";
+        public static final String EXCEPTION_ON_DELIVERY_FAILURE = "org.jboss.soa.esb.exceptionOnDeliverFailure";
+
+        /**
+         * The Registry Query Manager URI defines the endPoint where registry queries can be made.
+         */
+        public static final String REGISTRY_QUERY_MANAGER_URI     = "org.jboss.soa.esb.registry.queryManagerURI";
+        /**
+         * The Registry Lifecycle Manager URI defines the endPoint where service information can be published to.
+         */
+        public static final String REGISTRY_LIFECYCLE_MANAGER_URI = "org.jboss.soa.esb.registry.lifeCycleManagerURI";
     /**
      * The Registry Implementation class, a light wrapper class.
      */
-	public static final String REGISTRY_IMPEMENTATION_CLASS = "org.jboss.soa.esb.registry.implementationClass";
-	/** 
-	 * The Registry Factory Class setting specifies which JAXR implementation should be used.
-	 */
-	public static final String REGISTRY_FACTORY_CLASS         = "org.jboss.soa.esb.registry.factoryClass";
-	/**
-	 * The user used to query and publish to the registry.
-	 */
-	public static final String REGISTRY_USER                  = "org.jboss.soa.esb.registry.user";
-	/**
-	 * The password for the registry user.
-	 */
-	public static final String REGISTRY_PASSWORD              = "org.jboss.soa.esb.registry.password";
-	/** 
-	 * The Registry Scout Transport Class property defines which communication protocol Scout should use to communicate
-	 * with the UDDI registry. Note that this parameter is Scout specific.
-	 */
-	public static final String REGISTRY_SCOUT_TRANSPORT_CLASS = "org.jboss.soa.esb.scout.proxy.transportClass";
-	/** 
-	 * Property that holds directory to use with the helper EPRManager class.
-	 */
-	public static final String REGISTRY_FILE_HELPER_DIR       = "org.jboss.soa.esb.registry.file.directory";
+        public static final String REGISTRY_IMPEMENTATION_CLASS = "org.jboss.soa.esb.registry.implementationClass";
+        /**
+         * The Registry Factory Class setting specifies which JAXR implementation should be used.
+         */
+        public static final String REGISTRY_FACTORY_CLASS         = "org.jboss.soa.esb.registry.factoryClass";
+        /**
+         * The user used to query and publish to the registry.
+         */
+        public static final String REGISTRY_USER                  = "org.jboss.soa.esb.registry.user";
+        /**
+         * The password for the registry user.
+         */
+        public static final String REGISTRY_PASSWORD              = "org.jboss.soa.esb.registry.password";
+        /**
+         * The Registry Scout Transport Class property defines which communication protocol Scout should use to communicate
+         * with the UDDI registry. Note that this parameter is Scout specific.
+         */
+        public static final String REGISTRY_SCOUT_TRANSPORT_CLASS = "org.jboss.soa.esb.scout.proxy.transportClass";
+        /**
+         * Property that holds directory to use with the helper EPRManager class.
+         */
+        public static final String REGISTRY_FILE_HELPER_DIR       = "org.jboss.soa.esb.registry.file.directory";
     /**
      * Property that holds the setting to the semantic equivalence scheme to use.
      */
-	public static final String REGISTRY_SEMANTIC_EQUIVALENCES = "org.jboss.soa.esb.registry.semanticEquivalences";
+        public static final String REGISTRY_SEMANTIC_EQUIVALENCES = "org.jboss.soa.esb.registry.semanticEquivalences";
     /**
      * Property that holds the postal address scheme.
      */
@@ -120,7 +123,7 @@
      * Property that holds the max number of rows the UDDI should return on searches.
      */
     public static final String REGISTRY_UDDI_MAX_ROWS          = "org.jboss.soa.esb.registry.uddi.maxRows";
-    
+
     /**
      * The Registry interceptor class names.
      */
@@ -133,114 +136,138 @@
      * The cache validity period.
      */
     public static final String REGISTRY_CACHE_VALIDITY_PERIOD = "org.jboss.soa.esb.registry.cache.validityPeriod";
-	/*
-	 * Some default values.
-	 */
-	public static final String DEFAULT_PROPERTY_FILE                  = "jbossesb-properties.xml";
-	public static final String DEFAULT_HOST                           = "localhost";
-	public static final String DEFAULT_USERNAME                       = "";
-	public static final String DEFAULT_PASSWORD                       = "";
-	public static final String DEFAULT_PORT                           = "25";
-	public static final String DEFAULT_JNDI_CONTEXT_FACTORY           = "org.jnp.interfaces.NamingContextFactory";
-	public static final String DEFAULT_JNDI_PKG_PREFIX                = "org.jnp.interfaces";
+        /*
+         * Some default values.
+         */
+        public static final String DEFAULT_PROPERTY_FILE                  = "jbossesb-properties.xml";
+        public static final String DEFAULT_HOST                           = "localhost";
+        public static final String DEFAULT_USERNAME                       = "";
+        public static final String DEFAULT_PASSWORD                       = "";
+        public static final String DEFAULT_PORT                           = "25";
+        public static final String DEFAULT_JNDI_CONTEXT_FACTORY           = "org.jnp.interfaces.NamingContextFactory";
+        public static final String DEFAULT_JNDI_PKG_PREFIX                = "org.jnp.interfaces";
     public static final String DEFAULT_LOAD_BALANCER_POLICY           = "org.jboss.soa.esb.listeners.ha.FirstAvailable";
-	public static final String DEFAULT_REDELIVER_DLS_ON               = "true";
+        public static final String DEFAULT_REDELIVER_DLS_ON               = "true";
     public static final String DEFAULT_REGISTRY_CACHE_LIFE_MILLIS    = "60000";
-	/*
-	 * DatabaseMessageStore Persistence Store properties.
-	 */
-	public static final String MSG_STORE_DB_CONNECTION_URL 		= "org.jboss.soa.esb.persistence.db.connection.url";
-	public static final String MSG_STORE_DB_CONNECTION_USER 	= "org.jboss.soa.esb.persistence.db.user";
-	public static final String MSG_STORE_DB_CONNECTION_PWD 		= "org.jboss.soa.esb.persistence.db.pwd";
-	public static final String MSG_STORE_DB_TABLE_NAME 			= "org.jboss.soa.esb.persistence.db.table";
-	public static final String MSG_STORE_DB_JDBC_DRIVER			= "org.jboss.soa.esb.persistence.db.jdbc.driver";
-	public static final String MSG_STORE_DB_POOL_INITIAL_SIZE	= "org.jboss.soa.esb.persistence.db.pool.initial.size";
-	public static final String MSG_STORE_DB_POOL_MIN_SIZE		= "org.jboss.soa.esb.persistence.db.pool.min.size";
-	public static final String MSG_STORE_DB_POOL_MAX_SIZE		= "org.jboss.soa.esb.persistence.db.pool.max.size";
-	public static final String MSG_STORE_DB_POOL_TEST_TABLE		= "org.jboss.soa.esb.persistence.db.pool.test.table";
-	public static final String MSG_STORE_DB_POOL_TIMEOUT_MILLIS	= "org.jboss.soa.esb.persistence.db.pool.timeout.millis";
-	public static final String MSG_STORE_DB_CONN_MANAGER		= "org.jboss.soa.esb.persistence.db.conn.manager";
-	public static final String MSG_STORE_DB_DATASOURCE_NAME		= "org.jboss.soa.esb.persistence.db.datasource.name";
-	
-	/*
-	 * JcrMessageStore Persistence Store properties.
-	 */
-	public static final String MSG_STORE_JCR_JNDI_PATH			= "org.jboss.soa.esb.persistence.jcr.jndi.path";	
-	public static final String MSG_STORE_JCR_USERNAME			= "org.jboss.soa.esb.persistence.jcr.username";	
-	public static final String MSG_STORE_JCR_PASSWORD			= "org.jboss.soa.esb.persistence.jcr.password";	
-	public static final String MSG_STORE_JCR_ROOT_NODE_PATH		= "org.jboss.soa.esb.persistence.jcr.root.node.path";	
-	
-	/*
-	 * Some message metadata properties.
-	 */
-	
-	public static final String TRANSPORT_TYPE = "org.jboss.soa.esb.message.transport.type";
-	public static final String MESSAGE_SOURCE = "org.jboss.soa.esb.message.source";
-	public static final String MESSAGE_ENTRY_TIME = "org.jboss.soa.esb.message.time.dob"; // time born
-	public static final String MESSAGE_EXIT_TIME = "org.jboss.soa.esb.message.time.dod";  // time died
-	public static final String MESSAGE_BYTE_SIZE = "org.jboss.soa.esb.message.byte.size"; // size
-	
-	/** Message property name for original filename */
-	
-	public static final String ORIGINAL_FILE_NAME_MSG_PROP = "org.jboss.soa.esb.gateway.original.file.name";
-	public static final String ORIGINAL_QUEUE_NAME_MSG_PROP = "org.jboss.soa.esb.gateway.original.queue.name";
-	public static final String ORIGINAL_URL_PROP = "org.jboss.soa.esb.gateway.original.url";
-	
-	/*
-	 * Some gateway attachment names.
-	 */
-	
-	public static final String ORIGINAL_FILE = "org.jboss.soa.esb.gateway.file";
-	public static final String GATEWAY_CONFIG = "org.jboss.soa.esb.gateway.config";
-	
-	/*
-	 * Some JMS specific message element names.
-	 */
-	
-	public static final String JMS_MESSAGE_ID = "org.jboss.soa.esb.message.transport.jms.messageID";
-	public static final String JMS_NATIVE_MESSAGE_TYPE = "org.jboss.soa.esb.message.transport.jms.nativeMessageType"; // Text or Object
-	
-	/*
-	 * Filter properties should be identified by:
-	 * 
-	 * org.jboss.soa.esb.filter.<number>
-	 * 
-	 * and will be called in increasing order of <number>. Same <number> may be
-	 * called arbitrarily.
-	 */
+        /*
+         * DatabaseMessageStore Persistence Store properties.
+         */
+        public static final String MSG_STORE_DB_CONNECTION_URL          = "org.jboss.soa.esb.persistence.db.connection.url";
+        public static final String MSG_STORE_DB_CONNECTION_USER         = "org.jboss.soa.esb.persistence.db.user";
+        public static final String MSG_STORE_DB_CONNECTION_PWD          = "org.jboss.soa.esb.persistence.db.pwd";
+        public static final String MSG_STORE_DB_TABLE_NAME                      = "org.jboss.soa.esb.persistence.db.table";
+        public static final String MSG_STORE_DB_JDBC_DRIVER                     = "org.jboss.soa.esb.persistence.db.jdbc.driver";
+        public static final String MSG_STORE_DB_POOL_INITIAL_SIZE       = "org.jboss.soa.esb.persistence.db.pool.initial.size";
+        public static final String MSG_STORE_DB_POOL_MIN_SIZE           = "org.jboss.soa.esb.persistence.db.pool.min.size";
+        public static final String MSG_STORE_DB_POOL_MAX_SIZE           = "org.jboss.soa.esb.persistence.db.pool.max.size";
+        public static final String MSG_STORE_DB_POOL_TEST_TABLE         = "org.jboss.soa.esb.persistence.db.pool.test.table";
+        public static final String MSG_STORE_DB_POOL_TIMEOUT_MILLIS     = "org.jboss.soa.esb.persistence.db.pool.timeout.millis";
+        public static final String MSG_STORE_DB_CONN_MANAGER            = "org.jboss.soa.esb.persistence.db.conn.manager";
+        public static final String MSG_STORE_DB_DATASOURCE_NAME         = "org.jboss.soa.esb.persistence.db.datasource.name";
 
-	public static final String FILTER_NAME = "org.jboss.soa.esb.filter";
-	
-	/*
-	 * Some specific out-of-the-box filter configuration options.
-	 */
-	
-	public static final String MESSAGE_TRACE = "org.jboss.soa.esb.messagetrace"; // on or off
-	public static final String PER_MESSAGE_TRACE = "org.jboss.soa.esb.permessagetrace"; // on or off
-	
-	// Configuration options for the Naming Context pooling.
-	/**
-	 * The maximum pool size.
-	 */
-	public static final String NAMING_CONTEXT_POOL_SIZE = "org.jboss.soa.esb.namingcontext.poolsize" ;
-	/**
-	 * The maximum sleep period when waiting for a naming context, specified in seconds.
-	 */
+        /*
+         * JcrMessageStore Persistence Store properties.
+         */
+        public static final String MSG_STORE_JCR_JNDI_PATH                      = "org.jboss.soa.esb.persistence.jcr.jndi.path";
+        public static final String MSG_STORE_JCR_USERNAME                       = "org.jboss.soa.esb.persistence.jcr.username";
+        public static final String MSG_STORE_JCR_PASSWORD                       = "org.jboss.soa.esb.persistence.jcr.password";
+        public static final String MSG_STORE_JCR_ROOT_NODE_PATH         = "org.jboss.soa.esb.persistence.jcr.root.node.path";
+
+        /*
+         * Some message metadata properties.
+         */
+
+        public static final String TRANSPORT_TYPE = "org.jboss.soa.esb.message.transport.type";
+        public static final String MESSAGE_SOURCE = "org.jboss.soa.esb.message.source";
+        public static final String MESSAGE_ENTRY_TIME = "org.jboss.soa.esb.message.time.dob"; // time born
+        public static final String MESSAGE_EXIT_TIME = "org.jboss.soa.esb.message.time.dod";  // time died
+        public static final String MESSAGE_BYTE_SIZE = "org.jboss.soa.esb.message.byte.size"; // size
+
+        /** Message property name for original filename */
+
+        public static final String ORIGINAL_FILE_NAME_MSG_PROP = "org.jboss.soa.esb.gateway.original.file.name";
+        public static final String ORIGINAL_QUEUE_NAME_MSG_PROP = "org.jboss.soa.esb.gateway.original.queue.name";
+        public static final String ORIGINAL_URL_PROP = "org.jboss.soa.esb.gateway.original.url";
+
+        /*
+         * Some gateway attachment names.
+         */
+
+        public static final String ORIGINAL_FILE = "org.jboss.soa.esb.gateway.file";
+        public static final String GATEWAY_CONFIG = "org.jboss.soa.esb.gateway.config";
+
+        /*
+         * Some JMS specific message element names.
+         */
+
+        public static final String JMS_MESSAGE_ID = "org.jboss.soa.esb.message.transport.jms.messageID";
+        public static final String JMS_NATIVE_MESSAGE_TYPE = "org.jboss.soa.esb.message.transport.jms.nativeMessageType"; // Text or Object
+
+        /*
+         * Filter properties should be identified by:
+         *
+         * org.jboss.soa.esb.filter.<number>
+         *
+         * and will be called in increasing order of <number>. Same <number> may be
+         * called arbitrarily.
+         */
+
+        public static final String FILTER_NAME = "org.jboss.soa.esb.filter";
+
+        /*
+         * Some specific out-of-the-box filter configuration options.
+         */
+
+        public static final String MESSAGE_TRACE = "org.jboss.soa.esb.messagetrace"; // on or off
+        public static final String PER_MESSAGE_TRACE = "org.jboss.soa.esb.permessagetrace"; // on or off
+
+    /**
+     * The SecurityService Implementation class
+     */
+        public static final String SECURITY_SERVICE_IMPEMENTATION_CLASS         = "org.jboss.soa.esb.services.security.implementationClass";
+        public static final String SECURITY_SERVICE_CALLBACK_HANLDER_CLASS      = "org.jboss.soa.esb.services.security.callbackHandler";
+        public static final String SECURITY_SERVICE_CALLBACK                            = "org.jboss.soa.esb.services.security.callback_";
+        public static final String SECURITY_SERVICE_CONFIG_URL                          = "org.jboss.soa.esb.services.security.configUrl";
+        public static final String SECURITY_SERVICE_SEAL_ALGORITHM                      = "org.jboss.soa.esb.services.security.sealAlgorithm";
+        public static final String SECURITY_SERVICE_SEAL_KEYSIZE                        = "org.jboss.soa.esb.services.security.sealKeySize";
+
+        public static final String SECURITY_SERVICE_PRIVATE_KEYSTORE            = "org.jboss.soa.esb.services.security.privateKeystore";
+        public static final String SECURITY_SERVICE_PRIVATE_KEYSTORE_TYPE       = "org.jboss.soa.esb.services.security.privateKeystoreType";
+        public static final String SECURITY_SERVICE_PRIVATE_KEYSTORE_PASS       = "org.jboss.soa.esb.services.security.privateKeystorePassword";
+        public static final String SECURITY_SERVICE_PRIVATE_KEY_ALIAS       = "org.jboss.soa.esb.services.security.privateKeyAlias";
+        public static final String SECURITY_SERVICE_PRIVATE_KEY_PASS        = "org.jboss.soa.esb.services.security.privateKeyPassword";
+        public static final String SECURITY_SERVICE_PRIVATE_KEY_TRANSFORMATION = "org.jboss.soa.esb.services.security.privateKeyTransformation";
+
+        public static final String SECURITY_SERVICE_PUBLIC_KEYSTORE             = "org.jboss.soa.esb.services.security.publicKeystore";
+        public static final String SECURITY_SERVICE_PUBLIC_KEYSTORE_TYPE        = "org.jboss.soa.esb.services.security.publicKeystoreType";
+        public static final String SECURITY_SERVICE_PUBLIC_KEYSTORE_PASS        = "org.jboss.soa.esb.services.security.publicKeystorePassword";
+        public static final String SECURITY_SERVICE_PUBLIC_KEY_ALIAS        = "org.jboss.soa.esb.services.security.publicKeyAlias";
+        public static final String SECURITY_SERVICE_PUBLIC_KEY_PASS             = "org.jboss.soa.esb.services.security.publicKeyPassword";
+        public static final String SECURITY_SERVICE_PUBLIC_KEY_TRANSFORMATION = "org.jboss.soa.esb.services.security.publicKeyTransformation";
+
+        // Configuration options for the Naming Context pooling.
+        /**
+         * The maximum pool size.
+         */
+        public static final String NAMING_CONTEXT_POOL_SIZE = "org.jboss.soa.esb.namingcontext.poolsize" ;
+        /**
+         * The maximum sleep period when waiting for a naming context, specified in seconds.
+         */
         public static final String NAMING_CONTEXT_SLEEP_PERIOD = "org.jboss.soa.esb.namingcontext.sleepperiod" ;
         /**
          * The maximum number of retries when creating a naming context.
          */
         public static final String NAMING_CONTEXT_RETRY_COUNT = "org.jboss.soa.esb.namingcontext.retrycount" ;
         /**
-         * The JBoss JNDI provider URL. 
+         * The JBoss JNDI provider URL.
          */
         public static final String JBOSS_PROVIDER_URL = "localhost";
         /**
-         * The JBoss JNDI initial context factory. 
+         * The JBoss JNDI initial context factory.
          */
         public static final String JBOSS_INITIAL_CONTEXT_FACTORY = "org.jnp.interfaces.NamingContextFactory";
         /**
-         * The JBoss JNDI URL package prefix. 
+         * The JBoss JNDI URL package prefix.
          */
         public static final String JBOSS_URL_PKG_PREFIX = ""; //"org.jboss.naming:org.jnp.interfaces"
 }

Modified: labs/jbossesb/workspace/maeste/product/rosetta/src/org/jboss/soa/esb/util/FtpClientUtil.java
===================================================================
--- labs/jbossesb/workspace/maeste/product/rosetta/src/org/jboss/soa/esb/util/FtpClientUtil.java	2008-09-23 20:58:25 UTC (rev 23022)
+++ labs/jbossesb/workspace/maeste/product/rosetta/src/org/jboss/soa/esb/util/FtpClientUtil.java	2008-09-23 21:17:48 UTC (rev 23023)
@@ -35,8 +35,12 @@
 import org.apache.commons.net.ftp.FTPClient;
 import org.jboss.internal.soa.esb.util.FtpUtils;
 import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.common.Environment;
+import org.jboss.soa.esb.common.ModulePropertyManager;
 import org.jboss.soa.esb.helpers.ConfigTree;
 import org.jboss.soa.esb.helpers.KeyValuePair;
+import org.jboss.soa.esb.util.RemoteFileSystem;
+import org.jboss.soa.esb.util.RemoteFileSystemException;
 
 /**
  * Simplified FTP transfers
@@ -45,443 +49,492 @@
  * establish the FTP connection are provided at construction time and cannot
  * change during the lifetime of the object <br/>Hides low level details.
  * </p>
+ * 
+ * TODO why duplicate so much of FtpImpl.java?
  */
 
 public class FtpClientUtil
 {
-	public static final String PARMS_FTP_SERVER = "ftpServer";
+        public static final String PARMS_FTP_SERVER = "ftpServer";
 
-	public static final String PARMS_USER = "ftpUser";
+        public static final String PARMS_USER = "ftpUser";
 
-	public static final String PARMS_PASSWD = "ftpPassword";
+        public static final String PARMS_PASSWD = "ftpPassword";
 
-	public static final String PARMS_PORT = "ftpPort";
+        public static final String PARMS_PORT = "ftpPort";
 
-	public static final String PARMS_REMOTE_DIR = "ftpRemoteDir";
+        public static final String PARMS_REMOTE_DIR = "ftpRemoteDir";
 
-	public static final String PARMS_LOCAL_DIR = "ftpLocalDir";
+        public static final String PARMS_LOCAL_DIR = "ftpLocalDir";
 
-	public static final String PARMS_ASCII = "ftpAscii";
+        public static final String PARMS_ASCII = "ftpAscii";
 
-	public static final String PARMS_PASSIVE = "ftpPassive";
+        public static final String PARMS_PASSIVE = "ftpPassive";
 
-	private static final String TMP_SUFFIX = ".rosettaPart";
+        private static final String TMP_SUFFIX = ".rosettaPart";
+                
+        public enum XFER_TYPE
+        {
+                ascii, binary
+        }
 
-	public enum XFER_TYPE
-	{
-		ascii, binary
-	}
+        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;
+        private int m_iPort;
 
-	private int m_iPort;
+        private boolean m_bPassive;
 
-	private boolean m_bPassive;
-
         private FTPClient m_oConn = new FTPClient();
 
         private boolean m_bAsciiTransferType ; 
+        
+        private int renameRetry;
 
-	public String getRemoteDir ()
-	{
-		return m_sRemoteDir;
-	}
+        public String getRemoteDir ()
+        {
+                return m_sRemoteDir;
+        }
 
-	/**
-	 * Checks validity and completeness of parameters, and keeps the info
-	 * internally for subsequent FTP requests
-	 * 
-	 * @param p_oP
-	 *            ConfigTree
-	 * @throws ConfigurationException :
-	 *             if parameters are invalid or incomplete
-	 *             <li>Parameters: (XML attributes at the root level) </li>
-	 *             <li> ftpServer = name or IP of FTP server </li>
-	 *             <li> ftpUser = login ID for server </li>
-	 *             <li> ftpPassword </li>
-	 *             <li> localDirURI = absolute path in the local filesystem
-	 *             </li>
-	 *             <li> remoteDirURI = remote path is relative to ftp user home
-	 *             in remote computer </li>
-	 * @throws RemoteFileSystemException
-	 */
+        /**
+         * Checks validity and completeness of parameters, and keeps the info
+         * internally for subsequent FTP requests
+         * 
+         * @param p_oP
+         *            ConfigTree
+         * @throws ConfigurationException :
+         *             if parameters are invalid or incomplete
+         *             <li>Parameters: (XML attributes at the root level) </li>
+         *             <li> ftpServer = name or IP of FTP server </li>
+         *             <li> ftpUser = login ID for server </li>
+         *             <li> ftpPassword </li>
+         *             <li> localDirURI = absolute path in the local filesystem
+         *             </li>
+         *             <li> remoteDirURI = remote path is relative to ftp user home
+         *             in remote computer </li>
+         * @throws RemoteFileSystemException
+         */
 
-	public FtpClientUtil (ConfigTree p_oP, boolean p_bConnect) throws RemoteFileSystemException, ConfigurationException
-	{
-		m_oParms = p_oP;
-		initialize(p_bConnect);
-	} // _________________________________
+        public FtpClientUtil (ConfigTree p_oP, boolean p_bConnect) throws RemoteFileSystemException, ConfigurationException
+        {
+                m_oParms = p_oP;
+                initialize(p_bConnect);
+        } // _________________________________
 
-	public FtpClientUtil (List<KeyValuePair> attribs, boolean connect)
-			throws RemoteFileSystemException, ConfigurationException
-	{
-		m_oParms = new ConfigTree("fromProps");
-		for (KeyValuePair oCurr : attribs)
-			m_oParms.setAttribute(oCurr.getKey(), oCurr.getValue());
-		initialize(connect);
-	} // __________________________________
+        public FtpClientUtil (List<KeyValuePair> attribs, boolean connect)
+                        throws RemoteFileSystemException, ConfigurationException
+        {
+                m_oParms = new ConfigTree("fromProps");
+                for (KeyValuePair oCurr : attribs)
+                        m_oParms.setAttribute(oCurr.getKey(), oCurr.getValue());
+                initialize(connect);
+        } // __________________________________
 
-	private void initialize (boolean bConnect) throws RemoteFileSystemException, ConfigurationException
-	{
-		checkParms();
-		
-		try
-		{
-			if (bConnect)
-			{
-				if (m_iPort > 0)
-				{
-				    m_oConn.connect(m_sFtpServer, m_iPort) ;
-				}
-				else
-				{
-				    m_oConn.connect(m_sFtpServer) ;
-				}
+        private void initialize (boolean bConnect) throws RemoteFileSystemException, ConfigurationException
+        {
+                checkParms();
+                
+                try
+                {
+                        if (bConnect)
+                        {
+                                if (m_iPort > 0)
+                                {
+                                    m_oConn.connect(m_sFtpServer, m_iPort) ;
+                                }
+                                else
+                                {
+                                    m_oConn.connect(m_sFtpServer) ;
+                                }
 
-				
-				if (!m_oConn.isConnected())
-					throw new RemoteFileSystemException("Can't connect to FTP server");
-				if (!m_oConn.login(m_sUser, m_sPasswd))
-				{
-				    m_oConn.logout() ;
-				    throw new RemoteFileSystemException("Remote login failed: " + m_oConn.getReplyString());
-				}
-				m_oConn.setFileType(m_bAsciiTransferType ? FTP.ASCII_FILE_TYPE : FTP.BINARY_FILE_TYPE) ;
-				if (m_bPassive)
-				{
-					m_oConn.enterLocalPassiveMode() ;
-				}
-			}
-		}
-		catch (IOException ioe)
-		{
-			if (m_oConn.isConnected())
-			{
-			    try
-			    {
-			        m_oConn.disconnect() ;
-			    }
-			    catch (final IOException ioe2) {} // ignore
-			}
-			throw new RemoteFileSystemException(ioe);
-		}
-	} // __________________________________
+                                
+                                if (!m_oConn.isConnected())
+                                        throw new RemoteFileSystemException("Can't connect to FTP server");
+                                if (!m_oConn.login(m_sUser, m_sPasswd))
+                                {
+                                    m_oConn.logout() ;
+                                    throw new RemoteFileSystemException("Remote login failed: " + m_oConn.getReplyString());
+                                }
+                                m_oConn.setFileType(m_bAsciiTransferType ? FTP.ASCII_FILE_TYPE : FTP.BINARY_FILE_TYPE) ;
+                                if (m_bPassive)
+                                {
+                                        m_oConn.enterLocalPassiveMode() ;
+                                }
+                        }
+                }
+                catch (IOException ioe)
+                {
+                        if (m_oConn.isConnected())
+                        {
+                            try
+                            {
+                                m_oConn.disconnect() ;
+                            }
+                            catch (final IOException ioe2) {} // ignore
+                        }
+                        throw new RemoteFileSystemException(ioe);
+                }
+        } // __________________________________
 
-	/**
-	 * Terminates ftp session and frees resources
-	 * <li>Well behaved programs should make sure to call this method </li>
-	 */
-	public void quit ()
-	{
-		if (null != m_oConn) try
-		{
-			m_oConn.quit();
-			m_oConn.disconnect();
-		}
-		catch (Exception e)
-		{
-		}
-	} // _________________________________
+        /**
+         * Terminates ftp session and frees resources
+         * <li>Well behaved programs should make sure to call this method </li>
+         */
+        public void quit ()
+        {
+                if (null != m_oConn) try
+                {
+                        m_oConn.quit();
+                        m_oConn.disconnect();
+                }
+                catch (Exception e)
+                {
+                }
+        } // _________________________________
 
-	/**
-	 * Deletes specified file in remote directory
-	 * 
-	 * @param p_sFile
-	 *            String : filename to delete. Method will attempt to delete
-	 *            file with rightmost node of argument within remote directory
-	 *            specified in 'remoteDirURI'
-	 * @throws RemoteFileSystemException :
-	 *             if ftp connection cannot be established, or file cannot be
-	 *             deleted in remote directory
-	 */
-	public void deleteRemoteFile (String p_sFile) throws RemoteFileSystemException
-	{
-		try
-		{
-			changeRemoteDirectory() ;
-			if (!m_oConn.deleteFile(p_sFile))
-			{
-			    throw new RemoteFileSystemException("Failed to delete remote file: " + m_oConn.getReplyString());
-			}
-		}
-		catch (IOException ex)
-		{
-			throw new RemoteFileSystemException(ex);
-		}
-	} // _________________________________
+        /**
+         * Deletes specified file in remote directory
+         * 
+         * @param p_sFile
+         *            String : filename to delete. Method will attempt to delete
+         *            file with rightmost node of argument within remote directory
+         *            specified in 'remoteDirURI'
+         * @throws RemoteFileSystemException :
+         *             if ftp connection cannot be established, or file cannot be
+         *             deleted in remote directory
+         */
+        public void deleteRemoteFile (String p_sFile) throws RemoteFileSystemException
+        {
+                try
+                {
+                        changeRemoteDirectory() ;
+                        if (!m_oConn.deleteFile(p_sFile))
+                        {
+                            throw new RemoteFileSystemException("Failed to delete remote file: " + m_oConn.getReplyString());
+                        }
+                }
+                catch (IOException ex)
+                {
+                        throw new RemoteFileSystemException(ex);
+                }
+        } // _________________________________
 
-	public void remoteDelete (File p_oFile) throws RemoteFileSystemException
-	{
-		try
-		{
-			changeRemoteDirectory() ;
-			if (!m_oConn.deleteFile(p_oFile.getName()))
-			{
-			    throw new RemoteFileSystemException("Failed to delete remote file: " + m_oConn.getReplyString());
-			}
-		}
-		catch (IOException ex)
-		{
-			throw new RemoteFileSystemException(ex);
-		}
-	} // _________________________________
+        public void remoteDelete (File p_oFile) throws RemoteFileSystemException
+        {
+                try
+                {
+                        changeRemoteDirectory() ;
+                        if (!m_oConn.deleteFile(p_oFile.getName()))
+                        {
+                            throw new RemoteFileSystemException("Failed to delete remote file: " + m_oConn.getReplyString());
+                        }
+                }
+                catch (IOException ex)
+                {
+                        throw new RemoteFileSystemException(ex);
+                }
+        } // _________________________________
 
-	/**
-	 * Gets the list of files in the remote directory that end with arg0
-	 * 
-	 * @param p_sSuffix
-	 *            String : retrieve only files that end with that suffix - all
-	 *            files if null
-	 * @throws RemoteFileSystemException :
-	 *             if ftp connection cannot be established, or problems
-	 *             encountered
-	 */
-	public String[] getFileListFromRemoteDir (String p_sSuffix)
-			throws RemoteFileSystemException
-	{
-		String sSuffix = (null == p_sSuffix) ? "*" : "*" + p_sSuffix;
-		
-		try
-		{
-			changeRemoteDirectory() ;
-			return m_oConn.listNames(sSuffix);
-		}
-		catch (IOException ex)
-		{
-			throw new RemoteFileSystemException(ex);
-		}
-	} // _________________________________
+        /**
+         * Gets the list of files in the remote directory that end with arg0
+         * 
+         * @param p_sSuffix
+         *            String : retrieve only files that end with that suffix - all
+         *            files if null
+         * @throws RemoteFileSystemException :
+         *             if ftp connection cannot be established, or problems
+         *             encountered
+         */
+        public String[] getFileListFromRemoteDir (String p_sSuffix)
+                        throws RemoteFileSystemException
+        {
+                String sSuffix = (null == p_sSuffix) ? "*" : "*" + p_sSuffix;
+                
+                try
+                {
+                        changeRemoteDirectory() ;
+                        return m_oConn.listNames(sSuffix);
+                }
+                catch (IOException ex)
+                {
+                        throw new RemoteFileSystemException(ex);
+                }
+        } // _________________________________
 
-	/**
-	 * Change remote directory
-	 * 
-	 * @param p_sDir
-	 *            String : directory to set
-	 * @throws RemoteFileSystemException :
-	 *             if ftp connection cannot be established, or problems
-	 *             encountered
-	 */
-	public void setRemoteDir (String p_sDir) throws RemoteFileSystemException
-	{
-		m_sRemoteDir = p_sDir ;
-	} // _________________________________
+        /**
+         * Change remote directory
+         * 
+         * @param p_sDir
+         *            String : directory to set
+         * @throws RemoteFileSystemException :
+         *             if ftp connection cannot be established, or problems
+         *             encountered
+         */
+        public void setRemoteDir (String p_sDir) throws RemoteFileSystemException
+        {
+                m_sRemoteDir = p_sDir ;
+        } // _________________________________
 
-	/**
-	 * Renames specified file in remote directory to specified new name
-	 * 
-	 * @param p_sFrom
-	 *            String : filename to rename
-	 * @param p_sTo
-	 *            String : new filename
-	 * @throws RemoteFileSystemException :
-	 *             if ftp connection cannot be established, or file cannot be
-	 *             renamed to new name in remote directory
-	 *             <li>Method will attempt to rename file with rightmost node
-	 *             of argument within remote directory specified in
-	 *             'remoteDirURI', to new name inside the SAME remote directory
-	 */
-	public void renameInRemoteDir (String p_sFrom, String p_sTo)
-			throws RemoteFileSystemException
-	{
-		try
-		{
-			changeRemoteDirectory() ;
-			if (!m_oConn.rename(p_sFrom, p_sTo))
-			{
-			    throw new RemoteFileSystemException("Failed to rename file: " + m_oConn.getReplyString());
-			}
-		}
-		catch (final IOException ioe)
-		{
-			throw new RemoteFileSystemException(ioe);
-		}
-	} // _________________________________
+        /**
+         * Renames specified file in remote directory to specified new name
+         * 
+         * @param p_sFrom
+         *            String : filename to rename
+         * @param p_sTo
+         *            String : new filename
+         * @throws RemoteFileSystemException :
+         *             if ftp connection cannot be established, or file cannot be
+         *             renamed to new name in remote directory
+         *             <li>Method will attempt to rename file with rightmost node
+         *             of argument within remote directory specified in
+         *             'remoteDirURI', to new name inside the SAME remote directory
+         */
+        public void renameInRemoteDir (String p_sFrom, String p_sTo)
+                        throws RemoteFileSystemException
+        {
+                try
+                {
+                        changeRemoteDirectory() ;
+                        if (!m_oConn.rename(p_sFrom, p_sTo))
+                        {
+                            throw new RemoteFileSystemException("Failed to rename file: " + m_oConn.getReplyString());
+                        }
+                }
+                catch (final IOException ioe)
+                {
+                        throw new RemoteFileSystemException(ioe);
+                }
+        } // _________________________________
 
-	public void remoteRename (File p_oFrom, File p_oTo) throws RemoteFileSystemException
-	{
-		try
-		{
-			if (!m_oConn.rename(FtpClientUtil.fileToFtpString(p_oFrom),
-			        FtpUtils.fileToFtpString(p_oTo)))
-			{
-			    throw new RemoteFileSystemException("Failed to rename file: " + m_oConn.getReplyString());
-			}
-		}
-		catch (IOException ioe)
-		{
-			throw new RemoteFileSystemException(ioe);
-		}
-	} // _________________________________
+        public void remoteRename (File p_oFrom, File p_oTo) throws RemoteFileSystemException
+        {
+                try
+                {
+                        if (!m_oConn.rename(FtpClientUtil.fileToFtpString(p_oFrom),
+                                FtpUtils.fileToFtpString(p_oTo)))
+                        {
+                            throw new RemoteFileSystemException("Failed to rename file: " + m_oConn.getReplyString());
+                        }
+                }
+                catch (IOException ioe)
+                {
+                        throw new RemoteFileSystemException(ioe);
+                }
+        } // _________________________________
 
-	/**
-	 * Uploads specified file from local directory (localDirURI) to remote
-	 * directory (remoteDirURI)
-	 * 
-	 * @param p_oFile
-	 *            String : filename to upload
-	 * @throws RemoteFileSystemException :
-	 *             if ftp connection cannot be established, or file cannot be
-	 *             uploaded
-	 *             <li> local file will be renamed during transfer
-	 *             ('.xferNotReady' appended to name)</li>
-	 *             <li> upon successful completion. the suffix '.xferDone' will
-	 *             be appended to the original filename </li>
-	 */
-	public void uploadFile (File p_oFile, String p_sRemoteName)
-			throws RemoteFileSystemException
-	{
-		try
-		{
-			changeRemoteDirectory() ;
-			final String sRemoteTmp = p_sRemoteName + TMP_SUFFIX ;
-			
-			final OutputStream os = m_oConn.storeFileStream(sRemoteTmp) ;
-			try
-			{
-			    final FileInputStream fis = new FileInputStream(p_oFile) ;
-			    try
-			    {
-			        copyStream(fis, os) ;
-			    }
-			    finally
-			    {
-			        fis.close() ;
-			    }
-			}
-			finally
-			{
-			    os.flush() ;
-			    os.close() ;
-			}
-			if (!m_oConn.completePendingCommand())
-			{
-			    throw new RemoteFileSystemException("Failed to upload contents: " + m_oConn.getReplyString()) ;
-			}
-			if (!m_oConn.rename(sRemoteTmp, p_sRemoteName))
-			{
-			    throw new RemoteFileSystemException("Failed to rename file: " + m_oConn.getReplyString());
-			}
-		}
-		catch (IOException ex)
-		{
-			throw new RemoteFileSystemException(ex);
-		}
-	} // _________________________________
+        /**
+         * Uploads specified file from local directory (localDirURI) to remote
+         * directory (remoteDirURI)
+         * 
+         * @param p_oFile
+         *            String : filename to upload
+         * @throws RemoteFileSystemException :
+         *             if ftp connection cannot be established, or file cannot be
+         *             uploaded
+         *             <li> local file will be renamed during transfer
+         *             ('.xferNotReady' appended to name)</li>
+         *             <li> upon successful completion. the suffix '.xferDone' will
+         *             be appended to the original filename </li>
+         */
+        public void uploadFile (File p_oFile, String p_sRemoteName)
+                        throws RemoteFileSystemException
+        {
+                try
+                {
+                        changeRemoteDirectory() ;
+                        final String sRemoteTmp = p_sRemoteName + TMP_SUFFIX ;
+                        
+                        final OutputStream os = m_oConn.storeFileStream(sRemoteTmp) ;
+                        try
+                        {
+                            final FileInputStream fis = new FileInputStream(p_oFile) ;
+                            try
+                            {
+                                copyStream(fis, os) ;
+                            }
+                            finally
+                            {
+                                fis.close() ;
+                            }
+                        }
+                        finally
+                        {
+                            os.flush() ;
+                            os.close() ;
+                        }
+                        if (!m_oConn.completePendingCommand())
+                        {
+                            throw new RemoteFileSystemException("Failed to upload contents: " + m_oConn.getReplyString()) ;
+                        }
+                        
+                        boolean retryProblem = true;  // https://jira.jboss.org/jira/browse/JBESB-1995
 
-	/**
-	 * Downloads specified file from remote directory (remoteDirURI) to local
-	 * directory (localDirURI)
-	 * 
-	 * @param p_sFile
-	 *            String : filename to download
-	 * @throws RemoteFileSystemException :
-	 *             if ftp connection cannot be established, or file cannot be
-	 *             downloaded
-	 *             <li> local file is assigned a temporary name during transfer
-	 *             </li>
-	 *             <li> upon successful completion, local temporary file will be
-	 *             renamed to name specified in argument, and suffix '.xferDone'
-	 *             will be appended to the original filename in the remote
-	 *             directory </li>
-	 */
-	public void downloadFile (String p_sFile, String p_sFinalName)
-			throws RemoteFileSystemException
-	{
-		try
-		{
-			final File to = new File(p_sFinalName) ;
-			final File oLocalDir = new File(m_sLocalDir);
-			final File oNew = (to.isAbsolute() ? to : new File(oLocalDir, p_sFinalName)) ;
-			if (oNew.exists())
-			    oNew.delete();
-			
-			final File toTmp = new File(p_sFinalName + TMP_SUFFIX) ;
-			final File oNewTmp = (toTmp.isAbsolute() ? toTmp : new File(oLocalDir, p_sFinalName + TMP_SUFFIX)) ;
-			if (oNewTmp.exists())
-			    oNewTmp.delete();
-			
-			changeRemoteDirectory() ;
-			final InputStream is = m_oConn.retrieveFileStream(p_sFile) ;
-			if (is == null)
-			{
-			    throw new RemoteFileSystemException("Could not download file: " + m_oConn.getReplyString());
-			}
-			
-			try
-			{
-			    final FileOutputStream fos = new FileOutputStream(oNewTmp) ;
-			    try
-			    {
-			        copyStream(is, fos) ;
-			    }
-			    finally
-			    {
-			        fos.close() ;
-			    }
-			}
-			finally
-			{
-			    is.close() ;
-			}
-			if (!m_oConn.completePendingCommand())
-			{
-			    oNewTmp.delete() ;
-			    throw new RemoteFileSystemException("Failed to download contents: " + m_oConn.getReplyString()) ;
-			}
-			FileUtil.renameTo(oNewTmp, oNew);
-		}
-		catch (IOException ex)
-		{
-			throw new RemoteFileSystemException(ex);
-		}
-	} // _________________________________
+                        for (int i = 0; i < renameRetry; i++)
+                        {
+                            if (m_oConn.rename(sRemoteTmp, p_sRemoteName))
+                            {
+                                retryProblem = false;
 
-	private void checkParms () throws ConfigurationException
-	{
-		m_sFtpServer = m_oParms.getAttribute(PARMS_FTP_SERVER);
-		if (null == m_sFtpServer)
-			throw new ConfigurationException("No FTP server specified");
+                                break;
+                            }
+                            else
+                            {
+                                if (i+1 < renameRetry)
+                                {
+                                    try
+                                    {
+                                        Thread.sleep(RemoteFileSystem.DEFAULT_RENAME_RETRY_TIMEOUT);
+                                    }
+                                    catch (final Exception ex)
+                                    {
+                                    }
+                                }
+                            }
+                        }
 
-		m_sUser = m_oParms.getAttribute(PARMS_USER);
-		if (null == m_sUser)
-			throw new ConfigurationException("No username specified for FTP");
+                        if (retryProblem)
+                            throw new RemoteFileSystemException("Failed to rename file: " + m_oConn.getReplyString());
+                }
+                catch (IOException ex)
+                {
+                        throw new RemoteFileSystemException(ex);
+                }
+        } // _________________________________
 
-		m_sPasswd = m_oParms.getAttribute(PARMS_PASSWD);
-		if (null == m_sPasswd)
-			throw new ConfigurationException("No password specified for FTP");
+        /**
+         * Downloads specified file from remote directory (remoteDirURI) to local
+         * directory (localDirURI)
+         * 
+         * @param p_sFile
+         *            String : filename to download
+         * @throws RemoteFileSystemException :
+         *             if ftp connection cannot be established, or file cannot be
+         *             downloaded
+         *             <li> local file is assigned a temporary name during transfer
+         *             </li>
+         *             <li> upon successful completion, local temporary file will be
+         *             renamed to name specified in argument, and suffix '.xferDone'
+         *             will be appended to the original filename in the remote
+         *             directory </li>
+         */
+        public void downloadFile (String p_sFile, String p_sFinalName)
+                        throws RemoteFileSystemException
+        {
+                try
+                {
+                        final File to = new File(p_sFinalName) ;
+                        final File oLocalDir = new File(m_sLocalDir);
+                        final File oNew = (to.isAbsolute() ? to : new File(oLocalDir, p_sFinalName)) ;
+                        if (oNew.exists())
+                            oNew.delete();
+                        
+                        final File toTmp = new File(p_sFinalName + TMP_SUFFIX) ;
+                        final File oNewTmp = (toTmp.isAbsolute() ? toTmp : new File(oLocalDir, p_sFinalName + TMP_SUFFIX)) ;
+                        if (oNewTmp.exists())
+                            oNewTmp.delete();
+                        
+                        changeRemoteDirectory() ;
+                        final InputStream is = m_oConn.retrieveFileStream(p_sFile) ;
+                        if (is == null)
+                        {
+                            throw new RemoteFileSystemException("Could not download file: " + m_oConn.getReplyString());
+                        }
+                        
+                        try
+                        {
+                            final FileOutputStream fos = new FileOutputStream(oNewTmp) ;
+                            try
+                            {
+                                copyStream(is, fos) ;
+                            }
+                            finally
+                            {
+                                fos.close() ;
+                            }
+                        }
+                        finally
+                        {
+                            is.close() ;
+                        }
+                        if (!m_oConn.completePendingCommand())
+                        {
+                            oNewTmp.delete() ;
+                            throw new RemoteFileSystemException("Failed to download contents: " + m_oConn.getReplyString()) ;
+                        }
+                        FileUtil.renameTo(oNewTmp, oNew);
+                }
+                catch (IOException ex)
+                {
+                        throw new RemoteFileSystemException(ex);
+                }
+        } // _________________________________
 
-		m_sRemoteDir = m_oParms.getAttribute(PARMS_REMOTE_DIR);
-		if (null == m_sRemoteDir) 
-			m_sRemoteDir = "";
+        private void checkParms () throws ConfigurationException
+        {
+                m_sFtpServer = m_oParms.getAttribute(PARMS_FTP_SERVER);
+                if (null == m_sFtpServer)
+                        throw new ConfigurationException("No FTP server specified");
 
-		m_sLocalDir = m_oParms.getAttribute(PARMS_LOCAL_DIR);
-		if (null == m_sLocalDir) 
-			m_sLocalDir = ".";
+                m_sUser = m_oParms.getAttribute(PARMS_USER);
+                if (null == m_sUser)
+                        throw new ConfigurationException("No username specified for FTP");
 
-		String sAux = m_oParms.getAttribute(PARMS_PORT);
-		m_iPort = (null == sAux) ? 21 : Integer.parseInt(sAux);
+                m_sPasswd = m_oParms.getAttribute(PARMS_PASSWD);
+                if (null == m_sPasswd)
+                        throw new ConfigurationException("No password specified for FTP");
 
-		boolean bAscii = false;
-		sAux = m_oParms.getAttribute(PARMS_ASCII);
-		
-		if (null != sAux) 
-			bAscii = Boolean.parseBoolean(sAux);
-		
-		m_bAsciiTransferType = bAscii;
+                m_sRemoteDir = m_oParms.getAttribute(PARMS_REMOTE_DIR);
+                if (null == m_sRemoteDir) 
+                        m_sRemoteDir = "";
 
-		m_bPassive = false;
-		sAux = m_oParms.getAttribute(PARMS_PASSIVE);
-		m_bPassive = (null != sAux) && Boolean.parseBoolean(sAux);
-	} // __________________________________
+                m_sLocalDir = m_oParms.getAttribute(PARMS_LOCAL_DIR);
+                if (null == m_sLocalDir) 
+                        m_sLocalDir = ".";
 
-	public static String fileToFtpString (File p_oF)
-	{
-		return (null == p_oF) ? null : p_oF.toString().replace("\\", "/");
-	} // ________________________________
+                String sAux = m_oParms.getAttribute(PARMS_PORT);
+                m_iPort = (null == sAux) ? 21 : Integer.parseInt(sAux);
+
+                boolean bAscii = false;
+                sAux = m_oParms.getAttribute(PARMS_ASCII);
+                
+                if (null != sAux) 
+                        bAscii = Boolean.parseBoolean(sAux);
+                
+                m_bAsciiTransferType = bAscii;
+
+                m_bPassive = false;
+                sAux = m_oParms.getAttribute(PARMS_PASSIVE);
+                m_bPassive = (null != sAux) && Boolean.parseBoolean(sAux);
+                
+                String renameRetryString = ModulePropertyManager.getPropertyManager(
+                        ModulePropertyManager.TRANSPORTS_MODULE).getProperty(
+                        Environment.FTP_RENAME_RETRY, null);
+
+                if (renameRetryString != null)
+                {
+                    try
+                    {
+                        renameRetry = Integer.parseInt(renameRetryString);
+                    }
+                    catch (Exception ex)
+                    {
+                        throw new ConfigurationException("Invalid rename retry limit: "+renameRetryString);
+                    }
+                }
+                else
+                    renameRetry = RemoteFileSystem.DEFAULT_RENAME_RETRY_NUMBER;
+                
+                if (renameRetry < 1)
+                    renameRetry = 1;
+        } // __________________________________
+
+        public static String fileToFtpString (File p_oF)
+        {
+                return (null == p_oF) ? null : p_oF.toString().replace("\\", "/");
+        } // ________________________________
         
         private void changeRemoteDirectory()
             throws IOException, RemoteFileSystemException

Modified: labs/jbossesb/workspace/maeste/product/rosetta/src/org/jboss/soa/esb/util/RemoteFileSystem.java
===================================================================
--- labs/jbossesb/workspace/maeste/product/rosetta/src/org/jboss/soa/esb/util/RemoteFileSystem.java	2008-09-23 20:58:25 UTC (rev 23022)
+++ labs/jbossesb/workspace/maeste/product/rosetta/src/org/jboss/soa/esb/util/RemoteFileSystem.java	2008-09-23 21:17:48 UTC (rev 23023)
@@ -28,143 +28,147 @@
 public interface RemoteFileSystem
 {
 
-	public static final String FTP_PROTOCOL = "ftp";
+        public static final String FTP_PROTOCOL = "ftp";
 
-	public static final String SFTP_PROTOCOL = "sftp";
+        public static final String SFTP_PROTOCOL = "sftp";
 
-	public static final String FTPS_PROTOCOL = "ftps";
+        public static final String FTPS_PROTOCOL = "ftps";
 
-	public static final String PARMS_PROTOCOL = "protocol";
+        public static final String PARMS_PROTOCOL = "protocol";
 
-	public static final String PARMS_FTP_SERVER = "ftpServer";
+        public static final String PARMS_FTP_SERVER = "ftpServer";
 
-	public static final String PARMS_USER = "ftpUser";
+        public static final String PARMS_USER = "ftpUser";
 
-	public static final String PARMS_PASSWD = "ftpPassword";
+        public static final String PARMS_PASSWD = "ftpPassword";
 
-	public static final String PARMS_PORT = "ftpPort";
+        public static final String PARMS_PORT = "ftpPort";
 
-	public static final String PARMS_REMOTE_DIR = "ftpRemoteDir";
+        public static final String PARMS_REMOTE_DIR = "ftpRemoteDir";
 
-	public static final String PARMS_LOCAL_DIR = "ftpLocalDir";
+        public static final String PARMS_LOCAL_DIR = "ftpLocalDir";
 
-	public static final String PARMS_ASCII = "ftpAscii";
+        public static final String PARMS_ASCII = "ftpAscii";
 
-	public static final String PARMS_PASSIVE = "ftpPassive";
+        public static final String PARMS_PASSIVE = "ftpPassive";
 
-	public static final String PARMS_CERTIFICATE = "certificate";
+        public static final String PARMS_CERTIFICATE = "certificate";
 
-	public static final String PARMS_CERTIFICATE_NAME = "certificateName";
+        public static final String PARMS_CERTIFICATE_NAME = "certificateName";
 
-	public static final String PARMS_PASSPHRASE = "passphrase";
-	
-	public String getRemoteDir ();
+        public static final String PARMS_PASSPHRASE = "passphrase";
+        
+        public static final int DEFAULT_RENAME_RETRY_NUMBER = 10; // default retries
+        
+        public static final int DEFAULT_RENAME_RETRY_TIMEOUT = 1000;  // 1 second
+        
+        public String getRemoteDir ();
 
-	/**
-	 * Terminates ftp session and frees resources
-	 * <li>Well behaved programs should make sure to call this method </li>
-	 */
-	public void quit (); // _________________________________
+        /**
+         * Terminates ftp session and frees resources
+         * <li>Well behaved programs should make sure to call this method </li>
+         */
+        public void quit (); // _________________________________
 
-	/**
-	 * Deletes specified file in remote directory
-	 * 
-	 * @param p_sFile
-	 *            String : filename to delete. Method will attempt to delete
-	 *            file with rightmost node of argument within remote directory
-	 *            specified in 'remoteDirURI'
-	 * @throws RemoteFileSystemException :
-	 *             if ftp connection cannot be established, or file cannot be
-	 *             deleted in remote directory
-	 */
-	public void deleteRemoteFile (String p_sFile) throws RemoteFileSystemException; // _________________________________
+        /**
+         * Deletes specified file in remote directory
+         * 
+         * @param p_sFile
+         *            String : filename to delete. Method will attempt to delete
+         *            file with rightmost node of argument within remote directory
+         *            specified in 'remoteDirURI'
+         * @throws RemoteFileSystemException :
+         *             if ftp connection cannot be established, or file cannot be
+         *             deleted in remote directory
+         */
+        public void deleteRemoteFile (String p_sFile) throws RemoteFileSystemException; // _________________________________
 
-	public void remoteDelete (File p_oFile) throws RemoteFileSystemException; // _________________________________
+        public void remoteDelete (File p_oFile) throws RemoteFileSystemException; // _________________________________
 
-	/**
-	 * Gets the list of files in the remote directory that end with arg0
-	 * 
-	 * @param p_sSuffix
-	 *            String : retrieve only files that end with that suffix - all
-	 *            files if null
-	 * @throws RemoteFileSystemException :
-	 *             if ftp connection cannot be established, or problems
-	 *             encountered
-	 */
-	public String[] getFileListFromRemoteDir (String p_sSuffix)
-			throws IOException, RemoteFileSystemException; // _________________________________
+        /**
+         * Gets the list of files in the remote directory that end with arg0
+         * 
+         * @param p_sSuffix
+         *            String : retrieve only files that end with that suffix - all
+         *            files if null
+         * @throws RemoteFileSystemException :
+         *             if ftp connection cannot be established, or problems
+         *             encountered
+         */
+        public String[] getFileListFromRemoteDir (String p_sSuffix)
+                        throws IOException, RemoteFileSystemException; // _________________________________
 
-	/**
-	 * Change remote directory
-	 * 
-	 * @param p_sDir
-	 *            String : directory to set
-	 * @throws RemoteFileSystemException :
-	 *             if ftp connection cannot be established, or problems
-	 *             encountered
-	 */
-	public void setRemoteDir (String p_sDir) throws RemoteFileSystemException; // _________________________________
+        /**
+         * Change remote directory
+         * 
+         * @param p_sDir
+         *            String : directory to set
+         * @throws RemoteFileSystemException :
+         *             if ftp connection cannot be established, or problems
+         *             encountered
+         */
+        public void setRemoteDir (String p_sDir) throws RemoteFileSystemException; // _________________________________
 
-	/**
-	 * Renames specified file in remote directory to specified new name
-	 * 
-	 * @param p_sFrom
-	 *            String : filename to rename
-	 * @param p_sTo
-	 *            String : new filename
-	 * @throws RemoteFileSystemException :
-	 *             if ftp connection cannot be established, or file cannot be
-	 *             renamed to new name in remote directory
-	 *             <li>Method will attempt to rename file with rightmost node
-	 *             of argument within remote directory specified in
-	 *             'remoteDirURI', to new name inside the SAME remote directory
-	 */
-	public void renameInRemoteDir (String p_sFrom, String p_sTo)
-			throws RemoteFileSystemException; // _________________________________
+        /**
+         * Renames specified file in remote directory to specified new name
+         * 
+         * @param p_sFrom
+         *            String : filename to rename
+         * @param p_sTo
+         *            String : new filename
+         * @throws RemoteFileSystemException :
+         *             if ftp connection cannot be established, or file cannot be
+         *             renamed to new name in remote directory
+         *             <li>Method will attempt to rename file with rightmost node
+         *             of argument within remote directory specified in
+         *             'remoteDirURI', to new name inside the SAME remote directory
+         */
+        public void renameInRemoteDir (String p_sFrom, String p_sTo)
+                        throws RemoteFileSystemException; // _________________________________
 
-	/**
-	 * 
-	 * @param p_oFrom
-	 * @param p_oTo
-	 * @throws IOException if file not found.
-	 * @throws RemoteFileSystemException
-	 */
-	public void remoteRename (File p_oFrom, File p_oTo) throws IOException, RemoteFileSystemException; // _________________________________
+        /**
+         * 
+         * @param p_oFrom
+         * @param p_oTo
+         * @throws IOException if file not found.
+         * @throws RemoteFileSystemException
+         */
+        public void remoteRename (File p_oFrom, File p_oTo) throws IOException, RemoteFileSystemException; // _________________________________
 
-	/**
-	 * Uploads specified file from local directory (localDirURI) to remote
-	 * directory (remoteDirURI)
-	 * 
-	 * @param p_oFile
-	 *            String : filename to upload
-	 * @throws RemoteFileSystemException :
-	 *             if ftp connection cannot be established, or file cannot be
-	 *             uploaded
-	 *             <li> local file will be renamed during transfer
-	 *             ('.xferNotReady' appended to name)</li>
-	 *             <li> upon successful completion. the suffix '.xferDone' will
-	 *             be appended to the original filename </li>
-	 */
-	public void uploadFile (File p_oFile, String p_sRemoteName)
-			throws RemoteFileSystemException; // _________________________________
+        /**
+         * Uploads specified file from local directory (localDirURI) to remote
+         * directory (remoteDirURI)
+         * 
+         * @param p_oFile
+         *            String : filename to upload
+         * @throws RemoteFileSystemException :
+         *             if ftp connection cannot be established, or file cannot be
+         *             uploaded
+         *             <li> local file will be renamed during transfer
+         *             ('.xferNotReady' appended to name)</li>
+         *             <li> upon successful completion. the suffix '.xferDone' will
+         *             be appended to the original filename </li>
+         */
+        public void uploadFile (File p_oFile, String p_sRemoteName)
+                        throws RemoteFileSystemException; // _________________________________
 
-	/**
-	 * Downloads specified file from remote directory (remoteDirURI) to local
-	 * directory (localDirURI)
-	 * 
-	 * @param p_sFile
-	 *            String : filename to download
-	 * @throws RemoteFileSystemException :
-	 *             if ftp connection cannot be established, or file cannot be
-	 *             downloaded
-	 *             <li> local file is assigned a temporary name during transfer
-	 *             </li>
-	 *             <li> upon successful completion, local temporary file will be
-	 *             renamed to name specified in argument, and suffix '.xferDone'
-	 *             will be appended to the original filename in the remote
-	 *             directory </li>
-	 */
-	public void downloadFile (String p_sFile, String p_sFinalName)
-			throws IOException, RemoteFileSystemException; // _________________________________
+        /**
+         * Downloads specified file from remote directory (remoteDirURI) to local
+         * directory (localDirURI)
+         * 
+         * @param p_sFile
+         *            String : filename to download
+         * @throws RemoteFileSystemException :
+         *             if ftp connection cannot be established, or file cannot be
+         *             downloaded
+         *             <li> local file is assigned a temporary name during transfer
+         *             </li>
+         *             <li> upon successful completion, local temporary file will be
+         *             renamed to name specified in argument, and suffix '.xferDone'
+         *             will be appended to the original filename in the remote
+         *             directory </li>
+         */
+        public void downloadFile (String p_sFile, String p_sFinalName)
+                        throws IOException, RemoteFileSystemException; // _________________________________
 
 }
\ No newline at end of file

Modified: labs/jbossesb/workspace/maeste/product/samples/quickstarts/transform_CSV2XML/readme.txt
===================================================================
--- labs/jbossesb/workspace/maeste/product/samples/quickstarts/transform_CSV2XML/readme.txt	2008-09-23 20:58:25 UTC (rev 23022)
+++ labs/jbossesb/workspace/maeste/product/samples/quickstarts/transform_CSV2XML/readme.txt	2008-09-23 21:17:48 UTC (rev 23023)
@@ -15,7 +15,7 @@
   and a more detailed descripton of the different ways to run the quickstarts.
 
   A comprehensive description of message transformation can be found in
-  MessageTransformation.pdf, located in the docs/services folder.
+  the ProgrammersGuide.pdf, located in the docs folder.
 
 To Run standalone mode:
 =======================

Modified: labs/jbossesb/workspace/maeste/product/tools/jonplugin/install.sh
===================================================================
--- labs/jbossesb/workspace/maeste/product/tools/jonplugin/install.sh	2008-09-23 20:58:25 UTC (rev 23022)
+++ labs/jbossesb/workspace/maeste/product/tools/jonplugin/install.sh	2008-09-23 21:17:48 UTC (rev 23023)
@@ -1,4 +1,6 @@
 #!/bin/sh
+rm -rf ~/.m2/repository/org/jboss/on/rhq-jbossesb-plugin
 mvn -Dmaven.test.skip=true clean install
 cp target/rhq-jbossesb-plugin-2.1.0-SNAPSHOT.jar ~/src/rhq/dev-container/jbossas/server/default/deploy/rhq.ear/rhq-downloads/rhq-plugins
 cp target/rhq-jbossesb-plugin-2.1.0-SNAPSHOT.jar ~/src/jon/jon/dist/agent/target/jon-agent-2.1.0-SNAPSHOT/plugins/rhq-jbossesb-plugin-2.1.0-SNAPSHOT.jar
+

Modified: labs/jbossesb/workspace/maeste/product/tools/jonplugin/pom.xml
===================================================================
--- labs/jbossesb/workspace/maeste/product/tools/jonplugin/pom.xml	2008-09-23 20:58:25 UTC (rev 23022)
+++ labs/jbossesb/workspace/maeste/product/tools/jonplugin/pom.xml	2008-09-23 21:17:48 UTC (rev 23023)
@@ -25,6 +25,15 @@
       <scm.module.path>jon/plugins/jbossesb/</scm.module.path>
    </properties>
 
+   <dependencies>
+      <dependency>
+         <groupId>org.jboss.on</groupId>
+         <artifactId>rhq-jbossas-plugin</artifactId>
+         <version>2.1.0-SNAPSHOT</version>
+         <scope>provided</scope>
+      </dependency>
+   </dependencies>
+
    <build>
       <plugins>
 
@@ -66,7 +75,6 @@
 
          <build>
             <plugins>
-
                <!-- Integration testing voodoo to load and test this plugin with its plugin dependencies -->
                <plugin>
                   <artifactId>maven-antrun-plugin</artifactId>

Modified: labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ActionComponent.java
===================================================================
--- labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ActionComponent.java	2008-09-23 20:58:25 UTC (rev 23022)
+++ labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ActionComponent.java	2008-09-23 21:17:48 UTC (rev 23023)
@@ -21,7 +21,7 @@
 import java.util.Set;
 
 import org.mc4j.ems.connection.bean.attribute.EmsAttribute;
-import org.mc4j.ems.connection.bean.operation.EmsOperation;
+import org.rhq.core.domain.measurement.AvailabilityType;
 import org.rhq.core.domain.measurement.MeasurementDataNumeric;
 import org.rhq.core.domain.measurement.MeasurementReport;
 import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
@@ -45,17 +45,48 @@
     private static final String PROCESSING_TIME = "processing time";
     private static final String OVERALL_BYTES_PROCESSED = "processed bytes";
     private static final String OVERALL_BYTES_FAILED = "failed bytes";
-    
+
+    private static final String OVERALL_METRIC_NAME = "overallMessagesCount";
     private static final String SUCCESS_METRIC_NAME = "successProcessedCount";
     private static final String FAILED_METRIC_NAME = "failedProcessedCount";
     private static final String PROCESSINGTIME_METRIC_NAME = "processingTime";
     private static final String BYTESPROCESSED_METRIC_NAME = "overallBytesProcessed";
     private static final String BYTESFAILED_METRIC_NAME = "overallBytesFailed";
 
+    /**
+     * Is this service alive?
+     *
+     * @return true if the service is running
+     */
     @Override
+	public AvailabilityType getAvailability() {
+        try {
+        	EmsBean emsbean = getEmsBean();
+        	if (emsbean.isRegistered()) {
+            	String actionName = this.context.getResourceKey();
+            	actionName = actionName.trim();
+        		EmsAttribute attribute = this.bean.getAttribute(actionName + " " + SUCCESS_PROCESSED);
+        		if (attribute != null) {
+        			return AvailabilityType.UP;
+        		}
+        		return AvailabilityType.DOWN;
+        	} else {
+        		return AvailabilityType.DOWN;
+        	}
+        } catch (NullPointerException npe) {
+            if (resourceContext != null) {
+                log.warn("Could not determine availability of unknown ems bean for ["
+                    + resourceContext.getResourceType() + ":" + resourceContext.getResourceKey() + "]");
+            }
+
+            return AvailabilityType.DOWN;
+        }
+    }
+    
+    @Override
     public void start(ResourceContext<MBeanResourceComponent> context) {
        	super.start(context); 
-	this.context = context;
+       	this.context = context;
         this.bean = context.getParentResourceComponent().getEmsBean();
     }
 
@@ -69,7 +100,8 @@
     	actionName = actionName.trim();
         //Object entityStatistics = operation.invoke(context.getResourceKey());
 
-        for (MeasurementScheduleRequest request : requests) {
+    	int counter = 0;
+    	for (MeasurementScheduleRequest request : requests) {
         	String metricName = request.getName();
         	if (metricName.equals (SUCCESS_METRIC_NAME)) {
         		EmsAttribute attribute = this.bean.getAttribute(actionName + " " + SUCCESS_PROCESSED);
@@ -77,6 +109,7 @@
         		if (attribute != null) {
         			processed = (Integer) attribute.refresh();
         		}
+        		counter += processed.intValue();
         		report.addData(new MeasurementDataNumeric(request, new Double(processed.doubleValue())));
         	} else if (metricName.equals(FAILED_METRIC_NAME)) {
         		EmsAttribute attribute = this.bean.getAttribute(actionName + " " + FAILED_PROCESSED);
@@ -84,6 +117,7 @@
         	    if (attribute != null) {
         	    	processed = (Integer) attribute.refresh();
         	    }
+        	    counter += processed.intValue();
         		report.addData(new MeasurementDataNumeric(request, new Double(processed.doubleValue())));
         	} else if (metricName.equals(PROCESSINGTIME_METRIC_NAME)) {
         		EmsAttribute attribute = this.bean.getAttribute(actionName + " " + PROCESSING_TIME);
@@ -110,5 +144,11 @@
         		report.addData(new MeasurementDataNumeric(request, new Double(bytesProcessed.doubleValue())));        		
         	}
         }
+    	for (MeasurementScheduleRequest request : requests) {
+        	String metricName = request.getName();
+        	if (metricName.equals (OVERALL_METRIC_NAME)) {
+        		report.addData(new MeasurementDataNumeric(request, new Double(counter)));        		
+        	}
+    	}
     }
 }

Modified: labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ActionDiscoveryComponent.java
===================================================================
--- labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ActionDiscoveryComponent.java	2008-09-23 20:58:25 UTC (rev 23022)
+++ labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ActionDiscoveryComponent.java	2008-09-23 21:17:48 UTC (rev 23023)
@@ -22,7 +22,6 @@
 import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Set;
 
 import org.apache.commons.logging.Log;
@@ -31,11 +30,9 @@
 import org.mc4j.ems.connection.bean.attribute.EmsAttribute;
 import org.rhq.core.domain.configuration.Configuration;
 import org.rhq.core.domain.configuration.Property;
-import org.rhq.core.domain.configuration.PropertySimple;
 import org.rhq.core.domain.measurement.AvailabilityType;
 import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
 import org.rhq.core.pluginapi.inventory.ResourceContext;
-import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
 import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
 import org.rhq.plugins.jmx.JMXComponent;
 import org.rhq.plugins.jmx.MBeanResourceComponent;

Copied: labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/DeploymentComponent.java (from rev 22992, labs/jbossesb/trunk/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/DeploymentComponent.java)
===================================================================
--- labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/DeploymentComponent.java	                        (rev 0)
+++ labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/DeploymentComponent.java	2008-09-23 21:17:48 UTC (rev 23023)
@@ -0,0 +1,303 @@
+package org.jbosson.plugins.jbossesb;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+import org.mc4j.ems.connection.bean.EmsBean;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.content.PackageDetailsKey;
+import org.rhq.core.domain.content.PackageType;
+import org.rhq.core.domain.content.transfer.ContentResponseResult;
+import org.rhq.core.domain.content.transfer.DeployIndividualPackageResponse;
+import org.rhq.core.domain.content.transfer.DeployPackageStep;
+import org.rhq.core.domain.content.transfer.DeployPackagesResponse;
+import org.rhq.core.domain.content.transfer.RemovePackagesResponse;
+import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.resource.CreateResourceStatus;
+import org.rhq.core.pluginapi.content.ContentContext;
+import org.rhq.core.pluginapi.content.ContentFacet;
+import org.rhq.core.pluginapi.content.ContentServices;
+import org.rhq.core.pluginapi.event.EventContext;
+import org.rhq.core.pluginapi.inventory.CreateResourceReport;
+import org.rhq.core.pluginapi.inventory.DeleteResourceFacet;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.pluginapi.operation.OperationContext;
+import org.rhq.core.pluginapi.operation.OperationFacet;
+import org.rhq.plugins.jbossas.util.FileContentDelegate;
+import org.rhq.plugins.jmx.JMXComponent;
+import org.rhq.plugins.jmx.MBeanResourceComponent;
+import org.rhq.plugins.utils.FileUtils;
+
+/**
+ * Component for ESB package deployment.
+ *
+ * @author Tom Cunningham
+ * @param <T>
+ */
+public class DeploymentComponent extends MBeanResourceComponent<JMXComponent> implements 
+	OperationFacet, DeleteResourceFacet, ContentFacet {
+    public static final String JBOSS_WEB_NAME = "jbossWebName";
+    private EmsBean jbossWebMBean;
+    private File configPath;
+
+    private ResourceContext resourceContext;
+    private ContentContext contentContext;
+    private OperationContext operationContext;
+    private EventContext eventContext;
+    
+    // The following constants reference the exact name of the package types as defined in the plugin descriptor
+    private static final String PACKAGE_TYPE_PATCH = "cumulativePatch";
+    private static final String PACKAGE_TYPE_LIBRARY = "library";
+
+
+    private static final String RESOURCE_TYPE_ESB = "JBoss ESB Deployments";
+
+    public File getConfigurationPath() {
+        return this.configPath;
+    }
+        
+    public CreateResourceReport createResource(CreateResourceReport report) {
+        String resourceTypeName = report.getResourceType().getName();
+
+        if (resourceTypeName.equals(RESOURCE_TYPE_ESB)) {
+        	esbCreate(report, resourceTypeName);
+        } else {
+            throw new UnsupportedOperationException("Unknown Resource type: " + resourceTypeName);
+        }
+
+        return report;
+    }
+    
+    private void esbCreate(CreateResourceReport report, String resourceTypeName) {
+        ResourcePackageDetails details = report.getPackageDetails();
+        PackageDetailsKey key = details.getKey();
+        String archiveName = key.getName();
+
+        try {
+            // First check to see if the file name has the correct extension. Reject if the user attempts to
+            // deploy a WAR file with a bad extension.
+            String expectedExtension;
+            if (resourceTypeName.equals(RESOURCE_TYPE_ESB)) {
+                expectedExtension = "esb";
+            } else {
+            	expectedExtension = "";
+            }
+            
+            int lastPeriod = archiveName.lastIndexOf(".");
+            String extension = archiveName.substring(lastPeriod + 1);
+            if (lastPeriod == -1 || !expectedExtension.equals(extension)) {
+                report.setStatus(CreateResourceStatus.FAILURE);
+                report.setErrorMessage("Incorrect extension specified on filename [" + archiveName + "]. Expected ["
+                    + expectedExtension + "]");
+                return;
+            }
+
+            Configuration deployTimeConfiguration = details.getDeploymentTimeConfiguration();
+            String deployDirectory = deployTimeConfiguration.getSimple("deployDirectory").getStringValue();
+
+            // Verify the user did not enter a path that represents a security issue:
+            // - No absolute directories; must be relative to the configuration path
+            // - Cannot contain parent directory references
+            File testPath = new File(deployDirectory);
+
+            if (testPath.isAbsolute()) {
+                throw new RuntimeException("Path to deploy (deployDirectory) must be a relative path. Path specified: "
+                    + deployDirectory);
+            }
+
+            if (deployDirectory.contains("..")) {
+                throw new RuntimeException(
+                    "Path to deploy (deployDirectory) may not reference the parent directory. Path specified: "
+                        + deployDirectory);
+            }
+
+            // Perform the deployment
+            FileContentDelegate deployer = new FileContentDelegate(new File(getConfigurationPath() + File.separator
+                + deployDirectory), "", details.getPackageTypeName());
+
+            PropertySimple zipProperty = deployTimeConfiguration.getSimple("deployZipped");
+
+            if (zipProperty != null && zipProperty.getBooleanValue() != null) {
+                boolean zip = zipProperty.getBooleanValue();
+
+                File tempDir = resourceContext.getTemporaryDirectory();
+                File tempFile = new File(tempDir.getAbsolutePath(), "esb.bin");
+                OutputStream osForTempDir = new BufferedOutputStream(new FileOutputStream(tempFile));
+
+                ContentServices contentServices = contentContext.getContentServices();
+                contentServices
+                    .downloadPackageBitsForChildResource(contentContext, resourceTypeName, key, osForTempDir);
+
+                osForTempDir.close();
+
+                // check for content 
+                boolean valid = isOfType(tempFile, resourceTypeName);
+                if (!valid) {
+                    report.setStatus(CreateResourceStatus.FAILURE);
+                    report.setErrorMessage("Expected a " + resourceTypeName
+                        + " file, but its format/content did not match");
+                    return;
+                }
+
+                InputStream isForTempDir = new BufferedInputStream(new FileInputStream(tempFile));
+                deployer.createContent(details, isForTempDir, !zip);
+
+                // Resource key should match the following:      
+                // EAR: jboss.management.local:J2EEServer=Local,j2eeType=J2EEApplication,name=rhq.ear      
+                // WAR: jboss.management.local:J2EEApplication=null,J2EEServer=Local,j2eeType=WebModule,name=embedded-console.war
+
+                String resourceKey;
+                if (resourceTypeName.equals(RESOURCE_TYPE_ESB)) {
+                    resourceKey = "jboss.esb:deployment="
+                        + archiveName;
+                } 
+
+                report.setResourceName(archiveName);
+                //report.setResourceKey(resourceKey);
+                report.setStatus(CreateResourceStatus.SUCCESS);
+                sleepAfterConfigXmlUpdate();
+            } else {
+                report.setStatus(CreateResourceStatus.FAILURE);
+                report.setErrorMessage("Zipped property is required");
+            }
+        } catch (Throwable t) {
+            log.error("Error deploying application for report: " + report, t);
+            report.setException(t);
+            report.setStatus(CreateResourceStatus.FAILURE);
+        }
+    }
+
+    /**
+     * Check to see if the passed file is actually in jar format and contains a 
+     * <ul>
+     * <li>WEB-INF/web.xml for .war </li>
+     * <li>META-INF/application.xml for .ear</li>
+     * <li>META-INF/jboss.service.xml for .sar</li>
+     * </ul>
+     * @param file File to check
+     * @param type Type to match - see RESOURCE_TYPE_SAR, RESOURCE_TYPE_WAR and RESOURCE_TYPE_EAR
+     * @return true is the file is in jar format and matches the type
+     */
+    private boolean isOfType(File file, String type) {
+        JarFile jfile = null;
+        try {
+            jfile = new JarFile(file);
+            JarEntry entry;
+            if (RESOURCE_TYPE_ESB.equals(type))
+                entry = jfile.getJarEntry("META-INF/jboss-esb.xml");
+            else {
+                entry = null; // unknown type
+                log.warn("isOfType: " + type + " is unknown - not a valid file");
+            }
+
+            if (entry != null)
+                return true;
+
+            return false;
+        } catch (Exception e) {
+            log.info(e.getMessage());
+            return false;
+        } finally {
+            if (jfile != null)
+                try {
+                    jfile.close();
+                } catch (IOException e) {
+                    log.info("Exception when trying to close the war file: " + e.getMessage());
+                }
+        }
+    }
+    
+    private void sleepAfterConfigXmlUpdate() {
+        // JBNADM-1984 - The contract with this method is that the newly created managed resource should be discoverable.
+        //               Wait here so JBoss can recognize that the new managed resource has been created.
+        try {
+            Thread.sleep(5000L);
+        } catch (InterruptedException e) {
+            log.info("Sleep after Resource create interrupted", e);
+        }
+    }
+    
+    @Override
+	public AvailabilityType getAvailability() {
+        //        JBossASTomcatServerComponent parentTomcatComponent = (JBossASTomcatServerComponent) super.resourceContext
+        //            .getParentResourceComponent();
+        //        EmsConnection connection = parentTomcatComponent.getEmsConnection();
+        boolean isreg = bean.isRegistered();
+        return isreg ? AvailabilityType.UP : AvailabilityType.DOWN;
+    }
+
+	public void deleteResource() throws Exception {
+        Configuration pluginConfiguration = super.resourceContext.getPluginConfiguration();
+        String fullFileName = pluginConfiguration.getSimple("filename").getStringValue();
+
+        File file = new File(fullFileName);
+
+        if (!file.exists()) {
+            throw new Exception("Cannot find application file to delete: " + fullFileName);
+        }
+
+        if (file.isDirectory()) {
+            FileUtils.deleteDirectoryContents(file.listFiles());
+        }
+
+        boolean result = file.delete();
+
+        if (!result) {
+            throw new Exception("File delete call returned unsuccessful with no further detail");
+        }
+	}
+
+	public DeployPackagesResponse deployPackages(
+			Set<ResourcePackageDetails> packages,
+			ContentServices contentServices) {
+        ContentResponseResult overallResult = ContentResponseResult.SUCCESS;
+        List<DeployIndividualPackageResponse> individualResponses = new ArrayList<DeployIndividualPackageResponse>(
+            packages.size());
+
+        for (ResourcePackageDetails pkg : packages) {
+            log.info("Attempting to deploy package: " + pkg);
+
+            String packageTypeName = pkg.getPackageTypeName();
+            if (packageTypeName.equals(PACKAGE_TYPE_LIBRARY)) {
+                throw new UnsupportedOperationException("Deployment of new libraries is not supported by the plugin.");
+            }
+        }
+
+        DeployPackagesResponse response = new DeployPackagesResponse(overallResult);
+        response.getPackageResponses().addAll(individualResponses);
+
+        return response;
+	}
+
+	public Set<ResourcePackageDetails> discoverDeployedPackages(PackageType type) {
+		return null;
+	}
+
+	public List<DeployPackageStep> generateInstallationSteps(
+			ResourcePackageDetails packageDetails) {
+		return null;
+	}
+
+	public RemovePackagesResponse removePackages(
+			Set<ResourcePackageDetails> packages) {
+		return null;
+	}
+
+	public InputStream retrievePackageBits(ResourcePackageDetails packageDetails) {
+		return null;
+	}
+
+}

Copied: labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ESBComponent.java (from rev 22992, labs/jbossesb/trunk/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ESBComponent.java)
===================================================================
--- labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ESBComponent.java	                        (rev 0)
+++ labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ESBComponent.java	2008-09-23 21:17:48 UTC (rev 23023)
@@ -0,0 +1,228 @@
+package org.jbosson.plugins.jbossesb;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.content.PackageDetailsKey;
+import org.rhq.core.domain.content.PackageType;
+import org.rhq.core.domain.content.transfer.ContentResponseResult;
+import org.rhq.core.domain.content.transfer.DeployIndividualPackageResponse;
+import org.rhq.core.domain.content.transfer.DeployPackageStep;
+import org.rhq.core.domain.content.transfer.DeployPackagesResponse;
+import org.rhq.core.domain.content.transfer.RemovePackagesResponse;
+import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.resource.CreateResourceStatus;
+import org.rhq.core.pluginapi.content.ContentContext;
+import org.rhq.core.pluginapi.content.ContentFacet;
+import org.rhq.core.pluginapi.content.ContentServices;
+import org.rhq.core.pluginapi.inventory.CreateChildResourceFacet;
+import org.rhq.core.pluginapi.inventory.CreateResourceReport;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.pluginapi.operation.OperationContext;
+import org.rhq.core.pluginapi.util.ResponseTimeLogParser;
+import org.rhq.plugins.jbossas.JBossASServerComponent;
+import org.rhq.plugins.jbossas.util.FileContentDelegate;
+import org.rhq.plugins.jmx.MBeanResourceComponent;
+
+public class ESBComponent extends MBeanResourceComponent implements CreateChildResourceFacet, ContentFacet {
+   private static final String RESOURCE_TYPE_ESB = "JBoss ESB Deployment";
+
+   private String configSet;
+   private ResponseTimeLogParser logParser;
+   private File configPath;
+
+   private ContentContext contentContext;
+   private OperationContext operationContext;
+   public static final String CONTEXT_ROOT_CONFIG_PROP = "contextRoot";
+   // The following constants reference the exact name of the package types as defined in the plugin descriptor
+   private static final String PACKAGE_TYPE_PATCH = "cumulativePatch";
+   private static final String PACKAGE_TYPE_LIBRARY = "library";
+
+   public static final String CONFIGURATION_PATH_CONFIG_PROP = "configurationPath";
+   public static final String SCRIPT_PREFIX_CONFIG_PROP = "scriptPrefix";
+   public static final String CONFIGURATION_SET_CONFIG_PROP = "configurationSet";
+
+   public static final String JBOSS_HOME_DIR_CONFIG_PROP = "jbossHomeDir";
+
+   
+   @Override
+   public void start(ResourceContext context) {
+	   super.start(context);
+	   Configuration pluginConfig = context.getPluginConfiguration();
+
+	   this.configPath = getConfigurationPath();
+	   if (!this.configPath.exists()) {
+		   throw new InvalidPluginConfigurationException("Configuration path '" + configPath + "' does not exist.");
+	   }
+	   this.configSet = pluginConfig.getSimpleValue(CONFIGURATION_SET_CONFIG_PROP, this.configPath.getName());
+   }
+   
+   public File getConfigurationPath() {
+	   JBossASServerComponent jass = (JBossASServerComponent) resourceContext.getParentResourceComponent();
+	   return jass.getConfigurationPath();
+   }
+     
+   @Override
+   public AvailabilityType getAvailability() {
+	   AvailabilityType av = super.getAvailability();
+	   return av;
+   }
+      
+   private void esbCreate(CreateResourceReport report, String resourceTypeName) {
+        ResourcePackageDetails details = report.getPackageDetails();
+        PackageDetailsKey key = details.getKey();
+        String archiveName = key.getName();
+
+        try {
+            // First check to see if the file name has the correct extension. Reject if the user attempts to
+            // deploy a WAR file with a bad extension.
+            String expectedExtension;
+            if (resourceTypeName.equals(RESOURCE_TYPE_ESB)) {
+                expectedExtension = "esb";
+            } else {
+                expectedExtension = "";
+            }
+	        
+            int lastPeriod = archiveName.lastIndexOf(".");
+	        String extension = archiveName.substring(lastPeriod + 1);
+	        if (lastPeriod == -1 || !expectedExtension.equals(extension)) {
+	        	report.setStatus(CreateResourceStatus.FAILURE);
+	            report.setErrorMessage("Incorrect extension specified on filename [" + archiveName + "]. Expected ["
+	            	+ expectedExtension + "]");
+	            return;
+	        }
+
+            Configuration deployTimeConfiguration = details.getDeploymentTimeConfiguration();
+            String deployDirectory = deployTimeConfiguration.getSimple("deployDirectory").getStringValue();
+
+            // Verify the user did not enter a path that represents a security issue:
+            // - No absolute directories; must be relative to the configuration path
+            // - Cannot contain parent directory references
+            File testPath = new File(deployDirectory);
+
+            if (testPath.isAbsolute()) {
+            	throw new RuntimeException("Path to deploy (deployDirectory) must be a relative path. Path specified: "
+	                    + deployDirectory);
+            }
+            
+            if (deployDirectory.contains("..")) {
+	        	throw new RuntimeException(
+	            	"Path to deploy (deployDirectory) may not reference the parent directory. Path specified: "
+	                	+ deployDirectory);
+	        }
+
+	        // Perform the deployment
+            FileContentDelegate deployer = new FileContentDelegate(new File(getConfigurationPath() + File.separator
+            	+ deployDirectory), "", details.getPackageTypeName());
+
+            PropertySimple zipProperty = deployTimeConfiguration.getSimple("deployZipped");
+
+	        if (zipProperty != null && zipProperty.getBooleanValue() != null) {
+	        	boolean zip = zipProperty.getBooleanValue();
+
+	            File tempDir = resourceContext.getTemporaryDirectory();
+	            File tempFile = new File(tempDir.getAbsolutePath(), "esb.bin");
+	            OutputStream osForTempDir = new BufferedOutputStream(new FileOutputStream(tempFile));
+
+	            contentContext = resourceContext.getContentContext();
+	            ContentServices contentServices = contentContext.getContentServices();
+	            contentServices
+	                    .downloadPackageBitsForChildResource(contentContext, resourceTypeName, key, osForTempDir);
+
+	            osForTempDir.close();
+
+	            InputStream isForTempDir = new BufferedInputStream(new FileInputStream(tempFile));
+	            deployer.createContent(details, isForTempDir, !zip);
+
+                // Resource key should match the following:      
+                // ESB: jboss.esb:deployment=jbossesb.esb
+
+                String resourceKey;
+                resourceKey = "jboss.esb:deployment=" + archiveName;
+
+                report.setResourceName(archiveName);
+                report.setResourceKey(resourceKey);
+                report.setStatus(CreateResourceStatus.SUCCESS);
+            } else {
+                report.setStatus(CreateResourceStatus.FAILURE);
+                report.setErrorMessage("Zipped property is required");
+            }
+        } catch (Throwable t) {
+            log.error("Error deploying application for report: " + report, t);
+            report.setException(t);
+            report.setStatus(CreateResourceStatus.FAILURE);
+        }
+    }
+	
+	public CreateResourceReport createResource(CreateResourceReport report) {
+        String resourceTypeName = report.getResourceType().getName();
+
+        if (resourceTypeName.equals(RESOURCE_TYPE_ESB)) {
+            esbCreate(report, resourceTypeName);
+        } else {
+            throw new UnsupportedOperationException("Unknown Resource type: " + resourceTypeName);
+        }
+
+        // JBNADM-1984 - The contract with this method is that the newly created managed resource should be discoverable.
+        //               Wait here so JBoss can recognize that the new managed resource has been created.
+        try {
+            Thread.sleep(5000L);
+        } catch (InterruptedException e) {
+            log.info("Sleep after datasource create interrupted", e);
+        }
+
+        return report;
+    }
+
+	public DeployPackagesResponse deployPackages(
+			Set<ResourcePackageDetails> packages,
+			ContentServices contentServices) {
+        ContentResponseResult overallResult = ContentResponseResult.SUCCESS;
+        List<DeployIndividualPackageResponse> individualResponses = new ArrayList<DeployIndividualPackageResponse>(
+            packages.size());
+
+        for (ResourcePackageDetails pkg : packages) {
+            log.info("Attempting to deploy package: " + pkg);
+
+            String packageTypeName = pkg.getPackageTypeName();
+            if (packageTypeName.equals(PACKAGE_TYPE_LIBRARY)) {
+                throw new UnsupportedOperationException("Deployment of new libraries is not supported by the plugin.");
+            }
+        }
+
+        DeployPackagesResponse response = new DeployPackagesResponse(overallResult);
+        response.getPackageResponses().addAll(individualResponses);
+
+        return response;
+	}
+
+	public Set<ResourcePackageDetails> discoverDeployedPackages(PackageType type) {
+		return null;
+	}
+
+	public List<DeployPackageStep> generateInstallationSteps(
+			ResourcePackageDetails packageDetails) {
+		return null;
+	}
+
+	public RemovePackagesResponse removePackages(
+			Set<ResourcePackageDetails> packages) {
+        throw new UnsupportedOperationException();
+	}
+
+	public InputStream retrievePackageBits(ResourcePackageDetails packageDetails) {
+        throw new UnsupportedOperationException();
+	}
+}

Modified: labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ESBDiscoveryComponent.java
===================================================================
--- labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ESBDiscoveryComponent.java	2008-09-23 20:58:25 UTC (rev 23022)
+++ labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ESBDiscoveryComponent.java	2008-09-23 21:17:48 UTC (rev 23023)
@@ -1,21 +1,11 @@
 package org.jbosson.plugins.jbossesb;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.List;
 import java.util.Set;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
 import org.mc4j.ems.connection.bean.EmsBean;
 import org.mc4j.ems.connection.bean.attribute.EmsAttribute;
 import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
-import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
 import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
-import org.rhq.core.domain.configuration.Configuration;
 import org.rhq.plugins.jmx.JMXComponent;
-import org.rhq.plugins.jmx.JMXDiscoveryComponent;
-import org.rhq.plugins.jmx.MBeanResourceComponent;
 import org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent;
 
 /**
@@ -25,7 +15,8 @@
  * @author Tom Cunningham
  */
 public class ESBDiscoveryComponent extends MBeanResourceDiscoveryComponent {
-    public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<JMXComponent> context) {
+    @Override
+	public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<JMXComponent> context) {
         Set<DiscoveredResourceDetails> jmxResources = super.discoverResources(context);
 
         String versionNumber;

Modified: labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ListenerComponent.java
===================================================================
--- labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ListenerComponent.java	2008-09-23 20:58:25 UTC (rev 23022)
+++ labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ListenerComponent.java	2008-09-23 21:17:48 UTC (rev 23023)
@@ -21,8 +21,6 @@
 import java.util.Set;
 
 import org.mc4j.ems.connection.bean.attribute.EmsAttribute;
-import org.mc4j.ems.connection.bean.operation.EmsOperation;
-import org.rhq.core.domain.measurement.MeasurementDataNumeric;
 import org.rhq.core.domain.measurement.MeasurementDataTrait;
 import org.rhq.core.domain.measurement.MeasurementReport;
 import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
@@ -31,7 +29,6 @@
 
 import org.rhq.core.domain.configuration.Configuration;
 import org.rhq.core.domain.configuration.PropertySimple;
-import org.mc4j.ems.connection.bean.EmsBean;
 
 
 /**

Modified: labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ServiceComponent.java
===================================================================
--- labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ServiceComponent.java	2008-09-23 20:58:25 UTC (rev 23022)
+++ labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ServiceComponent.java	2008-09-23 21:17:48 UTC (rev 23023)
@@ -21,7 +21,6 @@
 import java.util.Set;
 
 import org.mc4j.ems.connection.bean.attribute.EmsAttribute;
-import org.mc4j.ems.connection.bean.operation.EmsOperation;
 import org.rhq.core.domain.measurement.MeasurementDataNumeric;
 import org.rhq.core.domain.measurement.MeasurementReport;
 import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
@@ -30,7 +29,6 @@
 
 import org.rhq.core.domain.configuration.Configuration;
 import org.rhq.core.domain.configuration.PropertySimple;
-import org.mc4j.ems.connection.bean.EmsBean;
 
 
 /**
@@ -50,23 +48,25 @@
     private static final String OVERALL_BYTES_PROCESSED = "overall bytes processed";
     private static final String OVERALL_BYTES_FAILED = "overall bytes failed";
 
+    private static final String OVERALL_MINUTE_METRIC_NAME = "overallMessageCountByMinute";
+    
     @Override
     public void start(ResourceContext<MBeanResourceComponent> context) {
         super.start(context);
         this.context = context;
     }
 
-
     @Override
     public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests) {
     	Configuration pluginConfig = this.context.getPluginConfiguration();
     	pluginConfig.put(new PropertySimple("type", "service"));
+    	Integer overallMessages = null;
         for (MeasurementScheduleRequest request : requests) {
         	String metricName = request.getName();
         	if (metricName.equals(OVERALL_MESSAGE_METRIC)) {
         		EmsAttribute attribute = getEmsBean().getAttribute(OVERALL_MESSAGE_COUNT);
-        		Integer processed = (Integer) attribute.refresh();
-        		report.addData(new MeasurementDataNumeric(request, new Double(processed.doubleValue())));
+        		overallMessages = (Integer) attribute.refresh();
+        		report.addData(new MeasurementDataNumeric(request, new Double(overallMessages.doubleValue())));
         	} else if (metricName.equals(OVERALL_BYTES_PROCESSED_METRIC)) {
         		EmsAttribute attribute = getEmsBean().getAttribute(OVERALL_BYTES_PROCESSED);
         		Integer processed = new Integer(0);
@@ -83,5 +83,11 @@
         		report.addData(new MeasurementDataNumeric(request, new Double(processed.doubleValue())));        		
         	}
         }
+        for (MeasurementScheduleRequest request : requests) {
+        	String metricName = request.getName();
+        	if (metricName.equals(OVERALL_MINUTE_METRIC_NAME)) {
+        		report.addData(new MeasurementDataNumeric(request, new Double(overallMessages.doubleValue())));
+        	}
+        }
     }
 }

Copied: labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ServiceDiscoveryComponent.java (from rev 22992, labs/jbossesb/trunk/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ServiceDiscoveryComponent.java)
===================================================================
--- labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ServiceDiscoveryComponent.java	                        (rev 0)
+++ labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/java/org/jbosson/plugins/jbossesb/ServiceDiscoveryComponent.java	2008-09-23 21:17:48 UTC (rev 23023)
@@ -0,0 +1,72 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.jbosson.plugins.jbossesb;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.mc4j.ems.connection.bean.EmsBean;
+import org.mc4j.ems.connection.bean.attribute.EmsAttribute;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+import org.rhq.plugins.jmx.JMXComponent;
+import org.rhq.plugins.jmx.MBeanResourceComponent;
+
+/**
+ * Discovers ESB Service entities from a ESB stats mbean
+ *
+ * @author Greg Hinkle
+ * @param <T>
+ */
+public class ServiceDiscoveryComponent<T extends JMXComponent> extends SOADiscoveryComponent {
+	
+	private static Log log = LogFactory.getLog(ServiceDiscoveryComponent.class);
+	
+	protected ResourceContext<T> resourceContext;
+		
+    public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<MBeanResourceComponent> context) {
+    	Set<DiscoveredResourceDetails> entities = new HashSet<DiscoveredResourceDetails>();
+
+        EmsBean serviceBean = context.getParentResourceComponent().getEmsBean();
+        Set<EmsAttribute> attributeSet = serviceBean.getAttributes();
+        for (Iterator i = attributeSet.iterator(); i.hasNext();) {
+        	EmsAttribute attr = (EmsAttribute) i.next();
+        	System.out.println(attr.getName());
+            //entities.add(detail);
+        }
+
+        /*
+        String serviceName = serviceBean.getBeanName().getKeyProperty(SERVICE_NAME);
+
+        // Do two passes - one to grab the entity names (ex. "data fileraction"
+        // and then a second to build up the metrics for the entity
+        Set<EmsAttribute> attributeSet = actionBean.getAttributes();
+        for (Iterator i = attributeSet.iterator(); i.hasNext();) {
+        	EmsAttribute attr = (EmsAttribute) i.next();
+            entities.add(detail);
+        }
+        */
+        return entities;
+    }
+}
\ No newline at end of file

Modified: labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/resources/META-INF/rhq-plugin.xml	2008-09-23 20:58:25 UTC (rev 23022)
+++ labs/jbossesb/workspace/maeste/product/tools/jonplugin/src/main/resources/META-INF/rhq-plugin.xml	2008-09-23 21:17:48 UTC (rev 23023)
@@ -15,7 +15,7 @@
 
    <service name="ESB"
       discovery="org.jbosson.plugins.jbossesb.ESBDiscoveryComponent"
-      class="org.rhq.plugins.jmx.MBeanResourceComponent"
+      class="org.jbosson.plugins.jbossesb.ESBComponent"
       description="Overall statistics for JBoss ESB"
       singleton="true">
        <runs-inside>
@@ -26,6 +26,24 @@
          <c:simple-property name="objectName" readOnly="true" default="jboss.esb:service=MessageCounter"/>
          <c:simple-property name="nameTemplate" default="JBoss ESB Statistics"/>
          <c:simple-property name="descriptionTemplate" default="JBoss ESB statistics."/>
+         <c:group name="connection" displayName="Connection Info">
+            <c:simple-property name="namingURL" displayName="Naming Provider URL"
+                               description="The JNP URL with which to connect to the JBoss Application Server instance (e.g. jnp://127.0.0.1:1099)."
+                               default="jnp://127.0.0.1:1099"/>
+            <c:simple-property name="principal" required="false" description="The name of the principal (i.e. user) to authenticate."/>
+            <c:simple-property name="credentials" type="password" required="false"
+                               description="The credentials (i.e. password) that should be used to authenticate the principal."/>
+            <c:simple-property name="jbossHomeDir" displayName="JBoss Home Directory" type="directory" readOnly="true"
+                               description="The absolute path to the directory where JBossAS is installed (e.g. /opt/jboss-4.2.2.GA)."/>
+            <c:simple-property name="configurationPath" displayName="Configuration Path" type="directory" readOnly="true"
+                               description="The path to the configuration directory under which this instance
+                                            operates (e.g. /opt/jboss-4.2.2.GA/server/default); if the path is not absolute,
+                                            then it will be resolved relative to {jbossHomeDir}."/>
+            <c:simple-property name="configurationSet" displayName="Configuration Set" required="false"
+                               description="The name of the server configuration (e.g. minimal, default, or all);
+                                            if not specified, it will default to the last path component of {configurationPath}."
+                               default="default"/>
+         </c:group>
       </plugin-configuration>
       <operation name="start" displayName="Start deployment" description="Start the JBoss ESB deployment"/>
       <operation name="stop" displayName="Stop deployment" description="Stop the JBoss ESB deployment"/>
@@ -39,42 +57,67 @@
       <metric property="LastFailedMessageDate" displayName="Last Failed Message Date" dataType="trait" displayType="summary" defaultOn="true" description="Last Failed Message Date"/>
       <metric property="StateString"  dataType="trait" displayName="State" displayType="summary" defaultOn="true" description="State of the ESB"/>
       <metric displayName="Bytes Processed" property="ProcessedBytes" units="bytes" category="utilization" displayType="summary" defaultOn="true" measurementType="dynamic" description="Overall Bytes Processed"/>
-
+      <content name="library" displayName="Jar Library" category="deployable"
+                description="Library Jar files deployed in JBoss AS">
+         <configuration>
+            <c:simple-property name="version" readOnly="true" description="The version declared by the JAR's manifest."/>
+            <c:simple-property name="title" readOnly="true" description="The title declared by the JAR's manifest."/>
+            <c:simple-property name="url" readOnly="true" description="The url declared by the JAR's manifest."/>
+            <c:simple-property name="vendor" readOnly="true" description="The vendor declared by the JAR's manifest."/>
+            <c:simple-property name="classpath" readOnly="true"
+                               description="The classpath declared by the JAR's manifest."/>
+            <c:simple-property name="sealed" readOnly="true" type="boolean" description="True if the JAR is sealed."/>
+         </configuration>
+      </content>
    <service name="JBoss ESB Deployment"
       discovery="org.jbosson.plugins.jbossesb.ESBDiscoveryComponent"
-      class="org.rhq.plugins.jmx.MBeanResourceComponent"
-      description="Statistics for JBoss ESB Deployments">
+      class="org.jbosson.plugins.jbossesb.DeploymentComponent"
+      description="Statistics for JBoss ESB Deployments"
+      creationDataType="content"	
+      createDeletePolicy="both">
 
       <plugin-configuration>
          <c:simple-property name="objectName" readOnly="true" default="jboss.esb:deployment=%deployment%"/>
          <c:simple-property name="nameTemplate" default="{deployment} JBoss ESB Statistics"/>
          <c:simple-property name="descriptionTemplate" default="JBoss ESB statistics for the {deployment} deployment."/>
          <c:simple-property name="deployment" type="string" description="the JBoss ESB deployment name"/>
+                <c:group name="advanced" displayName="Advanced" hiddenByDefault="true">
+                    <c:simple-property name="extension" default="esb" readOnly="true"/>
+                    <c:simple-property name="descriptionTemplate" default="ESB package" readOnly="true"/>
+                </c:group>
       </plugin-configuration>
-	
-    
      <operation name="start" displayName="Start deployment" description="Start the JBoss ESB deployment"/>
      <operation name="stop" displayName="Stop deployment" description="Stop the JBoss ESB deployment"/>
      <operation name="create" displayName="Move .esb deployment into the create state" description="Move the .esb deployment into the create state"/>
      <operation name="destroy" displayName="Move .esb deployment into the destroy state" description="Move the .esb deployment into the destroy state"/>
-
      <metric property="Name" displayName="Deployment Type" dataType="trait" displayType="summary" defaultOn="true" description="Type of deployment"/>
      <metric property="StateString" displayName=".esb State String" dataType="trait" displayType="summary" defaultOn="true" description="Current state of the ESB"/>
      <metric property="State" displayName=".esb State" dataType="trait" displayType="summary" defaultOn="true" description="Numeric value of the state of the ESB deployment"/>
-       <help>
+       <!--help>
           <![CDATA[
 	  JBoss ESB deployments are .esb packages deployed within a server.    
           ]]>
-       </help>
+       </help-->
+         <content name="file" displayName="ESB Package" category="deployable" isCreationType="true">
+            <configuration>
+               <c:group name="deployment" displayName="Deployment Options">
+                  <c:simple-property name="deployZipped" displayName="Deploy Zipped" type="boolean" default="false" required="true"
+                                     description="Indicates if the ESB is deployed either zipped or exploded."/>
+                  <c:simple-property name="deployDirectory" displayName="Deploy Directory" type="string" default="deploy" required="true"
+                                     description="Path to deploy the file. This must be a path relative to the AS configuration set in use."/>
+               </c:group>
+            </configuration>
+         </content>
       <service name="JBoss ESB Services"
-         discovery="org.jbosson.plugins.jbossesb.ESBDiscoveryComponent"
+         discovery="org.jbosson.plugins.jbossesb.ServiceDiscoveryComponent"
          class="ServiceComponent"
          description="JBoss ESB Services">
          <plugin-configuration>
-              <c:simple-property name="objectName" readOnly="true" default="jboss.esb:category=MessageCounter,deployment={deployment},service-name=%serviceName%"/>
+              <c:simple-property name="objectName" readOnly="true" default="jboss.esb:category=MessageCounter,deployment={deployment},service-category=%serviceCategory%,service-name=%serviceName%"/>
               <c:simple-property name="nameTemplate" default="{serviceName} Service"/>
               <c:simple-property name="DescriptionTemplate" default="JBoss ESB statistics for the {serviceName} service."/>
               <c:simple-property name="serviceName" type="string" description="the JBoss ESB service name"/>
+	      <c:simple-property name="serviceCategory" type="string" description="The JBoss ESB service category"/>
          </plugin-configuration>
          <operation name="resetCounter" displayName="Reset the message counter" description="Reset the message counter"/>
          <metric displayName="Overall Service Message Count" property="overallMessageCount" category="utilization" displayType="summary" measurementType="dynamic" description="Overall Service Message Count"/>




More information about the jboss-svn-commits mailing list