1 /*
2 * ========================================================================
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one or more
5 * contributor license agreements. See the NOTICE file distributed with
6 * this work for additional information regarding copyright ownership.
7 * The ASF licenses this file to You under the Apache License, Version 2.0
8 * (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 * ========================================================================
20 */
21 package org.apache.cactus.integration.ant;
22
23 import java.io.File;
24 import java.util.ArrayList;
25 import java.util.List;
26
27 import org.apache.cactus.integration.api.version.Version;
28 import org.codehaus.cargo.module.webapp.EjbRef;
29
30 /**
31 * Implements the nested element cactuswar of the cactifyear task.
32 * This element can be configured exactly as the cactifywar task
33 * with some additions as context within the ear file.
34 *
35 *
36 * @version $Id: CactusWar.java 239162 2005-04-26 09:57:59Z grimsell $
37 */
38 public class CactusWar
39 {
40 /**
41 * Name of the generated web app file.
42 */
43 private static final String FILE_NAME = "cactus.war";
44
45 /**
46 * Context of the cactus web application.
47 */
48 private String context;
49
50 /**
51 * The web-app version to use when creating a WAR from scratch.
52 */
53 private String version = null;
54
55 /**
56 * List of ejb-refs to add to the deployment descriptor
57 * of the cactified war.
58 */
59 private List ejbRefs = new ArrayList();
60
61 /**
62 * The destination file of the cactification process.
63 */
64 private File destFile = null;
65
66 /**
67 * @return Returns the context.
68 */
69 public String getContext()
70 {
71 return context;
72 }
73
74 /**
75 * @param theContext The context to set.
76 */
77 public void setContext(String theContext)
78 {
79 context = theContext;
80 }
81
82 /**
83 *
84 * @return the name of the web app file
85 */
86 public String getFileName()
87 {
88 return FILE_NAME;
89 }
90
91 /**
92 * Sets the web-app version to use when creating a WAR file from scratch.
93 *
94 * @param theVersion The version
95 */
96 public final void setVersion(Version theVersion)
97 {
98 this.version = theVersion.getValue();
99 }
100
101 /**
102 * Adds a configured EjbRef instance. Called by Ant.
103 *
104 * @param theEjbRef the EjbRef to add
105 */
106 public final void addConfiguredEjbref(EjbRef theEjbRef)
107 {
108 ejbRefs.add(theEjbRef);
109 }
110
111 /**
112 * Setter method for the destination file.
113 * @param destFile
114 */
115 public void setDestFile(File destFile)
116 {
117 this.destFile = destFile;
118 }
119 }