Commit 94c14ba60d09c010acb38c12fdf09ac72d8b82cc
1 parent
52f99101
Exists in
master
Ajustes nos Loggers dos Bootstraps
Showing
11 changed files
with
79 additions
and
57 deletions
Show diff stats
example/security/src/main/resources/demoiselle.properties
... | ... | @@ -32,6 +32,3 @@ |
32 | 32 | # "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> |
33 | 33 | # ou escreva para a Fundação do Software Livre (FSF) Inc., |
34 | 34 | # 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. |
35 | - | |
36 | -#frameworkdemoiselle.security.authenticator.class=example.MyAuthenticator | |
37 | -#frameworkdemoiselle.security.authorizer.class=example.MyAuthorizer | ... | ... |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/AbstractLifecycleBootstrap.java
... | ... | @@ -62,7 +62,6 @@ import br.gov.frameworkdemoiselle.internal.context.Contexts; |
62 | 62 | import br.gov.frameworkdemoiselle.internal.context.CustomContext; |
63 | 63 | import br.gov.frameworkdemoiselle.internal.context.ThreadLocalContext; |
64 | 64 | import br.gov.frameworkdemoiselle.internal.implementation.AnnotatedMethodProcessor; |
65 | -import br.gov.frameworkdemoiselle.internal.producer.LoggerProducer; | |
66 | 65 | import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer; |
67 | 66 | import br.gov.frameworkdemoiselle.util.Reflections; |
68 | 67 | import br.gov.frameworkdemoiselle.util.ResourceBundle; |
... | ... | @@ -81,24 +80,16 @@ public abstract class AbstractLifecycleBootstrap<A extends Annotation> implement |
81 | 80 | |
82 | 81 | private boolean registered = false; |
83 | 82 | |
84 | - private static Logger logger; | |
83 | + private ResourceBundle bundle; | |
85 | 84 | |
86 | - private static ResourceBundle bundle; | |
85 | + protected abstract Logger getLogger(); | |
87 | 86 | |
88 | - protected static Logger getLogger() { | |
89 | - if (logger == null) { | |
90 | - logger = LoggerProducer.create(AbstractLifecycleBootstrap.class); | |
87 | + protected ResourceBundle getBundle() { | |
88 | + if (this.bundle == null) { | |
89 | + this.bundle = ResourceBundleProducer.create("demoiselle-core-bundle", Locale.getDefault()); | |
91 | 90 | } |
92 | 91 | |
93 | - return logger; | |
94 | - } | |
95 | - | |
96 | - protected static ResourceBundle getBundle() { | |
97 | - if (bundle == null) { | |
98 | - bundle = ResourceBundleProducer.create("demoiselle-core-bundle", Locale.getDefault()); | |
99 | - } | |
100 | - | |
101 | - return bundle; | |
92 | + return this.bundle; | |
102 | 93 | } |
103 | 94 | |
104 | 95 | protected <T> AnnotatedMethodProcessor<T> newProcessorInstance(AnnotatedMethod<T> annotatedMethod) { | ... | ... |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/AbstractStrategyBootstrap.java
... | ... | @@ -11,24 +11,15 @@ import javax.enterprise.inject.spi.ProcessAnnotatedType; |
11 | 11 | |
12 | 12 | import org.slf4j.Logger; |
13 | 13 | |
14 | -import br.gov.frameworkdemoiselle.internal.producer.LoggerProducer; | |
15 | 14 | import br.gov.frameworkdemoiselle.util.Reflections; |
16 | 15 | |
17 | -public class AbstractStrategyBootstrap<I> implements Extension { | |
16 | +public abstract class AbstractStrategyBootstrap<I> implements Extension { | |
18 | 17 | |
19 | 18 | private Class<? extends I> strategyClass; |
20 | 19 | |
21 | 20 | private List<Class<? extends I>> cache; |
22 | 21 | |
23 | - private static Logger logger; | |
24 | - | |
25 | - protected static Logger getLogger() { | |
26 | - if (logger == null) { | |
27 | - logger = LoggerProducer.create(AbstractStrategyBootstrap.class); | |
28 | - } | |
29 | - | |
30 | - return logger; | |
31 | - } | |
22 | + protected abstract Logger getLogger(); | |
32 | 23 | |
33 | 24 | protected Class<? extends I> getStrategyClass() { |
34 | 25 | if (this.strategyClass == null) { | ... | ... |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/AuthenticatorBootstrap.java
... | ... | @@ -43,9 +43,10 @@ import br.gov.frameworkdemoiselle.security.Authenticator; |
43 | 43 | |
44 | 44 | public class AuthenticatorBootstrap extends AbstractStrategyBootstrap<Authenticator> { |
45 | 45 | |
46 | - private static Logger logger; | |
46 | + private Logger logger; | |
47 | 47 | |
48 | - protected static Logger getLogger() { | |
48 | + @Override | |
49 | + protected Logger getLogger() { | |
49 | 50 | if (logger == null) { |
50 | 51 | logger = LoggerProducer.create(AuthenticatorBootstrap.class); |
51 | 52 | } | ... | ... |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/AuthorizerBootstrap.java
... | ... | @@ -43,9 +43,10 @@ import br.gov.frameworkdemoiselle.security.Authorizer; |
43 | 43 | |
44 | 44 | public class AuthorizerBootstrap extends AbstractStrategyBootstrap<Authorizer> { |
45 | 45 | |
46 | - private static Logger logger; | |
46 | + private Logger logger; | |
47 | 47 | |
48 | - protected static Logger getLogger() { | |
48 | + @Override | |
49 | + protected Logger getLogger() { | |
49 | 50 | if (logger == null) { |
50 | 51 | logger = LoggerProducer.create(AuthorizerBootstrap.class); |
51 | 52 | } | ... | ... |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/CoreBootstrap.java
... | ... | @@ -60,24 +60,24 @@ public class CoreBootstrap implements Extension { |
60 | 60 | |
61 | 61 | private final Map<Class<?>, AnnotatedType<?>> beans = new HashMap<Class<?>, AnnotatedType<?>>(); |
62 | 62 | |
63 | - private static Logger logger; | |
63 | + private Logger logger; | |
64 | 64 | |
65 | - private static ResourceBundle bundle; | |
65 | + private ResourceBundle bundle; | |
66 | 66 | |
67 | - private static Logger getLogger() { | |
68 | - if (logger == null) { | |
69 | - logger = LoggerProducer.create(CoreBootstrap.class); | |
67 | + private Logger getLogger() { | |
68 | + if (this.logger == null) { | |
69 | + this.logger = LoggerProducer.create(CoreBootstrap.class); | |
70 | 70 | } |
71 | 71 | |
72 | - return logger; | |
72 | + return this.logger; | |
73 | 73 | } |
74 | 74 | |
75 | - private static ResourceBundle getBundle() { | |
76 | - if (bundle == null) { | |
77 | - bundle = ResourceBundleProducer.create("demoiselle-core-bundle", Locale.getDefault()); | |
75 | + private ResourceBundle getBundle() { | |
76 | + if (this.bundle == null) { | |
77 | + this.bundle = ResourceBundleProducer.create("demoiselle-core-bundle", Locale.getDefault()); | |
78 | 78 | } |
79 | 79 | |
80 | - return bundle; | |
80 | + return this.bundle; | |
81 | 81 | } |
82 | 82 | |
83 | 83 | public boolean isAnnotatedType(Class<?> type) { | ... | ... |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/ShutdownBootstrap.java
... | ... | @@ -38,6 +38,9 @@ package br.gov.frameworkdemoiselle.internal.bootstrap; |
38 | 38 | |
39 | 39 | import javax.enterprise.event.Observes; |
40 | 40 | |
41 | +import org.slf4j.Logger; | |
42 | + | |
43 | +import br.gov.frameworkdemoiselle.internal.producer.LoggerProducer; | |
41 | 44 | import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess; |
42 | 45 | import br.gov.frameworkdemoiselle.lifecycle.Shutdown; |
43 | 46 | |
... | ... | @@ -46,6 +49,17 @@ import br.gov.frameworkdemoiselle.lifecycle.Shutdown; |
46 | 49 | */ |
47 | 50 | public class ShutdownBootstrap extends AbstractLifecycleBootstrap<Shutdown> { |
48 | 51 | |
52 | + private Logger logger; | |
53 | + | |
54 | + @Override | |
55 | + protected Logger getLogger() { | |
56 | + if (logger == null) { | |
57 | + logger = LoggerProducer.create(ShutdownBootstrap.class); | |
58 | + } | |
59 | + | |
60 | + return logger; | |
61 | + } | |
62 | + | |
49 | 63 | public void shutdown(@Observes AfterShutdownProccess event) { |
50 | 64 | proccessEvent(); |
51 | 65 | } | ... | ... |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/StartupBootstrap.java
... | ... | @@ -38,6 +38,9 @@ package br.gov.frameworkdemoiselle.internal.bootstrap; |
38 | 38 | |
39 | 39 | import javax.enterprise.event.Observes; |
40 | 40 | |
41 | +import org.slf4j.Logger; | |
42 | + | |
43 | +import br.gov.frameworkdemoiselle.internal.producer.LoggerProducer; | |
41 | 44 | import br.gov.frameworkdemoiselle.lifecycle.AfterStartupProccess; |
42 | 45 | import br.gov.frameworkdemoiselle.lifecycle.Startup; |
43 | 46 | |
... | ... | @@ -46,6 +49,17 @@ import br.gov.frameworkdemoiselle.lifecycle.Startup; |
46 | 49 | */ |
47 | 50 | public class StartupBootstrap extends AbstractLifecycleBootstrap<Startup> { |
48 | 51 | |
52 | + private Logger logger; | |
53 | + | |
54 | + @Override | |
55 | + protected Logger getLogger() { | |
56 | + if (logger == null) { | |
57 | + logger = LoggerProducer.create(StartupBootstrap.class); | |
58 | + } | |
59 | + | |
60 | + return logger; | |
61 | + } | |
62 | + | |
49 | 63 | public void startup(@Observes AfterStartupProccess event) { |
50 | 64 | proccessEvent(); |
51 | 65 | } | ... | ... |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/TransactionBootstrap.java
... | ... | @@ -36,7 +36,21 @@ |
36 | 36 | */ |
37 | 37 | package br.gov.frameworkdemoiselle.internal.bootstrap; |
38 | 38 | |
39 | +import org.slf4j.Logger; | |
40 | + | |
41 | +import br.gov.frameworkdemoiselle.internal.producer.LoggerProducer; | |
39 | 42 | import br.gov.frameworkdemoiselle.transaction.Transaction; |
40 | 43 | |
41 | 44 | public class TransactionBootstrap extends AbstractStrategyBootstrap<Transaction> { |
45 | + | |
46 | + private Logger logger; | |
47 | + | |
48 | + @Override | |
49 | + protected Logger getLogger() { | |
50 | + if (logger == null) { | |
51 | + logger = LoggerProducer.create(TransactionBootstrap.class); | |
52 | + } | |
53 | + | |
54 | + return logger; | |
55 | + } | |
42 | 56 | } | ... | ... |
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/JsfBootstrap.java
... | ... | @@ -56,19 +56,18 @@ public class JsfBootstrap implements Extension { |
56 | 56 | private AfterBeanDiscovery afterBeanDiscoveryEvent; |
57 | 57 | |
58 | 58 | public void storeContexts(@Observes final AfterBeanDiscovery event) { |
59 | - tempContexts.add(new ViewContext()); | |
60 | - | |
61 | - afterBeanDiscoveryEvent = event; | |
59 | + this.tempContexts.add(new ViewContext()); | |
60 | + this.afterBeanDiscoveryEvent = event; | |
62 | 61 | } |
63 | 62 | |
64 | 63 | public void addContexts(@Observes final AfterDeploymentValidation event) { |
65 | - for (CustomContext tempContext : tempContexts) { | |
66 | - Contexts.add(tempContext, afterBeanDiscoveryEvent); | |
64 | + for (CustomContext tempContext : this.tempContexts) { | |
65 | + Contexts.add(tempContext, this.afterBeanDiscoveryEvent); | |
67 | 66 | } |
68 | 67 | } |
69 | 68 | |
70 | 69 | public void removeContexts(@Observes AfterShutdownProccess event) { |
71 | - for (CustomContext tempContext : tempContexts) { | |
70 | + for (CustomContext tempContext : this.tempContexts) { | |
72 | 71 | Contexts.remove(tempContext); |
73 | 72 | } |
74 | 73 | } | ... | ... |
impl/extension/se/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/SeBootstrap.java
... | ... | @@ -60,22 +60,22 @@ public class SeBootstrap implements Extension { |
60 | 60 | private AfterBeanDiscovery afterBeanDiscoveryEvent; |
61 | 61 | |
62 | 62 | public void storeContexts(@Observes final AfterBeanDiscovery event) { |
63 | - tempContexts.add(new ThreadLocalContext(ViewScoped.class)); | |
64 | - tempContexts.add(new ThreadLocalContext(SessionScoped.class)); | |
65 | - tempContexts.add(new ThreadLocalContext(ConversationScoped.class)); | |
66 | - tempContexts.add(new ThreadLocalContext(RequestScoped.class)); | |
63 | + this.tempContexts.add(new ThreadLocalContext(ViewScoped.class)); | |
64 | + this.tempContexts.add(new ThreadLocalContext(SessionScoped.class)); | |
65 | + this.tempContexts.add(new ThreadLocalContext(ConversationScoped.class)); | |
66 | + this.tempContexts.add(new ThreadLocalContext(RequestScoped.class)); | |
67 | 67 | |
68 | - afterBeanDiscoveryEvent = event; | |
68 | + this.afterBeanDiscoveryEvent = event; | |
69 | 69 | } |
70 | 70 | |
71 | 71 | public void addContexts(@Observes final AfterDeploymentValidation event) { |
72 | - for (CustomContext tempContext : tempContexts) { | |
73 | - Contexts.add(tempContext, afterBeanDiscoveryEvent); | |
72 | + for (CustomContext tempContext : this.tempContexts) { | |
73 | + Contexts.add(tempContext, this.afterBeanDiscoveryEvent); | |
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
77 | 77 | public void removeContexts(@Observes AfterShutdownProccess event) { |
78 | - for (CustomContext tempContext : tempContexts) { | |
78 | + for (CustomContext tempContext : this.tempContexts) { | |
79 | 79 | Contexts.remove(tempContext); |
80 | 80 | } |
81 | 81 | } | ... | ... |