Methods Summary |
---|
public void | addFileset(org.apache.tools.ant.types.FileSet fileset)Adds a resource file set.
fileSets.add(fileset);
|
private void | checkParameters()
if (hasFilesets()) {
if (getName() != null) {
throw new BuildException(
"Cannot use <resource name=\"...\"> attribute with filesets");
}
if (getFile() != null) {
throw new BuildException(
"Cannot use <resource file=\"...\"> attribute with filesets");
}
} else {
if (getNamespace() != null) {
throw new BuildException(
"Cannot use <resource namespace=\"...\"> attribute without filesets");
}
}
|
public java.io.File | getFile()The file resource.
return file;
|
public java.lang.String | getName()The name of the resource.
return name;
|
public java.lang.String | getNamespace()Filesets root namespace. The value always ends with '.' .
return namespace;
|
private java.lang.String | getParameter(java.lang.String fileName, java.lang.String name, boolean csharpStyle)
StringBuffer buffer = new StringBuffer();
buffer.append(isEmbed() ? "/resource" : "/linkresource");
buffer.append(':");
buffer.append(fileName);
if (name != null) {
buffer.append(',");
buffer.append(name);
if (csharpStyle) {
if (getPublic() != null) {
throw new BuildException("This compiler does not support the "
+ "public/private option.");
} else {
if (getPublic() != null) {
buffer.append(',");
buffer.append(getPublic().booleanValue() ? "public" : "private");
}
}
} else if (getPublic() != null) {
throw new BuildException("You cannot have a public or private "
+ "option without naming the resource");
}
}
return buffer.toString();
|
public void | getParameters(org.apache.tools.ant.Project p, NetCommand command, boolean csharpStyle)build the C# style parameter (which has no public/private option)
checkParameters();
if (hasFilesets()) {
for (Iterator listIter = fileSets.iterator(); listIter.hasNext();) {
FileSet fs = (FileSet) listIter.next();
String baseDirectory = fs.getDir(p).toString();
String namespace = getNamespace(); // ends with '.' or null
DirectoryScanner ds = fs.getDirectoryScanner(p);
String[] files = ds.getIncludedFiles();
for (int i = 0; i < files.length; i++) {
String file = files[i];
command.addArgument(getParameter(baseDirectory + File.separatorChar + file,
(namespace == null ? null : namespace
+ file.replace(File.separatorChar, '.")), csharpStyle));
}
}
} else {
command.addArgument(getParameter(getFile().toString(), getName(), csharpStyle));
}
|
public java.lang.Boolean | getPublic()Get the public attribute.
return isPublic;
|
public boolean | hasFilesets()Checks that node has embedded
return fileSets.size() > 0;
|
public boolean | isEmbed()Return the embed attribute.
return embed;
|
public void | setEmbed(boolean embed)embed the resource in the assembly (default, true) or just link to it.
this.embed = embed;
|
public void | setFile(java.io.File file)name the resource
this.file = file;
|
public void | setName(java.lang.String name)should the resource have a name?
this.name = name;
|
public void | setNamespace(java.lang.String namespace)Sets filesets root namespace.
if (namespace == null) {
this.namespace = null;
} else {
this.namespace = (namespace.length() == 0 || namespace.endsWith(".") ? namespace
: namespace + '.");
}
|
public void | setPublic(java.lang.Boolean aPublic)VB and J# only: is a resource public or not?
isPublic = aPublic;
|