Class ClasspathModelKnowledge
- java.lang.Object
-
- org.gcube.informationsystem.discovery.knowledge.ClasspathModelKnowledge
-
public class ClasspathModelKnowledge extends Object
Manages the discovered knowledge for a specific model, including type hierarchies and usage information, sourced from classpath scanning.- Author:
- Luca Frosini (ISTI - CNR)
-
-
Field Summary
Fields Modifier and Type Field Description protected booleancreatedWhether the knowledge base has been created.protected Map<AccessType,Dag<Class<Element>>>dagsA map of class hierarchy DAGs, keyed by access type.protected Map<AccessType,Discovery<Element>>discoveriesA map of discovery instances, keyed by access type.protected Set<Package>packagesThe set of packages to be scanned.
-
Constructor Summary
Constructors Constructor Description ClasspathModelKnowledge()Constructs a newClasspathModelKnowledgeinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPackages(Collection<Package> packages)Adds a collection of packages to be scanned for model types.voidcreateKnowledge()Creates the knowledge base by discovering types, building hierarchies, and gathering usage information.voidcreateKnowledge(boolean force)Creates the knowledge base, with an option to force recreation.voidcreateKnowledge(Collection<ClasspathModelKnowledge> modelKnowledges)Creates the knowledge base by merging the classes already discovered by other, previously createdClasspathModelKnowledgeinstances, avoiding a redundant rescan of their packages.Dag<Class<Element>>getClassesDag(AccessType accessType)Returns the class hierarchy DAG for a specific access type.Discovery<Element>getDiscovery(AccessType accessType)Returns the discovery instance for a specific access type.
-
-
-
Field Detail
-
created
protected boolean created
Whether the knowledge base has been created.
-
dags
protected Map<AccessType,Dag<Class<Element>>> dags
A map of class hierarchy DAGs, keyed by access type.
-
discoveries
protected Map<AccessType,Discovery<Element>> discoveries
A map of discovery instances, keyed by access type.
-
-
Method Detail
-
createKnowledge
public void createKnowledge(boolean force) throws ExceptionCreates the knowledge base, with an option to force recreation.- Parameters:
force-trueto force recreation of the knowledge base.- Throws:
Exception- if an error occurs during creation.
-
addPackages
public void addPackages(Collection<Package> packages)
Adds a collection of packages to be scanned for model types.- Parameters:
packages- The packages to add.
-
createKnowledge
public void createKnowledge() throws ExceptionCreates the knowledge base by discovering types, building hierarchies, and gathering usage information.- Throws:
Exception- if an error occurs during creation.
-
createKnowledge
public void createKnowledge(Collection<ClasspathModelKnowledge> modelKnowledges) throws Exception
Creates the knowledge base by merging the classes already discovered by other, previously createdClasspathModelKnowledgeinstances, avoiding a redundant rescan of their packages.- Parameters:
modelKnowledges- The already-created model knowledges to merge.- Throws:
Exception- if an error occurs during creation.
-
getClassesDag
public Dag<Class<Element>> getClassesDag(AccessType accessType)
Returns the class hierarchy DAG for a specific access type.- Parameters:
accessType- The access type.- Returns:
- The
Dagof classes.
-
getDiscovery
public Discovery<Element> getDiscovery(AccessType accessType)
Returns the discovery instance for a specific access type.- Parameters:
accessType- The access type.- Returns:
- The
Discoveryinstance.
-
-