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: Client.java 1970 2007-10-16 11:49:25Z benoitf $
23: * --------------------------------------------------------------------------
24: */package org.ow2.easybeans.ant.archive;
25:
26: import org.apache.tools.ant.Project;
27: import org.apache.tools.ant.Task;
28: import org.ow2.easybeans.ant.archive.api.IClient;
29: import org.ow2.easybeans.ant.archive.file.ClientFile;
30: import org.ow2.easybeans.ant.archive.info.ClientInfo;
31:
32: /**
33: * Task that creates a client archive (only .jar file).
34: * @author Florent Benoit
35: */
36: public class Client extends AbsArchive {
37:
38: /**
39: * Name of the Main-Class attribute.
40: */
41: private String mainClassAttribute = null;
42:
43: /**
44: * Default constructor.
45: */
46: public Client() {
47: super ();
48: }
49:
50: /**
51: * Execute the task.
52: */
53: @Override
54: public void execute() {
55:
56: log("Building Client in '" + getDest() + "'.", Project.MSG_INFO);
57:
58: IClient client = null;
59:
60: client = new ClientFile(getProject());
61:
62: // Set the name of the task
63: ((Task) client).setTaskName(getTaskName());
64:
65: // Build the info object
66: ClientInfo clientInfo = new ClientInfo();
67: client.setClientInfo(clientInfo);
68:
69: // Fill archive properties
70: updateArchiveInfo(clientInfo);
71:
72: // complete
73: clientInfo.setMainClass(mainClassAttribute);
74:
75: // no exploded mode yet
76: clientInfo.setExploded(false);
77:
78: // Execute the task
79: client.execute();
80: }
81:
82: /**
83: * Sets the Main-Class: Attribute of the manifest.
84: * @param mainClassAttribute the value of the Main-Class attribute
85: */
86: public void setMainClass(final String mainClassAttribute) {
87: this.mainClassAttribute = mainClassAttribute;
88: }
89:
90: }
|