Package org.jboss.metadata.spi.scope

Examples of org.jboss.metadata.spi.scope.ScopeKey


  
   public ScopeKey getScope()
   {
      if (scopeKey == null)
      {
         ScopeKey key = new ScopeKey();
         for (MetaDataRetrieval retrieval : getRetrievals())
         {
            ScopeKey retrievalKey = retrieval.getScope();
            Collection<Scope> scopes = retrievalKey.getScopes();
            for (Scope scope : scopes)
               key.addScope(scope);
         }
         scopeKey = key;
      }
View Full Code Here


   {
      List<MetaDataRetrieval> matchingRetrievals = new ArrayList<MetaDataRetrieval>();
      List<MetaDataRetrieval> localRetrievals = getLocalRetrievals();
      for (MetaDataRetrieval localRetrieval : localRetrievals)
      {
         ScopeKey scopeKey = localRetrieval.getScope();
         if (scopeKey.getScopeLevel(level) != null)
            matchingRetrievals.add(localRetrieval);
      }

      if (matchingRetrievals.isEmpty() == false)
      {
View Full Code Here

  
   public MetaDataRetrieval addMetaDataRetrieval(MetaDataRetrieval retrieval)
   {
      if (retrieval == null)
         throw new IllegalArgumentException("Null retrieval");
      ScopeKey key = retrieval.getScope();
      key.freeze();
      return retrievals.put(key, retrieval);
   }
View Full Code Here

   }

   public void testClassScope() throws Exception
   {
      AnnotatedElementMetaDataLoader loader = new AnnotatedElementMetaDataLoader(TestAnnotationScopeBean.class);
      ScopeKey scopeKey = loader.getScope();
     
      assertNotNull(scopeKey);
     
      Collection<Scope> scopes = scopeKey.getScopes();
      assertEquals(1, scopes.size());
     
      Scope scope = scopes.iterator().next();
     
      assertEquals(CommonLevels.CLASS, scope.getScopeLevel());
View Full Code Here

   protected void testMember(Member member) throws Exception
   {
      assertNotNull(member);
     
      AnnotatedElementMetaDataLoader loader = new AnnotatedElementMetaDataLoader((AnnotatedElement) member);
      ScopeKey scopeKey = loader.getScope();
      assertNotNull(scopeKey);
     
      Collection<Scope> scopes = scopeKey.getScopes();
      assertEquals(1, scopes.size());
     
      Scope scope = scopes.iterator().next();
     
      assertEquals(CommonLevels.JOINPOINT, scope.getScopeLevel());
View Full Code Here

      if (repository == null)
         return;
     
      try
      {
         ScopeKey scope = deploymentContext.getScope();
         repository.removeMetaDataRetrieval(scope);
      }
      catch (Throwable ignored)
      {
      }

      try
      {
         ScopeKey scope = deploymentContext.getMutableScope();
         repository.removeMetaDataRetrieval(scope);
      }
      catch (Throwable ignored)
      {
      }
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

            Class.forName("org.jboss.test.metadata.annotation.ejb3.MyStatefulBean")
      };
      List<Class<?>> classes = Arrays.asList(beanClasses);
      createMetaDataFromAnnotations("ejb0.jar", classes);

      ScopeKey jarKey = new ScopeKey(CommonLevels.DEPLOYMENT, "ejb0.jar");
      MetaData md = repository.getMetaData(jarKey);
      EjbJarMetaData jarMD = md.getMetaData(EjbJarMetaData.class);
      assertNotNull(jarMD);
      EnterpriseBeanMetaData beanMD = jarMD.getEnterpriseBean("MyStatelessBean");
      assertNotNull(beanMD);
View Full Code Here

      assertEquals(SessionType.Stateless, sbeanMD.getSessionType());
   }

   protected MetaData createMetaDataFromAnnotations(String jarName, Collection<Class<?>> classes)
   {
      ScopeKey jarKey = new ScopeKey(CommonLevels.DEPLOYMENT, jarName);
      MemoryMetaDataLoader loader = new MemoryMetaDataLoader(jarKey);
      repository.addMetaDataRetrieval(loader);

      AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
      EjbJar30Creator creator = new EjbJar30Creator(finder);
View Full Code Here

   @Override
   public ScopeKey getScope()
   {
      // THIS IS A HACK - the scope originally gets initialise with a class name, we fix it to have the class
      ScopeKey key = super.getScope();
      Scope scope = key.getScope(CommonLevels.CLASS);
      if (scope == null)
         return key;
      Object qualifier = scope.getQualifier();
      if (qualifier instanceof Class)
         return key;

      String className = (String) qualifier;
      ClassLoader cl;
      try
      {
         cl = Configurator.getClassLoader(beanMetaData);
      }
      catch (Throwable t)
      {
         throw new RuntimeException("Error getting classloader for " + key, t);
      }
      Class<?> clazz;
      try
      {
         clazz = Class.forName(className, false, cl);
      }
      catch (ClassNotFoundException e)
      {
         throw new RuntimeException("Unable to load class: " + className + " for " + key, e);
      }
      key.addScope(new Scope(CommonLevels.CLASS, clazz));
      return key;
   }
View Full Code Here

TOP

Related Classes of org.jboss.metadata.spi.scope.ScopeKey

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.