Commit 2ca9d1be93161082afc9526c416b21479f343faf
1 parent
ec56e81f
Exists in
master
Finalmente a correção para o escopo estático das classes de configuração
Showing
11 changed files
with
72 additions
and
59 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/configuration/Configuration.java
@@ -46,6 +46,8 @@ import java.lang.annotation.Target; | @@ -46,6 +46,8 @@ import java.lang.annotation.Target; | ||
46 | import javax.enterprise.inject.Stereotype; | 46 | import javax.enterprise.inject.Stereotype; |
47 | import javax.enterprise.util.Nonbinding; | 47 | import javax.enterprise.util.Nonbinding; |
48 | 48 | ||
49 | +import br.gov.frameworkdemoiselle.annotation.StaticScoped; | ||
50 | + | ||
49 | /** | 51 | /** |
50 | * Identifies a <b>configuration class</b>, that is, a structure reserved to store configuration values retrieved from a | 52 | * Identifies a <b>configuration class</b>, that is, a structure reserved to store configuration values retrieved from a |
51 | * given resource file or system variables. | 53 | * given resource file or system variables. |
@@ -63,7 +65,7 @@ import javax.enterprise.util.Nonbinding; | @@ -63,7 +65,7 @@ import javax.enterprise.util.Nonbinding; | ||
63 | */ | 65 | */ |
64 | @Inherited | 66 | @Inherited |
65 | @Stereotype | 67 | @Stereotype |
66 | -// @StaticScoped | 68 | +@StaticScoped |
67 | @Target(TYPE) | 69 | @Target(TYPE) |
68 | @Retention(RUNTIME) | 70 | @Retention(RUNTIME) |
69 | public @interface Configuration { | 71 | public @interface Configuration { |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/CoreBootstrap.java
@@ -36,6 +36,8 @@ | @@ -36,6 +36,8 @@ | ||
36 | */ | 36 | */ |
37 | package br.gov.frameworkdemoiselle.internal.bootstrap; | 37 | package br.gov.frameworkdemoiselle.internal.bootstrap; |
38 | 38 | ||
39 | +import java.util.ArrayList; | ||
40 | +import java.util.List; | ||
39 | import java.util.Locale; | 41 | import java.util.Locale; |
40 | 42 | ||
41 | import javax.enterprise.event.Observes; | 43 | import javax.enterprise.event.Observes; |
@@ -49,6 +51,7 @@ import javax.enterprise.inject.spi.Extension; | @@ -49,6 +51,7 @@ import javax.enterprise.inject.spi.Extension; | ||
49 | import org.slf4j.Logger; | 51 | import org.slf4j.Logger; |
50 | 52 | ||
51 | import br.gov.frameworkdemoiselle.internal.context.Contexts; | 53 | import br.gov.frameworkdemoiselle.internal.context.Contexts; |
54 | +import br.gov.frameworkdemoiselle.internal.context.CustomContext; | ||
52 | import br.gov.frameworkdemoiselle.internal.context.StaticContext; | 55 | import br.gov.frameworkdemoiselle.internal.context.StaticContext; |
53 | import br.gov.frameworkdemoiselle.internal.producer.LoggerProducer; | 56 | import br.gov.frameworkdemoiselle.internal.producer.LoggerProducer; |
54 | import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer; | 57 | import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer; |
@@ -61,7 +64,9 @@ public class CoreBootstrap implements Extension { | @@ -61,7 +64,9 @@ public class CoreBootstrap implements Extension { | ||
61 | 64 | ||
62 | private ResourceBundle bundle; | 65 | private ResourceBundle bundle; |
63 | 66 | ||
64 | - private AfterBeanDiscovery afterBeanDiscovery; | 67 | + private AfterBeanDiscovery afterBeanDiscoveryEvent; |
68 | + | ||
69 | + private List<CustomContext> customContexts = new ArrayList<CustomContext>(); | ||
65 | 70 | ||
66 | private Logger getLogger() { | 71 | private Logger getLogger() { |
67 | if (this.logger == null) { | 72 | if (this.logger == null) { |
@@ -86,17 +91,24 @@ public class CoreBootstrap implements Extension { | @@ -86,17 +91,24 @@ public class CoreBootstrap implements Extension { | ||
86 | getLogger().info(getBundle().getString("setting-up-bean-manager", Beans.class.getCanonicalName())); | 91 | getLogger().info(getBundle().getString("setting-up-bean-manager", Beans.class.getCanonicalName())); |
87 | } | 92 | } |
88 | 93 | ||
89 | - public void afterBeanDiscovery(@Observes final AfterBeanDiscovery event) { | ||
90 | - this.afterBeanDiscovery = event; | 94 | + public void storeContexts(@Observes final AfterBeanDiscovery event) { |
95 | + this.customContexts.add(new StaticContext()); | ||
96 | + this.afterBeanDiscoveryEvent = event; | ||
91 | } | 97 | } |
92 | 98 | ||
93 | public void takeOff(@Observes final AfterDeploymentValidation event) { | 99 | public void takeOff(@Observes final AfterDeploymentValidation event) { |
94 | - Contexts.add(new StaticContext(), this.afterBeanDiscovery); | 100 | + for (CustomContext tempContext : this.customContexts) { |
101 | + Contexts.add(tempContext, this.afterBeanDiscoveryEvent); | ||
102 | + } | ||
95 | 103 | ||
96 | getLogger().info(getBundle().getString("taking-off")); | 104 | getLogger().info(getBundle().getString("taking-off")); |
97 | } | 105 | } |
98 | 106 | ||
99 | public void engineOff(@Observes final BeforeShutdown event) { | 107 | public void engineOff(@Observes final BeforeShutdown event) { |
108 | + for (CustomContext tempContext : this.customContexts) { | ||
109 | + Contexts.remove(tempContext); | ||
110 | + } | ||
111 | + | ||
100 | getLogger().info(getBundle().getString("engine-off")); | 112 | getLogger().info(getBundle().getString("engine-off")); |
101 | } | 113 | } |
102 | } | 114 | } |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/context/AbstractCustomContext.java
@@ -42,12 +42,11 @@ import java.util.HashMap; | @@ -42,12 +42,11 @@ import java.util.HashMap; | ||
42 | import java.util.Map; | 42 | import java.util.Map; |
43 | 43 | ||
44 | import javax.enterprise.context.ContextNotActiveException; | 44 | import javax.enterprise.context.ContextNotActiveException; |
45 | -import javax.enterprise.context.spi.Context; | ||
46 | import javax.enterprise.context.spi.Contextual; | 45 | import javax.enterprise.context.spi.Contextual; |
47 | import javax.enterprise.context.spi.CreationalContext; | 46 | import javax.enterprise.context.spi.CreationalContext; |
48 | import javax.enterprise.inject.spi.Bean; | 47 | import javax.enterprise.inject.spi.Bean; |
49 | 48 | ||
50 | -public abstract class AbstractCustomContext implements Context { | 49 | +public abstract class AbstractCustomContext implements CustomContext { |
51 | 50 | ||
52 | private boolean active; | 51 | private boolean active; |
53 | 52 | ||
@@ -96,7 +95,7 @@ public abstract class AbstractCustomContext implements Context { | @@ -96,7 +95,7 @@ public abstract class AbstractCustomContext implements Context { | ||
96 | return this.active; | 95 | return this.active; |
97 | } | 96 | } |
98 | 97 | ||
99 | - public void setActive(final boolean active) { | 98 | + public void setActive(boolean active) { |
100 | this.active = active; | 99 | this.active = active; |
101 | } | 100 | } |
102 | 101 | ||
@@ -105,41 +104,27 @@ public abstract class AbstractCustomContext implements Context { | @@ -105,41 +104,27 @@ public abstract class AbstractCustomContext implements Context { | ||
105 | return this.scope; | 104 | return this.scope; |
106 | } | 105 | } |
107 | 106 | ||
108 | - // static class Store { | ||
109 | - // | ||
110 | - // private Map<Class<?>, Object> cache = Collections.synchronizedMap(new HashMap<Class<?>, Object>()); | ||
111 | - // | ||
112 | - // public boolean contains(final Class<?> type) { | ||
113 | - // return this.getMap().containsKey(type); | ||
114 | - // } | ||
115 | - // | ||
116 | - // public Object get(final Class<?> type) { | ||
117 | - // return this.getMap().get(type); | ||
118 | - // } | ||
119 | - // | ||
120 | - // public void put(final Class<?> type, final Object instance) { | ||
121 | - // this.getMap().put(type, instance); | ||
122 | - // } | ||
123 | - // | ||
124 | - // private Map<Class<?>, Object> getMap() { | ||
125 | - // return cache; | ||
126 | - // } | ||
127 | - // } | 107 | + protected static Store createStore() { |
108 | + return new Store(); | ||
109 | + } | ||
128 | 110 | ||
129 | static class Store { | 111 | static class Store { |
130 | 112 | ||
131 | private Map<ClassLoader, Map<Class<?>, Object>> cache = Collections | 113 | private Map<ClassLoader, Map<Class<?>, Object>> cache = Collections |
132 | .synchronizedMap(new HashMap<ClassLoader, Map<Class<?>, Object>>()); | 114 | .synchronizedMap(new HashMap<ClassLoader, Map<Class<?>, Object>>()); |
133 | 115 | ||
134 | - public boolean contains(final Class<?> type) { | 116 | + private Store() { |
117 | + } | ||
118 | + | ||
119 | + private boolean contains(final Class<?> type) { | ||
135 | return this.getMap().containsKey(type); | 120 | return this.getMap().containsKey(type); |
136 | } | 121 | } |
137 | 122 | ||
138 | - public Object get(final Class<?> type) { | 123 | + private Object get(final Class<?> type) { |
139 | return this.getMap().get(type); | 124 | return this.getMap().get(type); |
140 | } | 125 | } |
141 | 126 | ||
142 | - public void put(final Class<?> type, final Object instance) { | 127 | + private void put(final Class<?> type, final Object instance) { |
143 | this.getMap().put(type, instance); | 128 | this.getMap().put(type, instance); |
144 | } | 129 | } |
145 | 130 |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/context/Contexts.java
@@ -52,9 +52,9 @@ import br.gov.frameworkdemoiselle.util.ResourceBundle; | @@ -52,9 +52,9 @@ import br.gov.frameworkdemoiselle.util.ResourceBundle; | ||
52 | 52 | ||
53 | public final class Contexts { | 53 | public final class Contexts { |
54 | 54 | ||
55 | - private static List<AbstractCustomContext> activeContexts = Collections.synchronizedList(new ArrayList<AbstractCustomContext>()); | 55 | + private static List<CustomContext> activeContexts = Collections.synchronizedList(new ArrayList<CustomContext>()); |
56 | 56 | ||
57 | - private static List<AbstractCustomContext> inactiveContexts = Collections.synchronizedList(new ArrayList<AbstractCustomContext>()); | 57 | + private static List<CustomContext> inactiveContexts = Collections.synchronizedList(new ArrayList<CustomContext>()); |
58 | 58 | ||
59 | private static Logger logger; | 59 | private static Logger logger; |
60 | 60 | ||
@@ -79,7 +79,7 @@ public final class Contexts { | @@ -79,7 +79,7 @@ public final class Contexts { | ||
79 | return bundle; | 79 | return bundle; |
80 | } | 80 | } |
81 | 81 | ||
82 | - public static synchronized void add(AbstractCustomContext context, AfterBeanDiscovery event) { | 82 | + public static synchronized void add(CustomContext context, AfterBeanDiscovery event) { |
83 | Class<? extends Annotation> scope = context.getScope(); | 83 | Class<? extends Annotation> scope = context.getScope(); |
84 | 84 | ||
85 | getLogger() | 85 | getLogger() |
@@ -99,10 +99,10 @@ public final class Contexts { | @@ -99,10 +99,10 @@ public final class Contexts { | ||
99 | } | 99 | } |
100 | } | 100 | } |
101 | 101 | ||
102 | - private static AbstractCustomContext get(Class<? extends Annotation> scope, List<AbstractCustomContext> contexts) { | ||
103 | - AbstractCustomContext result = null; | 102 | + private static CustomContext get(Class<? extends Annotation> scope, List<CustomContext> contexts) { |
103 | + CustomContext result = null; | ||
104 | 104 | ||
105 | - for (AbstractCustomContext context : contexts) { | 105 | + for (CustomContext context : contexts) { |
106 | if (scope.equals(context.getScope())) { | 106 | if (scope.equals(context.getScope())) { |
107 | result = context; | 107 | result = context; |
108 | break; | 108 | break; |
@@ -112,7 +112,7 @@ public final class Contexts { | @@ -112,7 +112,7 @@ public final class Contexts { | ||
112 | return result; | 112 | return result; |
113 | } | 113 | } |
114 | 114 | ||
115 | - public static synchronized void remove(AbstractCustomContext context) { | 115 | + public static synchronized void remove(CustomContext context) { |
116 | getLogger().trace( | 116 | getLogger().trace( |
117 | getBundle().getString("custom-context-was-unregistered", context.getScope().getCanonicalName())); | 117 | getBundle().getString("custom-context-was-unregistered", context.getScope().getCanonicalName())); |
118 | 118 | ||
@@ -120,7 +120,7 @@ public final class Contexts { | @@ -120,7 +120,7 @@ public final class Contexts { | ||
120 | activeContexts.remove(context); | 120 | activeContexts.remove(context); |
121 | context.setActive(false); | 121 | context.setActive(false); |
122 | 122 | ||
123 | - AbstractCustomContext inactive = get(context.getScope(), inactiveContexts); | 123 | + CustomContext inactive = get(context.getScope(), inactiveContexts); |
124 | if (inactive != null) { | 124 | if (inactive != null) { |
125 | activeContexts.add(inactive); | 125 | activeContexts.add(inactive); |
126 | inactive.setActive(true); | 126 | inactive.setActive(true); |
@@ -133,8 +133,8 @@ public final class Contexts { | @@ -133,8 +133,8 @@ public final class Contexts { | ||
133 | } | 133 | } |
134 | 134 | ||
135 | public static synchronized void clear() { | 135 | public static synchronized void clear() { |
136 | - AbstractCustomContext context; | ||
137 | - for (Iterator<AbstractCustomContext> iter = activeContexts.iterator(); iter.hasNext();) { | 136 | + CustomContext context; |
137 | + for (Iterator<CustomContext> iter = activeContexts.iterator(); iter.hasNext();) { | ||
138 | context = iter.next(); | 138 | context = iter.next(); |
139 | context.setActive(false); | 139 | context.setActive(false); |
140 | iter.remove(); | 140 | iter.remove(); |
@@ -144,11 +144,11 @@ public final class Contexts { | @@ -144,11 +144,11 @@ public final class Contexts { | ||
144 | inactiveContexts.clear(); | 144 | inactiveContexts.clear(); |
145 | } | 145 | } |
146 | 146 | ||
147 | - public static synchronized List<AbstractCustomContext> getActiveContexts() { | 147 | + public static synchronized List<CustomContext> getActiveContexts() { |
148 | return activeContexts; | 148 | return activeContexts; |
149 | } | 149 | } |
150 | 150 | ||
151 | - public static synchronized List<AbstractCustomContext> getInactiveContexts() { | 151 | + public static synchronized List<CustomContext> getInactiveContexts() { |
152 | return inactiveContexts; | 152 | return inactiveContexts; |
153 | } | 153 | } |
154 | } | 154 | } |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/context/CustomContext.java
0 → 100644
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/context/StaticContext.java
@@ -52,7 +52,7 @@ import br.gov.frameworkdemoiselle.annotation.StaticScoped; | @@ -52,7 +52,7 @@ import br.gov.frameworkdemoiselle.annotation.StaticScoped; | ||
52 | 52 | ||
53 | public class StaticContext extends AbstractCustomContext { | 53 | public class StaticContext extends AbstractCustomContext { |
54 | 54 | ||
55 | - private final static Store store = new Store(); | 55 | + private final static Store store = createStore(); |
56 | 56 | ||
57 | public StaticContext() { | 57 | public StaticContext() { |
58 | super(StaticScoped.class, true); | 58 | super(StaticScoped.class, true); |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/context/ThreadLocalContext.java
@@ -65,7 +65,7 @@ public class ThreadLocalContext extends AbstractCustomContext { | @@ -65,7 +65,7 @@ public class ThreadLocalContext extends AbstractCustomContext { | ||
65 | @Override | 65 | @Override |
66 | protected Store getStore() { | 66 | protected Store getStore() { |
67 | if (this.threadLocal.get() == null) { | 67 | if (this.threadLocal.get() == null) { |
68 | - this.threadLocal.set(new Store()); | 68 | + this.threadLocal.set(createStore()); |
69 | } | 69 | } |
70 | 70 | ||
71 | return this.threadLocal.get(); | 71 | return this.threadLocal.get(); |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/basic/ConfigurationBasicFieldTest.java
@@ -46,6 +46,7 @@ import org.jboss.arquillian.container.test.api.Deployment; | @@ -46,6 +46,7 @@ import org.jboss.arquillian.container.test.api.Deployment; | ||
46 | import org.jboss.arquillian.junit.Arquillian; | 46 | import org.jboss.arquillian.junit.Arquillian; |
47 | import org.jboss.shrinkwrap.api.asset.FileAsset; | 47 | import org.jboss.shrinkwrap.api.asset.FileAsset; |
48 | import org.jboss.shrinkwrap.api.spec.JavaArchive; | 48 | import org.jboss.shrinkwrap.api.spec.JavaArchive; |
49 | +import org.junit.BeforeClass; | ||
49 | import org.junit.Test; | 50 | import org.junit.Test; |
50 | import org.junit.runner.RunWith; | 51 | import org.junit.runner.RunWith; |
51 | 52 | ||
@@ -77,10 +78,17 @@ public class ConfigurationBasicFieldTest extends AbstractConfigurationTest { | @@ -77,10 +78,17 @@ public class ConfigurationBasicFieldTest extends AbstractConfigurationTest { | ||
77 | return deployment; | 78 | return deployment; |
78 | } | 79 | } |
79 | 80 | ||
81 | + @BeforeClass | ||
82 | + public static void afterClass() { | ||
83 | + System.setProperty("primitiveInteger", String.valueOf(1)); | ||
84 | + System.setProperty("wrappedInteger", String.valueOf(2)); | ||
85 | + System.setProperty("stringWithSpace", String.valueOf("demoiselle framework")); | ||
86 | + System.setProperty("stringWithComma", String.valueOf("demoiselle,framework")); | ||
87 | + } | ||
88 | + | ||
80 | @Test | 89 | @Test |
81 | public void loadPrimitiveInteger() { | 90 | public void loadPrimitiveInteger() { |
82 | int expected = 1; | 91 | int expected = 1; |
83 | - System.setProperty("primitiveInteger", String.valueOf(expected)); | ||
84 | 92 | ||
85 | assertEquals(expected, systemConfig.getPrimitiveInteger()); | 93 | assertEquals(expected, systemConfig.getPrimitiveInteger()); |
86 | assertEquals(expected, propertiesConfig.getPrimitiveInteger()); | 94 | assertEquals(expected, propertiesConfig.getPrimitiveInteger()); |
@@ -90,7 +98,6 @@ public class ConfigurationBasicFieldTest extends AbstractConfigurationTest { | @@ -90,7 +98,6 @@ public class ConfigurationBasicFieldTest extends AbstractConfigurationTest { | ||
90 | @Test | 98 | @Test |
91 | public void loadWrappedInteger() { | 99 | public void loadWrappedInteger() { |
92 | Integer expected = 2; | 100 | Integer expected = 2; |
93 | - System.setProperty("wrappedInteger", String.valueOf(expected)); | ||
94 | 101 | ||
95 | assertEquals(expected, systemConfig.getWrappedInteger()); | 102 | assertEquals(expected, systemConfig.getWrappedInteger()); |
96 | assertEquals(expected, propertiesConfig.getWrappedInteger()); | 103 | assertEquals(expected, propertiesConfig.getWrappedInteger()); |
@@ -100,7 +107,6 @@ public class ConfigurationBasicFieldTest extends AbstractConfigurationTest { | @@ -100,7 +107,6 @@ public class ConfigurationBasicFieldTest extends AbstractConfigurationTest { | ||
100 | @Test | 107 | @Test |
101 | public void loadStringWithSpace() { | 108 | public void loadStringWithSpace() { |
102 | String expected = "demoiselle framework"; | 109 | String expected = "demoiselle framework"; |
103 | - System.setProperty("stringWithSpace", String.valueOf(expected)); | ||
104 | 110 | ||
105 | assertEquals(expected, systemConfig.getStringWithSpace()); | 111 | assertEquals(expected, systemConfig.getStringWithSpace()); |
106 | assertEquals(expected, propertiesConfig.getStringWithSpace()); | 112 | assertEquals(expected, propertiesConfig.getStringWithSpace()); |
@@ -110,7 +116,6 @@ public class ConfigurationBasicFieldTest extends AbstractConfigurationTest { | @@ -110,7 +116,6 @@ public class ConfigurationBasicFieldTest extends AbstractConfigurationTest { | ||
110 | // @Test | 116 | // @Test |
111 | public void loadStringWithComma() { | 117 | public void loadStringWithComma() { |
112 | String expected = "demoiselle,framework"; | 118 | String expected = "demoiselle,framework"; |
113 | - System.setProperty("stringWithComma", String.valueOf(expected)); | ||
114 | 119 | ||
115 | assertEquals(expected, systemConfig.getStringWithComma()); | 120 | assertEquals(expected, systemConfig.getStringWithComma()); |
116 | assertEquals(expected, propertiesConfig.getStringWithComma()); | 121 | assertEquals(expected, propertiesConfig.getStringWithComma()); |
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/JsfBootstrap.java
@@ -44,30 +44,30 @@ import javax.enterprise.inject.spi.AfterBeanDiscovery; | @@ -44,30 +44,30 @@ import javax.enterprise.inject.spi.AfterBeanDiscovery; | ||
44 | import javax.enterprise.inject.spi.AfterDeploymentValidation; | 44 | import javax.enterprise.inject.spi.AfterDeploymentValidation; |
45 | import javax.enterprise.inject.spi.Extension; | 45 | import javax.enterprise.inject.spi.Extension; |
46 | 46 | ||
47 | -import br.gov.frameworkdemoiselle.internal.context.AbstractCustomContext; | ||
48 | import br.gov.frameworkdemoiselle.internal.context.Contexts; | 47 | import br.gov.frameworkdemoiselle.internal.context.Contexts; |
48 | +import br.gov.frameworkdemoiselle.internal.context.CustomContext; | ||
49 | import br.gov.frameworkdemoiselle.internal.context.ViewContext; | 49 | import br.gov.frameworkdemoiselle.internal.context.ViewContext; |
50 | import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess; | 50 | import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess; |
51 | 51 | ||
52 | public class JsfBootstrap implements Extension { | 52 | public class JsfBootstrap implements Extension { |
53 | 53 | ||
54 | - private List<AbstractCustomContext> tempContexts = new ArrayList<AbstractCustomContext>(); | 54 | + private List<CustomContext> customContexts = new ArrayList<CustomContext>(); |
55 | 55 | ||
56 | private AfterBeanDiscovery afterBeanDiscoveryEvent; | 56 | private AfterBeanDiscovery afterBeanDiscoveryEvent; |
57 | 57 | ||
58 | public void storeContexts(@Observes final AfterBeanDiscovery event) { | 58 | public void storeContexts(@Observes final AfterBeanDiscovery event) { |
59 | - this.tempContexts.add(new ViewContext()); | 59 | + this.customContexts.add(new ViewContext()); |
60 | this.afterBeanDiscoveryEvent = event; | 60 | this.afterBeanDiscoveryEvent = event; |
61 | } | 61 | } |
62 | 62 | ||
63 | public void addContexts(@Observes final AfterDeploymentValidation event) { | 63 | public void addContexts(@Observes final AfterDeploymentValidation event) { |
64 | - for (AbstractCustomContext tempContext : this.tempContexts) { | 64 | + for (CustomContext tempContext : this.customContexts) { |
65 | Contexts.add(tempContext, this.afterBeanDiscoveryEvent); | 65 | Contexts.add(tempContext, this.afterBeanDiscoveryEvent); |
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | public void removeContexts(@Observes AfterShutdownProccess event) { | 69 | public void removeContexts(@Observes AfterShutdownProccess event) { |
70 | - for (AbstractCustomContext tempContext : this.tempContexts) { | 70 | + for (CustomContext tempContext : this.customContexts) { |
71 | Contexts.remove(tempContext); | 71 | Contexts.remove(tempContext); |
72 | } | 72 | } |
73 | } | 73 | } |
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/internal/context/ViewContext.java
@@ -53,7 +53,7 @@ public class ViewContext extends AbstractCustomContext { | @@ -53,7 +53,7 @@ public class ViewContext extends AbstractCustomContext { | ||
53 | String key = Store.class.getName(); | 53 | String key = Store.class.getName(); |
54 | 54 | ||
55 | if (!viewMap.containsKey(key)) { | 55 | if (!viewMap.containsKey(key)) { |
56 | - viewMap.put(key, new Store()); | 56 | + viewMap.put(key, createStore()); |
57 | } | 57 | } |
58 | 58 | ||
59 | return (Store) viewMap.get(key); | 59 | return (Store) viewMap.get(key); |
impl/extension/se/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/SeBootstrap.java
@@ -49,13 +49,13 @@ import javax.enterprise.inject.spi.Extension; | @@ -49,13 +49,13 @@ import javax.enterprise.inject.spi.Extension; | ||
49 | 49 | ||
50 | import br.gov.frameworkdemoiselle.annotation.ViewScoped; | 50 | import br.gov.frameworkdemoiselle.annotation.ViewScoped; |
51 | import br.gov.frameworkdemoiselle.internal.context.Contexts; | 51 | import br.gov.frameworkdemoiselle.internal.context.Contexts; |
52 | -import br.gov.frameworkdemoiselle.internal.context.AbstractCustomContext; | 52 | +import br.gov.frameworkdemoiselle.internal.context.CustomContext; |
53 | import br.gov.frameworkdemoiselle.internal.context.ThreadLocalContext; | 53 | import br.gov.frameworkdemoiselle.internal.context.ThreadLocalContext; |
54 | import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess; | 54 | import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess; |
55 | 55 | ||
56 | public class SeBootstrap implements Extension { | 56 | public class SeBootstrap implements Extension { |
57 | 57 | ||
58 | - private List<AbstractCustomContext> tempContexts = new ArrayList<AbstractCustomContext>(); | 58 | + private List<CustomContext> tempContexts = new ArrayList<CustomContext>(); |
59 | 59 | ||
60 | private AfterBeanDiscovery afterBeanDiscoveryEvent; | 60 | private AfterBeanDiscovery afterBeanDiscoveryEvent; |
61 | 61 | ||
@@ -69,13 +69,13 @@ public class SeBootstrap implements Extension { | @@ -69,13 +69,13 @@ public class SeBootstrap implements Extension { | ||
69 | } | 69 | } |
70 | 70 | ||
71 | public void addContexts(@Observes final AfterDeploymentValidation event) { | 71 | public void addContexts(@Observes final AfterDeploymentValidation event) { |
72 | - for (AbstractCustomContext tempContext : this.tempContexts) { | 72 | + for (CustomContext tempContext : this.tempContexts) { |
73 | Contexts.add(tempContext, this.afterBeanDiscoveryEvent); | 73 | Contexts.add(tempContext, this.afterBeanDiscoveryEvent); |
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | public void removeContexts(@Observes AfterShutdownProccess event) { | 77 | public void removeContexts(@Observes AfterShutdownProccess event) { |
78 | - for (AbstractCustomContext tempContext : this.tempContexts) { | 78 | + for (CustomContext tempContext : this.tempContexts) { |
79 | Contexts.remove(tempContext); | 79 | Contexts.remove(tempContext); |
80 | } | 80 | } |
81 | } | 81 | } |