Migrated code to new functionality on is-model
This commit is contained in:
parent
8d117454d0
commit
237667ab0c
|
@ -7,6 +7,7 @@ import org.gcube.informationsystem.base.reference.AccessType;
|
|||
import org.gcube.informationsystem.base.reference.Element;
|
||||
import org.gcube.informationsystem.discovery.ISModelRegistrationProvider;
|
||||
import org.gcube.informationsystem.discovery.RegistrationProvider;
|
||||
import org.gcube.informationsystem.discovery.knowledge.Knowledge;
|
||||
import org.gcube.informationsystem.tree.Node;
|
||||
import org.gcube.informationsystem.tree.NodeElaborator;
|
||||
import org.gcube.informationsystem.tree.Tree;
|
||||
|
@ -32,9 +33,10 @@ public class ModelKnowledgeGenerator extends DocumentationGenerator {
|
|||
protected boolean splittedFiles;
|
||||
protected String desiredFileName;
|
||||
|
||||
public ModelKnowledgeGenerator(RegistrationProvider rp) {
|
||||
public ModelKnowledgeGenerator(RegistrationProvider rp) throws Exception {
|
||||
super();
|
||||
this.rp = rp;
|
||||
this.modelKnowledge = Knowledge.getInstance().getModelKnowledges(rp);
|
||||
this.splittedFiles = false;
|
||||
this.desiredFileName = rp.getModelName().toLowerCase().replaceAll(" ", FILENAME_SEPARATOR);
|
||||
}
|
||||
|
@ -51,7 +53,7 @@ public class ModelKnowledgeGenerator extends DocumentationGenerator {
|
|||
}
|
||||
|
||||
public void elaborateTree(final AccessType at, Tree<Class<Element>> tree, File file, RegistrationProvider rp) throws Exception {
|
||||
logger.info("Going to elaborate the following type tree\n{}", tree.toString());
|
||||
logger.debug("Going to elaborate the following type tree\n{}", tree.toString());
|
||||
|
||||
Collection<Package> packages = rp.getPackagesToRegister();
|
||||
|
||||
|
@ -95,9 +97,6 @@ public class ModelKnowledgeGenerator extends DocumentationGenerator {
|
|||
|
||||
public void generate() throws Exception {
|
||||
|
||||
modelKnowledge.addRegistrationProvider(rp);
|
||||
modelKnowledge.createKnowledge();
|
||||
|
||||
File file = null;
|
||||
|
||||
if(!splittedFiles) {
|
||||
|
|
|
@ -6,6 +6,7 @@ import org.gcube.informationsystem.base.reference.AccessType;
|
|||
import org.gcube.informationsystem.base.reference.Element;
|
||||
import org.gcube.informationsystem.discovery.ISModelRegistrationProvider;
|
||||
import org.gcube.informationsystem.discovery.RegistrationProvider;
|
||||
import org.gcube.informationsystem.discovery.knowledge.Knowledge;
|
||||
import org.gcube.informationsystem.discovery.knowledge.ModelKnowledge;
|
||||
import org.gcube.informationsystem.tree.Tree;
|
||||
import org.gcube.informationsystem.utils.documentation.generator.ModelKnowledgeGenerator;
|
||||
|
@ -28,18 +29,9 @@ public class GenerateTest {
|
|||
ServiceLoader<? extends RegistrationProvider> registrationProviders = ServiceLoader
|
||||
.load(RegistrationProvider.class);
|
||||
for(RegistrationProvider rp : registrationProviders) {
|
||||
ModelKnowledgeGenerator treeGenerator = new ModelKnowledgeGenerator(rp);
|
||||
if(rp instanceof ISModelRegistrationProvider) {
|
||||
treeGenerator.setSplittedFiles(false);
|
||||
treeGenerator.setDesiredFileName("is-model");
|
||||
}else {
|
||||
treeGenerator.setSplittedFiles(true);
|
||||
}
|
||||
treeGenerator.generate();
|
||||
|
||||
logger.info("-------- Analising Discovery for model '{}'", rp.getModelName());
|
||||
|
||||
ModelKnowledge modelKnowledge = treeGenerator.getModelKnowledge();
|
||||
ModelKnowledge modelKnowledge = Knowledge.getInstance().getModelKnowledges(rp);
|
||||
ResultAnaliser ra = new ResultAnaliser(rp);
|
||||
modelKnowledge.addDiscoveredElementActions(ra);
|
||||
|
||||
|
@ -53,6 +45,19 @@ public class GenerateTest {
|
|||
tree.elaborate(ra);
|
||||
}
|
||||
|
||||
logger.info("ALL TEST PASSED FOR '{}'", rp.getModelName());
|
||||
|
||||
|
||||
ModelKnowledgeGenerator treeGenerator = new ModelKnowledgeGenerator(rp);
|
||||
if(rp instanceof ISModelRegistrationProvider) {
|
||||
treeGenerator.setSplittedFiles(false);
|
||||
treeGenerator.setDesiredFileName("is-model");
|
||||
}else {
|
||||
treeGenerator.setSplittedFiles(true);
|
||||
}
|
||||
|
||||
logger.info("GOING TO CREATE DOCUMENTATION FOR '{}'", rp.getModelName());
|
||||
treeGenerator.generate();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue