Commit 6e5cb42d832dc8cde9c53126810fac5ff38a571c
1 parent
7d33c0d4
Exists in
master
Inclusão dos WARN para depreciação de funcionaldiades do
ConfigurationLoader
Showing
9 changed files
with
27 additions
and
16 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/configuration/Configuration.java
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/configuration/ConfigurationLoader.java
@@ -160,10 +160,16 @@ public class ConfigurationLoader implements Serializable { | @@ -160,10 +160,16 @@ public class ConfigurationLoader implements Serializable { | ||
160 | Configuration classAnnotation = type.getAnnotation(Configuration.class); | 160 | Configuration classAnnotation = type.getAnnotation(Configuration.class); |
161 | if (!Strings.isEmpty(classAnnotation.prefix())) { | 161 | if (!Strings.isEmpty(classAnnotation.prefix())) { |
162 | 162 | ||
163 | - // TODO Verificar se o prefixo foi informado sem o ponto. Se sim, emitir um log do tipo WARN avisando para o | ||
164 | - // usuário corrigir manualmente e colocar o ponto automaticamente para evitar quebra de compatibilidade. | 163 | + prefix = classAnnotation.prefix(); |
165 | 164 | ||
166 | - prefix = classAnnotation.prefix() + "."; | 165 | + if (prefix.charAt(prefix.length() - 1) != '.') { |
166 | + getLogger().warn( | ||
167 | + "ATENÇÃO!!! Informe o ponto (.) ao final da declaração do atributo prefix = \"" + prefix | ||
168 | + + "\" da anotação @Configuration da classe " + type.getCanonicalName() | ||
169 | + + " para evitar incompatibilidade com as próximas versões do Demoiselle."); | ||
170 | + | ||
171 | + prefix += "."; | ||
172 | + } | ||
167 | } | 173 | } |
168 | 174 | ||
169 | return prefix; | 175 | return prefix; |
@@ -200,9 +206,12 @@ public class ConfigurationLoader implements Serializable { | @@ -200,9 +206,12 @@ public class ConfigurationLoader implements Serializable { | ||
200 | } | 206 | } |
201 | } | 207 | } |
202 | 208 | ||
203 | - // TODO Se a variável key estiver diferente de field.getName() neste ponto, emitir um log WARN avisando que o | ||
204 | - // formato encontrado em key deve ser definido manualmente utilizando a anotação @Name no atributo | ||
205 | - // correspondente da classe de configuração do usuário. | 209 | + if (!field.getName().equals(key)) { |
210 | + getLogger().warn( | ||
211 | + "ATENÇÃO!!! Anote o atributo " + field.getName() + " da classe " | ||
212 | + + field.getDeclaringClass().getCanonicalName() + " com @Name(\"" + key | ||
213 | + + "\") para evitar incompatibilidade com as próximas versões do Demoiselle."); | ||
214 | + } | ||
206 | 215 | ||
207 | if (matches == 0) { | 216 | if (matches == 0) { |
208 | getLogger().debug(getBundle().getString("configuration-key-not-found", key, conventions)); | 217 | getLogger().debug(getBundle().getString("configuration-key-not-found", key, conventions)); |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/configuration/PaginationConfig.java
@@ -47,7 +47,7 @@ import br.gov.frameworkdemoiselle.configuration.Configuration; | @@ -47,7 +47,7 @@ import br.gov.frameworkdemoiselle.configuration.Configuration; | ||
47 | * | 47 | * |
48 | * @author SERPRO | 48 | * @author SERPRO |
49 | */ | 49 | */ |
50 | -@Configuration(prefix = "frameworkdemoiselle.pagination") | 50 | +@Configuration(prefix = "frameworkdemoiselle.pagination.") |
51 | public class PaginationConfig implements Serializable { | 51 | public class PaginationConfig implements Serializable { |
52 | 52 | ||
53 | private static final long serialVersionUID = 1L; | 53 | private static final long serialVersionUID = 1L; |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/configuration/SecurityConfigImpl.java
@@ -38,19 +38,23 @@ package br.gov.frameworkdemoiselle.internal.configuration; | @@ -38,19 +38,23 @@ package br.gov.frameworkdemoiselle.internal.configuration; | ||
38 | 38 | ||
39 | import java.io.Serializable; | 39 | import java.io.Serializable; |
40 | 40 | ||
41 | +import br.gov.frameworkdemoiselle.annotation.Name; | ||
41 | import br.gov.frameworkdemoiselle.configuration.Configuration; | 42 | import br.gov.frameworkdemoiselle.configuration.Configuration; |
42 | import br.gov.frameworkdemoiselle.security.Authenticator; | 43 | import br.gov.frameworkdemoiselle.security.Authenticator; |
43 | import br.gov.frameworkdemoiselle.security.Authorizer; | 44 | import br.gov.frameworkdemoiselle.security.Authorizer; |
44 | 45 | ||
45 | -@Configuration(prefix = "frameworkdemoiselle.security") | 46 | +@Configuration(prefix = "frameworkdemoiselle.security.") |
46 | public class SecurityConfigImpl implements Serializable, SecurityConfig { | 47 | public class SecurityConfigImpl implements Serializable, SecurityConfig { |
47 | 48 | ||
48 | private static final long serialVersionUID = 1L; | 49 | private static final long serialVersionUID = 1L; |
49 | 50 | ||
51 | + @Name("enabled") | ||
50 | private boolean enabled = true; | 52 | private boolean enabled = true; |
51 | 53 | ||
54 | + @Name("authenticator.class") | ||
52 | private Class<? extends Authenticator> authenticatorClass; | 55 | private Class<? extends Authenticator> authenticatorClass; |
53 | 56 | ||
57 | + @Name("authorizer.class") | ||
54 | private Class<? extends Authorizer> authorizerClass; | 58 | private Class<? extends Authorizer> authorizerClass; |
55 | 59 | ||
56 | /* | 60 | /* |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/configuration/TransactionConfig.java
@@ -42,7 +42,7 @@ import br.gov.frameworkdemoiselle.annotation.Name; | @@ -42,7 +42,7 @@ import br.gov.frameworkdemoiselle.annotation.Name; | ||
42 | import br.gov.frameworkdemoiselle.configuration.Configuration; | 42 | import br.gov.frameworkdemoiselle.configuration.Configuration; |
43 | import br.gov.frameworkdemoiselle.transaction.Transaction; | 43 | import br.gov.frameworkdemoiselle.transaction.Transaction; |
44 | 44 | ||
45 | -@Configuration(prefix = "frameworkdemoiselle.transaction") | 45 | +@Configuration(prefix = "frameworkdemoiselle.transaction.") |
46 | public class TransactionConfig implements Serializable { | 46 | public class TransactionConfig implements Serializable { |
47 | 47 | ||
48 | private static final long serialVersionUID = 1L; | 48 | private static final long serialVersionUID = 1L; |
impl/core/src/test/java/br/gov/frameworkdemoiselle/internal/configuration/ConfigurationLoaderTest.java
@@ -133,7 +133,7 @@ public class ConfigurationLoaderTest { | @@ -133,7 +133,7 @@ public class ConfigurationLoaderTest { | ||
133 | 133 | ||
134 | } | 134 | } |
135 | 135 | ||
136 | - @Configuration(prefix = "frameworkdemoiselle.configurationtest") | 136 | + @Configuration(prefix = "frameworkdemoiselle.configurationtest.") |
137 | public class ConfigurationWithPrefix { | 137 | public class ConfigurationWithPrefix { |
138 | 138 | ||
139 | @Name("nameConfiguration") | 139 | @Name("nameConfiguration") |
@@ -282,7 +282,7 @@ public class ConfigurationLoaderTest { | @@ -282,7 +282,7 @@ public class ConfigurationLoaderTest { | ||
282 | 282 | ||
283 | } | 283 | } |
284 | 284 | ||
285 | - @Configuration(prefix = "br.gov.frameworkdemoiselle") | 285 | + @Configuration(prefix = "br.gov.frameworkdemoiselle.") |
286 | public class ConfigurationPropertiesSuccessWithPrefixNonAmbiguous { | 286 | public class ConfigurationPropertiesSuccessWithPrefixNonAmbiguous { |
287 | 287 | ||
288 | protected String success; | 288 | protected String success; |
impl/extension/jpa/src/main/java/br/gov/frameworkdemoiselle/internal/configuration/EntityManagerConfig.java
@@ -44,7 +44,7 @@ import br.gov.frameworkdemoiselle.configuration.Configuration; | @@ -44,7 +44,7 @@ import br.gov.frameworkdemoiselle.configuration.Configuration; | ||
44 | /** | 44 | /** |
45 | * Configuration class responsible for retrieving specific entity manager parameter values from properties file. | 45 | * Configuration class responsible for retrieving specific entity manager parameter values from properties file. |
46 | */ | 46 | */ |
47 | -@Configuration(prefix = "frameworkdemoiselle.persistence") | 47 | +@Configuration(prefix = "frameworkdemoiselle.persistence.") |
48 | public class EntityManagerConfig implements Serializable { | 48 | public class EntityManagerConfig implements Serializable { |
49 | 49 | ||
50 | private static final long serialVersionUID = 1L; | 50 | private static final long serialVersionUID = 1L; |
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/internal/configuration/ExceptionHandlerConfig.java
@@ -41,7 +41,7 @@ import java.io.Serializable; | @@ -41,7 +41,7 @@ import java.io.Serializable; | ||
41 | import br.gov.frameworkdemoiselle.annotation.Name; | 41 | import br.gov.frameworkdemoiselle.annotation.Name; |
42 | import br.gov.frameworkdemoiselle.configuration.Configuration; | 42 | import br.gov.frameworkdemoiselle.configuration.Configuration; |
43 | 43 | ||
44 | -@Configuration(prefix = "frameworkdemoiselle.handle") | 44 | +@Configuration(prefix = "frameworkdemoiselle.handle.") |
45 | public class ExceptionHandlerConfig implements Serializable { | 45 | public class ExceptionHandlerConfig implements Serializable { |
46 | 46 | ||
47 | private static final long serialVersionUID = 1L; | 47 | private static final long serialVersionUID = 1L; |
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/internal/configuration/JsfSecurityConfig.java
@@ -41,7 +41,7 @@ import java.io.Serializable; | @@ -41,7 +41,7 @@ import java.io.Serializable; | ||
41 | import br.gov.frameworkdemoiselle.annotation.Name; | 41 | import br.gov.frameworkdemoiselle.annotation.Name; |
42 | import br.gov.frameworkdemoiselle.configuration.Configuration; | 42 | import br.gov.frameworkdemoiselle.configuration.Configuration; |
43 | 43 | ||
44 | -@Configuration(prefix = "frameworkdemoiselle.security") | 44 | +@Configuration(prefix = "frameworkdemoiselle.security.") |
45 | public class JsfSecurityConfig implements Serializable { | 45 | public class JsfSecurityConfig implements Serializable { |
46 | 46 | ||
47 | private static final long serialVersionUID = 1L; | 47 | private static final long serialVersionUID = 1L; |
@@ -49,7 +49,6 @@ public class JsfSecurityConfig implements Serializable { | @@ -49,7 +49,6 @@ public class JsfSecurityConfig implements Serializable { | ||
49 | @Name("login.page") | 49 | @Name("login.page") |
50 | private String loginPage = "/login"; | 50 | private String loginPage = "/login"; |
51 | 51 | ||
52 | - // @Name("welcome.page") | ||
53 | @Name("redirect.after.login") | 52 | @Name("redirect.after.login") |
54 | private String redirectAfterLogin = "/index"; | 53 | private String redirectAfterLogin = "/index"; |
55 | 54 |