org.jboss.as.server.deployment.annotation.CompositeIndex Java Examples

The following examples show how to use org.jboss.as.server.deployment.annotation.CompositeIndex. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ModuleIndexBuilder.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public static CompositeIndex buildCompositeIndex(Module module) {
    try {
        final Enumeration<URL> resources = module.getClassLoader().getResources(INDEX_LOCATION);
        if (!resources.hasMoreElements()) {
            return null;
        }
        final Set<Index> indexes = new HashSet<Index>();
        while (resources.hasMoreElements()) {
            final URL url = resources.nextElement();
            InputStream stream = url.openStream();
            try {
                IndexReader reader = new IndexReader(stream);
                indexes.add(reader.read());
            } finally {
                stream.close();
            }
        }
        return new CompositeIndex(indexes);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }

}
 
Example #2
Source File: CamelContextDescriptorsProcessor.java    From wildfly-camel with Apache License 2.0 6 votes vote down vote up
public boolean addConditionally(DeploymentUnit depUnit, CamelDeploymentSettings.Builder depSettingsBuilder, URL fileURL) {

        boolean skipResource = false;
        CompositeIndex index = depUnit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX);

        // [#1215] Add support for Spring based CamelContext injection
        for (AnnotationInstance aninst : index.getAnnotations(DotName.createSimple("org.apache.camel.cdi.ImportResource"))) {
            for (String resname : aninst.value().asStringArray()) {
                skipResource |= fileURL.getPath().endsWith(resname);
            }
        }

        if (skipResource == false) {
            depSettingsBuilder.camelContextUrl(fileURL);
            return true;
        }
        return false;
    }
 
Example #3
Source File: CamelDeploymentSettingsBuilderProcessor.java    From wildfly-camel with Apache License 2.0 4 votes vote down vote up
private List<AnnotationInstance> getAnnotations(DeploymentUnit depUnit, String className) {
    CompositeIndex index = depUnit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX);
    return index.getAnnotations(DotName.createSimple(className));
}