Commit 9816002b8680bf80a34a3494ef8328eee426d3ae

Authored by Emerson Oliveira
2 parents f9aa001a ddd40709
Exists in master

Merge branch '2.4.0' of git@github.com:demoiselle/framework.git into 2.4.0

impl/core/src/main/java/br/gov/frameworkdemoiselle/exception/ExceptionHandlerInterceptor.java
@@ -51,8 +51,6 @@ import javax.interceptor.InvocationContext; @@ -51,8 +51,6 @@ import javax.interceptor.InvocationContext;
51 51
52 import org.slf4j.Logger; 52 import org.slf4j.Logger;
53 53
54 -import exception.custom.CustomException;  
55 -  
56 import br.gov.frameworkdemoiselle.DemoiselleException; 54 import br.gov.frameworkdemoiselle.DemoiselleException;
57 import br.gov.frameworkdemoiselle.stereotype.Controller; 55 import br.gov.frameworkdemoiselle.stereotype.Controller;
58 import br.gov.frameworkdemoiselle.util.Beans; 56 import br.gov.frameworkdemoiselle.util.Beans;
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/AbstractLifecycleBootstrap.java
@@ -41,7 +41,6 @@ import java.util.ArrayList; @@ -41,7 +41,6 @@ import java.util.ArrayList;
41 import java.util.Collections; 41 import java.util.Collections;
42 import java.util.Iterator; 42 import java.util.Iterator;
43 import java.util.List; 43 import java.util.List;
44 -import java.util.Locale;  
45 44
46 import javax.enterprise.context.ConversationScoped; 45 import javax.enterprise.context.ConversationScoped;
47 import javax.enterprise.context.RequestScoped; 46 import javax.enterprise.context.RequestScoped;
@@ -60,7 +59,8 @@ import br.gov.frameworkdemoiselle.annotation.ViewScoped; @@ -60,7 +59,8 @@ import br.gov.frameworkdemoiselle.annotation.ViewScoped;
60 import br.gov.frameworkdemoiselle.internal.context.ContextManager; 59 import br.gov.frameworkdemoiselle.internal.context.ContextManager;
61 import br.gov.frameworkdemoiselle.internal.context.ThreadLocalContext; 60 import br.gov.frameworkdemoiselle.internal.context.ThreadLocalContext;
62 import br.gov.frameworkdemoiselle.internal.implementation.AnnotatedMethodProcessor; 61 import br.gov.frameworkdemoiselle.internal.implementation.AnnotatedMethodProcessor;
63 -import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer; 62 +import br.gov.frameworkdemoiselle.util.Beans;
  63 +import br.gov.frameworkdemoiselle.util.NameQualifier;
64 import br.gov.frameworkdemoiselle.util.Reflections; 64 import br.gov.frameworkdemoiselle.util.Reflections;
65 import br.gov.frameworkdemoiselle.util.ResourceBundle; 65 import br.gov.frameworkdemoiselle.util.ResourceBundle;
66 66
@@ -74,16 +74,16 @@ public abstract class AbstractLifecycleBootstrap<A extends Annotation> implement @@ -74,16 +74,16 @@ public abstract class AbstractLifecycleBootstrap<A extends Annotation> implement
74 74
75 private boolean registered = false; 75 private boolean registered = false;
76 76
77 - private ResourceBundle bundle; 77 + private transient static ResourceBundle bundle;
78 78
79 protected abstract Logger getLogger(); 79 protected abstract Logger getLogger();
80 80
81 - protected ResourceBundle getBundle() {  
82 - if (this.bundle == null) {  
83 - this.bundle = ResourceBundleProducer.create("demoiselle-core-bundle", Locale.getDefault()); 81 + protected static ResourceBundle getBundle() {
  82 + if (bundle == null) {
  83 + bundle = Beans.getReference(ResourceBundle.class, new NameQualifier("demoiselle-core-bundle"));
84 } 84 }
85 85
86 - return this.bundle; 86 + return bundle;
87 } 87 }
88 88
89 protected <T> AnnotatedMethodProcessor<T> newProcessorInstance(AnnotatedMethod<T> annotatedMethod) { 89 protected <T> AnnotatedMethodProcessor<T> newProcessorInstance(AnnotatedMethod<T> annotatedMethod) {
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/CoreBootstrap.java
@@ -52,7 +52,6 @@ import br.gov.frameworkdemoiselle.annotation.StaticScoped; @@ -52,7 +52,6 @@ import br.gov.frameworkdemoiselle.annotation.StaticScoped;
52 import br.gov.frameworkdemoiselle.internal.context.ContextManager; 52 import br.gov.frameworkdemoiselle.internal.context.ContextManager;
53 import br.gov.frameworkdemoiselle.internal.context.StaticContext; 53 import br.gov.frameworkdemoiselle.internal.context.StaticContext;
54 import br.gov.frameworkdemoiselle.internal.producer.LoggerProducer; 54 import br.gov.frameworkdemoiselle.internal.producer.LoggerProducer;
55 -import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer;  
56 import br.gov.frameworkdemoiselle.util.Beans; 55 import br.gov.frameworkdemoiselle.util.Beans;
57 import br.gov.frameworkdemoiselle.util.ResourceBundle; 56 import br.gov.frameworkdemoiselle.util.ResourceBundle;
58 57
@@ -60,7 +59,7 @@ public class CoreBootstrap implements Extension { @@ -60,7 +59,7 @@ public class CoreBootstrap implements Extension {
60 59
61 private Logger logger; 60 private Logger logger;
62 61
63 - private ResourceBundle bundle; 62 + private static transient ResourceBundle bundle;
64 63
65 private Logger getLogger() { 64 private Logger getLogger() {
66 if (this.logger == null) { 65 if (this.logger == null) {
@@ -70,12 +69,12 @@ public class CoreBootstrap implements Extension { @@ -70,12 +69,12 @@ public class CoreBootstrap implements Extension {
70 return this.logger; 69 return this.logger;
71 } 70 }
72 71
73 - private ResourceBundle getBundle() {  
74 - if (this.bundle == null) {  
75 - this.bundle = ResourceBundleProducer.create("demoiselle-core-bundle", Locale.getDefault()); 72 + private static ResourceBundle getBundle() {
  73 + if (bundle == null) {
  74 + bundle = new ResourceBundle("demoiselle-core-bundle", Locale.getDefault());
76 } 75 }
77 76
78 - return this.bundle; 77 + return bundle;
79 } 78 }
80 79
81 public void engineOn(@Observes final BeforeBeanDiscovery event, BeanManager beanManager) { 80 public void engineOn(@Observes final BeforeBeanDiscovery event, BeanManager beanManager) {
@@ -91,7 +90,7 @@ public class CoreBootstrap implements Extension { @@ -91,7 +90,7 @@ public class CoreBootstrap implements Extension {
91 90
92 ContextManager.activate(StaticContext.class, StaticScoped.class); 91 ContextManager.activate(StaticContext.class, StaticScoped.class);
93 } 92 }
94 - 93 +
95 public void terminateCustomContexts(@Observes final BeforeShutdown event) { 94 public void terminateCustomContexts(@Observes final BeforeShutdown event) {
96 ContextManager.shutdown(); 95 ContextManager.shutdown();
97 } 96 }
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/context/ContextManager.java
@@ -16,7 +16,6 @@ import org.slf4j.Logger; @@ -16,7 +16,6 @@ import org.slf4j.Logger;
16 import br.gov.frameworkdemoiselle.DemoiselleException; 16 import br.gov.frameworkdemoiselle.DemoiselleException;
17 import br.gov.frameworkdemoiselle.annotation.StaticScoped; 17 import br.gov.frameworkdemoiselle.annotation.StaticScoped;
18 import br.gov.frameworkdemoiselle.internal.producer.LoggerProducer; 18 import br.gov.frameworkdemoiselle.internal.producer.LoggerProducer;
19 -import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer;  
20 import br.gov.frameworkdemoiselle.util.Beans; 19 import br.gov.frameworkdemoiselle.util.Beans;
21 import br.gov.frameworkdemoiselle.util.ResourceBundle; 20 import br.gov.frameworkdemoiselle.util.ResourceBundle;
22 21
@@ -40,14 +39,14 @@ import br.gov.frameworkdemoiselle.util.ResourceBundle; @@ -40,14 +39,14 @@ import br.gov.frameworkdemoiselle.util.ResourceBundle;
40 * 39 *
41 * @author serpro 40 * @author serpro
42 */ 41 */
43 -public class ContextManager { 42 +public final class ContextManager {
44 43
45 private static List<CustomContextCounter> contexts = Collections 44 private static List<CustomContextCounter> contexts = Collections
46 .synchronizedList(new ArrayList<CustomContextCounter>()); 45 .synchronizedList(new ArrayList<CustomContextCounter>());
47 46
48 private static boolean initialized = false; 47 private static boolean initialized = false;
49 48
50 - private static ResourceBundle bundle; 49 + private static transient ResourceBundle bundle;
51 50
52 private static Logger logger; 51 private static Logger logger;
53 52
@@ -217,7 +216,7 @@ public class ContextManager { @@ -217,7 +216,7 @@ public class ContextManager {
217 216
218 static ResourceBundle getBundle() { 217 static ResourceBundle getBundle() {
219 if (bundle == null) { 218 if (bundle == null) {
220 - bundle = ResourceBundleProducer.create("demoiselle-core-bundle", Locale.getDefault()); 219 + bundle = new ResourceBundle("demoiselle-core-bundle", Locale.getDefault());
221 } 220 }
222 221
223 return bundle; 222 return bundle;
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/AnnotatedMethodProcessor.java
@@ -37,7 +37,6 @@ @@ -37,7 +37,6 @@
37 package br.gov.frameworkdemoiselle.internal.implementation; 37 package br.gov.frameworkdemoiselle.internal.implementation;
38 38
39 import java.lang.reflect.InvocationTargetException; 39 import java.lang.reflect.InvocationTargetException;
40 -import java.util.Locale;  
41 40
42 import javax.enterprise.inject.spi.AnnotatedMethod; 41 import javax.enterprise.inject.spi.AnnotatedMethod;
43 42
@@ -46,9 +45,9 @@ import org.slf4j.Logger; @@ -46,9 +45,9 @@ import org.slf4j.Logger;
46 import br.gov.frameworkdemoiselle.annotation.Priority; 45 import br.gov.frameworkdemoiselle.annotation.Priority;
47 import br.gov.frameworkdemoiselle.exception.ApplicationException; 46 import br.gov.frameworkdemoiselle.exception.ApplicationException;
48 import br.gov.frameworkdemoiselle.internal.producer.LoggerProducer; 47 import br.gov.frameworkdemoiselle.internal.producer.LoggerProducer;
49 -import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer;  
50 import br.gov.frameworkdemoiselle.message.SeverityType; 48 import br.gov.frameworkdemoiselle.message.SeverityType;
51 import br.gov.frameworkdemoiselle.util.Beans; 49 import br.gov.frameworkdemoiselle.util.Beans;
  50 +import br.gov.frameworkdemoiselle.util.NameQualifier;
52 import br.gov.frameworkdemoiselle.util.ResourceBundle; 51 import br.gov.frameworkdemoiselle.util.ResourceBundle;
53 52
54 /** 53 /**
@@ -61,7 +60,7 @@ public class AnnotatedMethodProcessor&lt;T&gt; implements Comparable&lt;AnnotatedMethodPr @@ -61,7 +60,7 @@ public class AnnotatedMethodProcessor&lt;T&gt; implements Comparable&lt;AnnotatedMethodPr
61 60
62 private AnnotatedMethod<T> annotatedMethod; 61 private AnnotatedMethod<T> annotatedMethod;
63 62
64 - private ResourceBundle bundle; 63 + private transient static ResourceBundle bundle;
65 64
66 public AnnotatedMethodProcessor(final AnnotatedMethod<T> annotatedMethod) { 65 public AnnotatedMethodProcessor(final AnnotatedMethod<T> annotatedMethod) {
67 this.annotatedMethod = annotatedMethod; 66 this.annotatedMethod = annotatedMethod;
@@ -132,9 +131,9 @@ public class AnnotatedMethodProcessor&lt;T&gt; implements Comparable&lt;AnnotatedMethodPr @@ -132,9 +131,9 @@ public class AnnotatedMethodProcessor&lt;T&gt; implements Comparable&lt;AnnotatedMethodPr
132 return priority; 131 return priority;
133 } 132 }
134 133
135 - protected ResourceBundle getBundle() {  
136 - if (this.bundle == null) {  
137 - this.bundle = ResourceBundleProducer.create("demoiselle-core-bundle", Locale.getDefault()); 134 + protected static ResourceBundle getBundle() {
  135 + if (bundle == null) {
  136 + bundle = Beans.getReference(ResourceBundle.class, new NameQualifier("demoiselle-core-bundle"));
138 } 137 }
139 138
140 return bundle; 139 return bundle;
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/DefaultAuthenticator.java
@@ -42,10 +42,11 @@ import java.security.Principal; @@ -42,10 +42,11 @@ import java.security.Principal;
42 42
43 import br.gov.frameworkdemoiselle.DemoiselleException; 43 import br.gov.frameworkdemoiselle.DemoiselleException;
44 import br.gov.frameworkdemoiselle.annotation.Priority; 44 import br.gov.frameworkdemoiselle.annotation.Priority;
45 -import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer;  
46 import br.gov.frameworkdemoiselle.security.AuthenticationException; 45 import br.gov.frameworkdemoiselle.security.AuthenticationException;
47 import br.gov.frameworkdemoiselle.security.Authenticator; 46 import br.gov.frameworkdemoiselle.security.Authenticator;
48 import br.gov.frameworkdemoiselle.security.SecurityContext; 47 import br.gov.frameworkdemoiselle.security.SecurityContext;
  48 +import br.gov.frameworkdemoiselle.util.Beans;
  49 +import br.gov.frameworkdemoiselle.util.NameQualifier;
49 import br.gov.frameworkdemoiselle.util.ResourceBundle; 50 import br.gov.frameworkdemoiselle.util.ResourceBundle;
50 51
51 /** 52 /**
@@ -59,7 +60,7 @@ public class DefaultAuthenticator implements Authenticator { @@ -59,7 +60,7 @@ public class DefaultAuthenticator implements Authenticator {
59 60
60 private static final long serialVersionUID = 1L; 61 private static final long serialVersionUID = 1L;
61 62
62 - private static ResourceBundle bundle; 63 + private transient static ResourceBundle bundle;
63 64
64 /** 65 /**
65 * @see br.gov.frameworkdemoiselle.security.Authenticator#authenticate() 66 * @see br.gov.frameworkdemoiselle.security.Authenticator#authenticate()
@@ -92,7 +93,7 @@ public class DefaultAuthenticator implements Authenticator { @@ -92,7 +93,7 @@ public class DefaultAuthenticator implements Authenticator {
92 93
93 private static ResourceBundle getBundle() { 94 private static ResourceBundle getBundle() {
94 if (bundle == null) { 95 if (bundle == null) {
95 - bundle = ResourceBundleProducer.create("demoiselle-core-bundle"); 96 + bundle = Beans.getReference(ResourceBundle.class, new NameQualifier("demoiselle-core-bundle"));
96 } 97 }
97 98
98 return bundle; 99 return bundle;
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/DefaultAuthorizer.java
@@ -39,9 +39,10 @@ package br.gov.frameworkdemoiselle.internal.implementation; @@ -39,9 +39,10 @@ package br.gov.frameworkdemoiselle.internal.implementation;
39 import static br.gov.frameworkdemoiselle.annotation.Priority.L1_PRIORITY; 39 import static br.gov.frameworkdemoiselle.annotation.Priority.L1_PRIORITY;
40 import br.gov.frameworkdemoiselle.DemoiselleException; 40 import br.gov.frameworkdemoiselle.DemoiselleException;
41 import br.gov.frameworkdemoiselle.annotation.Priority; 41 import br.gov.frameworkdemoiselle.annotation.Priority;
42 -import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer;  
43 import br.gov.frameworkdemoiselle.security.Authorizer; 42 import br.gov.frameworkdemoiselle.security.Authorizer;
44 import br.gov.frameworkdemoiselle.security.SecurityContext; 43 import br.gov.frameworkdemoiselle.security.SecurityContext;
  44 +import br.gov.frameworkdemoiselle.util.Beans;
  45 +import br.gov.frameworkdemoiselle.util.NameQualifier;
45 import br.gov.frameworkdemoiselle.util.ResourceBundle; 46 import br.gov.frameworkdemoiselle.util.ResourceBundle;
46 47
47 /** 48 /**
@@ -55,7 +56,7 @@ public class DefaultAuthorizer implements Authorizer { @@ -55,7 +56,7 @@ public class DefaultAuthorizer implements Authorizer {
55 56
56 private static final long serialVersionUID = 1L; 57 private static final long serialVersionUID = 1L;
57 58
58 - private static ResourceBundle bundle; 59 + private transient static ResourceBundle bundle;
59 60
60 @Override 61 @Override
61 public boolean hasRole(String role) { 62 public boolean hasRole(String role) {
@@ -74,7 +75,7 @@ public class DefaultAuthorizer implements Authorizer { @@ -74,7 +75,7 @@ public class DefaultAuthorizer implements Authorizer {
74 75
75 private static ResourceBundle getBundle() { 76 private static ResourceBundle getBundle() {
76 if (bundle == null) { 77 if (bundle == null) {
77 - bundle = ResourceBundleProducer.create("demoiselle-core-bundle"); 78 + bundle = Beans.getReference(ResourceBundle.class, new NameQualifier("demoiselle-core-bundle"));
78 } 79 }
79 80
80 return bundle; 81 return bundle;
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/DefaultTransaction.java
@@ -39,9 +39,10 @@ package br.gov.frameworkdemoiselle.internal.implementation; @@ -39,9 +39,10 @@ package br.gov.frameworkdemoiselle.internal.implementation;
39 import static br.gov.frameworkdemoiselle.annotation.Priority.L1_PRIORITY; 39 import static br.gov.frameworkdemoiselle.annotation.Priority.L1_PRIORITY;
40 import br.gov.frameworkdemoiselle.DemoiselleException; 40 import br.gov.frameworkdemoiselle.DemoiselleException;
41 import br.gov.frameworkdemoiselle.annotation.Priority; 41 import br.gov.frameworkdemoiselle.annotation.Priority;
42 -import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer;  
43 import br.gov.frameworkdemoiselle.transaction.Transaction; 42 import br.gov.frameworkdemoiselle.transaction.Transaction;
44 import br.gov.frameworkdemoiselle.transaction.Transactional; 43 import br.gov.frameworkdemoiselle.transaction.Transactional;
  44 +import br.gov.frameworkdemoiselle.util.Beans;
  45 +import br.gov.frameworkdemoiselle.util.NameQualifier;
45 import br.gov.frameworkdemoiselle.util.ResourceBundle; 46 import br.gov.frameworkdemoiselle.util.ResourceBundle;
46 47
47 /** 48 /**
@@ -55,7 +56,7 @@ public class DefaultTransaction implements Transaction { @@ -55,7 +56,7 @@ public class DefaultTransaction implements Transaction {
55 56
56 private static final long serialVersionUID = 1L; 57 private static final long serialVersionUID = 1L;
57 58
58 - private static ResourceBundle bundle; 59 + private transient static ResourceBundle bundle;
59 60
60 @Override 61 @Override
61 public void begin() { 62 public void begin() {
@@ -94,7 +95,7 @@ public class DefaultTransaction implements Transaction { @@ -94,7 +95,7 @@ public class DefaultTransaction implements Transaction {
94 95
95 private static ResourceBundle getBundle() { 96 private static ResourceBundle getBundle() {
96 if (bundle == null) { 97 if (bundle == null) {
97 - bundle = ResourceBundleProducer.create("demoiselle-core-bundle"); 98 + bundle = Beans.getReference(ResourceBundle.class, new NameQualifier("demoiselle-core-bundle"));
98 } 99 }
99 100
100 return bundle; 101 return bundle;
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/MessageContextImpl.java
@@ -37,19 +37,19 @@ @@ -37,19 +37,19 @@
37 package br.gov.frameworkdemoiselle.internal.implementation; 37 package br.gov.frameworkdemoiselle.internal.implementation;
38 38
39 import java.io.Serializable; 39 import java.io.Serializable;
40 -import java.util.ArrayList;  
41 import java.util.List; 40 import java.util.List;
42 41
43 import org.slf4j.Logger; 42 import org.slf4j.Logger;
44 43
  44 +import br.gov.frameworkdemoiselle.DemoiselleException;
45 import br.gov.frameworkdemoiselle.internal.producer.LoggerProducer; 45 import br.gov.frameworkdemoiselle.internal.producer.LoggerProducer;
46 -import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer;  
47 import br.gov.frameworkdemoiselle.message.DefaultMessage; 46 import br.gov.frameworkdemoiselle.message.DefaultMessage;
48 import br.gov.frameworkdemoiselle.message.Message; 47 import br.gov.frameworkdemoiselle.message.Message;
49 import br.gov.frameworkdemoiselle.message.MessageAppender; 48 import br.gov.frameworkdemoiselle.message.MessageAppender;
50 import br.gov.frameworkdemoiselle.message.MessageContext; 49 import br.gov.frameworkdemoiselle.message.MessageContext;
51 import br.gov.frameworkdemoiselle.message.SeverityType; 50 import br.gov.frameworkdemoiselle.message.SeverityType;
52 import br.gov.frameworkdemoiselle.util.Beans; 51 import br.gov.frameworkdemoiselle.util.Beans;
  52 +import br.gov.frameworkdemoiselle.util.NameQualifier;
53 import br.gov.frameworkdemoiselle.util.ResourceBundle; 53 import br.gov.frameworkdemoiselle.util.ResourceBundle;
54 54
55 /** 55 /**
@@ -61,9 +61,6 @@ public class MessageContextImpl implements Serializable, MessageContext { @@ -61,9 +61,6 @@ public class MessageContextImpl implements Serializable, MessageContext {
61 61
62 private static final long serialVersionUID = 1L; 62 private static final long serialVersionUID = 1L;
63 63
64 - @Deprecated  
65 - private transient final List<Message> messages = new ArrayList<Message>();  
66 -  
67 private transient static ResourceBundle bundle; 64 private transient static ResourceBundle bundle;
68 65
69 private transient static Logger logger; 66 private transient static Logger logger;
@@ -101,19 +98,22 @@ public class MessageContextImpl implements Serializable, MessageContext { @@ -101,19 +98,22 @@ public class MessageContextImpl implements Serializable, MessageContext {
101 @Override 98 @Override
102 @Deprecated 99 @Deprecated
103 public List<Message> getMessages() { 100 public List<Message> getMessages() {
104 - return messages; 101 + throw new DemoiselleException(
  102 + "Este método não é mais suportado desde a versão 2.4.0 do Demoiselle Framework. Considere atualizar a sua aplicação ou o componente com uma nova versão que faça uso do "
  103 + + MessageAppender.class.getCanonicalName() + ".");
105 } 104 }
106 105
107 @Override 106 @Override
108 @Deprecated 107 @Deprecated
109 public void clear() { 108 public void clear() {
110 - getLogger().debug(getBundle().getString("cleaning-message-context"));  
111 - messages.clear(); 109 + throw new DemoiselleException(
  110 + "Este método não é mais suportado desde a versão 2.4.0 do Demoiselle Framework. Considere atualizar a sua aplicação ou o componente com uma nova versão que faça uso do "
  111 + + MessageAppender.class.getCanonicalName() + ".");
112 } 112 }
113 113
114 private static ResourceBundle getBundle() { 114 private static ResourceBundle getBundle() {
115 if (bundle == null) { 115 if (bundle == null) {
116 - bundle = ResourceBundleProducer.create("demoiselle-core-bundle"); 116 + bundle = Beans.getReference(ResourceBundle.class, new NameQualifier("demoiselle-core-bundle"));
117 } 117 }
118 118
119 return bundle; 119 return bundle;
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/SecurityContextImpl.java
@@ -43,7 +43,6 @@ import javax.inject.Named; @@ -43,7 +43,6 @@ import javax.inject.Named;
43 43
44 import br.gov.frameworkdemoiselle.DemoiselleException; 44 import br.gov.frameworkdemoiselle.DemoiselleException;
45 import br.gov.frameworkdemoiselle.internal.configuration.SecurityConfig; 45 import br.gov.frameworkdemoiselle.internal.configuration.SecurityConfig;
46 -import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer;  
47 import br.gov.frameworkdemoiselle.security.AfterLoginSuccessful; 46 import br.gov.frameworkdemoiselle.security.AfterLoginSuccessful;
48 import br.gov.frameworkdemoiselle.security.AfterLogoutSuccessful; 47 import br.gov.frameworkdemoiselle.security.AfterLogoutSuccessful;
49 import br.gov.frameworkdemoiselle.security.AuthenticationException; 48 import br.gov.frameworkdemoiselle.security.AuthenticationException;
@@ -53,6 +52,7 @@ import br.gov.frameworkdemoiselle.security.NotLoggedInException; @@ -53,6 +52,7 @@ import br.gov.frameworkdemoiselle.security.NotLoggedInException;
53 import br.gov.frameworkdemoiselle.security.SecurityContext; 52 import br.gov.frameworkdemoiselle.security.SecurityContext;
54 import br.gov.frameworkdemoiselle.security.User; 53 import br.gov.frameworkdemoiselle.security.User;
55 import br.gov.frameworkdemoiselle.util.Beans; 54 import br.gov.frameworkdemoiselle.util.Beans;
  55 +import br.gov.frameworkdemoiselle.util.NameQualifier;
56 import br.gov.frameworkdemoiselle.util.ResourceBundle; 56 import br.gov.frameworkdemoiselle.util.ResourceBundle;
57 57
58 /** 58 /**
@@ -66,6 +66,8 @@ public class SecurityContextImpl implements SecurityContext { @@ -66,6 +66,8 @@ public class SecurityContextImpl implements SecurityContext {
66 66
67 private static final long serialVersionUID = 1L; 67 private static final long serialVersionUID = 1L;
68 68
  69 + private transient static ResourceBundle bundle;
  70 +
69 private Authenticator authenticator; 71 private Authenticator authenticator;
70 72
71 private Authorizer authorizer; 73 private Authorizer authorizer;
@@ -199,11 +201,18 @@ public class SecurityContextImpl implements SecurityContext { @@ -199,11 +201,18 @@ public class SecurityContextImpl implements SecurityContext {
199 201
200 public void checkLoggedIn() throws NotLoggedInException { 202 public void checkLoggedIn() throws NotLoggedInException {
201 if (!isLoggedIn()) { 203 if (!isLoggedIn()) {
202 - ResourceBundle bundle = ResourceBundleProducer.create("demoiselle-core-bundle");  
203 - throw new NotLoggedInException(bundle.getString("user-not-authenticated")); 204 + throw new NotLoggedInException(getBundle().getString("user-not-authenticated"));
204 } 205 }
205 } 206 }
206 207
  208 + private static ResourceBundle getBundle() {
  209 + if (bundle == null) {
  210 + bundle = Beans.getReference(ResourceBundle.class, new NameQualifier("demoiselle-core-bundle"));
  211 + }
  212 +
  213 + return bundle;
  214 + }
  215 +
207 private static class EmptyUser implements Principal, Serializable { 216 private static class EmptyUser implements Principal, Serializable {
208 217
209 private static final long serialVersionUID = 1L; 218 private static final long serialVersionUID = 1L;
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/StrategySelector.java
@@ -50,27 +50,19 @@ import javax.enterprise.inject.spi.Bean; @@ -50,27 +50,19 @@ import javax.enterprise.inject.spi.Bean;
50 50
51 import br.gov.frameworkdemoiselle.DemoiselleException; 51 import br.gov.frameworkdemoiselle.DemoiselleException;
52 import br.gov.frameworkdemoiselle.annotation.Priority; 52 import br.gov.frameworkdemoiselle.annotation.Priority;
53 -import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer;  
54 import br.gov.frameworkdemoiselle.util.Beans; 53 import br.gov.frameworkdemoiselle.util.Beans;
  54 +import br.gov.frameworkdemoiselle.util.NameQualifier;
55 import br.gov.frameworkdemoiselle.util.ResourceBundle; 55 import br.gov.frameworkdemoiselle.util.ResourceBundle;
56 56
57 public final class StrategySelector implements Serializable { 57 public final class StrategySelector implements Serializable {
58 58
59 private static final long serialVersionUID = 1L; 59 private static final long serialVersionUID = 1L;
60 60
61 - private static ResourceBundle bundle; 61 + private transient static ResourceBundle bundle;
62 62
63 private StrategySelector() { 63 private StrategySelector() {
64 } 64 }
65 65
66 - private static ResourceBundle getBundle() {  
67 - if (bundle == null) {  
68 - bundle = ResourceBundleProducer.create("demoiselle-core-bundle");  
69 - }  
70 -  
71 - return bundle;  
72 - }  
73 -  
74 @SuppressWarnings("unchecked") 66 @SuppressWarnings("unchecked")
75 public static <T> T selectInstance(Class<T> type, Collection<? extends T> options) { 67 public static <T> T selectInstance(Class<T> type, Collection<? extends T> options) {
76 68
@@ -162,4 +154,12 @@ public final class StrategySelector implements Serializable { @@ -162,4 +154,12 @@ public final class StrategySelector implements Serializable {
162 154
163 return result; 155 return result;
164 } 156 }
  157 +
  158 + private static ResourceBundle getBundle() {
  159 + if (bundle == null) {
  160 + bundle = Beans.getReference(ResourceBundle.class, new NameQualifier("demoiselle-core-bundle"));
  161 + }
  162 +
  163 + return bundle;
  164 + }
165 } 165 }
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/producer/ResourceBundleProducer.java
@@ -62,6 +62,7 @@ public class ResourceBundleProducer implements Serializable { @@ -62,6 +62,7 @@ public class ResourceBundleProducer implements Serializable {
62 * @param String 62 * @param String
63 * baseName 63 * baseName
64 */ 64 */
  65 + @Deprecated
65 public static ResourceBundle create(String baseName) { 66 public static ResourceBundle create(String baseName) {
66 return create(baseName, Beans.getReference(Locale.class)); 67 return create(baseName, Beans.getReference(Locale.class));
67 } 68 }
@@ -72,6 +73,7 @@ public class ResourceBundleProducer implements Serializable { @@ -72,6 +73,7 @@ public class ResourceBundleProducer implements Serializable {
72 * @param String 73 * @param String
73 * baseName 74 * baseName
74 */ 75 */
  76 + @Deprecated
75 public static ResourceBundle create(String baseName, Locale locale) { 77 public static ResourceBundle create(String baseName, Locale locale) {
76 return new ResourceBundle(baseName, locale); 78 return new ResourceBundle(baseName, locale);
77 } 79 }
@@ -83,7 +85,7 @@ public class ResourceBundleProducer implements Serializable { @@ -83,7 +85,7 @@ public class ResourceBundleProducer implements Serializable {
83 @Default 85 @Default
84 @Produces 86 @Produces
85 public ResourceBundle createDefault(InjectionPoint ip) { 87 public ResourceBundle createDefault(InjectionPoint ip) {
86 - return create("messages", Beans.getReference(Locale.class)); 88 + return new ResourceBundle("messages", Beans.getReference(Locale.class));
87 } 89 }
88 90
89 /** 91 /**
@@ -94,6 +96,6 @@ public class ResourceBundleProducer implements Serializable { @@ -94,6 +96,6 @@ public class ResourceBundleProducer implements Serializable {
94 @Produces 96 @Produces
95 public ResourceBundle createNamed(InjectionPoint ip) { 97 public ResourceBundle createNamed(InjectionPoint ip) {
96 String baseName = ip.getAnnotated().getAnnotation(Name.class).value(); 98 String baseName = ip.getAnnotated().getAnnotation(Name.class).value();
97 - return create(baseName, Beans.getReference(Locale.class)); 99 + return new ResourceBundle(baseName, Beans.getReference(Locale.class));
98 } 100 }
99 } 101 }
impl/core/src/main/resources/demoiselle-core-bundle.properties
@@ -87,7 +87,6 @@ for= \ para\: @@ -87,7 +87,6 @@ for= \ para\:
87 file-not-found=O arquivo {0} n\u00E3o foi encontrado 87 file-not-found=O arquivo {0} n\u00E3o foi encontrado
88 88
89 adding-message-to-context=Adicionando uma mensagem no contexto: [{0}] 89 adding-message-to-context=Adicionando uma mensagem no contexto: [{0}]
90 -cleaning-message-context=Limpando o contexto de mensagens  
91 access-checking=Verificando permiss\u00E3o do usu\u00E1rio {0} para executar a a\u00E7\u00E3o {1} no recurso {2} 90 access-checking=Verificando permiss\u00E3o do usu\u00E1rio {0} para executar a a\u00E7\u00E3o {1} no recurso {2}
92 access-allowed=O usu\u00E1rio {0} acessou o recurso {2} com a a\u00E7\u00E3o {1} 91 access-allowed=O usu\u00E1rio {0} acessou o recurso {2} com a a\u00E7\u00E3o {1}
93 access-denied=O usu\u00E1rio {0} n\u00E3o possui permiss\u00E3o para executar a a\u00E7\u00E3o {1} no recurso {2} 92 access-denied=O usu\u00E1rio {0} n\u00E3o possui permiss\u00E3o para executar a a\u00E7\u00E3o {1} no recurso {2}