/* * ======================================================================== * * 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.EAR; import org.codehaus.cargo.generic.deployable.DefaultDeployableFactory; import org.codehaus.cargo.generic.deployable.DeployableType; /** * Holds configuration data for the <ear> tag used to configure * the plugin in the pom.xml file. * * @version $Id: $ */ public class Ear { private String name; private String earfile; public String getName() { return this.name; } public String getEarFile() { return this.earfile; } /** * @param containerId the container id to which this WAR will be deployed * @return a {@link EAR} deployable representing this nested Ant element */ public EAR createEAR(String containerId) throws MojoExecutionException { if (getEarFile() == null) { throw new MojoExecutionException("The [earFile] attribute is mandatory"); } EAR ear = (EAR) new DefaultDeployableFactory().createDeployable(containerId, getEarFile(), DeployableType.EAR); if (getName() != null) { ear.setName(getName()); } return ear; } }