Top Description Inners Fields Constructors Methods
org.glassfish.hk2.classmodel.reflect

public Class Parser

extends Object
implements Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable
Imports
java.io.Closeable, .File, .IOException, .InputStream, java.net.URI, .URL, java.util.ArrayList, .Collections, .EmptyStackException, .HashMap, .List, .Map, .Stack, java.util.concurrent.Callable, .ExecutionException, .ExecutorService, .Executors, .Future, .ThreadFactory, .TimeUnit, .TimeoutException, java.util.concurrent.locks.ReadWriteLock, .ReentrantLock, .ReentrantReadWriteLock, java.util.logging.Level, .Logger, org.glassfish.hk2.classmodel.reflect.impl.TypeProxy, .TypesCtr, org.glassfish.hk2.classmodel.reflect.util.DirectoryArchive, .JarArchive, .ResourceLocator, org.objectweb.asm.ClassReader

Parse jar files or directories and create the model for any classes found.
Author
Jerome Dochez

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private final ParsingContext
private final int
public static final String
private final ExecutorService
private final Stack<Future<Parser.Result>>
private final ReentrantLock
private final ReadWriteLock
private final boolean
private final Map<String, Types>
private final ReentrantLock

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Exception[]
public Exception[]
awaitTermination(int timeOut, TimeUnit unit)

public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.

private ArchiveAdapter
private ExecutorService
private void
doJob(final ArchiveAdapter adapter, final Runnable doneHook)

public ParsingContext

Returns:

the parsing context this parser uses to store the parsing activities results.
getContext
()

Returns the context this parser instance was initialized with during the call to Parser#Parser(ParsingContext)

private static URI
private static File
getFilePath(String path, String resourceName)

private Types
public void
parse(final File source, final Runnable doneHook)

public Future<Parser.Result>

Returns:

the future object to monitor the result of the parsing.
parse
(final ArchiveAdapter
the archive adapter to parse
source
,
final Runnable
the runnable hook to run after completion
doneHook
)

Parse the archive adapter entries and run the runnable hook on completion.

private void
saveResult(URI uri, Types types)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextback to summary
private final ParsingContext context
DEFAULT_TIMEOUTback to summary
private final int DEFAULT_TIMEOUT
DEFAULT_WAIT_SYSPROPback to summary
public static final String DEFAULT_WAIT_SYSPROP
executorServiceback to summary
private final ExecutorService executorService
futuresback to summary
private final Stack<Future<Parser.Result>> futures
futuresLockback to summary
private final ReentrantLock futuresLock
lockback to summary
private final ReadWriteLock lock
ownESback to summary
private final boolean ownES
processedURIback to summary
private final Map<String, Types> processedURI
thislockback to summary
private final ReentrantLock thislock

Constructor Detail

Parserback to summary
public Parser(ParsingContext context)

Method Detail

awaitTerminationback to summary
public Exception[] awaitTermination() throws InterruptedException
awaitTerminationback to summary
public Exception[] awaitTermination(int timeOut, TimeUnit unit) throws InterruptedException
closeback to summary
public void close()

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
createArchiveAdapterback to summary
private ArchiveAdapter createArchiveAdapter(File source, Runnable doneHook) throws IOException
createExecutorServiceback to summary
private ExecutorService createExecutorService()
doJobback to summary
private void doJob(final ArchiveAdapter adapter, final Runnable doneHook) throws Exception
getContextback to summary
public ParsingContext getContext()

Returns the context this parser instance was initialized with during the call to Parser#Parser(ParsingContext)

Returns:ParsingContext

the parsing context this parser uses to store the parsing activities results.

getDefiningURIback to summary
private static URI getDefiningURI(File file)
getFilePathback to summary
private static File getFilePath(String path, String resourceName)
getResultback to summary
private Types getResult(URI uri)
parseback to summary
public void parse(final File source, final Runnable doneHook) throws IOException
parseback to summary
public Future<Parser.Result> parse(final ArchiveAdapter source, final Runnable doneHook) throws IOException

Parse the archive adapter entries and run the runnable hook on completion.

Parameters
source:ArchiveAdapter

the archive adapter to parse

doneHook:Runnable

the runnable hook to run after completion

Returns:Future<Parser.Result>

the future object to monitor the result of the parsing.

Exceptions
IOException:
thrown by the source archive adapter when accessing entries
saveResultback to summary
private void saveResult(URI uri, Types types)
org.glassfish.hk2.classmodel.reflect back to summary

public Class Parser.Result

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
public final Exception
public final String

Constructor Summary

AccessConstructor and Description
private
Result(String name, Exception fault)

Method Summary

Modifier and TypeMethod and Description
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

faultback to summary
public final Exception fault
nameback to summary
public final String name

Constructor Detail

Resultback to summary
private Result(String name, Exception fault)

Method Detail

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override