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


            {
               if (annotation.annotationType().isAnnotationPresent(ScopeFactoryLookup.class))
               {
                  ScopeFactoryLookup sfl = annotation.annotationType().getAnnotation(ScopeFactoryLookup.class);
                  ScopeFactory scf = getScopeFactory(sfl.value());
                  Scope scope = scf.create(annotation);
                  scopes.add(scope);
               }
            }
            if (scopes.size() > 0)
            {
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.class.cast(annotated);
         scope = new Scope(CommonLevels.CLASS, clazz);
      }
      else if (annotated instanceof Member)
      {
         Member member = (Member) annotated;
         scope = new Scope(CommonLevels.JOINPOINT, member);
      }
      else
      {
         return ScopeKey.DEFAULT_SCOPE;
      }
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);
View Full Code Here

   {
      try
      {
         Controller controller = ((ScopingTestAPIDelegate)getDelegate()).getController();

         ScopeKey sk1 = new ScopeKey(new Scope[]{new Scope(CommonLevels.DEPLOYMENT, "deployment1"), new Scope(CommonLevels.APPLICATION, "testApp")});
         ScopedAliasControllerContext.addAlias("simple", "simple1", sk1, controller);

         ScopeKey sk3 = new ScopeKey(new Scope[]{new Scope(CommonLevels.DEPLOYMENT, "deployment3"), new Scope(CommonLevels.APPLICATION, "testApp")});
         ScopedAliasControllerContext.addAlias("simple", "simple3", sk3, controller);

         controller.addAlias("simple", "simple-main");
      }
      catch (Throwable t)
View Full Code Here

   {
      Controller controller = ((ScopingTestAPIDelegate)getDelegate()).getController();

      controller.removeAlias("simple");

      ScopeKey sk1 = new ScopeKey(new Scope[]{new Scope(CommonLevels.DEPLOYMENT, "deployment1"), new Scope(CommonLevels.APPLICATION, "testApp")});
      ScopedAliasControllerContext.removeAlias("simple", sk1, controller);

      ScopeKey sk3 = new ScopeKey(new Scope[]{new Scope(CommonLevels.DEPLOYMENT, "deployment3"), new Scope(CommonLevels.APPLICATION, "testApp")});
      ScopedAliasControllerContext.removeAlias("simple", sk3, controller);

      super.tearDown();
   }
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.class.cast(annotated);
         scope = new Scope(CommonLevels.CLASS, clazz);
      }
      else if (annotated instanceof Member)
      {
         Member member = (Member) annotated;
         scope = new Scope(CommonLevels.JOINPOINT, member);
      }
      else
      {
         return ScopeKey.DEFAULT_SCOPE;
      }
View Full Code Here

      assert canonicalObjectName != null : "canonicalObjectName is null";
      assert classLoader != null : "classLoader is null";
     
      this.classLoader = classLoader;
     
      MetaDataRetrieval classMetaData = ClassMetaDataRetrievalFactory.INSTANCE.getMetaDataRetrieval(new Scope(CommonLevels.CLASS, beanClass));
      ScopeKey instanceScope = new ScopeKey(CommonLevels.INSTANCE, canonicalObjectName);
      mutableMetaData = new MemoryMetaDataLoader(instanceScope);
      //MetaDataRetrieval dynamicXml = new EJBMetaDataLoader(instanceScope, beanMetaData, classLoader);
      this.bridgedMetaDataLoader = new BridgedMetaDataLoader<JBossEnterpriseBeanMetaData>(instanceScope, beanMetaData, classLoader);
     
View Full Code Here

     
      MetaDataContext classContext = null;
      if(beanMetaData == null || !beanMetaData.getEjbJarMetaData().isMetadataComplete())
      {
         // Create a fallback parent meta data context which targets the annotations
         MetaDataRetrieval classMetaData = ClassMetaDataRetrievalFactory.INSTANCE.getMetaDataRetrieval(new Scope(CommonLevels.CLASS, beanClass));
         classContext = new AbstractMetaDataContext(classMetaData);
      }
      MetaDataRetrieval[] instance = { bridgedMetaDataLoader, mutableMetaData };
      MetaDataContext instanceContext = new AbstractMetaDataContext(classContext, Arrays.asList(instance));
      metaData = new MetaDataRetrievalToMetaDataBridge(instanceContext);
View Full Code Here

            {
               if (annotation.annotationType().isAnnotationPresent(ScopeFactoryLookup.class))
               {
                  ScopeFactoryLookup sfl = annotation.annotationType().getAnnotation(ScopeFactoryLookup.class);
                  ScopeFactory scf = getScopeFactory(sfl.value());
                  Scope scope = scf.create(annotation);
                  scopes.add(scope);
               }
            }
            if (scopes.size() > 0)
            {
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.