Package org.jboss.aop

Examples of org.jboss.aop.Domain


   {
      //Scoped AOP deployments are only available when deployed as part of a scoped sar, ear etc.
      //It can contain an aop.xml file, or it can be part of a .aop file

      AspectManager manager = aspectManager;
      Domain domain = AOPClassLoaderInitializer.initializeForUnit(unit);
      if (domain != null)
      {
         manager = domain;
      }
      log.debug("Adding AspectManager attachment " + manager + " for " + unit);
View Full Code Here


     
      ClassLoader cl = Thread.currentThread().getContextClassLoader();
      Class<?> beanClass = MockBean.class;
      String beanClassName = beanClass.getName();
      String ejbName = beanClass.getSimpleName();
      Domain domain = new Domain(new AspectManager(), "Test", false);

      GenericAspectFactory aspectFactory = new GenericAspectFactory(CurrentInvocationInterceptor.class.getName(), null);
      AspectDefinition def = new AspectDefinition("CurrentInvocationInterceptor", Scope.PER_VM, aspectFactory);
      domain.addAspectDefinition(def);
      AdviceFactory factory = new AdviceFactory(def, "invoke");
      GenericAspectFactory aspectFactory2 = new GenericAspectFactory(CurrentInvocationContextInterceptor.class.getName(), null);
      AspectDefinition def2 = new AspectDefinition("CurrentInvocationContextInterceptor", Scope.PER_VM, aspectFactory2);
      domain.addAspectDefinition(def2);
      AdviceFactory factory2 = new AdviceFactory(def2, "invoke");
      AdviceStack stack = new AdviceStack("InjectionCallbackStack", new ArrayList<InterceptorFactory>(Arrays.asList(factory, factory2)));
      domain.addAdviceStack(stack);
     
      Map<String, Class<? extends PersistenceManagerFactory>> factories = new HashMap<String, Class<? extends PersistenceManagerFactory>>();
      factories.put("MyStatefulSessionFilePersistenceManager", MyStatefulSessionFilePersistenceManagerFactory.class);
      PersistenceManagerFactoryRegistry persistenceManagerFactoryRegistry = new PersistenceManagerFactoryRegistry();
      persistenceManagerFactoryRegistry.setFactories(factories);
View Full Code Here

         // Ensure jndi.properties is accessible
         log.info("Found: " + cl.getResource("jndi.properties"));

         // Obtain properties required of container construction
         String beanClassname = smd.getEjbClass();
         Domain domain = getDomain(sessionType.equals(ContainerType.SLSB)
               ? AbstractEJB3TestCase.DOMAIN_NAME_SLSB
               : AbstractEJB3TestCase.DOMAIN_NAME_SFSB);
         Hashtable<?, ?> ctxProperties = null;
        
         // Is SFSB, manually set a PM Factory Registry and Cache Factory
View Full Code Here

   {
      ClassLoader cl = Thread.currentThread().getContextClassLoader();
      System.out.println(cl.getResource("jndi.properties"));
      String beanClassname = MyStatefulBean.class.getName();
      String ejbName = MyStatefulBean.class.getSimpleName();
      Domain domain = getDomain("Stateful Bean");
      Hashtable<?,?> ctxProperties = null;
      Ejb3Deployment deployment = new MockEjb3Deployment(new MockDeploymentUnit());
      deployment.setPersistenceManagerFactoryRegistry(getBootstrap().lookup("EJB3PersistenceManagerFactoryRegistry", PersistenceManagerFactoryRegistry.class));
      JBossSessionBeanMetaData beanMetaData = MetaDataHelper.getMetadataFromBeanImplClass(MyStatefulBean.class);
      StatefulContainer container = new StatefulContainer(cl, beanClassname, ejbName, domain, ctxProperties, deployment, beanMetaData);
View Full Code Here

     
      DomainDefinition domainDefinition = AspectManager.instance().getContainer(containerName);
      if(domainDefinition == null)
         throw new IllegalArgumentException("Domain definition for container '" + containerName + "' can not be found");
     
      final Domain domain = (Domain) domainDefinition.getManager();
     
      ClassLoader classLoader = new DomainClassLoader(Thread.currentThread().getContextClassLoader(), deploymentClassLoader, domain);
      Thread.currentThread().setContextClassLoader(classLoader);
     
      // The moment an instrumented class comes up it does AspectManager.instance(classLoader), which
View Full Code Here

{
   public static Domain initializeForUnit(DeploymentUnit unit)
   {
      AOPClassLoaderScopingPolicyWithRegistry policy = (AOPClassLoaderScopingPolicyWithRegistry)AspectManager.getClassLoaderScopingPolicy();
      registerLoaders(policy, unit);
      Domain domain = getDomain(policy.getRegistry(), unit);
     
      return domain;
   }
View Full Code Here

   public synchronized Domain getDomain(ClassLoader classLoader, AspectManager parent)
   {
      ClassLoader scopedClassLoader = ifScopedDeploymentGetScopedParentUclForCL(classLoader);
      if (scopedClassLoader != null)
      {
         Domain scopedManager = null;
         synchronized (AOPClassPoolRepository.getInstance().getRegisteredCLs())
         {
            Object loaderRepository = getLoaderRepository(classLoader);
            scopedManager = scopedClassLoaderDomains.get(loaderRepository);
           
            // FIXME: JBAOP-107 REMOVE THIS HACK
            if (scopedManager != null && scopedManager.isValid() == false)
            {
               scopedClassLoaderDomains.remove(loaderRepository);
               scopedManager = null;
            }
           
            if (scopedManager == null)
            {
               scopedManager = getScopedClassLoaderDomain(scopedClassLoader, parent);
               log.debug("Created domain " + scopedManager + " for scoped deployment on: " +
                        classLoader + "; identifying scoped ucl: " + scopedClassLoader);
               scopedManager.setInheritsBindings(true);
               scopedManager.setInheritsDeclarations(true);
              
               scopedClassLoaderDomains.put(loaderRepository, scopedManager);
            }
            return scopedManager;
         }
View Full Code Here

   }
  
   public Domain getDomain(ClassLoader classLoader, AspectManager parent)
   {
      //Check the stored domains
      Domain domain = registry.getRegisteredDomain(classLoader);
      if (domain != null)
      {
         return domain;
      }
     
View Full Code Here

{
   public static Domain initializeForUnit(DeploymentUnit unit)
   {
      AOPClassLoaderScopingPolicyWithRegistry policy = (AOPClassLoaderScopingPolicyWithRegistry)AspectManager.getClassLoaderScopingPolicy();
      registerLoaders(policy, unit);
      Domain domain = getDomain(policy.getRegistry(), unit);
     
      return domain;
   }
View Full Code Here

   {
      DomainDefinition domainDefinition = AspectManager.instance().getContainer(domainName);
      if(domainDefinition == null)
         throw new IllegalArgumentException("Domain definition '" + domainName + "' can not be found");
     
      final Domain domain = (Domain) domainDefinition.getManager();
      return domain;
   }
View Full Code Here

TOP

Related Classes of org.jboss.aop.Domain

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.