|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lenya.ac.file.FileItemManager
public abstract class FileItemManager
Abstract superclass for classes that manage items loaded from configuration files.
Nested Class Summary | |
---|---|
static class |
FileItemManager.DirectoryChangeNotifier
Helper class to observe a directory for changes. |
Field Summary | |
---|---|
static java.lang.String |
PATH
|
Constructor Summary | |
---|---|
protected |
FileItemManager(java.io.File configurationDirectory)
Create a new ItemManager |
Method Summary | |
---|---|
void |
add(Item item)
Add an Item to this manager |
void |
addItemManagerListener(ItemManagerListener listener)
Attaches an item manager listener to this item manager. |
boolean |
contains(Item item)
Returns if the ItemManager contains an object. |
java.io.File |
getConfigurationDirectory()
Get the directory where the items are located. |
protected java.io.FileFilter |
getFileFilter()
Get a file filter which filters for files containing items. |
Item |
getItem(java.lang.String id)
Returns an item for a given ID. |
protected java.lang.String |
getItemClass(org.apache.avalon.framework.configuration.Configuration config)
Returns the class name of an item. |
protected org.apache.avalon.framework.configuration.Configuration |
getItemConfiguration(java.io.File file)
Loads teh configuration of an item from a file. |
Item[] |
getItems()
get all items |
protected abstract java.lang.String |
getSuffix()
Returns the file extension to be used. |
protected Item |
loadItem(java.io.File file)
Loads an item from a file. |
protected void |
loadItems()
Reloads the items if an item was changed / added / removed. |
protected void |
notifyAdded(Item item)
Notifies the listeners that an item was added. |
protected void |
notifyRemoved(Item item)
Notifies the listeners that an item was removed. |
void |
remove(Item item)
Remove an item from this manager |
protected void |
removeItem(java.io.File file)
|
void |
removeItemManagerListener(ItemManagerListener listener)
Removes an item manager listener from this item manager. |
void |
update(Item newItem)
Update an item. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String PATH
Constructor Detail |
---|
protected FileItemManager(java.io.File configurationDirectory) throws AccessControlException
configurationDirectory
- where the items are fetched from
AccessControlException
- if the item manager cannot be instantiatedMethod Detail |
---|
protected void loadItems() throws AccessControlException
AccessControlException
- when something went wrong.protected Item loadItem(java.io.File file) throws AccessControlException
file
- The file.
AccessControlException
- when something went wrong.protected java.lang.String getItemClass(org.apache.avalon.framework.configuration.Configuration config) throws AccessControlException
config
- The item configuration.
AccessControlException
- when something went wrong.protected org.apache.avalon.framework.configuration.Configuration getItemConfiguration(java.io.File file) throws AccessControlException
file
- The file.
AccessControlException
- when something went wrong.protected void removeItem(java.io.File file)
public Item getItem(java.lang.String id)
id
- The id.
public Item[] getItems()
public void add(Item item) throws AccessControlException
item
- to be added
AccessControlException
- when the notification threw this exception.public void remove(Item item) throws AccessControlException
item
- to be removed
AccessControlException
- when the notification threw this exception.public void update(Item newItem) throws AccessControlException
newItem
- The new version of the item.
AccessControlException
- when the notification threw this exception.public boolean contains(Item item)
item
- The object.
public java.io.File getConfigurationDirectory()
File
protected java.io.FileFilter getFileFilter()
FileFilter
protected abstract java.lang.String getSuffix()
public void addItemManagerListener(ItemManagerListener listener)
listener
- An item manager listener.public void removeItemManagerListener(ItemManagerListener listener)
listener
- An item manager listener.protected void notifyAdded(Item item) throws AccessControlException
item
- The item that was added.
AccessControlException
- if an error occurs.protected void notifyRemoved(Item item) throws AccessControlException
item
- The item that was removed.
AccessControlException
- if an error occurs.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |