01: /**
02: * EasyBeans
03: * Copyright (C) 2007 Bull S.A.S.
04: * Contact: easybeans@ow2.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19: * USA
20: *
21: * --------------------------------------------------------------------------
22: * $Id: WarFile.java 1970 2007-10-16 11:49:25Z benoitf $
23: * --------------------------------------------------------------------------
24: */package org.ow2.easybeans.ant.archive.file;
25:
26: import org.apache.tools.ant.Project;
27: import org.apache.tools.ant.taskdefs.War;
28: import org.apache.tools.ant.types.FileSet;
29: import org.ow2.easybeans.ant.archive.api.IWar;
30: import org.ow2.easybeans.ant.archive.info.ArchiveInfo;
31: import org.ow2.easybeans.ant.archive.info.WarInfo;
32:
33: /**
34: * Creates a WAR file.
35: * @author Florent Benoit
36: */
37: public class WarFile extends War implements IWar {
38:
39: /**
40: * Reference to the archive info object.
41: */
42: private ArchiveInfo archiveInfo = null;
43:
44: /**
45: * Creates an archive for the given project.
46: * @param p the given project
47: */
48: public WarFile(final Project p) {
49: super ();
50: setProject(p);
51: }
52:
53: /**
54: * Sets the information about an archive.
55: * @param archiveInfo the object that holds data information.
56: */
57: public void setArchiveInfo(final ArchiveInfo archiveInfo) {
58: this .archiveInfo = archiveInfo;
59: }
60:
61: /**
62: * Sets the information about a war archive.
63: * @param warInfo the object that holds data information.
64: */
65: public void setWarInfo(final WarInfo warInfo) {
66: setArchiveInfo(warInfo);
67: }
68:
69: /**
70: * Execute the task.
71: */
72: @Override
73: public void execute() {
74:
75: // Deployment descriptor
76: if (archiveInfo.getDd() != null) {
77: setWebxml(archiveInfo.getDd());
78: }
79:
80: // dest file
81: setDestFile(archiveInfo.getDest());
82:
83: // fileset
84: for (FileSet fileSet : archiveInfo.getFileSetList()) {
85: addFileset(fileSet);
86: }
87:
88: super.execute();
89: }
90:
91: }
|