View Javadoc

1   /*
2   * $Id: MulePackage.java 21720 2011-04-22 19:50:04Z mike.schilling $
3   * --------------------------------------------------------------------------------------
4   * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
5   *
6   * The software in this package is published under the terms of the CPAL v1.0
7   * license, a copy of which has been included with this distribution in the
8   * LICENSE.txt file.
9   */
10  package org.mule.tools.anttasks;
11  
12  import org.apache.tools.ant.taskdefs.Zip;
13  import org.apache.tools.ant.types.ZipFileSet;
14  
15  import java.io.File;
16  
17  /**
18  * Ant task to package a mule application
19  *
20  * XML format:
21  *
22  * <taskdef name="mulePackage" classname="org.mule.tools.anttasks.MulePackage"/>
23  *
24  * <mulePackage applicationFile="file">
25  * <config (fileSet)/>
26  * <classes (fileSet)/>
27  * <lib (fileSet)/>
28  * </mulePackage>
29  */
30  public class MulePackage extends Zip
31  {
32      /**
33  * Specify the Mule application file to install
34  */
35      public void setApplicationFile(File applicationFile)
36      {
37          setDestFile(applicationFile);
38      }
39  
40      /**
41  * add config files at top level
42  * @param fs the zip file set to add
43  */
44      public void addConfig(ZipFileSet fs)
45      {
46          super.addFileset(fs);
47      }
48  
49      /**
50  * add files under lib
51  * @param fs the zip file set to add
52  */
53      public void addLib(ZipFileSet fs)
54      {
55          // We just set the prefix for this fileset, and pass it up.
56          fs.setPrefix("lib/");
57          super.addFileset(fs);
58      }
59  
60      /**
61  * add files under classes
62  * @param fs the zip file set to add
63  */
64      public void addClasses(ZipFileSet fs)
65      {
66          // We just set the prefix for this fileset, and pass it up.
67          fs.setPrefix("classes/");
68          super.addFileset(fs);
69      }
70  
71  }