Package org.jboss.metadata.spi.retrieval

Examples of org.jboss.metadata.spi.retrieval.MetaDataRetrieval


   {
      if (cachedScopedRetrievals == null)
      {
         cachedScopedRetrievals = new HashMap<ScopeLevel, MetaDataRetrieval>();
      }
      MetaDataRetrieval retrieval = cachedScopedRetrievals.get(level);
      if (update)
      {
         retrieval = super.getScopedRetrieval(level);
         cachedScopedRetrievals.put(level, retrieval);
      }
View Full Code Here


      MutableMetaDataRepository repository = getRepository(deploymentContext);
      if (repository == null)
         return null;

      ScopeKey mutableScope = deploymentContext.getMutableScope();
      MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(mutableScope);
      if (retrieval == null)
      {
         initMutableMetaDataRetrieval(repository, deploymentContext);
         retrieval = repository.getMetaDataRetrieval(mutableScope);
      }
View Full Code Here

         throw new IllegalArgumentException("Null name");
      this.classLoader = container.getClassloader();
      if (classLoader == null)
         throw new IllegalArgumentException("Null class");
     
      MetaDataRetrieval classMetaData = ClassMetaDataRetrievalFactory.INSTANCE.getMetaDataRetrieval(new Scope(CommonLevels.CLASS, beanClass));
      ScopeKey instanceScope = new ScopeKey(CommonLevels.INSTANCE, name);
      mutableMetaData = new MemoryMetaDataLoader(instanceScope);
      MetaDataRetrieval dynamicXml = new EJBMetaDataLoader(instanceScope, container);
     
      MetaDataContext classContext = new AbstractMetaDataContext(classMetaData);
      MetaDataRetrieval[] instance = { dynamicXml, mutableMetaData };
      MetaDataContext instanceContext = new AbstractMetaDataContext(classContext, Arrays.asList(instance));
      metaData = new MetaDataRetrievalToMetaDataBridge(instanceContext);
View Full Code Here

      MutableMetaDataRepository repository = getRepository(deploymentContext);
      if (repository == null)
         return null;

      ScopeKey mutableScope = deploymentContext.getMutableScope();
      MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(mutableScope);
      if (retrieval == null)
      {
         initMutableMetaDataRetrieval(repository, deploymentContext);
         retrieval = repository.getMetaDataRetrieval(mutableScope);
      }
View Full Code Here

   public void testProvidedMetaData() throws Throwable
   {
      MemoryMetaDataLoader memory = new MemoryMetaDataLoader(new ScopeKey(CommonLevels.INSTANCE, "foobar"));
      memory.addAnnotation(new AliasesImpl("alias"));
      MetaDataRetrieval retrieval = new AbstractMetaDataContext(null, memory);
      MetaData metaData = new MetaDataRetrievalToMetaDataBridge(retrieval);

      BeanMetaData bmd = AnnotationToBeanMetaDataFactory.createBeanMetaData(Object.class, metaData);
      assertNotNull(bmd);
      assertEquals(Collections.singleton((Object)"alias"), bmd.getAliases());
View Full Code Here

      AnnotatedElementMetaDataLoader annotatedElementLoader = new AnnotatedElementMetaDataLoader(MethodBean.class);
      // Create a DeclaredMethodSignature for the method with 1 annotation
      Method methodWithOneAnnotation = MethodBean.class.getMethod("testAnnotation", new Class<?>[] {String.class});
      DeclaredMethodSignature declaredMethodSignature = new DeclaredMethodSignature(methodWithOneAnnotation);
      // create a retrieval out of it
      MetaDataRetrieval retrieval = annotatedElementLoader.getComponentMetaDataRetrieval(declaredMethodSignature);
      MetaData metadata = new MetaDataRetrievalToMetaDataBridge(retrieval);
      // should be empty array since the bean has no annotations
      Annotation[] annotations = metadata.getAnnotations();
      assertTrue("Expected one annotation on " + methodWithOneAnnotation, annotations.length == 1);
     
      // Now try the same on a method which has 2 annotations
      Method methodWithTwoAnnotations = MethodBean.class.getMethod("testAnnotation12", new Class<?>[] {String.class, Class.class});
      DeclaredMethodSignature anotherDeclaredMethodSignature = new DeclaredMethodSignature(methodWithTwoAnnotations);
      // create a retrieval out of it
      MetaDataRetrieval anotherRetrieval = annotatedElementLoader.getComponentMetaDataRetrieval(anotherDeclaredMethodSignature);
      MetaData anotherMetadata = new MetaDataRetrievalToMetaDataBridge(anotherRetrieval);
      // should be empty array since the bean has no annotations
      Annotation[] annotationsOnMethodWithTwoAnnotations = anotherMetadata.getAnnotations();
      assertTrue("Expected two annotations on " + anotherDeclaredMethodSignature, annotationsOnMethodWithTwoAnnotations.length == 2);
   }
View Full Code Here

   {
      AnnotatedElementMetaDataLoader annotatedElementLoader = new AnnotatedElementMetaDataLoader(MethodBean.class);
      // Create a MethodSignature for the method with 1 annotation
      MethodSignature methodSignature = new MethodSignature("testAnnotation", String.class);
      // create a retrieval out of it
      MetaDataRetrieval retrieval = annotatedElementLoader.getComponentMetaDataRetrieval(methodSignature);
      MetaData metadata = new MetaDataRetrievalToMetaDataBridge(retrieval);
      // should be empty array since the bean has no annotations
      Annotation[] annotations = metadata.getAnnotations();
      assertTrue("Expected one annotation on testAnnotation method of " + MethodBean.class, annotations.length == 1);
     
      // Now try the same on a method which has 2 annotations
      MethodSignature anotherMethodSignature = new MethodSignature("testAnnotation12", String.class, Class.class);
      // create a retrieval out of it
      MetaDataRetrieval anotherRetrieval = annotatedElementLoader.getComponentMetaDataRetrieval(anotherMethodSignature);
      MetaData anotherMetadata = new MetaDataRetrievalToMetaDataBridge(anotherRetrieval);
      // should be empty array since the bean has no annotations
      Annotation[] annotationsOnMethodWithTwoAnnotations = anotherMetadata.getAnnotations();
      assertTrue("Expected two annotations on testAnnotation12 method of " + MethodBean.class, annotationsOnMethodWithTwoAnnotations.length == 2);
   }
View Full Code Here

      if(metaData == null)
         return null;
     
      for(ComponentMetaDataLoaderFactory<M> factory : factories)
      {
         MetaDataRetrieval retrieval = factory.createComponentMetaDataRetrieval(metaData, signature, getScope(), classLoader);
         if(retrieval != null)
            return retrieval;
      }
     
      // TODO: shouldn't this be a factory?
View Full Code Here

      MutableMetaDataRepository repository = getRepository(deploymentContext);
      if (repository == null)
         return null;

      ScopeKey mutableScope = deploymentContext.getMutableScope();
      MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(mutableScope);
      if (retrieval == null)
      {
         initMutableMetaDataRetrieval(repository, deploymentContext);
         retrieval = repository.getMetaDataRetrieval(mutableScope);
      }
View Full Code Here

      MutableMetaDataRepository repository = getRepository(deploymentContext);
      if (repository == null)
         return null;

      ScopeKey mutableScope = deploymentContext.getMutableScope();
      MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(mutableScope);
      if (retrieval == null)
      {
         initMutableMetaDataRetrieval(repository, deploymentContext);
         retrieval = repository.getMetaDataRetrieval(mutableScope);
      }
View Full Code Here

TOP

Related Classes of org.jboss.metadata.spi.retrieval.MetaDataRetrieval

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.