Subversion Repositories XServices

Compare Revisions

Ignore whitespace Rev 6 → Rev 10

/xservices/trunk/src/java/net/brutex/xservices/types/FileResource.java/FileResource.java
20,6 → 20,7
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlRootElement;
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.BZip2Resource;
27,32 → 28,83
import org.apache.tools.ant.types.resources.URLResource;
 
/**
* File based resource declaration.
*
* @author Brian Rosenberger, bru@brutex.de
*/
@XmlRootElement(namespace="http://ws.xservices.brutex.net")
@XmlRootElement(namespace=BrutexNamespaces.WS_XSERVICES, name="FileResourceType")
public class FileResource
implements ResourceInterface {
 
/**
* File resource type.
*/
@XmlElement(defaultValue = "FILE", nillable = false, required = true)
public Type type = Type.FILE;
 
/**
* URI to file.
*
* Examples:<br>
* <code>c:/path/to/myfile.txt<br>
* /usr/share/file<br>
* http://server/path/file.zip</code>
*/
@XmlElement(nillable = false, required = true)
public String uri;
 
@XmlEnum(String.class)
/**
* File resource type.
*
* Defines the wrapper around the source.
*/
@XmlEnum(value=String.class)
public enum Type {
 
FILE, URL, GZIP, BZIP2
/**
* Plain file from OS accessible file system.
*/
FILE,
 
/**
* File from URL (http, https, ftp, ...)
*/
URL,
 
/**
* File from file system with on-the-fly GZIP decompression
*/
GZIP,
 
/**
* File from file system with on-the-fly BZIP2 decompression
*/
BZIP2
}
 
/**
* Creates a FileResource.
*
* @param type file resource type
* @param uri file resource uri
*/
public FileResource(Type type, String uri) {
this.type = type;
this.uri = uri;
}
 
/**
* Create an empty FileResource
*/
public FileResource() {
}
 
/**
* Get Apache Ant Resource type.
*
* @param p Ant project
* @return This FileResource as Ant Resource
*/
public Resource getAntResource(Project p) {
Resource res = null;
switch (type) {