Skip to content
Snippets Groups Projects
Commit 78e82c6b authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Build with models pt 2

parent 53e22da4
No related branches found
No related tags found
1 merge request!7Gnuaffero
Pipeline #1595 canceled
......@@ -30,10 +30,10 @@
</repositories>
<dependencies>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.10.2</version>
</dependency>
<groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId>
<version>4.8.162</version>
</dependency>
<dependency>
<groupId>com.thetransactioncompany</groupId>
<artifactId>cors-filter</artifactId>
......
......@@ -19,7 +19,9 @@
package no.nibio.vips.model.factory;
import java.lang.reflect.Constructor;
import io.github.classgraph.ClassGraph;
import io.github.classgraph.ClassInfo;
import io.github.classgraph.ScanResult;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.HashSet;
......@@ -27,7 +29,6 @@ import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.reflections.Reflections;
import no.nibio.vips.model.Model;
/**
......@@ -130,13 +131,28 @@ public class ModelFactory {
* for each TLD not found. Use application container's config to suppress
* this in log files.
*/
Reflections reflections;
Set<Class<? extends Model>> subTypes = new HashSet();
for(String topDomain: defaultTopDomains)
/*for(String topDomain: defaultTopDomains)
{
reflections = new Reflections(topDomain);
subTypes.addAll(reflections.getSubTypesOf(Model.class));
}
}*/
try (ScanResult scanResult = // Assign scanResult in try-with-resources
new ClassGraph() // Create a new ClassGraph instance
.verbose() // If you want to enable logging to stderr
.enableClassInfo() // Scan classes, methods, fields, annotations
//.acceptPackages("com.xyz") // Scan com.xyz and subpackages
.scan()) { // Perform the scan and return a ScanResult
//ClassInfoList classInfoList =
for(ClassInfo cInfo:scanResult.getClassesImplementing(Model.class))
{
subTypes.add(cInfo.loadClass(Model.class));
}
/**
* Iterates and instantiates one object for each class
......@@ -165,6 +181,7 @@ public class ModelFactory {
Logger.getLogger(ModelFactory.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}
/**
......
......@@ -20,15 +20,8 @@ along with VIPSCore. If not, see <http://www.nibio.no/licenses/>.
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="no.nibio.vips.modelcontainer"/>
<module name="org.graalvm"/>
<module name="no.nibio.vips.VIPSCommon" export="true"/>
<module name="com.fasterxml.jackson.core.jackson-core" />
<module name="com.fasterxml.jackson.core.jackson-databind" />
<module name="com.fasterxml.jackson.core.jackson-annotations" />
</dependencies>
<exclusions>
<module name="org.jboss.resteasy.resteasy-json-binding-provider"/>
</exclusions>
</deployment>
</jboss-deployment-structure>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment