use of org.jboss.jandex.Index in project wildfly by wildfly.
the class WSHandlerChainAnnotationProcessor method deploy.
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit unit = phaseContext.getDeploymentUnit();
if (DeploymentTypeMarker.isType(DeploymentType.EAR, unit)) {
return;
}
List<ResourceRoot> resourceRoots = ASHelper.getResourceRoots(unit);
if (resourceRoots == null) {
return;
}
final WSEndpointHandlersMapping mapping = new WSEndpointHandlersMapping();
Index index = null;
for (final ResourceRoot resourceRoot : resourceRoots) {
index = resourceRoot.getAttachment(ANNOTATION_INDEX);
if (index != null) {
// process @HandlerChain annotations
processHandlerChainAnnotations(resourceRoot, resourceRoots, index, mapping);
}
}
if (!mapping.isEmpty()) {
unit.putAttachment(WS_ENDPOINT_HANDLERS_MAPPING_KEY, mapping);
}
}
use of org.jboss.jandex.Index in project wildfly by wildfly.
the class AnnotationsTestCase method testProcessConnector.
/**
* Process: Connector -- verification of the processConnector method
*
* @throws Throwable throwable exception
*/
@Test
public void testProcessConnector() throws Throwable {
try {
URI uri = getURI("/ra16inoutanno.rar");
final VirtualFile virtualFile = VFS.getChild(uri);
final Indexer indexer = new Indexer();
final List<VirtualFile> classChildren = virtualFile.getChildren(new SuffixMatchFilter(".class", VisitorAttributes.RECURSE_LEAVES_ONLY));
for (VirtualFile classFile : classChildren) {
InputStream inputStream = null;
try {
inputStream = classFile.openStream();
indexer.index(inputStream);
} finally {
VFSUtils.safeClose(inputStream);
}
}
final Index index = indexer.complete();
AnnotationRepository ar = new JandexAnnotationRepositoryImpl(index, Thread.currentThread().getContextClassLoader());
annotations.process(ar, null, Thread.currentThread().getContextClassLoader());
} catch (Throwable t) {
t.printStackTrace();
fail(t.getMessage());
}
}
use of org.jboss.jandex.Index in project wildfly by wildfly.
the class AnnotationsTestCase method testProcessAuthenticationMechanism.
/**
* Process: AuthenticationMechanism -- verification of the
* processAuthenticationMechanism method
*
* @throws Throwable throwable exception
*/
@Test
public void testProcessAuthenticationMechanism() throws Throwable {
try {
URI uri = getURI("/ra16annoauthmech.rar");
final VirtualFile virtualFile = VFS.getChild(uri);
final Indexer indexer = new Indexer();
final List<VirtualFile> classChildren = virtualFile.getChildren(new SuffixMatchFilter(".class", VisitorAttributes.RECURSE_LEAVES_ONLY));
for (VirtualFile classFile : classChildren) {
InputStream inputStream = null;
try {
inputStream = classFile.openStream();
indexer.index(inputStream);
} finally {
VFSUtils.safeClose(inputStream);
}
}
final Index index = indexer.complete();
AnnotationRepository ar = new JandexAnnotationRepositoryImpl(index, Thread.currentThread().getContextClassLoader());
annotations.process(ar, null, Thread.currentThread().getContextClassLoader());
} catch (Throwable t) {
fail(t.getMessage());
}
}
use of org.jboss.jandex.Index in project wildfly by wildfly.
the class AnnotationsTestCase method testProcessAdministeredObject.
/**
* Process: AdministeredObject -- verification of the
* processAdministeredObject method
*
* @throws Throwable throwable exception
*/
@Test
public void testProcessAdministeredObject() throws Throwable {
try {
URI uri = getURI("/ra16annoadminobj.rar");
final VirtualFile virtualFile = VFS.getChild(uri);
final Indexer indexer = new Indexer();
final List<VirtualFile> classChildren = virtualFile.getChildren(new SuffixMatchFilter(".class", VisitorAttributes.RECURSE_LEAVES_ONLY));
for (VirtualFile classFile : classChildren) {
InputStream inputStream = null;
try {
inputStream = classFile.openStream();
indexer.index(inputStream);
} finally {
VFSUtils.safeClose(inputStream);
}
}
final Index index = indexer.complete();
AnnotationRepository ar = new JandexAnnotationRepositoryImpl(index, Thread.currentThread().getContextClassLoader());
annotations.process(ar, null, Thread.currentThread().getContextClassLoader());
} catch (Throwable t) {
fail(t.getMessage());
}
}
Aggregations