]
George Gastaldi closed FORGE-699.
---------------------------------
Fix Version/s: (was: 3.x Future)
Resolution: Out of Date
Closing as Out of Date. Reopen if work is still being performed in this issue
create a plugin for WildcardImportResolver
------------------------------------------
Key: FORGE-699
URL:
https://issues.jboss.org/browse/FORGE-699
Project: Forge
Issue Type: Feature Request
Components: Parsers / File Manipulation
Affects Versions: 1.1.1.Final
Reporter: fiorenzo pizza
Assignee: fiorenzo pizza
general notes
We need to create some WildcardImportResolver (Responsible for providing additional
import resolution functionality for situations where classes have referenced a package or
wild-card import)
summary:
- when start creation of index --> new-project
- when update the index --> re-open project | add|remove plugins to the project |
add|remove maven dependencies | add|remove new class inside forge project
- where save the index --> always
- how information to save for future search --> className, jarName (null if the class
is in the project), packageName, absoluteClassName
- how search inside the index --> (ram hashmap? ram db?)
- how generate new entry for the index --> cdi event
general considerations
1) when forge create a new-project we should create some structure to add all classes
used referenced by project
2) we need to add all classes required from some plugin (persistence|scaffolding..)
2) we need to add all classes inside maven dependencies
3) we need to add all classes created in the project
4) we need remove all deleted classes
5) we need to remove all classes inside dependecies removed
6) we need to update the index files, when forge project is reopen (the user could modify
the project out of forge)
problems
1) with a lot of jars, the indexing process should be slow!!
2) how synchronize the access to index
3) how we should synchronize of index update?
requirements
1) we need some fast library to extract classes from jar files
2) we should use cdi event to start a single jar indexing
HOW CREATE INDEX FROM JAR:
possibile libraries: jandex, tattletale, jarindexer
FIRST CANDIDATE: JANDEX
i started to hack jandex code, because jandex is very fast.
Jandex opens the jar files using java jar utilities: JarFile jar = new JarFile(jarFile);
and for every class generate a ClassInfo object: ClassInfo info =
indexer.index(jar.getInputStream(entry));
For my test, i removed some methods inside jandex: we don't care about annotations
inside classes. Also i removed the generation of file index.
questions:
1) why don't use H2, the Java SQL database, for memorize all informations about
classes?
How memorize for a single class:
1) classname, jar name (with version), package name, complete name