cdqa.repository

Class Repository

Implemented Interfaces:
IRepository

public final class Repository
extends java.lang.Object
implements IRepository

Field Summary

(package private) IdGen
IdGen
DR**************
(package private) URL
baseURL
(package private) HashMap
doc2XDoc
(package private) HashMap
doc2forest
DR***************
(package private) HashMap
file2name
(package private) HashMap
forests
(package private) String
origUri
DR*********
(package private) HashMap
replicationCounters
DR **************
(package private) HashMap
url2XDoc

Constructor Summary

Repository(URL url)
Constructor
Repository(URL url, boolean useDataGuides)

Method Summary

boolean
addDocToForest(String forestName, String fileName, String docName)
*******************************ADD DOCUMENT TO FOREST ************************************
void
addDocToForest(String forestName, XDocument xdoc)
boolean
clear()
(package private) void
createForest(Element forest)
boolean
createForest(String forestName)
creates forest with the given name
Iterator
find(String name)
HashMap
getData()
ArrayList
getDataGuide(String name)
D&R*******************************************
XDocument
getDocument(String fileName)
XDocument
getDocument(String forestName, String fileName)
(package private) XDocument
getDocument(URL url, String xdocName, String forestName)
Returns a XDocument representing the document located at url
XDocument
getDocument(URL docURL, String fileName, String docName, String forestName)
D&R*******************************************
XDocument
getDocument(XDocument doc, String fileName)
String[]
getDocumentFileNames()
String
getDocumentName(Document doc)
String
getDocumentName(String fileName)
returns a real name of a document
String[]
getDocumentNames()
URL[]
getDocumentURLs()
String[]
getDocumentsPaths()
String
getForestByDocument(Document doc)
String
getForestName(String fileName)
String[]
getForestNames()
String
getOrigURI()
String
getOrigUri()
DR********
ReplicationCounter
getReplicationCounter(String forestName)
XDocument
getXDocument(Document doc)
URL
getbaseURL()
boolean
isDocInForest(String forestName, String fileName)
(package private) static boolean
isElement(Node n, String name)
(package private) void
readbaseURL(URL baseURL)
void
releaseDocuments()
boolean
removeDocFromForest(String forestName, XDocument xdoc)
boolean
removeDocument(String fileName, Document doc)
boolean
removeDocument(URL url)
void
removeForest(String forestName)
boolean
save()
void
updateDocument(Document doc)
void
updateDocument(String forestName, URL docURL, Document doc)
boolean
useDataGuides()
void
xmlSerialize(PrintWriter pw)
(package private) void
xmlSerializeForest(PrintWriter pw, String forestName, ArrayList forest)

Field Details

IdGen

(package private)  IdGen IdGen
DR**************

baseURL

(package private)  URL baseURL

doc2XDoc

(package private)  HashMap doc2XDoc

doc2forest

(package private)  HashMap doc2forest
DR***************

file2name

(package private)  HashMap file2name

forests

(package private)  HashMap forests

origUri

(package private)  String origUri
DR*********

replicationCounters

(package private)  HashMap replicationCounters
DR **************

url2XDoc

(package private)  HashMap url2XDoc

Constructor Details

Repository

public Repository(URL url)
Constructor

Repository

public Repository(URL url,
                  boolean useDataGuides)

Method Details

addDocToForest

public boolean addDocToForest(String forestName,
                              String fileName,
                              String docName)
*******************************ADD DOCUMENT TO FOREST ************************************
Parameters:
forestName -
fileName -
docName -

addDocToForest

public void addDocToForest(String forestName,
                           XDocument xdoc)
Parameters:
forestName -
xdoc -
Author:
Omar

clear

public boolean clear()

createForest

(package private)  void createForest(Element forest)

createForest

public boolean createForest(String forestName)
creates forest with the given name
Parameters:
forestName -
Returns:

find

public Iterator find(String name)
Specified by:
find in interface IRepository
Parameters:
name -

getData

public HashMap getData()

getDataGuide

public ArrayList getDataGuide(String name)
D&R*******************************************

getDocument

public XDocument getDocument(String fileName)
Specified by:
getDocument in interface IRepository

getDocument

public XDocument getDocument(String forestName,
                             String fileName)

getDocument

(package private)  XDocument getDocument(URL url,
                                         String xdocName,
                                         String forestName)
            throws Exception
Returns a XDocument representing the document located at url

getDocument

public XDocument getDocument(URL docURL,
                             String fileName,
                             String docName,
                             String forestName)
D&R*******************************************

getDocument

public XDocument getDocument(XDocument doc,
                             String fileName)
Specified by:
getDocument in interface IRepository

getDocumentFileNames

public String[] getDocumentFileNames()

getDocumentName

public String getDocumentName(Document doc)
Parameters:
doc -
Returns:

getDocumentName

public String getDocumentName(String fileName)
returns a real name of a document
Parameters:
fileName -

getDocumentNames

public String[] getDocumentNames()
Returns:

getDocumentURLs

public URL[] getDocumentURLs()
Returns:

getDocumentsPaths

public String[] getDocumentsPaths()

getForestByDocument

public String getForestByDocument(Document doc)
Specified by:
getForestByDocument in interface IRepository

getForestName

public String getForestName(String fileName)

getForestNames

public String[] getForestNames()

getOrigURI

public String getOrigURI()

getOrigUri

public String getOrigUri()
DR********
Specified by:
getOrigUri in interface IRepository

getReplicationCounter

public ReplicationCounter getReplicationCounter(String forestName)
Parameters:
forestName -
Returns:

getXDocument

public XDocument getXDocument(Document doc)
Specified by:
getXDocument in interface IRepository
Parameters:
doc -

getbaseURL

public URL getbaseURL()

isDocInForest

public boolean isDocInForest(String forestName,
                             String fileName)

isElement

(package private) static boolean isElement(Node n,
                                           String name)

readbaseURL

(package private)  void readbaseURL(URL baseURL)

releaseDocuments

public void releaseDocuments()
Specified by:
releaseDocuments in interface IRepository

removeDocFromForest

public boolean removeDocFromForest(String forestName,
                                   XDocument xdoc)

removeDocument

public boolean removeDocument(String fileName,
                              Document doc)

removeDocument

public boolean removeDocument(URL url)

removeForest

public void removeForest(String forestName)
Parameters:
forestName -
Author:
Omar

save

public boolean save()

updateDocument

public void updateDocument(Document doc)

updateDocument

public void updateDocument(String forestName,
                           URL docURL,
                           Document doc)

useDataGuides

public boolean useDataGuides()
Specified by:
useDataGuides in interface IRepository

xmlSerialize

public void xmlSerialize(PrintWriter pw)

xmlSerializeForest

(package private)  void xmlSerializeForest(PrintWriter pw,
                                           String forestName,
                                           ArrayList forest)