Class Parser
- java.lang.Object
-
- org.glassfish.hk2.classmodel.reflect.Parser
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class Parser extends java.lang.Object implements java.io.CloseableParse jar files or directories and create the model for any classes found.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classParser.Result
-
Field Summary
Fields Modifier and Type Field Description private ParsingContextcontextprivate intDEFAULT_TIMEOUTstatic java.lang.StringDEFAULT_WAIT_SYSPROPprivate java.util.concurrent.ExecutorServiceexecutorServiceprivate java.util.Stack<java.util.concurrent.Future<Parser.Result>>futuresprivate java.util.concurrent.locks.ReadWriteLocklockprivate booleanownESprivate java.util.Map<java.lang.String,Types>processedURI
-
Constructor Summary
Constructors Constructor Description Parser(ParsingContext context)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Exception[]awaitTermination()java.lang.Exception[]awaitTermination(int timeOut, java.util.concurrent.TimeUnit unit)voidclose()private ArchiveAdaptercreateArchiveAdapter(java.io.File source, java.lang.Runnable doneHook)private java.util.concurrent.ExecutorServicecreateExecutorService()private voiddoJob(ArchiveAdapter adapter, java.lang.Runnable doneHook)ParsingContextgetContext()Returns the context this parser instance was initialized with during the call toParser(ParsingContext)private static java.net.URIgetDefiningURI(java.io.File file)private static java.io.FilegetFilePath(java.lang.String path, java.lang.String resourceName)private TypesgetResult(java.net.URI uri)voidparse(java.io.File source, java.lang.Runnable doneHook)java.util.concurrent.Future<Parser.Result>parse(ArchiveAdapter source, java.lang.Runnable doneHook)Parse the archive adapter entries and run the runnable hook on completion.private voidsaveResult(java.net.URI uri, Types types)
-
-
-
Field Detail
-
DEFAULT_WAIT_SYSPROP
public static final java.lang.String DEFAULT_WAIT_SYSPROP
- See Also:
- Constant Field Values
-
context
private final ParsingContext context
-
processedURI
private final java.util.Map<java.lang.String,Types> processedURI
-
futures
private final java.util.Stack<java.util.concurrent.Future<Parser.Result>> futures
-
executorService
private final java.util.concurrent.ExecutorService executorService
-
ownES
private final boolean ownES
-
lock
private final java.util.concurrent.locks.ReadWriteLock lock
-
DEFAULT_TIMEOUT
private final int DEFAULT_TIMEOUT
-
-
Constructor Detail
-
Parser
public Parser(ParsingContext context)
-
-
Method Detail
-
awaitTermination
public java.lang.Exception[] awaitTermination() throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
awaitTermination
public java.lang.Exception[] awaitTermination(int timeOut, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
getDefiningURI
private static java.net.URI getDefiningURI(java.io.File file)
-
getFilePath
private static java.io.File getFilePath(java.lang.String path, java.lang.String resourceName)
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
parse
public void parse(java.io.File source, java.lang.Runnable doneHook) throws java.io.IOException- Throws:
java.io.IOException
-
createArchiveAdapter
private ArchiveAdapter createArchiveAdapter(java.io.File source, java.lang.Runnable doneHook) throws java.io.IOException
- Throws:
java.io.IOException
-
parse
public java.util.concurrent.Future<Parser.Result> parse(ArchiveAdapter source, java.lang.Runnable doneHook) throws java.io.IOException
Parse the archive adapter entries and run the runnable hook on completion.- Parameters:
source- the archive adapter to parsedoneHook- the runnable hook to run after completion- Returns:
- the future object to monitor the result of the parsing.
- Throws:
java.io.IOException- thrown by the source archive adapter when accessing entries
-
getResult
private Types getResult(java.net.URI uri)
-
saveResult
private void saveResult(java.net.URI uri, Types types)
-
doJob
private void doJob(ArchiveAdapter adapter, java.lang.Runnable doneHook) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getContext
public ParsingContext getContext()
Returns the context this parser instance was initialized with during the call toParser(ParsingContext)- Returns:
- the parsing context this parser uses to store the parsing activities results.
-
createExecutorService
private java.util.concurrent.ExecutorService createExecutorService()
-
-