Commit b14e654fdaa20ff57099e15ea2b7acef557e07ac

Authored by Cleverson Sacramento
1 parent 6a09fdf9
Exists in master

Aplicando o padrão de formatação do código-fonte

Showing 62 changed files with 408 additions and 488 deletions   Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/Ignore.java
@@ -42,7 +42,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; @@ -42,7 +42,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
42 import java.lang.annotation.Retention; 42 import java.lang.annotation.Retention;
43 import java.lang.annotation.Target; 43 import java.lang.annotation.Target;
44 44
45 -@Target(FIELD) 45 +@Target(FIELD)
46 @Retention(RUNTIME) 46 @Retention(RUNTIME)
47 public @interface Ignore { 47 public @interface Ignore {
48 } 48 }
impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/ManagedOperation.java
@@ -47,24 +47,28 @@ import javax.enterprise.util.Nonbinding; @@ -47,24 +47,28 @@ import javax.enterprise.util.Nonbinding;
47 import br.gov.frameworkdemoiselle.DemoiselleException; 47 import br.gov.frameworkdemoiselle.DemoiselleException;
48 48
49 /** 49 /**
50 - * <p>Indicates that a method is a <b>managed operation</b>, meaning you can manage some aspect of the application by calling it from a external management client.</p>  
51 - * <p>This annotation can't be used together with {@link ManagedProperty}, doing so will throw a {@link DemoiselleException}.</p> 50 + * <p>
  51 + * Indicates that a method is a <b>managed operation</b>, meaning you can manage some aspect of the application by
  52 + * calling it from a external management client.
  53 + * </p>
  54 + * <p>
  55 + * This annotation can't be used together with {@link ManagedProperty}, doing so will throw a
  56 + * {@link DemoiselleException}.
  57 + * </p>
52 * 58 *
53 * @author SERPRO 59 * @author SERPRO
54 - *  
55 */ 60 */
56 @Documented 61 @Documented
57 -@Target({ElementType.METHOD}) 62 +@Target({ ElementType.METHOD })
58 @Retention(RetentionPolicy.RUNTIME) 63 @Retention(RetentionPolicy.RUNTIME)
59 public @interface ManagedOperation { 64 public @interface ManagedOperation {
60 - 65 +
61 /** 66 /**
62 - * Description that will be used to publish the operation to clients.  
63 - * Defaults to an empty description. 67 + * Description that will be used to publish the operation to clients. Defaults to an empty description.
64 */ 68 */
65 @Nonbinding 69 @Nonbinding
66 String description() default ""; 70 String description() default "";
67 - 71 +
68 /** 72 /**
69 * Type of operation. Defaults to {@link OperationType#UNKNOWN}. 73 * Type of operation. Defaults to {@link OperationType#UNKNOWN}.
70 */ 74 */
impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/ManagedProperty.java
@@ -45,57 +45,65 @@ import java.lang.annotation.Target; @@ -45,57 +45,65 @@ import java.lang.annotation.Target;
45 import javax.enterprise.util.Nonbinding; 45 import javax.enterprise.util.Nonbinding;
46 46
47 /** 47 /**
48 - * <p>Indicates that a field must be exposed as a property to management clients.</p>  
49 - * <p>The property will be writable if there's a public setter method  
50 - * declared for the field and readable if there's a getter method. You can override this behaviour by passing a value  
51 - * to the {@link #accessLevel()} property.</p>  
52 - * <p>It's a runtime error to annotate a field with no getter and no setter method.</p>  
53 - * <p>It's also a runtime error to declare a field as a property and one or both of it's getter and setter  
54 - * methods as an operation using the {@link ManagedOperation} annotation.</p> 48 + * <p>
  49 + * Indicates that a field must be exposed as a property to management clients.
  50 + * </p>
  51 + * <p>
  52 + * The property will be writable if there's a public setter method declared for the field and readable if there's a
  53 + * getter method. You can override this behaviour by passing a value to the {@link #accessLevel()} property.
  54 + * </p>
  55 + * <p>
  56 + * It's a runtime error to annotate a field with no getter and no setter method.
  57 + * </p>
  58 + * <p>
  59 + * It's also a runtime error to declare a field as a property and one or both of it's getter and setter methods as an
  60 + * operation using the {@link ManagedOperation} annotation.
  61 + * </p>
55 * 62 *
56 * @author SERPRO 63 * @author SERPRO
57 - *  
58 */ 64 */
59 @Documented 65 @Documented
60 -@Target({ElementType.FIELD}) 66 +@Target({ ElementType.FIELD })
61 @Retention(RetentionPolicy.RUNTIME) 67 @Retention(RetentionPolicy.RUNTIME)
62 public @interface ManagedProperty { 68 public @interface ManagedProperty {
63 - 69 +
64 /** 70 /**
65 * @return The description of this property exposed to management clients. 71 * @return The description of this property exposed to management clients.
66 */ 72 */
67 @Nonbinding 73 @Nonbinding
68 String description() default ""; 74 String description() default "";
69 - 75 +
70 @Nonbinding 76 @Nonbinding
71 ManagedPropertyAccess accessLevel() default ManagedPropertyAccess.DEFAULT; 77 ManagedPropertyAccess accessLevel() default ManagedPropertyAccess.DEFAULT;
72 - 78 +
73 /** 79 /**
74 - * <p>Access level of a managed property.</p>  
75 - *  
76 - * <p>These values only affect access via external management clients, the application is still able to inject and use the normal visibility of the property  
77 - * by Java standards.</p> 80 + * <p>
  81 + * Access level of a managed property.
  82 + * </p>
  83 + * <p>
  84 + * These values only affect access via external management clients, the application is still able to inject and use
  85 + * the normal visibility of the property by Java standards.
  86 + * </p>
78 * 87 *
79 * @author serpro 88 * @author serpro
80 - *  
81 */ 89 */
82 - enum ManagedPropertyAccess{  
83 - 90 + enum ManagedPropertyAccess {
  91 +
84 /** 92 /**
85 * Restricts a property to be only readable even if a setter method exists. 93 * Restricts a property to be only readable even if a setter method exists.
86 */ 94 */
87 READ_ONLY 95 READ_ONLY
88 - 96 +
89 /** 97 /**
90 * Restricts a property to be only writeable even if a getter method exists. 98 * Restricts a property to be only writeable even if a getter method exists.
91 */ 99 */
92 - ,WRITE_ONLY  
93 - 100 + , WRITE_ONLY
  101 +
94 /** 102 /**
95 - * Says that the read or write access will  
96 - * be determined by the presence of a getter method <code>(getProperty())</code> or setter method <code>(setProperty(propertyValue))</code> for a property. 103 + * Says that the read or write access will be determined by the presence of a getter method
  104 + * <code>(getProperty())</code> or setter method <code>(setProperty(propertyValue))</code> for a property.
97 */ 105 */
98 - ,DEFAULT; 106 + , DEFAULT;
99 } 107 }
100 108
101 } 109 }
impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/OperationParameter.java
@@ -45,29 +45,31 @@ import java.lang.annotation.Target; @@ -45,29 +45,31 @@ import java.lang.annotation.Target;
45 import javax.enterprise.util.Nonbinding; 45 import javax.enterprise.util.Nonbinding;
46 46
47 /** 47 /**
48 - * <p>Optional annotation to write additional detail about an operation's parameter.</p>  
49 - * <p>This annotation is ignored for non-operation methods.</p> 48 + * <p>
  49 + * Optional annotation to write additional detail about an operation's parameter.
  50 + * </p>
  51 + * <p>
  52 + * This annotation is ignored for non-operation methods.
  53 + * </p>
50 * 54 *
51 * @author SERPRO 55 * @author SERPRO
52 - *  
53 */ 56 */
54 @Documented 57 @Documented
55 -@Target({ElementType.PARAMETER}) 58 +@Target({ ElementType.PARAMETER })
56 @Retention(RetentionPolicy.RUNTIME) 59 @Retention(RetentionPolicy.RUNTIME)
57 public @interface OperationParameter { 60 public @interface OperationParameter {
58 - 61 +
59 /** 62 /**
60 * Name that will be used to publish this operation's parameter to clients. 63 * Name that will be used to publish this operation's parameter to clients.
61 */ 64 */
62 @Nonbinding 65 @Nonbinding
63 String name(); 66 String name();
64 - 67 +
65 /** 68 /**
66 - * Optional description that will be used to publish this operation's parameter to clients.  
67 - * Defaults to an empty description. 69 + * Optional description that will be used to publish this operation's parameter to clients. Defaults to an empty
  70 + * description.
68 */ 71 */
69 @Nonbinding 72 @Nonbinding
70 String description() default ""; 73 String description() default "";
71 -  
72 74
73 } 75 }
impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/OperationType.java
@@ -38,52 +38,50 @@ package br.gov.frameworkdemoiselle.annotation; @@ -38,52 +38,50 @@ package br.gov.frameworkdemoiselle.annotation;
38 38
39 import javax.management.MBeanOperationInfo; 39 import javax.management.MBeanOperationInfo;
40 40
41 -  
42 /** 41 /**
43 - * <p>Define the operation type for an operation inside a ManagementController class.</p>  
44 - *  
45 - * <p>This is an optional annotation and it's significanse will change based on the management extension  
46 - * used. Most extensions will just publish this information to the client so it can better show to the user the inner  
47 - * workings of the annotated operation.</p>  
48 - * 42 + * <p>
  43 + * Define the operation type for an operation inside a ManagementController class.
  44 + * </p>
  45 + * <p>
  46 + * This is an optional annotation and it's significanse will change based on the management extension used. Most
  47 + * extensions will just publish this information to the client so it can better show to the user the inner workings of
  48 + * the annotated operation.
  49 + * </p>
49 * 50 *
50 * @author SERPRO 51 * @author SERPRO
51 - *  
52 */ 52 */
53 public enum OperationType { 53 public enum OperationType {
54 - 54 +
55 /** 55 /**
56 - * ManagedOperation is write-only, it causes the application  
57 - * to change some of it's behaviour but doesn't return any kind of information 56 + * ManagedOperation is write-only, it causes the application to change some of it's behaviour but doesn't return any
  57 + * kind of information
58 */ 58 */
59 - ACTION(MBeanOperationInfo.ACTION)  
60 - , 59 + ACTION(MBeanOperationInfo.ACTION),
61 /** 60 /**
62 * ManagedOperation is read-only, it will operate over data provided by the application and return some information, 61 * ManagedOperation is read-only, it will operate over data provided by the application and return some information,
63 * but will not change the application in any way. 62 * but will not change the application in any way.
64 */ 63 */
65 - INFO(MBeanOperationInfo.INFO)  
66 - , 64 + INFO(MBeanOperationInfo.INFO),
67 /** 65 /**
68 - * ManagedOperation is read-write, it will both change the way the application work and return some information regarding  
69 - * the result of the operation. 66 + * ManagedOperation is read-write, it will both change the way the application work and return some information
  67 + * regarding the result of the operation.
70 */ 68 */
71 - ACTION_INFO(MBeanOperationInfo.ACTION_INFO)  
72 - , 69 + ACTION_INFO(MBeanOperationInfo.ACTION_INFO),
73 /** 70 /**
74 - * The effect of calling this operation is unknown. This is the default type and if this type is assigned to an operation,  
75 - * the user must rely on the {@link ManagedOperation#description()} attribute to learn about how the operation works. 71 + * The effect of calling this operation is unknown. This is the default type and if this type is assigned to an
  72 + * operation, the user must rely on the {@link ManagedOperation#description()} attribute to learn about how the
  73 + * operation works.
76 */ 74 */
77 UNKNOWN(MBeanOperationInfo.UNKNOWN); 75 UNKNOWN(MBeanOperationInfo.UNKNOWN);
78 - 76 +
79 private int operationTypeValue; 77 private int operationTypeValue;
80 -  
81 - private OperationType(int type){ 78 +
  79 + private OperationType(int type) {
82 this.operationTypeValue = type; 80 this.operationTypeValue = type;
83 } 81 }
84 -  
85 - public int getValue(){ 82 +
  83 + public int getValue() {
86 return operationTypeValue; 84 return operationTypeValue;
87 } 85 }
88 - 86 +
89 } 87 }
impl/core/src/main/java/br/gov/frameworkdemoiselle/configuration/ConfigType.java
@@ -57,5 +57,5 @@ public enum ConfigType { @@ -57,5 +57,5 @@ public enum ConfigType {
57 * Configuration loaded on properties resources. 57 * Configuration loaded on properties resources.
58 */ 58 */
59 PROPERTIES; 59 PROPERTIES;
60 - 60 +
61 } 61 }
impl/core/src/main/java/br/gov/frameworkdemoiselle/exception/ExceptionHandlerInterceptor.java
@@ -52,9 +52,9 @@ import javax.interceptor.InvocationContext; @@ -52,9 +52,9 @@ import javax.interceptor.InvocationContext;
52 import org.slf4j.Logger; 52 import org.slf4j.Logger;
53 53
54 import br.gov.frameworkdemoiselle.DemoiselleException; 54 import br.gov.frameworkdemoiselle.DemoiselleException;
55 -import br.gov.frameworkdemoiselle.internal.producer.LoggerProducer;  
56 -import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer;  
57 import br.gov.frameworkdemoiselle.stereotype.Controller; 55 import br.gov.frameworkdemoiselle.stereotype.Controller;
  56 +import br.gov.frameworkdemoiselle.util.Beans;
  57 +import br.gov.frameworkdemoiselle.util.NameQualifier;
58 import br.gov.frameworkdemoiselle.util.ResourceBundle; 58 import br.gov.frameworkdemoiselle.util.ResourceBundle;
59 59
60 @Interceptor 60 @Interceptor
@@ -63,9 +63,9 @@ public class ExceptionHandlerInterceptor implements Serializable { @@ -63,9 +63,9 @@ public class ExceptionHandlerInterceptor implements Serializable {
63 63
64 private static final long serialVersionUID = 1L; 64 private static final long serialVersionUID = 1L;
65 65
66 - private static ResourceBundle bundle; 66 + private static transient ResourceBundle bundle;
67 67
68 - private static Logger logger; 68 + private static transient Logger logger;
69 69
70 private final Map<Class<?>, Map<Class<?>, Method>> cache = new HashMap<Class<?>, Map<Class<?>, Method>>(); 70 private final Map<Class<?>, Map<Class<?>, Method>> cache = new HashMap<Class<?>, Map<Class<?>, Method>>();
71 71
@@ -199,7 +199,7 @@ public class ExceptionHandlerInterceptor implements Serializable { @@ -199,7 +199,7 @@ public class ExceptionHandlerInterceptor implements Serializable {
199 199
200 private static ResourceBundle getBundle() { 200 private static ResourceBundle getBundle() {
201 if (bundle == null) { 201 if (bundle == null) {
202 - bundle = ResourceBundleProducer.create("demoiselle-core-bundle"); 202 + bundle = Beans.getReference(ResourceBundle.class, new NameQualifier("demoiselle-core-bundle"));
203 } 203 }
204 204
205 return bundle; 205 return bundle;
@@ -207,7 +207,7 @@ public class ExceptionHandlerInterceptor implements Serializable { @@ -207,7 +207,7 @@ public class ExceptionHandlerInterceptor implements Serializable {
207 207
208 private static Logger getLogger() { 208 private static Logger getLogger() {
209 if (logger == null) { 209 if (logger == null) {
210 - logger = LoggerProducer.create(ExceptionHandlerInterceptor.class); 210 + logger = Beans.getReference(Logger.class, new NameQualifier(ExceptionHandlerInterceptor.class.getName()));
211 } 211 }
212 212
213 return logger; 213 return logger;
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/AbstractLifecycleBootstrap.java
@@ -110,10 +110,10 @@ public abstract class AbstractLifecycleBootstrap&lt;A extends Annotation&gt; implement @@ -110,10 +110,10 @@ public abstract class AbstractLifecycleBootstrap&lt;A extends Annotation&gt; implement
110 } 110 }
111 111
112 public void loadTempContexts(@Observes final AfterBeanDiscovery event) { 112 public void loadTempContexts(@Observes final AfterBeanDiscovery event) {
113 - //Caso este bootstrap rode antes do CoreBootstrap. Não há problemas em chamar este método várias vezes, ele  
114 - //ignora chamadas adicionais. 113 + // Caso este bootstrap rode antes do CoreBootstrap. Não há problemas em chamar este método várias vezes, ele
  114 + // ignora chamadas adicionais.
115 ContextManager.initialize(event); 115 ContextManager.initialize(event);
116 - 116 +
117 // Não registrar o contexto de aplicação pq ele já é registrado pela implementação do CDI 117 // Não registrar o contexto de aplicação pq ele já é registrado pela implementação do CDI
118 ContextManager.add(new ThreadLocalContext(ViewScoped.class), event); 118 ContextManager.add(new ThreadLocalContext(ViewScoped.class), event);
119 ContextManager.add(new ThreadLocalContext(SessionScoped.class), event); 119 ContextManager.add(new ThreadLocalContext(SessionScoped.class), event);
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/CustomInjectionPoint.java
@@ -1,136 +0,0 @@ @@ -1,136 +0,0 @@
1 -/*  
2 - * Demoiselle Framework  
3 - * Copyright (C) 2010 SERPRO  
4 - * ----------------------------------------------------------------------------  
5 - * This file is part of Demoiselle Framework.  
6 - *  
7 - * Demoiselle Framework is free software; you can redistribute it and/or  
8 - * modify it under the terms of the GNU Lesser General Public License version 3  
9 - * as published by the Free Software Foundation.  
10 - *  
11 - * This program is distributed in the hope that it will be useful,  
12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
14 - * GNU General Public License for more details.  
15 - *  
16 - * You should have received a copy of the GNU Lesser General Public License version 3  
17 - * along with this program; if not, see <http://www.gnu.org/licenses/>  
18 - * or write to the Free Software Foundation, Inc., 51 Franklin Street,  
19 - * Fifth Floor, Boston, MA 02110-1301, USA.  
20 - * ----------------------------------------------------------------------------  
21 - * Este arquivo é parte do Framework Demoiselle.  
22 - *  
23 - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
24 - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
25 - * do Software Livre (FSF).  
26 - *  
27 - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
28 - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
29 - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
30 - * para maiores detalhes.  
31 - *  
32 - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
33 - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
34 - * ou escreva para a Fundação do Software Livre (FSF) Inc.,  
35 - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
36 - */  
37 -package br.gov.frameworkdemoiselle.internal.bootstrap;  
38 -  
39 -import java.lang.annotation.Annotation;  
40 -import java.lang.reflect.Member;  
41 -import java.lang.reflect.Type;  
42 -import java.util.Arrays;  
43 -import java.util.HashSet;  
44 -import java.util.Set;  
45 -  
46 -import javax.enterprise.inject.spi.Annotated;  
47 -import javax.enterprise.inject.spi.Bean;  
48 -import javax.enterprise.inject.spi.InjectionPoint;  
49 -  
50 -public class CustomInjectionPoint implements InjectionPoint {  
51 -  
52 - private final Bean<?> bean;  
53 -  
54 - private final Type beanType;  
55 -  
56 - private final Set<Annotation> qualifiers;  
57 -  
58 - public CustomInjectionPoint(Bean<?> bean, Type beanType, Annotation... qualifiers) {  
59 - this.bean = bean;  
60 - this.beanType = beanType;  
61 - this.qualifiers = new HashSet<Annotation>(Arrays.asList(qualifiers));  
62 - }  
63 -  
64 - @Override  
65 - public Type getType() {  
66 - return this.beanType;  
67 - }  
68 -  
69 - @Override  
70 - public Set<Annotation> getQualifiers() {  
71 - return this.qualifiers;  
72 - }  
73 -  
74 - @Override  
75 - public Bean<?> getBean() {  
76 - return this.bean;  
77 - }  
78 -  
79 - @Override  
80 - public Member getMember() {  
81 - return null;  
82 - }  
83 -  
84 - @Override  
85 - public boolean isDelegate() {  
86 - return false;  
87 - }  
88 -  
89 - @Override  
90 - public boolean isTransient() {  
91 - return false;  
92 - }  
93 -  
94 - @Override  
95 - public Annotated getAnnotated() {  
96 - return new Annotated() {  
97 -  
98 - @Override  
99 - public Type getBaseType() {  
100 - // TODO Auto-generated method stub  
101 - return null;  
102 - }  
103 -  
104 - @Override  
105 - public Set<Type> getTypeClosure() {  
106 - // TODO Auto-generated method stub  
107 - return null;  
108 - }  
109 -  
110 - @Override  
111 - @SuppressWarnings("unchecked")  
112 - public <T extends Annotation> T getAnnotation(Class<T> annotationType) {  
113 - T result = null;  
114 -  
115 - for (Annotation annotation : getAnnotations()) {  
116 - if (annotation.annotationType() == annotationType) {  
117 - result = (T) annotation;  
118 - break;  
119 - }  
120 - }  
121 -  
122 - return result;  
123 - }  
124 -  
125 - @Override  
126 - public Set<Annotation> getAnnotations() {  
127 - return qualifiers;  
128 - }  
129 -  
130 - @Override  
131 - public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {  
132 - return qualifiers.contains(annotationType);  
133 - }  
134 - };  
135 - }  
136 -}  
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/ManagementBootstrap.java
@@ -32,8 +32,8 @@ public class ManagementBootstrap implements Extension { @@ -32,8 +32,8 @@ public class ManagementBootstrap implements Extension {
32 32
33 protected static List<AnnotatedType<?>> types = Collections.synchronizedList(new ArrayList<AnnotatedType<?>>()); 33 protected static List<AnnotatedType<?>> types = Collections.synchronizedList(new ArrayList<AnnotatedType<?>>());
34 34
35 - private List<Class<? extends ManagementExtension>> managementExtensionCache = Collections.synchronizedList(new ArrayList<Class<? extends ManagementExtension>>());  
36 - 35 + private List<Class<? extends ManagementExtension>> managementExtensionCache = Collections
  36 + .synchronizedList(new ArrayList<Class<? extends ManagementExtension>>());
37 37
38 public <T> void detectAnnotation(@Observes final ProcessAnnotatedType<T> event, final BeanManager beanManager) { 38 public <T> void detectAnnotation(@Observes final ProcessAnnotatedType<T> event, final BeanManager beanManager) {
39 if (event.getAnnotatedType().isAnnotationPresent(ManagementController.class)) { 39 if (event.getAnnotatedType().isAnnotationPresent(ManagementController.class)) {
@@ -47,27 +47,28 @@ public class ManagementBootstrap implements Extension { @@ -47,27 +47,28 @@ public class ManagementBootstrap implements Extension {
47 } 47 }
48 48
49 @SuppressWarnings("unchecked") 49 @SuppressWarnings("unchecked")
50 - public void registerAvailableManagedTypes(@Observes final AfterDeploymentValidation event,BeanManager beanManager) { 50 + public void registerAvailableManagedTypes(@Observes final AfterDeploymentValidation event, BeanManager beanManager) {
51 ResourceBundle bundle = ResourceBundleProducer.create("demoiselle-core-bundle", Locale.getDefault()); 51 ResourceBundle bundle = ResourceBundleProducer.create("demoiselle-core-bundle", Locale.getDefault());
52 52
53 Management monitoringManager = Beans.getReference(Management.class); 53 Management monitoringManager = Beans.getReference(Management.class);
54 for (AnnotatedType<?> type : types) { 54 for (AnnotatedType<?> type : types) {
55 - if (type.getJavaClass().isInterface() || Modifier.isAbstract(type.getJavaClass().getModifiers()) ){  
56 - throw new DemoiselleException(bundle.getString("management-abstract-class-defined" , type.getJavaClass().getCanonicalName())); 55 + if (type.getJavaClass().isInterface() || Modifier.isAbstract(type.getJavaClass().getModifiers())) {
  56 + throw new DemoiselleException(bundle.getString("management-abstract-class-defined", type.getJavaClass()
  57 + .getCanonicalName()));
57 } 58 }
58 59
59 ManagedType managedType = new ManagedType(type.getJavaClass()); 60 ManagedType managedType = new ManagedType(type.getJavaClass());
60 monitoringManager.addManagedType(managedType); 61 monitoringManager.addManagedType(managedType);
61 } 62 }
62 - 63 +
63 Set<Bean<?>> extensionBeans = beanManager.getBeans(ManagementExtension.class); 64 Set<Bean<?>> extensionBeans = beanManager.getBeans(ManagementExtension.class);
64 - if (extensionBeans!=null){  
65 - for (Bean<?> bean : extensionBeans){ 65 + if (extensionBeans != null) {
  66 + for (Bean<?> bean : extensionBeans) {
66 Class<?> extensionConcreteClass = bean.getBeanClass(); 67 Class<?> extensionConcreteClass = bean.getBeanClass();
67 managementExtensionCache.add((Class<? extends ManagementExtension>) extensionConcreteClass); 68 managementExtensionCache.add((Class<? extends ManagementExtension>) extensionConcreteClass);
68 } 69 }
69 } 70 }
70 - 71 +
71 monitoringManager.initialize(managementExtensionCache); 72 monitoringManager.initialize(managementExtensionCache);
72 } 73 }
73 74
@@ -75,7 +76,7 @@ public class ManagementBootstrap implements Extension { @@ -75,7 +76,7 @@ public class ManagementBootstrap implements Extension {
75 76
76 Management manager = Beans.getReference(Management.class); 77 Management manager = Beans.getReference(Management.class);
77 manager.shutdown(managementExtensionCache); 78 manager.shutdown(managementExtensionCache);
78 - 79 +
79 managementExtensionCache.clear(); 80 managementExtensionCache.clear();
80 types.clear(); 81 types.clear();
81 } 82 }
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/context/ContextManager.java
@@ -51,8 +51,9 @@ public class ContextManager { @@ -51,8 +51,9 @@ public class ContextManager {
51 private static ResourceBundle bundle; 51 private static ResourceBundle bundle;
52 52
53 private static Logger logger; 53 private static Logger logger;
54 -  
55 - private ContextManager(){} 54 +
  55 + private ContextManager() {
  56 + }
56 57
57 /** 58 /**
58 * <p> 59 * <p>
@@ -105,9 +106,9 @@ public class ContextManager { @@ -105,9 +106,9 @@ public class ContextManager {
105 } 106 }
106 107
107 ContextManager.getLogger().trace( 108 ContextManager.getLogger().trace(
108 - ContextManager.getBundle().getString("bootstrap-context-added",  
109 - context.getClass().getCanonicalName(), context.getScope().getCanonicalName()));  
110 - 109 + ContextManager.getBundle().getString("bootstrap-context-added", context.getClass().getCanonicalName(),
  110 + context.getScope().getCanonicalName()));
  111 +
111 context.setActive(false); 112 context.setActive(false);
112 event.addContext(context); 113 event.addContext(context);
113 contexts.add(new CustomContextCounter(context)); 114 contexts.add(new CustomContextCounter(context));
@@ -194,8 +195,10 @@ public class ContextManager { @@ -194,8 +195,10 @@ public class ContextManager {
194 } 195 }
195 196
196 /** 197 /**
197 - * <p>This method should be called when the application is shutting down, usually by observing  
198 - * the {@link BeforeShutdown} event.</p> 198 + * <p>
  199 + * This method should be called when the application is shutting down, usually by observing the
  200 + * {@link BeforeShutdown} event.
  201 + * </p>
199 */ 202 */
200 public static synchronized void shutdown() { 203 public static synchronized void shutdown() {
201 for (CustomContextCounter context : contexts) { 204 for (CustomContextCounter context : contexts) {
@@ -252,7 +255,7 @@ class CustomContextCounter { @@ -252,7 +255,7 @@ class CustomContextCounter {
252 public CustomContext getInternalContext() { 255 public CustomContext getInternalContext() {
253 return this.context; 256 return this.context;
254 } 257 }
255 - 258 +
256 public void setInternalContext(CustomContext context) { 259 public void setInternalContext(CustomContext context) {
257 this.context = context; 260 this.context = context;
258 } 261 }
@@ -261,19 +264,14 @@ class CustomContextCounter { @@ -261,19 +264,14 @@ class CustomContextCounter {
261 try { 264 try {
262 BeanManager beanManager = Beans.getReference(BeanManager.class); 265 BeanManager beanManager = Beans.getReference(BeanManager.class);
263 Context c = beanManager.getContext(context.getScope()); 266 Context c = beanManager.getContext(context.getScope());
264 -  
265 - 267 +
266 if (c == context) { 268 if (c == context) {
267 activationCounter++; 269 activationCounter++;
268 - }  
269 - else{ 270 + } else {
270 ContextManager.getLogger().trace( 271 ContextManager.getLogger().trace(
271 ContextManager.getBundle().getString("custom-context-already-activated", 272 ContextManager.getBundle().getString("custom-context-already-activated",
272 - context.getClass().getCanonicalName()  
273 - ,c.getScope().getCanonicalName()  
274 - ,c.getClass().getCanonicalName()  
275 - )  
276 - ); 273 + context.getClass().getCanonicalName(), c.getScope().getCanonicalName(),
  274 + c.getClass().getCanonicalName()));
277 } 275 }
278 } catch (ContextNotActiveException ce) { 276 } catch (ContextNotActiveException ce) {
279 context.setActive(true); 277 context.setActive(true);
@@ -299,10 +297,10 @@ class CustomContextCounter { @@ -299,10 +297,10 @@ class CustomContextCounter {
299 } catch (ContextNotActiveException ce) { 297 } catch (ContextNotActiveException ce) {
300 } 298 }
301 } 299 }
302 - 300 +
303 public synchronized void shutdown() { 301 public synchronized void shutdown() {
304 context.setActive(false); 302 context.setActive(false);
305 - context=null;  
306 - activationCounter=0; 303 + context = null;
  304 + activationCounter = 0;
307 } 305 }
308 } 306 }
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/context/ManagedContext.java
@@ -5,14 +5,13 @@ import javax.enterprise.context.RequestScoped; @@ -5,14 +5,13 @@ import javax.enterprise.context.RequestScoped;
5 import br.gov.frameworkdemoiselle.stereotype.ManagementController; 5 import br.gov.frameworkdemoiselle.stereotype.ManagementController;
6 6
7 /** 7 /**
8 - * Context that stores {@link RequestScoped} beans during client calls to {@link ManagementController} classes.  
9 - * This context is only activated when no other context is active for {@link RequestScoped}. 8 + * Context that stores {@link RequestScoped} beans during client calls to {@link ManagementController} classes. This
  9 + * context is only activated when no other context is active for {@link RequestScoped}.
10 * 10 *
11 * @author serpro 11 * @author serpro
12 - *  
13 */ 12 */
14 public class ManagedContext extends ThreadLocalContext { 13 public class ManagedContext extends ThreadLocalContext {
15 - 14 +
16 /** 15 /**
17 * Constructs a new context. 16 * Constructs a new context.
18 */ 17 */
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/context/ThreadLocalContext.java
@@ -51,10 +51,9 @@ package br.gov.frameworkdemoiselle.internal.context; @@ -51,10 +51,9 @@ package br.gov.frameworkdemoiselle.internal.context;
51 import java.lang.annotation.Annotation; 51 import java.lang.annotation.Annotation;
52 52
53 /** 53 /**
54 - * Base context that has a separated store for each thread 54 + * Base context that has a separated store for each thread
55 * 55 *
56 * @author serpro 56 * @author serpro
57 - *  
58 */ 57 */
59 public class ThreadLocalContext extends AbstractCustomContext { 58 public class ThreadLocalContext extends AbstractCustomContext {
60 59
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/TransactionContextImpl.java
@@ -55,7 +55,8 @@ public class TransactionContextImpl implements TransactionContext { @@ -55,7 +55,8 @@ public class TransactionContextImpl implements TransactionContext {
55 55
56 private Transaction transaction; 56 private Transaction transaction;
57 57
58 - private Transaction getTransaction() { 58 + @Override
  59 + public Transaction getCurrentTransaction() {
59 if (this.transaction == null) { 60 if (this.transaction == null) {
60 Class<? extends Transaction> clazz = getConfig().getTransactionClass(); 61 Class<? extends Transaction> clazz = getConfig().getTransactionClass();
61 62
@@ -69,11 +70,6 @@ public class TransactionContextImpl implements TransactionContext { @@ -69,11 +70,6 @@ public class TransactionContextImpl implements TransactionContext {
69 return this.transaction; 70 return this.transaction;
70 } 71 }
71 72
72 - @Override  
73 - public Transaction getCurrentTransaction() {  
74 - return getTransaction();  
75 - }  
76 -  
77 private TransactionConfig getConfig() { 73 private TransactionConfig getConfig() {
78 return Beans.getReference(TransactionConfig.class); 74 return Beans.getReference(TransactionConfig.class);
79 } 75 }
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/interceptor/ExceptionHandlerInterceptor.java
@@ -57,7 +57,7 @@ public class ExceptionHandlerInterceptor extends br.gov.frameworkdemoiselle.exce @@ -57,7 +57,7 @@ public class ExceptionHandlerInterceptor extends br.gov.frameworkdemoiselle.exce
57 57
58 @Inject 58 @Inject
59 private Logger logger; 59 private Logger logger;
60 - 60 +
61 @Override 61 @Override
62 @AroundInvoke 62 @AroundInvoke
63 public Object manage(InvocationContext ic) throws Exception { 63 public Object manage(InvocationContext ic) throws Exception {
@@ -65,4 +65,3 @@ public class ExceptionHandlerInterceptor extends br.gov.frameworkdemoiselle.exce @@ -65,4 +65,3 @@ public class ExceptionHandlerInterceptor extends br.gov.frameworkdemoiselle.exce
65 return super.manage(ic); 65 return super.manage(ic);
66 } 66 }
67 } 67 }
68 -  
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/proxy/Slf4jLoggerProxy.java
@@ -61,12 +61,12 @@ public class Slf4jLoggerProxy implements Logger, Serializable { @@ -61,12 +61,12 @@ public class Slf4jLoggerProxy implements Logger, Serializable {
61 private transient Logger delegate; 61 private transient Logger delegate;
62 62
63 private final Class<?> type; 63 private final Class<?> type;
64 - 64 +
65 private Logger getDelegate() { 65 private Logger getDelegate() {
66 - if(delegate == null) { 66 + if (delegate == null) {
67 delegate = LoggerFactory.getLogger(type); 67 delegate = LoggerFactory.getLogger(type);
68 } 68 }
69 - 69 +
70 return delegate; 70 return delegate;
71 } 71 }
72 72
impl/core/src/main/java/br/gov/frameworkdemoiselle/lifecycle/ManagementExtension.java
@@ -42,34 +42,36 @@ import br.gov.frameworkdemoiselle.internal.management.ManagedType; @@ -42,34 +42,36 @@ import br.gov.frameworkdemoiselle.internal.management.ManagedType;
42 import br.gov.frameworkdemoiselle.stereotype.ManagementController; 42 import br.gov.frameworkdemoiselle.stereotype.ManagementController;
43 43
44 /** 44 /**
45 - *  
46 - * <p>Interface defining the lifecycle of a <b>management extension</b>, an extension  
47 - * capable of exposing {@link ManagementController}'s to external clients in one  
48 - * of the available management technologies, such as JMX or SNMP.</p>  
49 - *  
50 - * <p>To include a management extension into the management lifecycle, it just needs  
51 - * to implement this interface and be a CDI bean (have a <b>beans.xml</b> file inside  
52 - * the META-INF folder of it's java package). The Demoiselle Core lifecycle controller  
53 - * will call the {@link #initialize(List managedTypes)} and {@link #shutdown(List managedTypes)} methods at the apropriate times.</p> 45 + * <p>
  46 + * Interface defining the lifecycle of a <b>management extension</b>, an extension capable of exposing
  47 + * {@link ManagementController}'s to external clients in one of the available management technologies, such as JMX or
  48 + * SNMP.
  49 + * </p>
  50 + * <p>
  51 + * To include a management extension into the management lifecycle, it just needs to implement this interface and be a
  52 + * CDI bean (have a <b>beans.xml</b> file inside the META-INF folder of it's java package). The Demoiselle Core
  53 + * lifecycle controller will call the {@link #initialize(List managedTypes)} and {@link #shutdown(List managedTypes)}
  54 + * methods at the apropriate times.
  55 + * </p>
54 * 56 *
55 * @author serpro 57 * @author serpro
56 - *  
57 */ 58 */
58 public interface ManagementExtension { 59 public interface ManagementExtension {
59 60
60 /** 61 /**
61 - * This method is called during the application initialization process for each concrete  
62 - * implementation of this interface. 62 + * This method is called during the application initialization process for each concrete implementation of this
  63 + * interface.
63 * 64 *
64 - * @param managedTypes The list of discovered {@link ManagementController} classes. 65 + * @param managedTypes
  66 + * The list of discovered {@link ManagementController} classes.
65 */ 67 */
66 void initialize(List<ManagedType> managedTypes); 68 void initialize(List<ManagedType> managedTypes);
67 69
68 /** 70 /**
69 - * This method is called during the application shutdown process for each concrete  
70 - * implementation of this interface. 71 + * This method is called during the application shutdown process for each concrete implementation of this interface.
71 * 72 *
72 - * @param managedTypes The list of discovered {@link ManagementController} classes. 73 + * @param managedTypes
  74 + * The list of discovered {@link ManagementController} classes.
73 */ 75 */
74 void shutdown(List<ManagedType> managedTypes); 76 void shutdown(List<ManagedType> managedTypes);
75 77
impl/core/src/main/java/br/gov/frameworkdemoiselle/lifecycle/Shutdown.java
@@ -48,17 +48,20 @@ import java.lang.annotation.Target; @@ -48,17 +48,20 @@ import java.lang.annotation.Target;
48 * Take a look at the following usage sample: 48 * Take a look at the following usage sample:
49 * <p> 49 * <p>
50 * <blockquote> 50 * <blockquote>
  51 + *
51 * <pre> 52 * <pre>
52 * public class Finalizer { 53 * public class Finalizer {
53 * 54 *
54 - * &#064;Shutdown 55 + * &#064;Shutdown
55 * &#064;Priority(5) 56 * &#064;Priority(5)
56 * public void finalize() { 57 * public void finalize() {
57 * ... 58 * ...
58 * } 59 * }
59 * } 60 * }
60 * 61 *
  62 + *
61 * </pre> 63 * </pre>
  64 + *
62 * </blockquote> 65 * </blockquote>
63 * <p> 66 * <p>
64 * 67 *
impl/core/src/main/java/br/gov/frameworkdemoiselle/lifecycle/Startup.java
@@ -48,17 +48,20 @@ import java.lang.annotation.Target; @@ -48,17 +48,20 @@ import java.lang.annotation.Target;
48 * Take a look at the following usage sample: 48 * Take a look at the following usage sample:
49 * <p> 49 * <p>
50 * <blockquote> 50 * <blockquote>
  51 + *
51 * <pre> 52 * <pre>
52 * public class Finalizer { 53 * public class Finalizer {
53 * 54 *
54 - * &#064;Startup 55 + * &#064;Startup
55 * &#064;Priority(1) 56 * &#064;Priority(1)
56 * public void init() { 57 * public void init() {
57 * ... 58 * ...
58 * } 59 * }
59 * } 60 * }
60 * 61 *
  62 + *
61 * </pre> 63 * </pre>
  64 + *
62 * </blockquote> 65 * </blockquote>
63 * <p> 66 * <p>
64 * 67 *
impl/core/src/main/java/br/gov/frameworkdemoiselle/pagination/Pagination.java
@@ -88,5 +88,5 @@ public interface Pagination { @@ -88,5 +88,5 @@ public interface Pagination {
88 * Sets the position for the first record and hence calculates current page according to page size. 88 * Sets the position for the first record and hence calculates current page according to page size.
89 */ 89 */
90 void setFirstResult(int firstResult); 90 void setFirstResult(int firstResult);
91 - 91 +
92 } 92 }
impl/core/src/main/java/br/gov/frameworkdemoiselle/pagination/PaginationContext.java
@@ -51,7 +51,8 @@ public interface PaginationContext { @@ -51,7 +51,8 @@ public interface PaginationContext {
51 /** 51 /**
52 * Retrieves the pagination according to the class type specified. 52 * Retrieves the pagination according to the class type specified.
53 * 53 *
54 - * @param clazz a {@code Class} type 54 + * @param clazz
  55 + * a {@code Class} type
55 * @return Pagination 56 * @return Pagination
56 */ 57 */
57 Pagination getPagination(Class<?> clazz); 58 Pagination getPagination(Class<?> clazz);
@@ -60,8 +61,10 @@ public interface PaginationContext { @@ -60,8 +61,10 @@ public interface PaginationContext {
60 * Retrieves the pagination according to the class type specified. If not existing, creates the pagination whenever 61 * Retrieves the pagination according to the class type specified. If not existing, creates the pagination whenever
61 * {@code create} parameter is true. 62 * {@code create} parameter is true.
62 * 63 *
63 - * @param clazz a {@code Class} type  
64 - * @param create determines whether pagination must always be returned 64 + * @param clazz
  65 + * a {@code Class} type
  66 + * @param create
  67 + * determines whether pagination must always be returned
65 * @return Pagination 68 * @return Pagination
66 */ 69 */
67 Pagination getPagination(Class<?> clazz, boolean create); 70 Pagination getPagination(Class<?> clazz, boolean create);
impl/core/src/main/java/br/gov/frameworkdemoiselle/security/Authenticator.java
@@ -49,7 +49,8 @@ public interface Authenticator extends Serializable { @@ -49,7 +49,8 @@ public interface Authenticator extends Serializable {
49 /** 49 /**
50 * Executes the necessary steps to authenticate an user. 50 * Executes the necessary steps to authenticate an user.
51 * 51 *
52 - * @throws AuthenticationException When the authentication process fails, this exception is thrown. 52 + * @throws AuthenticationException
  53 + * When the authentication process fails, this exception is thrown.
53 */ 54 */
54 void authenticate() throws AuthenticationException; 55 void authenticate() throws AuthenticationException;
55 56
impl/core/src/main/java/br/gov/frameworkdemoiselle/security/RequiredPermissionInterceptor.java
@@ -46,9 +46,8 @@ import javax.interceptor.InvocationContext; @@ -46,9 +46,8 @@ import javax.interceptor.InvocationContext;
46 import org.slf4j.Logger; 46 import org.slf4j.Logger;
47 47
48 import br.gov.frameworkdemoiselle.annotation.Name; 48 import br.gov.frameworkdemoiselle.annotation.Name;
49 -import br.gov.frameworkdemoiselle.internal.producer.LoggerProducer;  
50 -import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer;  
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 import br.gov.frameworkdemoiselle.util.Strings; 52 import br.gov.frameworkdemoiselle.util.Strings;
54 53
@@ -63,9 +62,9 @@ public class RequiredPermissionInterceptor implements Serializable { @@ -63,9 +62,9 @@ public class RequiredPermissionInterceptor implements Serializable {
63 62
64 private static final long serialVersionUID = 1L; 63 private static final long serialVersionUID = 1L;
65 64
66 - private static ResourceBundle bundle; 65 + private static transient ResourceBundle bundle;
67 66
68 - private static Logger logger; 67 + private static transient Logger logger;
69 68
70 /** 69 /**
71 * Gets the values for both resource and operation properties of {@code @RequiredPermission}. Delegates to 70 * Gets the values for both resource and operation properties of {@code @RequiredPermission}. Delegates to
@@ -168,7 +167,7 @@ public class RequiredPermissionInterceptor implements Serializable { @@ -168,7 +167,7 @@ public class RequiredPermissionInterceptor implements Serializable {
168 167
169 private static ResourceBundle getBundle() { 168 private static ResourceBundle getBundle() {
170 if (bundle == null) { 169 if (bundle == null) {
171 - bundle = ResourceBundleProducer.create("demoiselle-core-bundle"); 170 + bundle = Beans.getReference(ResourceBundle.class, new NameQualifier("demoiselle-core-bundle"));
172 } 171 }
173 172
174 return bundle; 173 return bundle;
@@ -176,7 +175,7 @@ public class RequiredPermissionInterceptor implements Serializable { @@ -176,7 +175,7 @@ public class RequiredPermissionInterceptor implements Serializable {
176 175
177 private static Logger getLogger() { 176 private static Logger getLogger() {
178 if (logger == null) { 177 if (logger == null) {
179 - logger = LoggerProducer.create(RequiredPermissionInterceptor.class); 178 + logger = Beans.getReference(Logger.class, new NameQualifier(RequiredPermissionInterceptor.class.getName()));
180 } 179 }
181 180
182 return logger; 181 return logger;
impl/core/src/main/java/br/gov/frameworkdemoiselle/security/RequiredRoleInterceptor.java
@@ -47,9 +47,8 @@ import javax.interceptor.InvocationContext; @@ -47,9 +47,8 @@ import javax.interceptor.InvocationContext;
47 47
48 import org.slf4j.Logger; 48 import org.slf4j.Logger;
49 49
50 -import br.gov.frameworkdemoiselle.internal.producer.LoggerProducer;  
51 -import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer;  
52 import br.gov.frameworkdemoiselle.util.Beans; 50 import br.gov.frameworkdemoiselle.util.Beans;
  51 +import br.gov.frameworkdemoiselle.util.NameQualifier;
53 import br.gov.frameworkdemoiselle.util.ResourceBundle; 52 import br.gov.frameworkdemoiselle.util.ResourceBundle;
54 53
55 /** 54 /**
@@ -63,9 +62,9 @@ public class RequiredRoleInterceptor implements Serializable { @@ -63,9 +62,9 @@ public class RequiredRoleInterceptor implements Serializable {
63 62
64 private static final long serialVersionUID = 1L; 63 private static final long serialVersionUID = 1L;
65 64
66 - private static ResourceBundle bundle; 65 + private static transient ResourceBundle bundle;
67 66
68 - private static Logger logger; 67 + private static transient Logger logger;
69 68
70 /** 69 /**
71 * Gets the value property of {@code @RequiredRole}. Delegates to {@code SecurityContext} check role. If the user 70 * Gets the value property of {@code @RequiredRole}. Delegates to {@code SecurityContext} check role. If the user
@@ -102,7 +101,6 @@ public class RequiredRoleInterceptor implements Serializable { @@ -102,7 +101,6 @@ public class RequiredRoleInterceptor implements Serializable {
102 .error(getBundle().getString("does-not-have-role", getSecurityContext().getCurrentUser().getName(), 101 .error(getBundle().getString("does-not-have-role", getSecurityContext().getCurrentUser().getName(),
103 roles)); 102 roles));
104 103
105 - // AuthorizationException a = new AuthorizationException(null);  
106 throw new AuthorizationException(getBundle().getString("does-not-have-role-ui", roles)); 104 throw new AuthorizationException(getBundle().getString("does-not-have-role-ui", roles));
107 } 105 }
108 106
@@ -139,7 +137,7 @@ public class RequiredRoleInterceptor implements Serializable { @@ -139,7 +137,7 @@ public class RequiredRoleInterceptor implements Serializable {
139 137
140 private static ResourceBundle getBundle() { 138 private static ResourceBundle getBundle() {
141 if (bundle == null) { 139 if (bundle == null) {
142 - bundle = ResourceBundleProducer.create("demoiselle-core-bundle"); 140 + bundle = Beans.getReference(ResourceBundle.class, new NameQualifier("demoiselle-core-bundle"));
143 } 141 }
144 142
145 return bundle; 143 return bundle;
@@ -147,7 +145,7 @@ public class RequiredRoleInterceptor implements Serializable { @@ -147,7 +145,7 @@ public class RequiredRoleInterceptor implements Serializable {
147 145
148 private static Logger getLogger() { 146 private static Logger getLogger() {
149 if (logger == null) { 147 if (logger == null) {
150 - logger = LoggerProducer.create(RequiredRoleInterceptor.class); 148 + logger = Beans.getReference(Logger.class, new NameQualifier(RequiredRoleInterceptor.class.getName()));
151 } 149 }
152 150
153 return logger; 151 return logger;
impl/core/src/main/java/br/gov/frameworkdemoiselle/security/User.java
@@ -41,7 +41,7 @@ import java.security.Principal; @@ -41,7 +41,7 @@ import java.security.Principal;
41 41
42 /** 42 /**
43 * @author SERPRO 43 * @author SERPRO
44 - * @deprecated 44 + * @deprecated
45 */ 45 */
46 public interface User extends Principal, Serializable { 46 public interface User extends Principal, Serializable {
47 47
impl/core/src/main/java/br/gov/frameworkdemoiselle/stereotype/ManagementController.java
@@ -49,17 +49,23 @@ import javax.enterprise.inject.Stereotype; @@ -49,17 +49,23 @@ import javax.enterprise.inject.Stereotype;
49 import javax.enterprise.util.Nonbinding; 49 import javax.enterprise.util.Nonbinding;
50 50
51 /** 51 /**
52 - * <p>Identifies a <b>management controller</b> bean. What it means is that an external client can manage the application  
53 - * this class is in by reading or writing it's attributes and calling it's operations.</p>  
54 * <p> 52 * <p>
55 - * Only fields annotated with {@link br.gov.frameworkdemoiselle.annotation.ManagedProperty} or  
56 - * methods annotated with {@link br.gov.frameworkdemoiselle.annotation.ManagedOperation} will be exposed  
57 - * to clients.</p>  
58 - * <p>Only bean implementations (concrete classes) can be management controllers. It's a runtime error to mark an interface  
59 - * or abstract class with this annotation.</p>  
60 - * <p>This stereotype only defines a class as managed, you need to choose an extension that will expose this managed class 53 + * Identifies a <b>management controller</b> bean. What it means is that an external client can manage the application
  54 + * this class is in by reading or writing it's attributes and calling it's operations.
  55 + * </p>
  56 + * <p>
  57 + * Only fields annotated with {@link br.gov.frameworkdemoiselle.annotation.ManagedProperty} or methods annotated with
  58 + * {@link br.gov.frameworkdemoiselle.annotation.ManagedOperation} will be exposed to clients.
  59 + * </p>
  60 + * <p>
  61 + * Only bean implementations (concrete classes) can be management controllers. It's a runtime error to mark an interface
  62 + * or abstract class with this annotation.
  63 + * </p>
  64 + * <p>
  65 + * This stereotype only defines a class as managed, you need to choose an extension that will expose this managed class
61 * to external clients using any technology available. One example is the Demoiselle JMX extension, that will expose 66 * to external clients using any technology available. One example is the Demoiselle JMX extension, that will expose
62 - * managed classes as MBeans.</p> 67 + * managed classes as MBeans.
  68 + * </p>
63 * 69 *
64 * @author SERPRO 70 * @author SERPRO
65 */ 71 */
@@ -71,7 +77,7 @@ import javax.enterprise.util.Nonbinding; @@ -71,7 +77,7 @@ import javax.enterprise.util.Nonbinding;
71 @Retention(RUNTIME) 77 @Retention(RUNTIME)
72 @Target({ TYPE }) 78 @Target({ TYPE })
73 public @interface ManagementController { 79 public @interface ManagementController {
74 - 80 +
75 /** 81 /**
76 * @return Human readable description of this managed class. 82 * @return Human readable description of this managed class.
77 */ 83 */
impl/core/src/main/java/br/gov/frameworkdemoiselle/template/Crud.java
@@ -43,16 +43,18 @@ import java.util.List; @@ -43,16 +43,18 @@ import java.util.List;
43 * Interface containing basic methods for creating, updating and deleting entities (the CRUD design pattern). 43 * Interface containing basic methods for creating, updating and deleting entities (the CRUD design pattern).
44 * 44 *
45 * @author serpro 45 * @author serpro
46 - *  
47 - * @param <T> Type of the entity  
48 - * @param <I> Type of the identification attribute of the entity 46 + * @param <T>
  47 + * Type of the entity
  48 + * @param <I>
  49 + * Type of the identification attribute of the entity
49 */ 50 */
50 public interface Crud<T, I> extends Serializable { 51 public interface Crud<T, I> extends Serializable {
51 52
52 /** 53 /**
53 * Find an entity by it's identification attribute and make it transient. 54 * Find an entity by it's identification attribute and make it transient.
54 * 55 *
55 - * @param id The unique identification to find the entity to be deleted. 56 + * @param id
  57 + * The unique identification to find the entity to be deleted.
56 */ 58 */
57 void delete(I id); 59 void delete(I id);
58 60
@@ -66,24 +68,27 @@ public interface Crud&lt;T, I&gt; extends Serializable { @@ -66,24 +68,27 @@ public interface Crud&lt;T, I&gt; extends Serializable {
66 /** 68 /**
67 * Insert an entity and return the inserted instance of the entity 69 * Insert an entity and return the inserted instance of the entity
68 * 70 *
69 - * @param bean The bean to be inserted 71 + * @param bean
  72 + * The bean to be inserted
70 * @return The inserted instance of the entity 73 * @return The inserted instance of the entity
71 */ 74 */
72 T insert(T bean); 75 T insert(T bean);
73 76
74 /** 77 /**
75 * Find an entity's instance by it's identification attribute and return it 78 * Find an entity's instance by it's identification attribute and return it
76 - * @param id Value of the identification attribute of the desired entity's instance  
77 - * @return The entity's instance whose identification attribute's value matches  
78 - * the one passed as argument. 79 + *
  80 + * @param id
  81 + * Value of the identification attribute of the desired entity's instance
  82 + * @return The entity's instance whose identification attribute's value matches the one passed as argument.
79 */ 83 */
80 T load(I id); 84 T load(I id);
81 85
82 /** 86 /**
83 - * Update an instance of the entity with the bean's attributes as new values. 87 + * Update an instance of the entity with the bean's attributes as new values.
84 * 88 *
85 - * @param bean The bean instance containing both the identification value to find the old  
86 - * instance and the new values for the instance's attributes. 89 + * @param bean
  90 + * The bean instance containing both the identification value to find the old instance and the new values
  91 + * for the instance's attributes.
87 * @return The updated entity's instance 92 * @return The updated entity's instance
88 */ 93 */
89 T update(T bean); 94 T update(T bean);
impl/core/src/main/java/br/gov/frameworkdemoiselle/template/DelegateCrud.java
@@ -39,20 +39,15 @@ package br.gov.frameworkdemoiselle.template; @@ -39,20 +39,15 @@ package br.gov.frameworkdemoiselle.template;
39 import java.util.List; 39 import java.util.List;
40 import java.util.ListIterator; 40 import java.util.ListIterator;
41 41
42 -import br.gov.frameworkdemoiselle.internal.implementation.DefaultTransaction;  
43 -import br.gov.frameworkdemoiselle.transaction.Transaction;  
44 -import br.gov.frameworkdemoiselle.transaction.TransactionContext;  
45 -import br.gov.frameworkdemoiselle.transaction.Transactional;  
46 import br.gov.frameworkdemoiselle.util.Beans; 42 import br.gov.frameworkdemoiselle.util.Beans;
47 import br.gov.frameworkdemoiselle.util.Reflections; 43 import br.gov.frameworkdemoiselle.util.Reflections;
48 44
49 /** 45 /**
50 - * An implementation of the {@link Crud} interface that delegates it's operations  
51 - * to another {@link Crud} implementation. 46 + * An implementation of the {@link Crud} interface that delegates it's operations to another {@link Crud}
  47 + * implementation.
52 * 48 *
53 * @author serpro 49 * @author serpro
54 - *  
55 - * @param <T> 50 + * @param <T>
56 * bean object type 51 * bean object type
57 * @param <I> 52 * @param <I>
58 * bean id type 53 * bean id type
@@ -75,19 +70,6 @@ public class DelegateCrud&lt;T, I, C extends Crud&lt;T, I&gt;&gt; implements Crud&lt;T, I&gt; { @@ -75,19 +70,6 @@ public class DelegateCrud&lt;T, I, C extends Crud&lt;T, I&gt;&gt; implements Crud&lt;T, I&gt; {
75 */ 70 */
76 @Override 71 @Override
77 public void delete(final I id) { 72 public void delete(final I id) {
78 - if (isRunningTransactionalOperations()) {  
79 - transactionalDelete(id);  
80 - } else {  
81 - nonTransactionalDelete(id);  
82 - }  
83 - }  
84 -  
85 - @Transactional  
86 - private void transactionalDelete(final I id) {  
87 - nonTransactionalDelete(id);  
88 - }  
89 -  
90 - private void nonTransactionalDelete(final I id) {  
91 getDelegate().delete(id); 73 getDelegate().delete(id);
92 } 74 }
93 75
@@ -98,20 +80,8 @@ public class DelegateCrud&lt;T, I, C extends Crud&lt;T, I&gt;&gt; implements Crud&lt;T, I&gt; { @@ -98,20 +80,8 @@ public class DelegateCrud&lt;T, I, C extends Crud&lt;T, I&gt;&gt; implements Crud&lt;T, I&gt; {
98 * List of entities identifiers 80 * List of entities identifiers
99 */ 81 */
100 public void delete(final List<I> ids) { 82 public void delete(final List<I> ids) {
101 - if (isRunningTransactionalOperations()) {  
102 - transactionalDelete(ids);  
103 - } else {  
104 - nonTransactionalDelete(ids);  
105 - }  
106 - }  
107 -  
108 - @Transactional  
109 - private void transactionalDelete(final List<I> ids) {  
110 - nonTransactionalDelete(ids);  
111 - }  
112 -  
113 - private void nonTransactionalDelete(final List<I> ids) {  
114 ListIterator<I> iter = ids.listIterator(); 83 ListIterator<I> iter = ids.listIterator();
  84 +
115 while (iter.hasNext()) { 85 while (iter.hasNext()) {
116 this.delete(iter.next()); 86 this.delete(iter.next());
117 } 87 }
@@ -151,19 +121,6 @@ public class DelegateCrud&lt;T, I, C extends Crud&lt;T, I&gt;&gt; implements Crud&lt;T, I&gt; { @@ -151,19 +121,6 @@ public class DelegateCrud&lt;T, I, C extends Crud&lt;T, I&gt;&gt; implements Crud&lt;T, I&gt; {
151 */ 121 */
152 @Override 122 @Override
153 public T insert(final T bean) { 123 public T insert(final T bean) {
154 - if (isRunningTransactionalOperations()) {  
155 - return transactionalInsert(bean);  
156 - } else {  
157 - return nonTransactionalInsert(bean);  
158 - }  
159 - }  
160 -  
161 - @Transactional  
162 - private T transactionalInsert(final T bean) {  
163 - return nonTransactionalInsert(bean);  
164 - }  
165 -  
166 - private T nonTransactionalInsert(final T bean) {  
167 return getDelegate().insert(bean); 124 return getDelegate().insert(bean);
168 } 125 }
169 126
@@ -185,24 +142,6 @@ public class DelegateCrud&lt;T, I, C extends Crud&lt;T, I&gt;&gt; implements Crud&lt;T, I&gt; { @@ -185,24 +142,6 @@ public class DelegateCrud&lt;T, I, C extends Crud&lt;T, I&gt;&gt; implements Crud&lt;T, I&gt; {
185 */ 142 */
186 @Override 143 @Override
187 public T update(final T bean) { 144 public T update(final T bean) {
188 - if (isRunningTransactionalOperations()) {  
189 - return transactionalUpdate(bean);  
190 - } else {  
191 - return nonTransactionalUpdate(bean);  
192 - }  
193 - }  
194 -  
195 - @Transactional  
196 - private T transactionalUpdate(final T bean) {  
197 - return nonTransactionalUpdate(bean);  
198 - }  
199 -  
200 - private T nonTransactionalUpdate(final T bean) {  
201 return getDelegate().update(bean); 145 return getDelegate().update(bean);
202 } 146 }
203 -  
204 - private boolean isRunningTransactionalOperations() {  
205 - Transaction transaction = Beans.getReference(TransactionContext.class).getCurrentTransaction();  
206 - return !(transaction instanceof DefaultTransaction);  
207 - }  
208 } 147 }
impl/core/src/main/java/br/gov/frameworkdemoiselle/transaction/TransactionalInterceptor.java
@@ -48,9 +48,8 @@ import javax.interceptor.InvocationContext; @@ -48,9 +48,8 @@ import javax.interceptor.InvocationContext;
48 import org.slf4j.Logger; 48 import org.slf4j.Logger;
49 49
50 import br.gov.frameworkdemoiselle.exception.ApplicationException; 50 import br.gov.frameworkdemoiselle.exception.ApplicationException;
51 -import br.gov.frameworkdemoiselle.internal.producer.LoggerProducer;  
52 -import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer;  
53 import br.gov.frameworkdemoiselle.util.Beans; 51 import br.gov.frameworkdemoiselle.util.Beans;
  52 +import br.gov.frameworkdemoiselle.util.NameQualifier;
54 import br.gov.frameworkdemoiselle.util.ResourceBundle; 53 import br.gov.frameworkdemoiselle.util.ResourceBundle;
55 54
56 @Interceptor 55 @Interceptor
@@ -63,9 +62,9 @@ public class TransactionalInterceptor implements Serializable { @@ -63,9 +62,9 @@ public class TransactionalInterceptor implements Serializable {
63 62
64 private TransactionInfo transactionInfo; 63 private TransactionInfo transactionInfo;
65 64
66 - private static ResourceBundle bundle; 65 + private static transient ResourceBundle bundle;
67 66
68 - private static Logger logger; 67 + private static transient Logger logger;
69 68
70 private TransactionContext getTransactionContext() { 69 private TransactionContext getTransactionContext() {
71 if (this.transactionContext == null) { 70 if (this.transactionContext == null) {
@@ -175,7 +174,7 @@ public class TransactionalInterceptor implements Serializable { @@ -175,7 +174,7 @@ public class TransactionalInterceptor implements Serializable {
175 174
176 private static ResourceBundle getBundle() { 175 private static ResourceBundle getBundle() {
177 if (bundle == null) { 176 if (bundle == null) {
178 - bundle = ResourceBundleProducer.create("demoiselle-core-bundle"); 177 + bundle = Beans.getReference(ResourceBundle.class, new NameQualifier("demoiselle-core-bundle"));
179 } 178 }
180 179
181 return bundle; 180 return bundle;
@@ -183,7 +182,7 @@ public class TransactionalInterceptor implements Serializable { @@ -183,7 +182,7 @@ public class TransactionalInterceptor implements Serializable {
183 182
184 private static Logger getLogger() { 183 private static Logger getLogger() {
185 if (logger == null) { 184 if (logger == null) {
186 - logger = LoggerProducer.create(TransactionalInterceptor.class); 185 + logger = Beans.getReference(Logger.class, new NameQualifier(TransactionalInterceptor.class.getName()));
187 } 186 }
188 187
189 return logger; 188 return logger;
impl/core/src/main/java/br/gov/frameworkdemoiselle/util/Beans.java
@@ -37,22 +37,25 @@ @@ -37,22 +37,25 @@
37 package br.gov.frameworkdemoiselle.util; 37 package br.gov.frameworkdemoiselle.util;
38 38
39 import java.lang.annotation.Annotation; 39 import java.lang.annotation.Annotation;
  40 +import java.lang.reflect.Member;
40 import java.lang.reflect.Type; 41 import java.lang.reflect.Type;
41 -import java.util.Locale; 42 +import java.util.Arrays;
  43 +import java.util.HashSet;
42 import java.util.NoSuchElementException; 44 import java.util.NoSuchElementException;
43 import java.util.Set; 45 import java.util.Set;
44 46
45 import javax.enterprise.context.spi.CreationalContext; 47 import javax.enterprise.context.spi.CreationalContext;
  48 +import javax.enterprise.inject.spi.Annotated;
46 import javax.enterprise.inject.spi.Bean; 49 import javax.enterprise.inject.spi.Bean;
47 import javax.enterprise.inject.spi.BeanManager; 50 import javax.enterprise.inject.spi.BeanManager;
48 import javax.enterprise.inject.spi.InjectionPoint; 51 import javax.enterprise.inject.spi.InjectionPoint;
49 52
50 import br.gov.frameworkdemoiselle.DemoiselleException; 53 import br.gov.frameworkdemoiselle.DemoiselleException;
51 -import br.gov.frameworkdemoiselle.internal.bootstrap.CustomInjectionPoint;  
52 -import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer;  
53 54
54 public final class Beans { 55 public final class Beans {
55 56
  57 + private static transient ResourceBundle bundle;
  58 +
56 private static BeanManager manager; 59 private static BeanManager manager;
57 60
58 private Beans() { 61 private Beans() {
@@ -132,6 +135,98 @@ public final class Beans { @@ -132,6 +135,98 @@ public final class Beans {
132 } 135 }
133 136
134 private static ResourceBundle getBundle() { 137 private static ResourceBundle getBundle() {
135 - return ResourceBundleProducer.create("demoiselle-core-bundle", Locale.getDefault()); 138 + if (bundle == null) {
  139 + bundle = Beans.getReference(ResourceBundle.class, new NameQualifier("demoiselle-core-bundle"));
  140 + }
  141 +
  142 + return bundle;
  143 + }
  144 +
  145 + static class CustomInjectionPoint implements InjectionPoint {
  146 +
  147 + private final Bean<?> bean;
  148 +
  149 + private final Type beanType;
  150 +
  151 + private final Set<Annotation> qualifiers;
  152 +
  153 + public CustomInjectionPoint(Bean<?> bean, Type beanType, Annotation... qualifiers) {
  154 + this.bean = bean;
  155 + this.beanType = beanType;
  156 + this.qualifiers = new HashSet<Annotation>(Arrays.asList(qualifiers));
  157 + }
  158 +
  159 + @Override
  160 + public Type getType() {
  161 + return this.beanType;
  162 + }
  163 +
  164 + @Override
  165 + public Set<Annotation> getQualifiers() {
  166 + return this.qualifiers;
  167 + }
  168 +
  169 + @Override
  170 + public Bean<?> getBean() {
  171 + return this.bean;
  172 + }
  173 +
  174 + @Override
  175 + public Member getMember() {
  176 + return null;
  177 + }
  178 +
  179 + @Override
  180 + public boolean isDelegate() {
  181 + return false;
  182 + }
  183 +
  184 + @Override
  185 + public boolean isTransient() {
  186 + return false;
  187 + }
  188 +
  189 + @Override
  190 + public Annotated getAnnotated() {
  191 + return new Annotated() {
  192 +
  193 + @Override
  194 + public Type getBaseType() {
  195 + // TODO Auto-generated method stub
  196 + return null;
  197 + }
  198 +
  199 + @Override
  200 + public Set<Type> getTypeClosure() {
  201 + // TODO Auto-generated method stub
  202 + return null;
  203 + }
  204 +
  205 + @Override
  206 + @SuppressWarnings("unchecked")
  207 + public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
  208 + T result = null;
  209 +
  210 + for (Annotation annotation : getAnnotations()) {
  211 + if (annotation.annotationType() == annotationType) {
  212 + result = (T) annotation;
  213 + break;
  214 + }
  215 + }
  216 +
  217 + return result;
  218 + }
  219 +
  220 + @Override
  221 + public Set<Annotation> getAnnotations() {
  222 + return qualifiers;
  223 + }
  224 +
  225 + @Override
  226 + public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
  227 + return qualifiers.contains(annotationType);
  228 + }
  229 + };
  230 + }
136 } 231 }
137 } 232 }
impl/core/src/test/java/configuration/field/beanvalidation/BeanValidationWithEmptyNotNullFieldConfig.java
@@ -42,14 +42,14 @@ public abstract class BeanValidationWithEmptyNotNullFieldConfig { @@ -42,14 +42,14 @@ public abstract class BeanValidationWithEmptyNotNullFieldConfig {
42 42
43 @NotNull 43 @NotNull
44 private Integer intAttributeNull; 44 private Integer intAttributeNull;
45 - 45 +
46 @NotNull 46 @NotNull
47 private String stringAttributeNull; 47 private String stringAttributeNull;
48 - 48 +
49 public Integer getIntAttributeNull() { 49 public Integer getIntAttributeNull() {
50 return intAttributeNull; 50 return intAttributeNull;
51 } 51 }
52 - 52 +
53 public String getStringAttributeNull() { 53 public String getStringAttributeNull() {
54 return stringAttributeNull; 54 return stringAttributeNull;
55 } 55 }
impl/core/src/test/java/configuration/field/beanvalidation/BeanValidationWithFilledNotNullFieldConfig.java
@@ -6,14 +6,14 @@ public class BeanValidationWithFilledNotNullFieldConfig { @@ -6,14 +6,14 @@ public class BeanValidationWithFilledNotNullFieldConfig {
6 6
7 @NotNull 7 @NotNull
8 private String stringAttributeNotNull; 8 private String stringAttributeNotNull;
9 - 9 +
10 @NotNull 10 @NotNull
11 private Integer intAttibuteNotNull; 11 private Integer intAttibuteNotNull;
12 - 12 +
13 public String getStringAttributeNotNull() { 13 public String getStringAttributeNotNull() {
14 return stringAttributeNotNull; 14 return stringAttributeNotNull;
15 } 15 }
16 - 16 +
17 public Integer getIntAttibuteNotNull() { 17 public Integer getIntAttibuteNotNull() {
18 return intAttibuteNotNull; 18 return intAttibuteNotNull;
19 } 19 }
impl/core/src/test/java/configuration/field/beanvalidation/ConfigurationBeanValidationFieldTest.java
@@ -80,7 +80,8 @@ public class ConfigurationBeanValidationFieldTest { @@ -80,7 +80,8 @@ public class ConfigurationBeanValidationFieldTest {
80 JavaArchive deployment = Tests.createDeployment(ConfigurationBeanValidationFieldTest.class); 80 JavaArchive deployment = Tests.createDeployment(ConfigurationBeanValidationFieldTest.class);
81 deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); 81 deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties");
82 deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.xml"), "demoiselle.xml"); 82 deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.xml"), "demoiselle.xml");
83 - deployment.addAsResource(Tests.createFileAsset(PATH + "/two-constrain-validation.properties"), "two-constrain-validation.properties"); 83 + deployment.addAsResource(Tests.createFileAsset(PATH + "/two-constrain-validation.properties"),
  84 + "two-constrain-validation.properties");
84 85
85 return deployment; 86 return deployment;
86 } 87 }
@@ -136,7 +137,7 @@ public class ConfigurationBeanValidationFieldTest { @@ -136,7 +137,7 @@ public class ConfigurationBeanValidationFieldTest {
136 } 137 }
137 138
138 @Test 139 @Test
139 - public void loadPropertiesWithTwoConstraintViolations(){ 140 + public void loadPropertiesWithTwoConstraintViolations() {
140 try { 141 try {
141 propertyWithTwoConstrainViolations.getAttributeWithTwoConstrainValidations(); 142 propertyWithTwoConstrainViolations.getAttributeWithTwoConstrainValidations();
142 fail(); 143 fail();
impl/core/src/test/java/configuration/field/clazz/AbstractClassNotFoundFieldConfig.java
@@ -41,7 +41,7 @@ public abstract class AbstractClassNotFoundFieldConfig { @@ -41,7 +41,7 @@ public abstract class AbstractClassNotFoundFieldConfig {
41 private Class<MyClass> nonExistentTypedClass; 41 private Class<MyClass> nonExistentTypedClass;
42 42
43 private Class<?> nonExistentUntypedClass; 43 private Class<?> nonExistentUntypedClass;
44 - 44 +
45 public Class<MyClass> getNonExistentTypedClass() { 45 public Class<MyClass> getNonExistentTypedClass() {
46 return nonExistentTypedClass; 46 return nonExistentTypedClass;
47 } 47 }
impl/core/src/test/java/configuration/field/clazz/PropertiesNullClassFieldConfig.java
@@ -40,9 +40,9 @@ import br.gov.frameworkdemoiselle.configuration.Configuration; @@ -40,9 +40,9 @@ import br.gov.frameworkdemoiselle.configuration.Configuration;
40 40
41 @Configuration 41 @Configuration
42 public class PropertiesNullClassFieldConfig { 42 public class PropertiesNullClassFieldConfig {
43 - 43 +
44 private Class<MyClass> nullClass; 44 private Class<MyClass> nullClass;
45 - 45 +
46 public Class<MyClass> getNullClass() { 46 public Class<MyClass> getNullClass() {
47 return nullClass; 47 return nullClass;
48 } 48 }
impl/core/src/test/java/configuration/field/map/AbstractMapFieldConfig.java
@@ -45,7 +45,7 @@ public abstract class AbstractMapFieldConfig { @@ -45,7 +45,7 @@ public abstract class AbstractMapFieldConfig {
45 private Map<String, String> stringWithUndefinedKeyMap; 45 private Map<String, String> stringWithUndefinedKeyMap;
46 46
47 private Map<String, String> emptyValueMap; 47 private Map<String, String> emptyValueMap;
48 - 48 +
49 private Map<String, String> NullMapValue; 49 private Map<String, String> NullMapValue;
50 50
51 public Map<String, String> getStringWithUndefinedKeyMap() { 51 public Map<String, String> getStringWithUndefinedKeyMap() {
impl/core/src/test/java/configuration/field/map/ConfigurationMapFieldTest.java
@@ -99,9 +99,9 @@ public class ConfigurationMapFieldTest { @@ -99,9 +99,9 @@ public class ConfigurationMapFieldTest {
99 assertEquals(expected, propertiesConfig.getEmptyValueMap()); 99 assertEquals(expected, propertiesConfig.getEmptyValueMap());
100 assertEquals(expected, xmlConfig.getEmptyValueMap()); 100 assertEquals(expected, xmlConfig.getEmptyValueMap());
101 } 101 }
102 - 102 +
103 @Test 103 @Test
104 - public void loadNullMap(){ 104 + public void loadNullMap() {
105 assertNull(propertiesConfig.getNullMapValue()); 105 assertNull(propertiesConfig.getNullMapValue());
106 assertNull(xmlConfig.getNullMapValue()); 106 assertNull(xmlConfig.getNullMapValue());
107 } 107 }
impl/core/src/test/java/configuration/field/primitiveorwrapper/AbstractPrimitiveOrWrapperErrorFieldConfig.java
@@ -45,7 +45,7 @@ public abstract class AbstractPrimitiveOrWrapperErrorFieldConfig { @@ -45,7 +45,7 @@ public abstract class AbstractPrimitiveOrWrapperErrorFieldConfig {
45 private Integer emptyWrappedField; 45 private Integer emptyWrappedField;
46 46
47 private Integer conversionErrorWrappedField; 47 private Integer conversionErrorWrappedField;
48 - 48 +
49 public int getEmptyPrimitiveField() { 49 public int getEmptyPrimitiveField() {
50 return emptyPrimitiveField; 50 return emptyPrimitiveField;
51 } 51 }
impl/core/src/test/java/configuration/field/primitiveorwrapper/ConfigurationPrimitiveOrWrapperFieldTest.java
@@ -78,7 +78,7 @@ public class ConfigurationPrimitiveOrWrapperFieldTest { @@ -78,7 +78,7 @@ public class ConfigurationPrimitiveOrWrapperFieldTest {
78 78
79 @Inject 79 @Inject
80 private PropertiesNullWrappedField nullWrappedField; 80 private PropertiesNullWrappedField nullWrappedField;
81 - 81 +
82 @Deployment 82 @Deployment
83 public static JavaArchive createDeployment() { 83 public static JavaArchive createDeployment() {
84 JavaArchive deployment = Tests.createDeployment(ConfigurationPrimitiveOrWrapperFieldTest.class); 84 JavaArchive deployment = Tests.createDeployment(ConfigurationPrimitiveOrWrapperFieldTest.class);
@@ -210,9 +210,9 @@ public class ConfigurationPrimitiveOrWrapperFieldTest { @@ -210,9 +210,9 @@ public class ConfigurationPrimitiveOrWrapperFieldTest {
210 assertEquals(ConversionException.class, cause.getCause().getClass()); 210 assertEquals(ConversionException.class, cause.getCause().getClass());
211 } 211 }
212 } 212 }
213 - 213 +
214 @Test 214 @Test
215 - public void loadNullWrappedField(){ 215 + public void loadNullWrappedField() {
216 assertNull(nullWrappedField.getNullWrappedField()); 216 assertNull(nullWrappedField.getNullWrappedField());
217 } 217 }
218 } 218 }
impl/core/src/test/java/configuration/field/primitiveorwrapper/PropertiesNullWrappedField.java
@@ -6,7 +6,7 @@ import br.gov.frameworkdemoiselle.configuration.Configuration; @@ -6,7 +6,7 @@ import br.gov.frameworkdemoiselle.configuration.Configuration;
6 public class PropertiesNullWrappedField { 6 public class PropertiesNullWrappedField {
7 7
8 private Integer nullWrappedField; 8 private Integer nullWrappedField;
9 - 9 +
10 public Integer getNullWrappedField() { 10 public Integer getNullWrappedField() {
11 return nullWrappedField; 11 return nullWrappedField;
12 } 12 }
impl/core/src/test/java/configuration/field/string/AbstractNullStringFieldConfig.java
1 package configuration.field.string; 1 package configuration.field.string;
2 2
3 -  
4 public class AbstractNullStringFieldConfig { 3 public class AbstractNullStringFieldConfig {
5 4
6 private String nullString; 5 private String nullString;
impl/core/src/test/java/configuration/field/string/ConfigurationStringFieldTest.java
@@ -63,7 +63,7 @@ public class ConfigurationStringFieldTest { @@ -63,7 +63,7 @@ public class ConfigurationStringFieldTest {
63 63
64 @Inject 64 @Inject
65 private SystemStringFieldConfig systemConfig; 65 private SystemStringFieldConfig systemConfig;
66 - 66 +
67 @Inject 67 @Inject
68 private PropertiesNullStringFieldConfig propertiesNullConfig; 68 private PropertiesNullStringFieldConfig propertiesNullConfig;
69 69
@@ -113,9 +113,9 @@ public class ConfigurationStringFieldTest { @@ -113,9 +113,9 @@ public class ConfigurationStringFieldTest {
113 assertEquals(expected, propertiesConfig.getEmptyString()); 113 assertEquals(expected, propertiesConfig.getEmptyString());
114 assertEquals(expected, xmlConfig.getEmptyString()); 114 assertEquals(expected, xmlConfig.getEmptyString());
115 } 115 }
116 - 116 +
117 @Test 117 @Test
118 - public void loadNullString(){ 118 + public void loadNullString() {
119 assertNull(propertiesNullConfig.getNullString()); 119 assertNull(propertiesNullConfig.getNullString());
120 assertNull(xmlNullConfig.getNullString()); 120 assertNull(xmlNullConfig.getNullString());
121 assertNull(systemNullConfig.getNullString()); 121 assertNull(systemNullConfig.getNullString());
impl/core/src/test/java/exception/basic/ExceptionClassNotAnnotated.java
@@ -41,7 +41,7 @@ import br.gov.frameworkdemoiselle.exception.ExceptionHandler; @@ -41,7 +41,7 @@ import br.gov.frameworkdemoiselle.exception.ExceptionHandler;
41 public class ExceptionClassNotAnnotated { 41 public class ExceptionClassNotAnnotated {
42 42
43 private boolean nullPointerExceptionHandler = false; 43 private boolean nullPointerExceptionHandler = false;
44 - 44 +
45 public boolean isNullPointerExceptionHandler() { 45 public boolean isNullPointerExceptionHandler() {
46 return nullPointerExceptionHandler; 46 return nullPointerExceptionHandler;
47 } 47 }
impl/core/src/test/java/exception/basic/ExceptionHandlerTest.java
@@ -64,7 +64,7 @@ public class ExceptionHandlerTest { @@ -64,7 +64,7 @@ public class ExceptionHandlerTest {
64 64
65 @Inject 65 @Inject
66 private ExceptionNested nested; 66 private ExceptionNested nested;
67 - 67 +
68 @Inject 68 @Inject
69 private ExceptionClassNotAnnotated classNotAnnotated; 69 private ExceptionClassNotAnnotated classNotAnnotated;
70 70
@@ -127,7 +127,7 @@ public class ExceptionHandlerTest { @@ -127,7 +127,7 @@ public class ExceptionHandlerTest {
127 assertEquals(false, nested.isExceptionHandler()); 127 assertEquals(false, nested.isExceptionHandler());
128 } 128 }
129 } 129 }
130 - 130 +
131 @Test 131 @Test
132 public void exceptionClassNotAnnotatedController() { 132 public void exceptionClassNotAnnotatedController() {
133 try { 133 try {
impl/core/src/test/java/exception/basic/SimpleExceptionHandler.java
@@ -45,7 +45,7 @@ public class SimpleExceptionHandler { @@ -45,7 +45,7 @@ public class SimpleExceptionHandler {
45 private boolean nullPointerExceptionHandler = false; 45 private boolean nullPointerExceptionHandler = false;
46 46
47 private boolean arithmeticExceptionHandler = false; 47 private boolean arithmeticExceptionHandler = false;
48 - 48 +
49 public boolean isNullPointerExceptionHandler() { 49 public boolean isNullPointerExceptionHandler() {
50 return nullPointerExceptionHandler; 50 return nullPointerExceptionHandler;
51 } 51 }
@@ -53,7 +53,7 @@ public class SimpleExceptionHandler { @@ -53,7 +53,7 @@ public class SimpleExceptionHandler {
53 public boolean isArithmeticExceptionHandler() { 53 public boolean isArithmeticExceptionHandler() {
54 return arithmeticExceptionHandler; 54 return arithmeticExceptionHandler;
55 } 55 }
56 - 56 +
57 public void throwNullPointerException() { 57 public void throwNullPointerException() {
58 throw new NullPointerException(); 58 throw new NullPointerException();
59 } 59 }
@@ -61,11 +61,11 @@ public class SimpleExceptionHandler { @@ -61,11 +61,11 @@ public class SimpleExceptionHandler {
61 public void throwArithmeticException() { 61 public void throwArithmeticException() {
62 throw new ArithmeticException(); 62 throw new ArithmeticException();
63 } 63 }
64 - 64 +
65 public void throwExceptionWithoutHandler() { 65 public void throwExceptionWithoutHandler() {
66 throw new IllegalArgumentException(); 66 throw new IllegalArgumentException();
67 - }  
68 - 67 + }
  68 +
69 @SuppressWarnings({ "null", "unused" }) 69 @SuppressWarnings({ "null", "unused" })
70 public void throwTwoException() { 70 public void throwTwoException() {
71 String txt = null; 71 String txt = null;
@@ -81,5 +81,5 @@ public class SimpleExceptionHandler { @@ -81,5 +81,5 @@ public class SimpleExceptionHandler {
81 @ExceptionHandler 81 @ExceptionHandler
82 public void handler(ArithmeticException cause) { 82 public void handler(ArithmeticException cause) {
83 arithmeticExceptionHandler = true; 83 arithmeticExceptionHandler = true;
84 - } 84 + }
85 } 85 }
impl/core/src/test/java/exception/custom/CustomExceptionHandler.java
@@ -50,12 +50,12 @@ public class CustomExceptionHandler { @@ -50,12 +50,12 @@ public class CustomExceptionHandler {
50 50
51 public void setExceptionHandler(boolean exceptionHandler) { 51 public void setExceptionHandler(boolean exceptionHandler) {
52 this.exceptionHandler = exceptionHandler; 52 this.exceptionHandler = exceptionHandler;
53 - }  
54 - 53 + }
  54 +
55 public void throwExceptionWithMessage() { 55 public void throwExceptionWithMessage() {
56 throw new CustomException(); 56 throw new CustomException();
57 } 57 }
58 - 58 +
59 @ExceptionHandler 59 @ExceptionHandler
60 public void handler(CustomException exception) { 60 public void handler(CustomException exception) {
61 setExceptionHandler(true); 61 setExceptionHandler(true);
impl/core/src/test/java/lifecycle/shutdown/priority/ShutdownWithPriority.java
@@ -51,7 +51,7 @@ import br.gov.frameworkdemoiselle.lifecycle.Shutdown; @@ -51,7 +51,7 @@ import br.gov.frameworkdemoiselle.lifecycle.Shutdown;
51 public class ShutdownWithPriority { 51 public class ShutdownWithPriority {
52 52
53 private List<Integer> listShutdown = new ArrayList<Integer>(); 53 private List<Integer> listShutdown = new ArrayList<Integer>();
54 - 54 +
55 public List<Integer> getListShutdown() { 55 public List<Integer> getListShutdown() {
56 return listShutdown; 56 return listShutdown;
57 } 57 }
@@ -67,7 +67,7 @@ public class ShutdownWithPriority { @@ -67,7 +67,7 @@ public class ShutdownWithPriority {
67 public void unloadWithPriority1() { 67 public void unloadWithPriority1() {
68 listShutdown.add(2); 68 listShutdown.add(2);
69 } 69 }
70 - 70 +
71 @Shutdown 71 @Shutdown
72 @Priority(MAX_PRIORITY) 72 @Priority(MAX_PRIORITY)
73 public void unloadWithMaxPriority() { 73 public void unloadWithMaxPriority() {
impl/core/src/test/java/lifecycle/shutdown/simple/ShutdownSimple.java
@@ -47,11 +47,11 @@ import br.gov.frameworkdemoiselle.lifecycle.Shutdown; @@ -47,11 +47,11 @@ import br.gov.frameworkdemoiselle.lifecycle.Shutdown;
47 public class ShutdownSimple { 47 public class ShutdownSimple {
48 48
49 private List<Integer> listShutdown = new ArrayList<Integer>(); 49 private List<Integer> listShutdown = new ArrayList<Integer>();
50 - 50 +
51 public List<Integer> getListShutdown() { 51 public List<Integer> getListShutdown() {
52 return listShutdown; 52 return listShutdown;
53 } 53 }
54 - 54 +
55 @Shutdown 55 @Shutdown
56 public void unloadWithoutPriorityFirst() { 56 public void unloadWithoutPriorityFirst() {
57 listShutdown.add(3); 57 listShutdown.add(3);
impl/core/src/test/java/lifecycle/startup/priority/StartupWithPriorityTest.java
@@ -73,7 +73,7 @@ public class StartupWithPriorityTest { @@ -73,7 +73,7 @@ public class StartupWithPriorityTest {
73 Beans.getBeanManager().fireEvent(new AfterStartupProccess() { 73 Beans.getBeanManager().fireEvent(new AfterStartupProccess() {
74 }); 74 });
75 } 75 }
76 - 76 +
77 @Test 77 @Test
78 public void startupWithPriority() { 78 public void startupWithPriority() {
79 expected.add(1); 79 expected.add(1);
impl/core/src/test/java/lifecycle/startup/simple/StartupSimple.java
@@ -65,5 +65,5 @@ public class StartupSimple { @@ -65,5 +65,5 @@ public class StartupSimple {
65 @Startup 65 @Startup
66 public void loadWithoutPriorityThird() { 66 public void loadWithoutPriorityThird() {
67 listStartup.add(2); 67 listStartup.add(2);
68 - } 68 + }
69 } 69 }
impl/core/src/test/java/lifecycle/startup/simple/StartupSimpleTest.java
@@ -59,9 +59,9 @@ public class StartupSimpleTest { @@ -59,9 +59,9 @@ public class StartupSimpleTest {
59 59
60 @Inject 60 @Inject
61 private StartupSimple startupSimple; 61 private StartupSimple startupSimple;
62 - 62 +
63 List<Integer> expected = new ArrayList<Integer>(); 63 List<Integer> expected = new ArrayList<Integer>();
64 - 64 +
65 @Deployment 65 @Deployment
66 public static JavaArchive createDeployment() { 66 public static JavaArchive createDeployment() {
67 JavaArchive deployment = Tests.createDeployment(StartupSimpleTest.class); 67 JavaArchive deployment = Tests.createDeployment(StartupSimpleTest.class);
@@ -73,7 +73,7 @@ public class StartupSimpleTest { @@ -73,7 +73,7 @@ public class StartupSimpleTest {
73 Beans.getBeanManager().fireEvent(new AfterStartupProccess() { 73 Beans.getBeanManager().fireEvent(new AfterStartupProccess() {
74 }); 74 });
75 } 75 }
76 - 76 +
77 @Test 77 @Test
78 public void startup() { 78 public void startup() {
79 expected.add(1); 79 expected.add(1);
@@ -83,4 +83,3 @@ public class StartupSimpleTest { @@ -83,4 +83,3 @@ public class StartupSimpleTest {
83 Assert.assertEquals(expected, startupSimple.getListStartup()); 83 Assert.assertEquals(expected, startupSimple.getListStartup());
84 } 84 }
85 } 85 }
86 -  
impl/core/src/test/java/resourcebundle/file/defaultfile/ResourceBundleDefaultTest.java
@@ -67,23 +67,23 @@ public class ResourceBundleDefaultTest { @@ -67,23 +67,23 @@ public class ResourceBundleDefaultTest {
67 67
68 @Test 68 @Test
69 public void loadResourceDefault() { 69 public void loadResourceDefault() {
70 - Locale.setDefault(new Locale("pt", "BR")); 70 + Locale.setDefault(new Locale("pt", "BR"));
71 bundleDefault = Beans.getReference(ResourceBundleDefault.class); 71 bundleDefault = Beans.getReference(ResourceBundleDefault.class);
72 Assert.assertEquals("mensagem em Portugues", bundleDefault.getMessage()); 72 Assert.assertEquals("mensagem em Portugues", bundleDefault.getMessage());
73 } 73 }
74 74
75 @Test 75 @Test
76 public void loadResourceDefaultEnglish() { 76 public void loadResourceDefaultEnglish() {
77 - Locale.setDefault(Locale.US); 77 + Locale.setDefault(Locale.US);
78 bundleDefault = Beans.getReference(ResourceBundleDefault.class); 78 bundleDefault = Beans.getReference(ResourceBundleDefault.class);
79 Assert.assertEquals("message in English", bundleDefault.getMessage()); 79 Assert.assertEquals("message in English", bundleDefault.getMessage());
80 } 80 }
81 - 81 +
82 @Test 82 @Test
83 public void loadResourceWithLocaleNotExist() { 83 public void loadResourceWithLocaleNotExist() {
84 Locale.setDefault(Locale.ITALY); 84 Locale.setDefault(Locale.ITALY);
85 bundleDefault = Beans.getReference(ResourceBundleDefault.class); 85 bundleDefault = Beans.getReference(ResourceBundleDefault.class);
86 Assert.assertEquals("mensagem em Portugues", bundleDefault.getMessage()); 86 Assert.assertEquals("mensagem em Portugues", bundleDefault.getMessage());
87 - } 87 + }
88 88
89 } 89 }
impl/core/src/test/java/resourcebundle/parameter/ResourceBundleWithParameterTest.java
@@ -77,7 +77,7 @@ public class ResourceBundleWithParameterTest { @@ -77,7 +77,7 @@ public class ResourceBundleWithParameterTest {
77 String value = bundleCustom.getBundle().getString("messageTwoParameter", "1", "2"); 77 String value = bundleCustom.getBundle().getString("messageTwoParameter", "1", "2");
78 Assert.assertEquals(expected, value); 78 Assert.assertEquals(expected, value);
79 } 79 }
80 - 80 +
81 @Test 81 @Test
82 public void loadKeyWithoutParameter() { 82 public void loadKeyWithoutParameter() {
83 bundleCustom = Beans.getReference(ResourceBundleWithParameter.class); 83 bundleCustom = Beans.getReference(ResourceBundleWithParameter.class);
@@ -85,15 +85,15 @@ public class ResourceBundleWithParameterTest { @@ -85,15 +85,15 @@ public class ResourceBundleWithParameterTest {
85 String value = bundleCustom.getBundle().getString("messageWithoutParameter", "1", "2", "3"); 85 String value = bundleCustom.getBundle().getString("messageWithoutParameter", "1", "2", "3");
86 Assert.assertEquals(expected, value); 86 Assert.assertEquals(expected, value);
87 } 87 }
88 - 88 +
89 @Test 89 @Test
90 public void loadKeyWithStringParameter() { 90 public void loadKeyWithStringParameter() {
91 bundleCustom = Beans.getReference(ResourceBundleWithParameter.class); 91 bundleCustom = Beans.getReference(ResourceBundleWithParameter.class);
92 String expected = "Mensagem número 1"; 92 String expected = "Mensagem número 1";
93 String value = bundleCustom.getBundle().getString("messageParameterString", "1"); 93 String value = bundleCustom.getBundle().getString("messageParameterString", "1");
94 Assert.assertNotSame(expected, value); 94 Assert.assertNotSame(expected, value);
95 -  
96 - expected = "Mensagem número {numero}"; 95 +
  96 + expected = "Mensagem número {numero}";
97 Assert.assertEquals(expected, value); 97 Assert.assertEquals(expected, value);
98 } 98 }
99 99
impl/core/src/test/java/security/athentication/custom/CustomAuthenticatorTest.java
@@ -83,24 +83,24 @@ public class CustomAuthenticatorTest { @@ -83,24 +83,24 @@ public class CustomAuthenticatorTest {
83 @Test 83 @Test
84 public void loginProcess() { 84 public void loginProcess() {
85 ContextManager.activate(ThreadLocalContext.class, RequestScoped.class); 85 ContextManager.activate(ThreadLocalContext.class, RequestScoped.class);
86 - 86 +
87 context.login(); 87 context.login();
88 assertTrue(context.isLoggedIn()); 88 assertTrue(context.isLoggedIn());
89 assertNotNull(observer.getEvent()); 89 assertNotNull(observer.getEvent());
90 assertEquals("demoiselle", context.getCurrentUser().getName()); 90 assertEquals("demoiselle", context.getCurrentUser().getName());
91 - 91 +
92 ContextManager.deactivate(ThreadLocalContext.class, RequestScoped.class); 92 ContextManager.deactivate(ThreadLocalContext.class, RequestScoped.class);
93 } 93 }
94 94
95 @Test 95 @Test
96 public void logoutProcess() { 96 public void logoutProcess() {
97 ContextManager.activate(ThreadLocalContext.class, RequestScoped.class); 97 ContextManager.activate(ThreadLocalContext.class, RequestScoped.class);
98 - 98 +
99 context.login(); 99 context.login();
100 context.logout(); 100 context.logout();
101 assertFalse(context.isLoggedIn()); 101 assertFalse(context.isLoggedIn());
102 assertNull(context.getCurrentUser()); 102 assertNull(context.getCurrentUser());
103 - 103 +
104 ContextManager.deactivate(ThreadLocalContext.class, RequestScoped.class); 104 ContextManager.deactivate(ThreadLocalContext.class, RequestScoped.class);
105 } 105 }
106 } 106 }
impl/core/src/test/java/test/Tests.java
@@ -47,7 +47,7 @@ public final class Tests { @@ -47,7 +47,7 @@ public final class Tests {
47 private Tests() { 47 private Tests() {
48 } 48 }
49 49
50 - public static JavaArchive createDeployment(Class<?> baseClass) { 50 + public static JavaArchive createDeployment(final Class<?> baseClass) {
51 return createDeployment().addPackages(true, baseClass.getPackage()); 51 return createDeployment().addPackages(true, baseClass.getPackage());
52 } 52 }
53 53
@@ -62,7 +62,7 @@ public final class Tests { @@ -62,7 +62,7 @@ public final class Tests {
62 "services/javax.enterprise.inject.spi.Extension"); 62 "services/javax.enterprise.inject.spi.Extension");
63 } 63 }
64 64
65 - public static FileAsset createFileAsset(String pathname) { 65 + public static FileAsset createFileAsset(final String pathname) {
66 return new FileAsset(new File(pathname)); 66 return new FileAsset(new File(pathname));
67 } 67 }
68 } 68 }
impl/core/src/test/java/transaction/rollback/DummyStrategy.java
@@ -41,7 +41,7 @@ import br.gov.frameworkdemoiselle.transaction.Transaction; @@ -41,7 +41,7 @@ import br.gov.frameworkdemoiselle.transaction.Transaction;
41 public class DummyStrategy implements Transaction { 41 public class DummyStrategy implements Transaction {
42 42
43 private static final long serialVersionUID = 1L; 43 private static final long serialVersionUID = 1L;
44 - 44 +
45 private boolean markedRollback = false; 45 private boolean markedRollback = false;
46 46
47 private boolean active = false; 47 private boolean active = false;
impl/core/src/test/java/transaction/rollback/TransactionManager.java
@@ -97,35 +97,35 @@ public class TransactionManager { @@ -97,35 +97,35 @@ public class TransactionManager {
97 return transactionPassedInSetRollbackOnlyMethod; 97 return transactionPassedInSetRollbackOnlyMethod;
98 } 98 }
99 99
100 - public static void setTransactionMarkedRollback(boolean markedRollback) { 100 + public static void setTransactionMarkedRollback(final boolean markedRollback) {
101 transactionMarkedRollback = markedRollback; 101 transactionMarkedRollback = markedRollback;
102 } 102 }
103 103
104 - public static void setTransactionActive(boolean active) { 104 + public static void setTransactionActive(final boolean active) {
105 transactionActive = active; 105 transactionActive = active;
106 } 106 }
107 107
108 - public static void setTransactionPassedInIsActiveMethod(boolean passedInIsActiveMethod) { 108 + public static void setTransactionPassedInIsActiveMethod(final boolean passedInIsActiveMethod) {
109 transactionPassedInIsActiveMethod = passedInIsActiveMethod; 109 transactionPassedInIsActiveMethod = passedInIsActiveMethod;
110 } 110 }
111 111
112 - public static void setTransactionPassedInIsMarkedRollbackMethod(boolean passedInIsMarkedRollbackMethod) { 112 + public static void setTransactionPassedInIsMarkedRollbackMethod(final boolean passedInIsMarkedRollbackMethod) {
113 transactionPassedInIsMarkedRollbackMethod = passedInIsMarkedRollbackMethod; 113 transactionPassedInIsMarkedRollbackMethod = passedInIsMarkedRollbackMethod;
114 } 114 }
115 115
116 - public static void setTransactionPassedInBeginMethod(boolean passedInBeginMethod) { 116 + public static void setTransactionPassedInBeginMethod(final boolean passedInBeginMethod) {
117 transactionPassedInBeginMethod = passedInBeginMethod; 117 transactionPassedInBeginMethod = passedInBeginMethod;
118 } 118 }
119 119
120 - public static void setTransactionPassedInCommitMethod(boolean passedInCommitMethod) { 120 + public static void setTransactionPassedInCommitMethod(final boolean passedInCommitMethod) {
121 transactionPassedInCommitMethod = passedInCommitMethod; 121 transactionPassedInCommitMethod = passedInCommitMethod;
122 } 122 }
123 123
124 - public static void setTransactionPassedInRollbackMethod(boolean passedInRollbackMethod) { 124 + public static void setTransactionPassedInRollbackMethod(final boolean passedInRollbackMethod) {
125 transactionPassedInRollbackMethod = passedInRollbackMethod; 125 transactionPassedInRollbackMethod = passedInRollbackMethod;
126 } 126 }
127 127
128 - public static void setTransactionPassedInSetRollbackOnlyMethod(boolean passedInSetRollbackOnlyMethod) { 128 + public static void setTransactionPassedInSetRollbackOnlyMethod(final boolean passedInSetRollbackOnlyMethod) {
129 transactionPassedInSetRollbackOnlyMethod = passedInSetRollbackOnlyMethod; 129 transactionPassedInSetRollbackOnlyMethod = passedInSetRollbackOnlyMethod;
130 } 130 }
131 } 131 }
impl/core/src/test/java/transaction/rollback/TransactionManagerWithDefaultRollback.java
@@ -41,8 +41,8 @@ import br.gov.frameworkdemoiselle.stereotype.Controller; @@ -41,8 +41,8 @@ import br.gov.frameworkdemoiselle.stereotype.Controller;
41 import br.gov.frameworkdemoiselle.transaction.Transactional; 41 import br.gov.frameworkdemoiselle.transaction.Transactional;
42 42
43 @Controller 43 @Controller
44 -public class TransactionManagerWithDefaultRollback extends TransactionManager{  
45 - 44 +public class TransactionManagerWithDefaultRollback extends TransactionManager {
  45 +
46 @Transactional 46 @Transactional
47 public void insert() { 47 public void insert() {
48 throw new TransactionExceptionWithDefaultRollback(); 48 throw new TransactionExceptionWithDefaultRollback();
impl/core/src/test/java/transaction/rollback/TransactionManagerWithRollback.java
@@ -41,7 +41,7 @@ import br.gov.frameworkdemoiselle.stereotype.Controller; @@ -41,7 +41,7 @@ import br.gov.frameworkdemoiselle.stereotype.Controller;
41 import br.gov.frameworkdemoiselle.transaction.Transactional; 41 import br.gov.frameworkdemoiselle.transaction.Transactional;
42 42
43 @Controller 43 @Controller
44 -public class TransactionManagerWithRollback extends TransactionManager{ 44 +public class TransactionManagerWithRollback extends TransactionManager {
45 45
46 @Transactional 46 @Transactional
47 public void insert() { 47 public void insert() {
impl/core/src/test/java/transaction/rollback/TransactionRollbackTest.java
@@ -58,16 +58,16 @@ import br.gov.frameworkdemoiselle.internal.context.ManagedContext; @@ -58,16 +58,16 @@ import br.gov.frameworkdemoiselle.internal.context.ManagedContext;
58 58
59 @RunWith(Arquillian.class) 59 @RunWith(Arquillian.class)
60 public class TransactionRollbackTest { 60 public class TransactionRollbackTest {
61 - 61 +
62 @Inject 62 @Inject
63 private TransactionManagerWithDefaultRollback managerWithDefaultRollback; 63 private TransactionManagerWithDefaultRollback managerWithDefaultRollback;
64 - 64 +
65 @Inject 65 @Inject
66 private TransactionManagerWithRollback managerWithRollback; 66 private TransactionManagerWithRollback managerWithRollback;
67 - 67 +
68 @Inject 68 @Inject
69 private TransactionManagerWithoutRollback managerWithoutRollback; 69 private TransactionManagerWithoutRollback managerWithoutRollback;
70 - 70 +
71 @Deployment 71 @Deployment
72 public static JavaArchive createDeployment() { 72 public static JavaArchive createDeployment() {
73 JavaArchive deployment = Tests.createDeployment(TransactionRollbackTest.class); 73 JavaArchive deployment = Tests.createDeployment(TransactionRollbackTest.class);
@@ -78,19 +78,19 @@ public class TransactionRollbackTest { @@ -78,19 +78,19 @@ public class TransactionRollbackTest {
78 public void activeContext() { 78 public void activeContext() {
79 ContextManager.activate(ManagedContext.class, RequestScoped.class); 79 ContextManager.activate(ManagedContext.class, RequestScoped.class);
80 } 80 }
81 - 81 +
82 @After 82 @After
83 - public void deactiveContext(){ 83 + public void deactiveContext() {
84 ContextManager.deactivate(ManagedContext.class, RequestScoped.class); 84 ContextManager.deactivate(ManagedContext.class, RequestScoped.class);
85 } 85 }
86 - 86 +
87 @Test 87 @Test
88 - public void transactionWithDefaultRollback(){  
89 - try{ 88 + public void transactionWithDefaultRollback() {
  89 + try {
90 managerWithDefaultRollback.clean(); 90 managerWithDefaultRollback.clean();
91 managerWithDefaultRollback.insert(); 91 managerWithDefaultRollback.insert();
92 fail(); 92 fail();
93 - }catch(TransactionExceptionWithDefaultRollback exception){ 93 + } catch (TransactionExceptionWithDefaultRollback exception) {
94 assertTrue(managerWithDefaultRollback.isTransactionPassedInIsActiveMethod()); 94 assertTrue(managerWithDefaultRollback.isTransactionPassedInIsActiveMethod());
95 assertTrue(managerWithDefaultRollback.isTransactionPassedInBeginMethod()); 95 assertTrue(managerWithDefaultRollback.isTransactionPassedInBeginMethod());
96 assertTrue(managerWithDefaultRollback.isTransactionMarkedRollback()); 96 assertTrue(managerWithDefaultRollback.isTransactionMarkedRollback());
@@ -101,14 +101,14 @@ public class TransactionRollbackTest { @@ -101,14 +101,14 @@ public class TransactionRollbackTest {
101 assertFalse(managerWithDefaultRollback.isTransactionActive()); 101 assertFalse(managerWithDefaultRollback.isTransactionActive());
102 } 102 }
103 } 103 }
104 - 104 +
105 @Test 105 @Test
106 - public void transactionWithRollback(){  
107 - try{ 106 + public void transactionWithRollback() {
  107 + try {
108 managerWithRollback.clean(); 108 managerWithRollback.clean();
109 managerWithRollback.insert(); 109 managerWithRollback.insert();
110 fail(); 110 fail();
111 - }catch(TransactionExceptionWithRollback exception){ 111 + } catch (TransactionExceptionWithRollback exception) {
112 assertTrue(managerWithRollback.isTransactionPassedInIsActiveMethod()); 112 assertTrue(managerWithRollback.isTransactionPassedInIsActiveMethod());
113 assertTrue(managerWithRollback.isTransactionPassedInBeginMethod()); 113 assertTrue(managerWithRollback.isTransactionPassedInBeginMethod());
114 assertTrue(managerWithRollback.isTransactionMarkedRollback()); 114 assertTrue(managerWithRollback.isTransactionMarkedRollback());
@@ -119,14 +119,14 @@ public class TransactionRollbackTest { @@ -119,14 +119,14 @@ public class TransactionRollbackTest {
119 assertFalse(managerWithRollback.isTransactionActive()); 119 assertFalse(managerWithRollback.isTransactionActive());
120 } 120 }
121 } 121 }
122 -  
123 - @Test  
124 - public void transactionWithoutRollback(){  
125 - try{ 122 +
  123 + @Test
  124 + public void transactionWithoutRollback() {
  125 + try {
126 managerWithoutRollback.clean(); 126 managerWithoutRollback.clean();
127 managerWithoutRollback.insert(); 127 managerWithoutRollback.insert();
128 fail(); 128 fail();
129 - }catch(TransactionExceptionWithoutRollback exception){ 129 + } catch (TransactionExceptionWithoutRollback exception) {
130 assertTrue(managerWithRollback.isTransactionPassedInIsActiveMethod()); 130 assertTrue(managerWithRollback.isTransactionPassedInIsActiveMethod());
131 assertTrue(managerWithRollback.isTransactionPassedInBeginMethod()); 131 assertTrue(managerWithRollback.isTransactionPassedInBeginMethod());
132 assertFalse(managerWithRollback.isTransactionMarkedRollback()); 132 assertFalse(managerWithRollback.isTransactionMarkedRollback());
impl/core/src/test/java/util/ReflectionsTest.java
@@ -62,7 +62,7 @@ public class ReflectionsTest { @@ -62,7 +62,7 @@ public class ReflectionsTest {
62 62
63 class SomeClass<T, I> { 63 class SomeClass<T, I> {
64 64
65 - public void setNumber(T t) { 65 + public void setNumber(final T t) {
66 66
67 } 67 }
68 } 68 }
impl/core/src/test/java/util/StringsTest.java
@@ -144,7 +144,7 @@ public class StringsTest { @@ -144,7 +144,7 @@ public class StringsTest {
144 assertTrue(result.contains("Test [name=myName, lastname=myLastname, nullField=null, this")); 144 assertTrue(result.contains("Test [name=myName, lastname=myLastname, nullField=null, this"));
145 } 145 }
146 146
147 - private void testEqualsGetString(String in, String expected, Object... params) { 147 + private void testEqualsGetString(final String in, final String expected, final Object... params) {
148 String out = Strings.getString(in, params); 148 String out = Strings.getString(in, params);
149 assertEquals(expected, out); 149 assertEquals(expected, out);
150 } 150 }