/* * ======================================================================== * * Copyright 2005 Vincent Massol. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * ======================================================================== */ package org.codehaus.cargo.maven2; import org.apache.maven.plugin.MojoExecutionException; import org.codehaus.cargo.container.deployable.WAR; import org.codehaus.cargo.generic.deployable.DefaultDeployableFactory; import org.codehaus.cargo.generic.deployable.DeployableType; /** * Holds configuration data for the <war> tag used to configure * the plugin in the pom.xml file. * * @version $Id: $ */ public class War { private String name; private String warfile; private String context; public String getName() { return this.name; } public String getWarFile() { return this.warfile; } public String getContext() { return this.context; } /** * @param containerId the container id to which this WAR will be deployed * @return a {@link WAR} deployable representing this nested Ant element */ public WAR createWAR(String containerId) throws MojoExecutionException { if (getWarFile() == null) { throw new MojoExecutionException("The [warFile] attribute is mandatory"); } WAR war = (WAR) new DefaultDeployableFactory().createDeployable(containerId, getWarFile(), DeployableType.WAR); if (getContext() != null) { war.setContext(getContext()); } return war; } }