Package org.apache.nutch.collection
Class CollectionManager
- java.lang.Object
-
- org.apache.hadoop.conf.Configured
-
- org.apache.nutch.collection.CollectionManager
-
- All Implemented Interfaces:
Configurable
public class CollectionManager extends Configured
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_FILE_NAME
-
Constructor Summary
Constructors Modifier Constructor Description protectedCollectionManager()Used for testingCollectionManager(Configuration conf)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SubcollectioncreateSubCollection(String id, String name)Create a new subcollection.voiddeleteSubCollection(String id)Delete named subcollectionCollectiongetAll()Returns all collectionsstatic CollectionManagergetCollectionManager(Configuration conf)SubcollectiongetSubColection(String id)Get the named subcollectionList<Subcollection>getSubCollections(String url)Return names of collections url is part ofprotected voidinit()protected voidparse(InputStream input)voidsave()Save collections into file-
Methods inherited from class org.apache.hadoop.conf.Configured
getConf, setConf
-
-
-
-
Field Detail
-
DEFAULT_FILE_NAME
public static final String DEFAULT_FILE_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CollectionManager
public CollectionManager(Configuration conf)
-
CollectionManager
protected CollectionManager()
Used for testing
-
-
Method Detail
-
init
protected void init()
-
parse
protected void parse(InputStream input)
-
getCollectionManager
public static CollectionManager getCollectionManager(Configuration conf)
-
getSubColection
public Subcollection getSubColection(String id)
Get the named subcollection- Parameters:
id- the id of a subcollection ot retrieve- Returns:
- Named SubCollection (or null if not existing)
-
deleteSubCollection
public void deleteSubCollection(String id) throws IOException
Delete named subcollection- Parameters:
id- Id of SubCollection to delete- Throws:
IOException- If there is an error retrieving and deleting the subcollection from the collection.
-
createSubCollection
public Subcollection createSubCollection(String id, String name)
Create a new subcollection.- Parameters:
id- Id of SubCollection to createname- Name of SubCollection to create- Returns:
- Created SubCollection or null if allready existed
-
getSubCollections
public List<Subcollection> getSubCollections(String url)
Return names of collections url is part of- Parameters:
url- The url to test against Collections- Returns:
- A
ListofSubcollection's
-
getAll
public Collection getAll()
Returns all collections- Returns:
- All collections CollectionManager knows about
-
save
public void save() throws IOExceptionSave collections into file- Throws:
IOException- If there is a fatal error flushing or closing theFileOutputStreamassociated with the save process.
-
-