commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject cvs commit: jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messenger/task ProducerTask.java
Date Wed, 02 Oct 2002 15:00:06 GMT
jstrachan    2002/10/02 08:00:05

  Modified:    messenger project.xml
               messenger/src/java/org/apache/commons/messenger/task
                        ProducerTask.java
  Log:
  Patched the JMS Send task so that it can take a single file instead of insisting on a whole
fileset
  
  Revision  Changes    Path
  1.10      +1 -1      jakarta-commons-sandbox/messenger/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/messenger/project.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- project.xml	6 Sep 2002 11:57:29 -0000	1.9
  +++ project.xml	2 Oct 2002 15:00:04 -0000	1.10
  @@ -4,7 +4,7 @@
     <pomVersion>3</pomVersion>
     <name>commons-messenger</name>
     <id>commons-messenger</id>
  -  <currentVersion>1.0-dev</currentVersion>
  +  <currentVersion>1.0-dev-8</currentVersion>
     <organization>
   	  <name>Apache Software Foundation</name>
   	  <url>http://www.apache.org</url>
  
  
  
  1.5       +40 -18    jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messenger/task/ProducerTask.java
  
  Index: ProducerTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messenger/task/ProducerTask.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ProducerTask.java	17 May 2002 15:05:47 -0000	1.4
  +++ ProducerTask.java	2 Oct 2002 15:00:05 -0000	1.5
  @@ -48,7 +48,8 @@
       private String messengerName;
       private Destination destination;
       private String subject;
  -    private MessengerManager messengerManager;    
  +    private MessengerManager messengerManager;   
  +    private File file; 
   
       /** Holds value of property sleep. */
       private long sleep;
  @@ -160,6 +161,22 @@
           this.sleep = sleep;
       }
       
  +    /**
  +     * Returns the single file to be sent instead of a FileSet
  +     * @return File
  +     */
  +    public File getFile() {
  +        return file;
  +    }
  +
  +    /**
  +     * Allows a single file to be sent via the Ant Task
  +     * @param file The file to set
  +     */
  +    public void setFile(File file) {
  +        this.file = file;
  +    }
  +
       // Task interface
       //-------------------------------------------------------------------------
       
  @@ -186,22 +203,27 @@
                       
               // deal with the filesets
               boolean first = true;
  -            for (Iterator iter = filesets.iterator(); iter.hasNext(); ) {
  -                FileSet fs = (FileSet) iter.next();
  -                DirectoryScanner ds = fs.getDirectoryScanner(project);                
  -                ds.scan();
  -
  -                File dir = ds.getBasedir();
  -                String[] files = ds.getIncludedFiles();
  -                
  -                for (int i = 0; i < files.length; i++) {
  -                    if ( first ) {
  -                        first = false;
  -                    }
  -                    else {
  -                        sleep();
  +            if (file != null ) {
  +                sendFile(file, messenger, destination);
  +            }
  +            else {
  +                for (Iterator iter = filesets.iterator(); iter.hasNext(); ) {
  +                    FileSet fs = (FileSet) iter.next();
  +                    DirectoryScanner ds = fs.getDirectoryScanner(project);            
   
  +                    ds.scan();
  +    
  +                    File dir = ds.getBasedir();
  +                    String[] files = ds.getIncludedFiles();
  +                    
  +                    for (int i = 0; i < files.length; i++) {
  +                        if ( first ) {
  +                            first = false;
  +                        }
  +                        else {
  +                            sleep();
  +                        }
  +                        sendFile( new File( dir, files[i]), messenger, destination );
                       }
  -                    sendFile( new File( dir, files[i]), messenger, destination );
                   }
               }
           }
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message