Package javax.enterprise.context.spi

Examples of javax.enterprise.context.spi.Contextual


   public void afterCompletion(int status)
   {
      TransactionScopeData data = contextData.get();
      for (Entry<String, Object> e : data.getInstanceStore().entrySet())
      {
         Contextual contextual = identifierStore.getContextual(e.getKey());
         CreationalContext<?> ctx = data.getCreationalContexts().get(e.getKey());
         contextual.destroy(e.getValue(), ctx);
         ctx.release();
      }
      contextData.remove();
   }
View Full Code Here


                new HashMap<Object, ContextualInstanceInfo<?>>(storage.getStorage());
        storage.getStorage().clear();

        for (Map.Entry<Object, ContextualInstanceInfo<?>> entry : contextMap.entrySet())
        {
            Contextual bean = storage.getBean(entry.getKey());

            ContextualInstanceInfo<?> contextualInstanceInfo = entry.getValue();
            destroyBean(bean, contextualInstanceInfo);
        }
        return contextMap;
View Full Code Here

        {
            for (Map.Entry<Object, ContextualInstanceInfo<?>> storageEntry : storage.getStorage().entrySet())
            {
                if (!viewAccessBeanAccessHistory.getAccessedBeans().contains((String) storageEntry.getKey()))
                {
                    Contextual bean = storage.getBean(storageEntry.getKey());
                    AbstractContext.destroyBean(bean, storageEntry.getValue());
                    storage.getStorage().remove(storageEntry.getKey()); //ok due to ConcurrentHashMap
                }
            }
        }
View Full Code Here

            {
                Class classOfEntry = storageEntry.getValue().getContextualInstance().getClass();
                if (subGroup.equals(classOfEntry) ||
                    (subGroup.isInterface() && subGroup.isAssignableFrom(classOfEntry)))
                {
                    Contextual bean = storage.getBean(storageEntry.getKey());
                    AbstractContext.destroyBean(bean, storageEntry.getValue());
                    storage.getStorage().remove(storageEntry.getKey()); //ok due to ConcurrentHashMap
                    break;
                }
            }
View Full Code Here

        assert(!flowScopedBeanMap.isEmpty());
        assert(!creationalMap.isEmpty());
        List<Contextual<?>> flowScopedBeansToRemove = new ArrayList<Contextual<?>>();
       
        for (Entry<Contextual<?>, Object> entry : flowScopedBeanMap.entrySet()) {
            Contextual owner = entry.getKey();
            Object bean = entry.getValue();
            CreationalContext creational = creationalMap.get(owner);
           
            owner.destroy(bean, creational);
            flowScopedBeansToRemove.add(owner);
        }
       
        for (Contextual<?> cur : flowScopedBeansToRemove) {
            flowScopedBeanMap.remove(cur);
View Full Code Here

    private void destroyBeans(Map<String, Object> viewMap, Map<Contextual, ViewScopeContextObject> contextMap) {
        ArrayList<String> removalNameList = new ArrayList<String>();

        if (contextMap != null) {
            for (Map.Entry<Contextual, ViewScopeContextObject> entry : contextMap.entrySet()) {
                Contextual contextual = entry.getKey();
                ViewScopeContextObject contextObject = entry.getValue();
                CreationalContext creationalContext = contextObject.getCreationalContext();
                contextual.destroy(viewMap.get(contextObject.getName()), creationalContext);
                removalNameList.add(contextObject.getName());
            }

            Iterator<String> removalNames = removalNameList.iterator();
            while (removalNames.hasNext()) {
View Full Code Here

      if ((componentInstanceMap != null) && (creationalContextMap != null))
      {
         for (Entry<Contextual<?>, Object> componentEntry : componentInstanceMap.entrySet())
         {
            Contextual contextual = componentEntry.getKey();
            Object instance = componentEntry.getValue();
            CreationalContext creational = creationalContextMap.get(contextual);

            contextual.destroy(instance, creational);
         }
      }
   }
View Full Code Here

            {
                for ( Entry<Contextual<?>, Object> componentEntry : componentInstanceMap.entrySet())
                {
                    // there is no nice way to explain the Java Compiler that we are handling the same type T,
                    // therefore we need completely drop the type information :(
                    Contextual contextual = componentEntry.getKey();
                    Object instance = componentEntry.getValue();
                    CreationalContext creational = creationalContextMap.get(contextual);

                    contextual.destroy(instance, creational);
                }
            }
        }
    }
View Full Code Here

            if(componentInstanceMap != null) {
                for ( Entry<Contextual<?>, Object> componentEntry : componentInstanceMap.entrySet())
                {
                    // there is no nice way to explain the Java Compiler that we are handling the same type T,
                    // therefore we need completely drop the type information :( 
                    Contextual contextual = componentEntry.getKey();
                    Object instance = componentEntry.getValue();
                    CreationalContext creational = creationalContextMap.get(contextual);
                   
                    contextual.destroy(instance, creational);
                }
            }
        }
    }
View Full Code Here

       
        for (Map.Entry<Object, ContextualInstanceInfo<?>> entry : contextMap.entrySet())
        {
            if (!(entry.getKey() instanceof _ContextualKey))
            {           
                Contextual bean = storage.getBean(entry.getKey());

                ContextualInstanceInfo<?> contextualInstanceInfo = entry.getValue();
                bean.destroy(contextualInstanceInfo.getContextualInstance(),
                    contextualInstanceInfo.getCreationalContext());
            }
        }
    }
View Full Code Here

TOP

Related Classes of javax.enterprise.context.spi.Contextual

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.