|
|||||||||
| Home >> All >> jreceiver >> server >> [ bus overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
jreceiver.server.bus
Class FolderBus

java.lang.Objectjreceiver.server.bus.BaseBus
jreceiver.server.bus.KeyBus
jreceiver.server.bus.FolderBus
- public class FolderBus
- extends KeyBus
business logic layer code for Folder management.
- Version:
- $Revision: 1.7 $ $Date: 2003/05/13 07:56:23 $
| Field Summary | |
protected static org.apache.commons.logging.Log |
log
logging object |
private static FolderBus |
singleton
this class is implemented as a singleton |
| Fields inherited from class jreceiver.server.bus.KeyBus |
|
| Fields inherited from class jreceiver.server.bus.BaseBus |
|
| Constructor Summary | |
protected |
FolderBus(jreceiver.server.db.KeyDB db)
ctor |
| Method Summary | |
int |
findParent(int folder_id,
java.util.Set folders)
Attempt to determine whether or not folder_id has a parent amongst the set of parents. |
int |
getChildId(int parent_id,
java.lang.String folder_name)
Obtain the folder_id for the child of the specified parent folder |
java.util.Vector |
getChildKeys(int parent_id,
java.lang.String order_by,
boolean recurse,
int rec_offset,
int rec_count)
Obtain a list of folder_ids which represent the children of the folder associated with parent_id. |
java.util.Map |
getChildMap(int parent_id,
int rec_offset,
int rec_count)
Given a parent_folder_id, create a map of all its child folders, keyed by folder name |
protected jreceiver.server.db.FolderDB |
getDB()
|
int |
getFolderId(int site_id,
java.io.File folder_path)
Given a folder path, obtain the folder id to which it is associated. |
int |
getFolderId(int site_id,
java.io.File root_path,
java.io.File current)
Obtain a folder id for a path. |
static FolderBus |
getInstance()
obtain an instance of this singleton |
int |
getRelativeFolderId(int base_parent_id,
java.io.File relative_folder)
Obtain the folder_id for the rightmost folder name of the specified folder path which is located at the specified folder base. |
java.util.Vector |
getRootKeys(java.lang.String order_by,
int rec_offset,
int rec_count)
Obtain a list of folder_ids which represent the root folders for all sites. |
private void |
updateFolderPath(jreceiver.common.rec.site.RootKey root_key,
jreceiver.common.rec.site.Folder folder)
assign the File fullpath to the specified folder object |
| Methods inherited from class jreceiver.server.bus.KeyBus |
deleteRec, deleteRec, deleteRecs, getKey, getKeyCount, getKeyDB, getKeys, getRec, getRec, getRec, getRecs, getRecs, storeRec, storeRecs |
| Methods inherited from class jreceiver.server.bus.BaseBus |
getBaseDB, getClassName |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
singleton
private static FolderBus singleton
- this class is implemented as a singleton
log
protected static org.apache.commons.logging.Log log
- logging object
| Constructor Detail |
FolderBus
protected FolderBus(jreceiver.server.db.KeyDB db)
- ctor
| Method Detail |
getInstance
public static FolderBus getInstance()
- obtain an instance of this singleton
Note that this uses the questionable DCL pattern (search on DoubleCheckedLockingIsBroken for more info)
getDB
protected jreceiver.server.db.FolderDB getDB()
getChildId
public int getChildId(int parent_id,
java.lang.String folder_name)
throws BusException
- Obtain the folder_id for the child of the specified parent folder
Note that relative child paths are NOT supported.
getRelativeFolderId
public int getRelativeFolderId(int base_parent_id,
java.io.File relative_folder)
throws BusException
- Obtain the folder_id for the rightmost folder name of the specified folder path
which is located at the specified folder base.
Example:
base_parent_id = 34; relative_folder = "./foo/bar/baz";
then the folder_id returned would be for "baz".
TODO: cached the results in an LRUMap()
getFolderId
public int getFolderId(int site_id,
java.io.File root_path,
java.io.File current)
throws BusException
- Obtain a folder id for a path.
Must first find the parent to which we will be added as a child.
If we are the root, there will not be a parent. In this case we'll add ourselves.
For a given directory path, one or more records will go into the folder table.
The search starts from the root path. First try to insert the first part (which may be a drive letter or server name under Windows). Then for all remaining child folders in the path, insert one record.
TODO: cached the results in an LRUMap()
findParent
public int findParent(int folder_id,
java.util.Set folders)
throws BusException
- Attempt to determine whether or not folder_id
has a parent amongst the set of parents.
Note that 0 is not considered a valid folder_id and will be ignored if in the list of parents.
TODO: cached the results in an LRUMap()
getChildMap
public java.util.Map getChildMap(int parent_id, int rec_offset, int rec_count) throws BusException
- Given a parent_folder_id, create a map of all its child folders,
keyed by folder name
getChildKeys
public java.util.Vector getChildKeys(int parent_id, java.lang.String order_by, boolean recurse, int rec_offset, int rec_count) throws BusException
- Obtain a list of folder_ids which represent the children
of the folder associated with parent_id.
TODO: cached the results in an LRUMap()
Note that the parent_id WILL NOT be included in the list
getRootKeys
public java.util.Vector getRootKeys(java.lang.String order_by, int rec_offset, int rec_count) throws BusException
- Obtain a list of folder_ids which represent the root folders
for all sites.
getFolderId
public int getFolderId(int site_id,
java.io.File folder_path)
throws java.io.FileNotFoundException,
BusException
- Given a folder path, obtain the folder id to which it
is associated.
No attempt is made to add the folder path to the database if it is not found.
Note that this assumes that the root table is consistent (no recursive paths).
Assumes that scanning of the root folder has started at least once. If not an exception is thrown.
updateFolderPath
private void updateFolderPath(jreceiver.common.rec.site.RootKey root_key, jreceiver.common.rec.site.Folder folder) throws jreceiver.server.util.db.DatabaseException
- assign the File fullpath to the specified folder object
A recursive search of the folders table is required.
Note: no trailing separator char will be provided!
The root_folder pathname will be prepended to the result.
|
|||||||||
| Home >> All >> jreceiver >> server >> [ bus overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC