package org.w3c.jigsaw.resources ;
import java.util.*;
import java.io.*;
import org.w3c.tools.resources.*;
public class PassDirectory extends org.w3c.jigsaw.resources.DirectoryResource {
protected static int ATTR_PASSTARGET = -1 ;
static {
Attribute a = null ;
Class cls = null ;
try {
cls = Class.forName("org.w3c.jigsaw.resources.PassDirectory") ;
} catch (Exception ex) {
ex.printStackTrace() ;
System.exit(1) ;
}
a = new FileAttribute("pass-target"
, null
, Attribute.EDITABLE);
ATTR_PASSTARGET = AttributeRegistry.registerAttribute(cls, a) ;
}
@param idx@param value
public void setValue(int idx, Object value) {
super.setValue(idx, value);
if ( idx == ATTR_PASSTARGET ) {
File file = (File) value;
if ( ! file.isAbsolute() ) {
File abs = new File(getServer().getRootDirectory()
, file.toString());
values[ATTR_PASSTARGET] = abs;
values[ATTR_DIRECTORY] = abs;
}
}
}
@return
public File getDirectory() {
return (File) getValue(ATTR_PASSTARGET, null) ;
}
@param values
public void initialize(Object values[]) {
super.initialize(values);
File target = getDirectory();
if ( target != null )
setValue(ATTR_DIRECTORY, target);
}
}