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.api.deployable;
22
23 import java.io.File;
24
25 import org.codehaus.cargo.module.webapp.WarArchive;
26
27
28
29 /**
30 * Logic common to all deployable implementations (WAR and EAR
31 * deployments).
32 *
33 * @since Cactus 1.5
34 * @version $Id: AbstractDeployableFile.java 239003 2004-05-31 20:05:27Z vmassol $
35 */
36 public abstract class AbstractDeployableFile
37 implements DeployableFile, Cloneable
38 {
39 /**
40 * The WAR or EAR file to deploy.
41 */
42 protected File deployableFile;
43
44 /**
45 * WAR deployment descriptor as a java object. In case of an EAR,
46 * it is the first WAR containing the Cactus Servlet redirector.
47 */
48 protected WarArchive warArchive;
49
50 /**
51 * Webapp context path containing the Cactus tests.
52 */
53 protected String testContext;
54
55 /**
56 * Servlet mapping of the Cactus Servlet redirector found
57 * in the warArchive WAR.
58 */
59 protected String servletRedirectorMapping;
60
61 /**
62 * Filter mapping of the Cactus Filter redirector found
63 * in the warArchive WAR.
64 */
65 protected String filterRedirectorMapping;
66
67 /**
68 * JSP mapping of the Cactus JSP redirector found
69 * in the warArchive WAR.
70 */
71 protected String jspRedirectorMapping;
72
73 /**
74 * {@inheritDoc}
75 * @see DeployableFile#getFile()
76 */
77 public final File getFile()
78 {
79 return this.deployableFile;
80 }
81
82 /**
83 * @param theDeployableFile the file to deploy
84 */
85 public final void setFile(File theDeployableFile)
86 {
87 this.deployableFile = theDeployableFile;
88 }
89
90 /**
91 * {@inheritDoc}
92 * @see DeployableFile#getTestContext()
93 */
94 public final String getTestContext()
95 {
96 return this.testContext;
97 }
98
99 /**
100 * {@inheritDoc}
101 * @see DeployableFile#setTestContext(String)
102 */
103 public final void setTestContext(String theTestContext)
104 {
105 this.testContext = theTestContext;
106 }
107
108 /**
109 * {@inheritDoc}
110 * @see DeployableFile#getServletRedirectorMapping()
111 */
112 public final String getServletRedirectorMapping()
113 {
114 return this.servletRedirectorMapping;
115 }
116
117 /**
118 * @param theMapping the servlet redirector mapping
119 */
120 public final void setServletRedirectorMapping(String theMapping)
121 {
122 this.servletRedirectorMapping = theMapping;
123 }
124
125 /**
126 * {@inheritDoc}
127 * @see DeployableFile#getFilterRedirectorMapping()
128 */
129 public final String getFilterRedirectorMapping()
130 {
131 return this.filterRedirectorMapping;
132 }
133
134 /**
135 * @param theMapping the filter redirector mapping
136 */
137 public final void setFilterRedirectorMapping(String theMapping)
138 {
139 this.filterRedirectorMapping = theMapping;
140 }
141
142 /**
143 * {@inheritDoc}
144 * @see DeployableFile#getJspRedirectorMapping()
145 */
146 public final String getJspRedirectorMapping()
147 {
148 return this.jspRedirectorMapping;
149 }
150
151 /**
152 * @param theMapping the JSP redirector mapping
153 */
154 public final void setJspRedirectorMapping(String theMapping)
155 {
156 this.jspRedirectorMapping = theMapping;
157 }
158
159 /**
160 * {@inheritDoc}
161 * @see DeployableFile#getWarArchive()
162 */
163 public final WarArchive getWarArchive()
164 {
165 return this.warArchive;
166 }
167
168 /**
169 * {@inheritDoc}
170 * @see DeployableFile#clone()
171 */
172 public Object clone() throws CloneNotSupportedException
173 {
174 AbstractDeployableFile file = (AbstractDeployableFile) super.clone();
175 file.deployableFile = this.deployableFile;
176 file.warArchive = this.warArchive;
177 file.testContext = this.testContext;
178 file.servletRedirectorMapping = this.servletRedirectorMapping;
179 file.filterRedirectorMapping = this.filterRedirectorMapping;
180 file.jspRedirectorMapping = this.jspRedirectorMapping;
181 return file;
182 }
183
184 /**
185 * @param theWarArchive the WAR archive object
186 */
187 public final void setWarArchive(WarArchive theWarArchive)
188 {
189 this.warArchive = theWarArchive;
190 }
191
192 }