Package org.jboss.jandex

Examples of org.jboss.jandex.Index


    // add package-info from the configured packages
    for ( String packageName : sources.getAnnotatedPackages() ) {
      indexClass( indexer, packageName.replace( '.', '/' ) + "/package-info.class" );
    }

    Index index = indexer.complete();

    List<JaxbRoot<JaxbEntityMappings>> mappings = new ArrayList<JaxbRoot<JaxbEntityMappings>>();
    for ( JaxbRoot<?> root : sources.getJaxbRootList() ) {
      if ( root.getRoot() instanceof JaxbEntityMappings ) {
        mappings.add( (JaxbRoot<JaxbEntityMappings>) root );
      }
    }
    if ( !mappings.isEmpty() ) {
      index = parseAndUpdateIndex( mappings, index );
    }

    if ( index.getAnnotations( PseudoJpaDotNames.DEFAULT_DELIMITED_IDENTIFIERS ) != null ) {
      // todo : this needs to move to AnnotationBindingContext
      // what happens right now is that specifying this in an orm.xml causes it to effect all orm.xmls
      metadata.setGloballyQuotedIdentifiers( true );
    }
    bindingContext = new AnnotationBindingContextImpl( metadata, index );
View Full Code Here


        for (ResourceRoot resourceRoot : potentialSubDeployments) {
            if (ModuleRootMarker.isModuleRoot(resourceRoot)) {
                // module roots cannot be managed bean jars
                continue;
            }
            final Index index = resourceRoot.getAttachment(Attachments.ANNOTATION_INDEX);
            if (index != null) {
                if (!index.getAnnotations(MANAGED_BEAN).isEmpty()) {
                    //this is an managed bean deployment
                    SubDeploymentMarker.mark(resourceRoot);
                    ModuleRootMarker.mark(resourceRoot);
                }
            }
View Full Code Here

                throw new RuntimeException("Missing PersistenceUnitMetadataImpl (thread local wasn't set)");
            }
            if (jartoScan == null) {
                throw new IllegalArgumentException("Null jar to scan url");
            }
            Index index = getJarFileIndex(jartoScan, pu);
            if (index == null) {
                log.tracef("No classes to scan for annotations in jar '%s'"
                     +" (jars with classes '%s')", jartoScan.getPath(), pu.getAnnotationIndex().keySet());
                return new HashSet<Package>();
            }
            Collection<ClassInfo> allClasses = index.getKnownClasses();
            for (ClassInfo classInfo : allClasses) {
                String className = classInfo.name().toString();
                try {
                    resultClasses.add(pu.getClassLoader().loadClass(className));
                    // TODO:  fix temp classloader (get CFNE on entity class)
View Full Code Here

            throw new RuntimeException("Missing PersistenceUnitMetadataImpl (thread local wasn't set)");
        }
        if (jartoScan == null) {
            throw new IllegalArgumentException("Null jar to scan url");
        }
        Index index = getJarFileIndex(jartoScan, pu);
        if (index == null) {
            log.tracef("No classes to scan for annotations in jar '%s'"
                 +" (jars with classes '%s')", jartoScan.getPath(), pu.getAnnotationIndex().keySet());
            return new HashSet<Class<?>>();
        }
        if (annotationsToLookFor == null) {
            throw new IllegalArgumentException("Null annotations to look for");
        }
        if (annotationsToLookFor.size() == 0) {
            throw new IllegalArgumentException("Zero annotations to look for");
        }

        Set<Class<?>> result = new HashSet<Class<?>>();

        for (Class<? extends Annotation> annClass : annotationsToLookFor) {
            DotName annotation = DotName.createSimple(annClass.getName());
            List<AnnotationInstance> classesWithAnnotation = index.getAnnotations(annotation);
            for (AnnotationInstance annotationInstance : classesWithAnnotation) {
                String className = annotationInstance.target().toString();
                try {
                    log.tracef("getClassesInJar found class %s with annotation %s", className, annClass.getName());
                    result.add(pu.getClassLoader().loadClass(className));
View Full Code Here

        Map<ResourceRoot, Index> indexes = new HashMap<ResourceRoot, Index>();
        for (ResourceRoot resourceRoot : allResourceRoots) {
            if (resourceRoot == null)
                continue;

            Index index = resourceRoot.getAttachment(Attachments.ANNOTATION_INDEX);
            if (index != null) {
                indexes.put(resourceRoot, index);
            }
        }
        return indexes;
View Full Code Here

        final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
        if (ModuleRootMarker.isModuleRoot(deploymentRoot)) {
            allResourceRoots.add(deploymentRoot);
        }
        for (ResourceRoot resourceRoot : allResourceRoots) {
            Index index = resourceRoot.getAttachment(Attachments.ANNOTATION_INDEX);
            if (index != null) {
                indexes.add(index);
            }
        }
        deploymentUnit.putAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX, new CompositeIndex(indexes));
View Full Code Here

                    ServerLogger.DEPLOYMENT_LOGGER.cannotIndexClass(classFile.getPathNameRelativeTo(virtualFile), virtualFile.getPathName(), e);
                } finally {
                    VFSUtils.safeClose(inputStream);
                }
            }
            final Index index = indexer.complete();
            resourceRoot.putAttachment(Attachments.ANNOTATION_INDEX, index);
            ServerLogger.DEPLOYMENT_LOGGER.tracef("Generated index for archive %s", virtualFile);
        } catch (Throwable t) {
            throw ServerMessages.MESSAGES.deploymentIndexingFailed(t);
        }
View Full Code Here

    // add package-info from the configured packages
    for ( String packageName : sources.getAnnotatedPackages() ) {
      indexClass( indexer, packageName.replace( '.', '/' ) + "/package-info.class" );
    }

    Index index = indexer.complete();

    List<JaxbRoot<JaxbEntityMappings>> mappings = new ArrayList<JaxbRoot<JaxbEntityMappings>>();
    for ( JaxbRoot<?> root : sources.getJaxbRootList() ) {
      if ( root.getRoot() instanceof JaxbEntityMappings ) {
        mappings.add( (JaxbRoot<JaxbEntityMappings>) root );
      }
    }
    if ( !mappings.isEmpty() ) {
      index = parseAndUpdateIndex( mappings, index );
    }

    if ( index.getAnnotations( PseudoJpaDotNames.DEFAULT_DELIMITED_IDENTIFIERS ) != null ) {
      // todo : this needs to move to AnnotationBindingContext
      // what happens right now is that specifying this in an orm.xml causes it to effect all orm.xmls
      metadata.setGloballyQuotedIdentifiers( true );
    }
    bindingContext = new AnnotationBindingContextImpl( metadata, index );
View Full Code Here

    // add package-info from the configured packages
    for ( String packageName : sources.getAnnotatedPackages() ) {
      indexClass( indexer, packageName.replace( '.', '/' ) + "/package-info.class" );
    }

    Index index = indexer.complete();

    List<JaxbRoot<XMLEntityMappings>> mappings = new ArrayList<JaxbRoot<XMLEntityMappings>>();
    for ( JaxbRoot<?> root : sources.getJaxbRootList() ) {
      if ( root.getRoot() instanceof XMLEntityMappings ) {
        mappings.add( (JaxbRoot<XMLEntityMappings>) root );
      }
    }
    if ( !mappings.isEmpty() ) {
      index = parseAndUpdateIndex( mappings, index );
    }

    if ( index.getAnnotations( PseudoJpaDotNames.DEFAULT_DELIMITED_IDENTIFIERS ) != null ) {
      // todo : this needs to move to AnnotationBindingContext
      // what happens right now is that specifying this in an orm.xml causes it to effect all orm.xmls
      metadata.setGloballyQuotedIdentifiers( true );
    }
    bindingContext = new AnnotationBindingContextImpl( metadata, index );
View Full Code Here

  public static Set<EntityHierarchy> createEntityHierarchies(AnnotationBindingContext bindingContext) {
    Set<EntityHierarchy> hierarchies = new HashSet<EntityHierarchy>();

    List<DotName> processedEntities = new ArrayList<DotName>();
    Map<DotName, List<ClassInfo>> classToDirectSubClassMap = new HashMap<DotName, List<ClassInfo>>();
    Index index = bindingContext.getIndex();
    for ( ClassInfo info : index.getKnownClasses() ) {
      if ( !isEntityClass( info ) ) {
        continue;
      }

      if ( processedEntities.contains( info.name() ) ) {
View Full Code Here

TOP

Related Classes of org.jboss.jandex.Index

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.