package Site::Resource; ###### 
### 	$Id: Resource.pm,v 1.3 2002/11/23 16:11:41 steve Exp $
###
###	This class creates, maintains, and reads per-directory metadata,
###	and serves as a manager for the Resource::* objects that describe
###	files.  It is in charge of the mapping from file extension to 
###	Resource class.

### ===	Whether Site::Resource should, itself, represent a directory 
###	resource is an open question.  At this point, I'm inclined to think
###	not; it is, after all, in a different part of the hierarchy and will
###	be busy enough as a manager.

### ===	Right now, the Site::Config object is reading the per-directory config
###	(..cf) files.  That ought to be done here instead so that a mod_perl
###	implementation could cache them.

use XML::Node;
use Exporter();
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);

BEGIN {
    $VERSION=1.00;
    @ISA = qw(Exporter XML::Node);
    @EXPORT = qw(
		 );
}



#############################################################################
##
## Notes on Resource Metadata:
##

## There are a couple of different ways we can store resource metadata:
##	per-directory XML files, .htaccess files, and property (.cf) files. 
##	We will use all three, for different purposes:  
##
##   .htaccess	will be reserved for the stuff that Apache needs, and will
##		be automatically generated when the information changes.
##
##   ..cf	contains protected information:  owner's user id, resource
##		protection information, etc.  Basically whatever is needed
##		to regenerate .htaccess and to authenticate file operations.
##
##   XML	will be used for user-modifiable metadata, possibly in the
##		form of WebDAV properties.
##
##		[For the moment we'll try to get along without an xml file.]

## Resource objects depend only on the directory and its contents, not 
##	the current request.  They can, accordingly, be cached across 
##	requests, although this might not be a good idea in most cases.

## Authentication is done by Site::User, taking the Resource as an argument.

## In any event, this class extends XML::Node as a convenient representation
##	for XML-like metadata.



#############################################################################
###
### Constructors:
###

### Resource->fromPath($cxt, $dirpath)
#	Create new Resource object for the given path.  
#
#	Note that a Resource depends _only_ on the directory and its
#	contents; it's independent of the query and user information.
#
sub fromPath {
    my ($class, $context, $dirpath) = @_;

    # Assuming the file exists, we can now parse it.
   
    my $self = {'root'=>$root, 'dirpath'=>$dirpath };
    $self = bless $self, $class;

    return $self;
}

# === do we need a fromQuery to unify the path extraction stuff?



#############################################################################
###
### Access Functions:
###


#############################################################################
###
### 
###


#############################################################################
1;
