20,6 → 20,7 |
import javax.xml.bind.annotation.XmlElement; |
import javax.xml.bind.annotation.XmlEnum; |
import javax.xml.bind.annotation.XmlType; |
import net.brutex.xservices.util.BrutexNamespaces; |
import org.apache.tools.ant.Project; |
import org.apache.tools.ant.types.Resource; |
import org.apache.tools.ant.types.resources.TarResource; |
28,26 → 29,68 |
import org.apache.tools.zip.ZipEntry; |
|
/** |
* |
* Resource from archive declaration. |
* |
* Defines a resource within an archive. |
* @author Brian Rosenberger, bru@brutex.de |
*/ |
@XmlType(namespace = "http://ws.xservices.brutex.net") |
@XmlType(namespace = BrutexNamespaces.WS_XSERVICES, name="ArchiveResourceType") |
public class ArchiveResource |
implements ResourceInterface { |
|
/** |
* Archive Type. |
*/ |
@XmlElement(defaultValue = "ZIP", nillable = false, required = true) |
public ArchiveType type = ArchiveType.ZIP; |
|
/** |
* Archive file. |
* |
* Path and filename of the archive to use. |
*/ |
@XmlElement(nillable = false, required = true) |
public String archive; |
|
/** |
* URI within the archive. |
* |
* This is usually a filename or a path/filename combination. Relative paths |
* are based from the archive root. It depends on how the archive has been |
* created wether or not it is possible to use relative paths, absolute |
* paths are required otherwise. Uses "/" as separator. |
*/ |
@XmlElement(nillable = false, required = true) |
public String uri; |
|
@XmlEnum(String.class) |
/** |
* Supported archive types. |
*/ |
@XmlEnum(value=String.class) |
public enum ArchiveType { |
|
ZIP, TAR, GZTAR |
/** |
* Zip archive type. |
*/ |
ZIP, |
|
/** |
* Tar archive type, without compression |
*/ |
TAR, |
|
/** |
* Tar archive type, with GZIP compression |
*/ |
GZTAR |
} |
|
/** |
* Get Apache Ant Resource Type. |
* |
* @param p Ant project |
* @return this ArchiveResource as Ant Resource |
*/ |
public Resource getAntResource(Project p) { |
Resource res = null; |
switch (type) { |