Class PmrDb
- java.lang.Object
-
- de.unirostock.sems.ModelCrawler.databases.Interface.ModelDatabase
-
- de.unirostock.sems.ModelCrawler.databases.PMR2.PmrDb
-
- All Implemented Interfaces:
Closeable
,Serializable
,AutoCloseable
,Callable<Map<String,ChangeSet>>
public class PmrDb extends ModelDatabase
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
PmrDb.ExposureTransformJob
-
Nested classes/interfaces inherited from class de.unirostock.sems.ModelCrawler.databases.Interface.ModelDatabase
ModelDatabase.DatabaseTypes
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,ChangeSet>
changeSetMap
protected de.unirostock.sems.bives.tools.DocumentClassifier
classifier
protected URL
collectionEndpoint
protected de.unirostock.sems.ModelCrawler.databases.PMR2.PmrDb.WorkingDirConfig
config
protected Set<String>
fileExtensionBlacklist
protected String
hashAlgo
protected URL
repoListUrl
-
Fields inherited from class de.unirostock.sems.ModelCrawler.databases.Interface.ModelDatabase
enabled, limit, modelStorage, morreClient, tempDir
-
-
Constructor Summary
Constructors Constructor Description PmrDb()
Default dataholder
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,ChangeSet>
call()
Starts the process of crawling for this specific Database.void
close()
Cleans up the working directoryprotected List<org.eclipse.jgit.revwalk.RevCommit>
detectRelevantVersions(org.eclipse.jgit.api.Git repo, List<RelevantFile> relevantFiles)
protected net.hamnaberg.json.Collection
getCollection(URL url)
URL
getCollectionEndpoint()
String
getHashAlgo()
ChangeSet
getModelChanges(String fileId)
Returns the ChangeSet only for one specific model.URL
getRepoListUrl()
protected LinkedHashSet<String>
getRepositoriesFromCollection()
protected File
getRepositoryDirectory(String repository)
Gets the Path to the Repository Directory out of Workspace config or null if it fails.protected LinkedHashSet<String>
getRepositoryList()
Retrieves the txt Repository List and puts it in a list.protected File
getTempFile()
Returns a non existent temporary file.protected void
init()
protected void
iterateRelevantVersions(org.eclipse.jgit.api.Git repo, File location, List<RelevantFile> relevantFiles, List<org.eclipse.jgit.revwalk.RevCommit> relevantVersions)
Map<String,ChangeSet>
listChanges()
Returns a map with all changes made after the last crawl
the fileId is the map key.List<String>
listModels()
lists all Models in the latest revisionprotected File
makeRepositoryDirectory(String repository)
Creates the directory for the given Repository.protected void
processRepository(String repoLink)
protected void
saveProperties()
protected void
scanAndTransferRepository(String repoUrl, File location, org.eclipse.jgit.api.Git repo)
protected List<RelevantFile>
scanRepository(File location)
protected void
searchLatestKnownVersion(RelevantFile relevantFile)
void
setCollectionEndpoint(URL collectionEndpoint)
void
setHashAlgo(String hashAlgo)
void
setRepoListUrl(URL repoListUri)
protected URL
transformExposureUrl(URL link)
-
Methods inherited from class de.unirostock.sems.ModelCrawler.databases.Interface.ModelDatabase
createTempDir, getLimit, getModelStorage, getMorreClient, getWorkingDir, isEnabled, obtainWorkingDir, setEnabled, setLimit, setModelStorage, setMorreClient, setWorkingDir
-
-
-
-
Field Detail
-
hashAlgo
protected String hashAlgo
-
repoListUrl
protected URL repoListUrl
-
collectionEndpoint
protected URL collectionEndpoint
-
classifier
protected de.unirostock.sems.bives.tools.DocumentClassifier classifier
-
config
protected de.unirostock.sems.ModelCrawler.databases.PMR2.PmrDb.WorkingDirConfig config
-
-
Method Detail
-
listModels
public List<String> listModels()
Description copied from class:ModelDatabase
lists all Models in the latest revision- Specified by:
listModels
in classModelDatabase
- Returns:
- List with all model IDs
-
listChanges
public Map<String,ChangeSet> listChanges()
Description copied from class:ModelDatabase
Returns a map with all changes made after the last crawl
the fileId is the map key.- Specified by:
listChanges
in classModelDatabase
- Returns:
- the list of changes
-
getModelChanges
public ChangeSet getModelChanges(String fileId)
Description copied from class:ModelDatabase
Returns the ChangeSet only for one specific model.- Specified by:
getModelChanges
in classModelDatabase
- Parameters:
fileId
- the file id- Returns:
- ChangeSet
-
getHashAlgo
public String getHashAlgo()
-
setHashAlgo
public void setHashAlgo(String hashAlgo)
-
getRepoListUrl
public URL getRepoListUrl()
-
setRepoListUrl
public void setRepoListUrl(URL repoListUri)
-
getCollectionEndpoint
public URL getCollectionEndpoint()
-
setCollectionEndpoint
public void setCollectionEndpoint(URL collectionEndpoint)
-
close
public void close()
Description copied from class:ModelDatabase
Cleans up the working directory- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classModelDatabase
-
call
public Map<String,ChangeSet> call()
Description copied from class:ModelDatabase
Starts the process of crawling for this specific Database.
-
init
protected void init()
-
getTempFile
protected File getTempFile()
Returns a non existent temporary file.- Returns:
- the temp file
-
saveProperties
protected void saveProperties()
-
getRepositoryList
protected LinkedHashSet<String> getRepositoryList() throws HttpException
Retrieves the txt Repository List and puts it in a list.- Returns:
- the repository list
- Throws:
HttpException
- the http exception
-
getRepositoriesFromCollection
protected LinkedHashSet<String> getRepositoriesFromCollection() throws HttpException
- Throws:
HttpException
-
getCollection
protected net.hamnaberg.json.Collection getCollection(URL url) throws IOException
- Throws:
IOException
-
makeRepositoryDirectory
protected File makeRepositoryDirectory(String repository)
Creates the directory for the given Repository.- Parameters:
repository
- the repository- Returns:
- the file object representing the new repository directory
-
getRepositoryDirectory
protected File getRepositoryDirectory(String repository)
Gets the Path to the Repository Directory out of Workspace config or null if it fails.- Parameters:
repository
- the repository- Returns:
- the repo file
-
processRepository
protected void processRepository(String repoLink)
-
scanAndTransferRepository
protected void scanAndTransferRepository(String repoUrl, File location, org.eclipse.jgit.api.Git repo)
-
scanRepository
protected List<RelevantFile> scanRepository(File location)
-
searchLatestKnownVersion
protected void searchLatestKnownVersion(RelevantFile relevantFile)
-
detectRelevantVersions
protected List<org.eclipse.jgit.revwalk.RevCommit> detectRelevantVersions(org.eclipse.jgit.api.Git repo, List<RelevantFile> relevantFiles)
-
iterateRelevantVersions
protected void iterateRelevantVersions(org.eclipse.jgit.api.Git repo, File location, List<RelevantFile> relevantFiles, List<org.eclipse.jgit.revwalk.RevCommit> relevantVersions) throws IOException
- Throws:
IOException
-
-