org.apache.xbean.server.repository
Class FileSystemRepository

java.lang.Object
  extended byorg.apache.xbean.server.repository.FileSystemRepository
All Implemented Interfaces:
Repository

public class FileSystemRepository
extends java.lang.Object
implements Repository

FileSystemRepository maps resource ids to a directory on the local file system.

Since:
2.0
Version:
$Id$
Author:
Dain Sundstrom

Constructor Summary
FileSystemRepository()
          Creates a new repository without a specified root directory.
FileSystemRepository(java.io.File root)
          Creates a new repository using the specified root directory.
 
Method Summary
 java.net.URL getResource(java.lang.String location)
          Gets location of the resource realitive to the root directory.
 java.io.File getRoot()
          Gets the root directory from which resources are resolved.
 void setRoot(java.io.File root)
          Sets the root directory of this repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSystemRepository

public FileSystemRepository()
Creates a new repository without a specified root directory. This repository is not usable until the root directory is specified.


FileSystemRepository

public FileSystemRepository(java.io.File root)
Creates a new repository using the specified root directory.

Parameters:
root - the root directory from which resources are resolved
Method Detail

getRoot

public java.io.File getRoot()
Gets the root directory from which resources are resolved.

Returns:
the root directory of this repository

setRoot

public void setRoot(java.io.File root)
Sets the root directory of this repository. Note: the setting of the root directory is not synchronized and is expected to be called immediately after the default constructor in the same thread.

Parameters:
root - the new root directory from which resources are to be resolved

getResource

public java.net.URL getResource(java.lang.String location)
Gets location of the resource realitive to the root directory. This method simply resolves the location against the root directory using root.toURI().resolve(location).

Specified by:
getResource in interface Repository
Parameters:
location - the location of the resource
Returns:
the absolute location of the resource or null if the root directory does not contain a readable file at the specified location


Copyright © {inceptionYear}-2006 Apache Software Foundation. All Rights Reserved.