Package org.jboss.metadata.spi.scope

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


   @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


   /** The annotated element */
   private AnnotatedElement annotated;
  
   private static final ScopeKey getScopeKey(AnnotatedElement annotated)
   {
      Scope scope;
      if (annotated instanceof Class)
      {
         Class clazz = (Class) annotated;
         scope = new Scope(CommonLevels.CLASS, clazz.getName());
      }
      else if (annotated instanceof Member)
      {
         Member member = (Member) annotated;
         scope = new Scope(CommonLevels.JOINPOINT, member.getName());
      }
      else
      {
         return ScopeKey.DEFAULT_SCOPE;
      }
View Full Code Here

/*     */   }
/*     */
/*     */   public ScopeKey getScope()
/*     */   {
/*  71 */     ScopeKey key = super.getScope();
/*  72 */     Scope scope = key.getScope(CommonLevels.CLASS);
/*  73 */     if (scope == null)
/*  74 */       return key;
/*  75 */     Object qualifier = scope.getQualifier();
/*  76 */     if ((qualifier instanceof Class)) {
/*  77 */       return key;
/*  79 */     }String className = (String)qualifier;
/*     */     ClassLoader cl;
/*     */     try {
/*  83 */       cl = Configurator.getClassLoader(this.beanMetaData);
/*     */     }
/*     */     catch (Throwable t)
/*     */     {
/*  87 */       throw new RuntimeException("Error getting classloader for " + key, t);
/*     */     }
/*     */     Class clazz;
/*     */     try {
/*  92 */       clazz = cl.loadClass(className);
/*     */     }
/*     */     catch (ClassNotFoundException e)
/*     */     {
/*  96 */       throw new RuntimeException("Unable to load class: " + className + " for " + key, e);
/*     */     }
/*  98 */     key.addScope(new Scope(CommonLevels.CLASS, clazz));
/*  99 */     return key;
/*     */   }
View Full Code Here

/*  92 */         for (Annotation annotation : annotations)
/*     */         {
/*  94 */           if (!annotation.annotationType().isAnnotationPresent(ScopeFactoryLookup.class))
/*     */             continue;
/*  96 */           ScopeFactoryLookup sfl = (ScopeFactoryLookup)annotation.annotationType().getAnnotation(ScopeFactoryLookup.class);
/*  97 */           Scope scope = ((ScopeFactory)sfl.value().newInstance()).create(annotation);
/*  98 */           scopes.add(scope);
/*     */         }
/*     */
/* 101 */         if (scopes.size() > 0)
/*     */         {
View Full Code Here

/*  85 */       throw new IllegalArgumentException("Null name");
/*  86 */     this.classLoader = container.getClassloader();
/*  87 */     if (this.classLoader == null) {
/*  88 */       throw new IllegalArgumentException("Null class");
/*     */     }
/*  90 */     MetaDataRetrieval classMetaData = ClassMetaDataRetrievalFactory.INSTANCE.getMetaDataRetrieval(new Scope(CommonLevels.CLASS, beanClass));
/*  91 */     ScopeKey instanceScope = new ScopeKey(CommonLevels.INSTANCE, name);
/*  92 */     this.mutableMetaData = new MemoryMetaDataLoader(instanceScope);
/*  93 */     MetaDataRetrieval dynamicXml = new EJBMetaDataLoader(instanceScope, container);
/*     */
/*  95 */     MetaDataContext classContext = new AbstractMetaDataContext(classMetaData);
View Full Code Here

/*  61 */       return true;
/*     */     }
/*  63 */     boolean match = false;
/*  64 */     int index = 0;
/*  65 */     Iterator i = key.getScopes().iterator();
/*  66 */     Scope repositoryScope = (Scope)i.next();
/*  67 */     Scope matchScope = this.matchScopes[index];
/*     */     while (true)
/*     */     {
/*  70 */       ScopeLevel keyLevel = matchScope.getScopeLevel();
/*  71 */       ScopeLevel repositoryLevel = repositoryScope.getScopeLevel();
/*     */
/*  74 */       if (keyLevel.compareTo(repositoryLevel) == 0)
/*     */       {
/*  76 */         if (matchScope.equals(repositoryScope)) {
/*  77 */           match = true;
/*     */         }
/*     */         else
/*     */         {
/*  81 */           match = false;
View Full Code Here

/*  72 */     Collection scopes = key.getScopes();
/*  73 */     if (scopes.size() != 1) {
/*  74 */       return null;
/*     */     }
/*     */
/*  77 */     Scope scope = (Scope)scopes.iterator().next();
/*  78 */     ScopeLevel scopeLevel = scope.getScopeLevel();
/*  79 */     MetaDataRetrievalFactory factory = getMetaDataRetrievalFactory(scopeLevel);
/*  80 */     if (factory == null) {
/*  81 */       return null;
/*     */     }
/*     */
View Full Code Here

/*  61 */   private final BasicMetaDatasItem NO_META_DATA = new BasicMetaDatasItem(this, BasicMetaDatasItem.NO_META_DATA_ITEMS);
/*     */
/*     */   private static final ScopeKey getThreadScopeKey()
/*     */   {
/*  70 */     String name = (String)AccessController.doPrivileged(GET_THREAD_NAME);
/*  71 */     Scope scope = new Scope(CommonLevels.THREAD, name);
/*  72 */     return new ScopeKey(scope);
/*     */   }
View Full Code Here

/*     */ {
/*     */   private AnnotatedElement annotated;
/*     */
/*     */   private static final ScopeKey getScopeKey(AnnotatedElement annotated)
/*     */   {
/*     */     Scope scope;
/*  63 */     if ((annotated instanceof Class))
/*     */     {
/*  65 */       Class clazz = (Class)Class.class.cast(annotated);
/*  66 */       scope = new Scope(CommonLevels.CLASS, clazz);
/*     */     }
/*     */     else
/*     */     {
/*     */       Scope scope;
/*  68 */       if ((annotated instanceof Member))
/*     */       {
/*  70 */         Member member = (Member)annotated;
/*  71 */         scope = new Scope(CommonLevels.JOINPOINT, member);
/*     */       }
/*     */       else
/*     */       {
/*  75 */         return ScopeKey.DEFAULT_SCOPE;
/*     */       }
/*     */     }
/*     */     Scope scope;
/*  77 */     return new ScopeKey(scope);
/*     */   }
View Full Code Here

/*    */ public class InstanceScopeFactory
/*    */   implements ScopeFactory<InstanceScope>
/*    */ {
/*    */   public Scope create(InstanceScope annotation)
/*    */   {
/* 38 */     return new Scope(CommonLevels.INSTANCE, annotation.value());
/*    */   }
View Full Code Here

TOP

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

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.