Category Classes

Unlike the java.io package, where File objects can represent either directories or files, the Resource package uses a Category class to represent the directory concept.

Category objects, like Resource objects, are lightweight objects that delegate many of their functions to their resource servers.

Categories allow a resource chooser to navigate local and remote filesystems, as well as pseudo-filesystems such as The Collective and CVS.

Interface
Category
+ getName() : String
+ getParentCategory() : Category
+ getResources() : Resource[]
+ getSubCategories() : Category[]
CategoryBasics
# server : ResourceServer
# CategoryBasics(ResourceServer)
+ getParentCategory() : Category
+ getResources() : Resource[]
+ getSubCategories() : Category[]
LocalCategory
- file : File
+ LocalCategory(ResourceServer, File)
+ getName() : String
+ equals(Object) : boolean
UrlCategory
- url : URL
+ UrlCategory(ResourceServer, URL)
+ getName() : String
+ equals(Object) : boolean
abstract class CategoryBasics implements Category {

    protected ResourceServer server;

    public Category getParentCategory() {
        return server.getParentCategory(this);
    }

    public Resource[] getResources() throws IOException {
        return server.getResources(this);
    }

    public Category[] getSubCategories() throws IOException {
        return server.getSubCategories(this);
    }
}
public class LocalCategory extends CategoryBasics implements Category {

    private File file;

    public String getName() {
        String name = file.getName();
        if (name.length() == 0) {
            name = file.toString();
        }
        return name;
    }
}
class UrlCategory extends CategoryBasics implements Category {
    private URL url;

    public String getName() {
        return UrlResourceServer.getName(url);
    }
}