Commit 8d4eb858f332821afd44ab986140eaad065deedd
Exists in
master
Merge branch '2.4.0' of git@github.com:demoiselle/framework.git into 2.4.0
Showing
14 changed files
with
92 additions
and
224 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/ConfigurationLoader.java
... | ... | @@ -193,8 +193,7 @@ public class ConfigurationLoader implements Serializable { |
193 | 193 | String prefix = this.object.getClass().getAnnotation(Configuration.class).prefix(); |
194 | 194 | |
195 | 195 | if (prefix.endsWith(".")) { |
196 | - // prefix = prefix.substring(0, prefix.length() - 1); | |
197 | - // TODO Lançar warning pedindo para retirar o ponto (.)? | |
196 | + getLogger().warn(getBundle().getString("configuration-dot-after-prefix", this.resource)); | |
198 | 197 | } else if (!prefix.isEmpty()) { |
199 | 198 | prefix += "."; |
200 | 199 | } |
... | ... | @@ -243,8 +242,7 @@ public class ConfigurationLoader implements Serializable { |
243 | 242 | } |
244 | 243 | |
245 | 244 | catch (Exception cause) { |
246 | - // TODO Lançar mensagem informando que houve erro ao tentar extrair o valor com o extrator tal. | |
247 | - throw new ConfigurationException("", cause); | |
245 | + throw new ConfigurationException(getBundle().getString("configuration-generic-extraction-error", field.getType().toString(), getValueExtractor(field).getClass().getCanonicalName()), cause); | |
248 | 246 | } |
249 | 247 | |
250 | 248 | return value; | ... | ... |
impl/core/src/main/resources/demoiselle-core-bundle.properties
... | ... | @@ -60,6 +60,8 @@ loading-configuration-class=Carregando a classe de configura\u00E7\u00E3o {0} |
60 | 60 | configuration-field-loaded=Configura\u00E7\u00E3o {0} atribu\u00EDda a {1} com o valor {2} |
61 | 61 | configuration-attribute-is-mandatory=A configura\u00E7\u00E3o {0} \u00E9 obrigat\u00F3ria, mas n\u00E3o foi encontrada em {1} |
62 | 62 | configuration-name-attribute-cant-be-empty=A nota\u00E7\u00E3o Name n\u00E3o pode estar em branco |
63 | +configuration-generic-extraction-error=Ocorreu um erro durante a extra\u00E7\u00E3o do tipo {0} com o extrator {1} | |
64 | +configuration-dot-after-prefix=N\u00E3o \u00E9 necess\u00E1rio adicionar o ponto ap\u00F3s o prefixo para uma classe de configura\u00E7\u00E3o. \u00C9 recomendado que sejam retirados, pois poder\u00E3o causar erros em vers\u00F5es futuras do Framework. | |
63 | 65 | configuration-key-not-found=Chave de configura\u00E7\u00E3o {0} n\u00E3o encontrada |
64 | 66 | configuration-extractor-not-found=N\u00E3o foi poss\u00EDvel encontrar a classe extratora para o atributo {0}. Implemente a interface {1} para criar sua classe extratora. |
65 | 67 | configuration-not-conversion=N\u00E3o \u00E9 poss\u00EDvel converter o valor {0} para o tipo {1} | ... | ... |
impl/extension/jpa/src/test/java/productor/MyEntity.java
... | ... | @@ -1,29 +0,0 @@ |
1 | -package productor; | |
2 | - | |
3 | -import javax.persistence.Entity; | |
4 | -import javax.persistence.Id; | |
5 | - | |
6 | -@Entity | |
7 | -public class MyEntity { | |
8 | - | |
9 | - @Id | |
10 | - private String id; | |
11 | - | |
12 | - private String description; | |
13 | - | |
14 | - public String getId() { | |
15 | - return id; | |
16 | - } | |
17 | - | |
18 | - public void setId(String id) { | |
19 | - this.id = id; | |
20 | - } | |
21 | - | |
22 | - public String getDescription() { | |
23 | - return description; | |
24 | - } | |
25 | - | |
26 | - public void setDescription(String description) { | |
27 | - this.description = description; | |
28 | - } | |
29 | -} |
impl/extension/jpa/src/test/java/productor/ProductorTest.java
... | ... | @@ -1,80 +0,0 @@ |
1 | -package productor; | |
2 | - | |
3 | -import javax.persistence.EntityManager; | |
4 | - | |
5 | -import org.jboss.arquillian.container.test.api.Deployment; | |
6 | -import org.jboss.arquillian.junit.Arquillian; | |
7 | -import org.jboss.shrinkwrap.api.spec.WebArchive; | |
8 | -import org.junit.Assert; | |
9 | -import org.junit.Test; | |
10 | -import org.junit.runner.RunWith; | |
11 | - | |
12 | -import test.Tests; | |
13 | -import br.gov.frameworkdemoiselle.internal.proxy.EntityManagerProxy; | |
14 | -import br.gov.frameworkdemoiselle.util.Beans; | |
15 | -import br.gov.frameworkdemoiselle.util.NameQualifier; | |
16 | - | |
17 | - | |
18 | -@RunWith(Arquillian.class) | |
19 | -public class ProductorTest { | |
20 | - | |
21 | - private static final String PATH = "src/test/resources/productor"; | |
22 | - | |
23 | - @Deployment | |
24 | - public static WebArchive createDeployment() { | |
25 | - WebArchive deployment = Tests.createDeployment(ProductorTest.class); | |
26 | - deployment.addAsResource(Tests.createFileAsset(PATH + "/persistence.xml"), "META-INF/persistence.xml"); | |
27 | - deployment.addAsResource(Tests.createFileAsset(PATH + "/demoiselle.properties"), "demoiselle.properties"); | |
28 | - | |
29 | - return deployment; | |
30 | - } | |
31 | - | |
32 | - @Test | |
33 | - public void produceEntityManager(){ | |
34 | - | |
35 | - EntityManager manager = Beans.getReference(EntityManager.class); | |
36 | - Assert.assertNotNull(manager); | |
37 | - Assert.assertEquals(EntityManagerProxy.class,manager.getClass()); | |
38 | - | |
39 | - } | |
40 | - | |
41 | - @Test | |
42 | - public void produceMultipleEntityManagers(){ | |
43 | - | |
44 | - EntityManager m1 = Beans.getReference(EntityManager.class,new NameQualifier("pu")); | |
45 | - | |
46 | - Assert.assertNotNull(m1); | |
47 | - Assert.assertEquals(EntityManagerProxy.class,m1.getClass()); | |
48 | - | |
49 | - EntityManager m2 = Beans.getReference(EntityManager.class,new NameQualifier("pu2")); | |
50 | - | |
51 | - Assert.assertNotNull(m2); | |
52 | - Assert.assertEquals(EntityManagerProxy.class,m2.getClass()); | |
53 | - | |
54 | - } | |
55 | - | |
56 | - @Test | |
57 | - public void produceOneEntityManagerPerRequest(){ | |
58 | - EntityManager m1 = Beans.getReference(EntityManager.class,new NameQualifier("pu")); | |
59 | - | |
60 | - Assert.assertNotNull(m1); | |
61 | - Assert.assertEquals(EntityManagerProxy.class,m1.getClass()); | |
62 | - | |
63 | - EntityManager m2 = Beans.getReference(EntityManager.class,new NameQualifier("pu")); | |
64 | - | |
65 | - Assert.assertNotNull(m2); | |
66 | - Assert.assertEquals(EntityManagerProxy.class,m2.getClass()); | |
67 | - | |
68 | - MyEntity entity = new MyEntity(); | |
69 | - entity.setId(createId("testID")); | |
70 | - | |
71 | - m1.persist(entity); | |
72 | - | |
73 | - Assert.assertTrue( m2.contains(entity) ); | |
74 | - } | |
75 | - | |
76 | - private String createId(String id) { | |
77 | - return this.getClass().getName() + "_" + id; | |
78 | - } | |
79 | - | |
80 | -} |
impl/extension/jpa/src/test/resources/producer/demoiselle.properties
0 → 100644
impl/extension/jpa/src/test/resources/productor/demoiselle.properties
impl/extension/jpa/src/test/resources/productor/persistence.xml
... | ... | @@ -1,64 +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 | -<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
38 | - xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> | |
39 | - | |
40 | - <persistence-unit name="pu" transaction-type="RESOURCE_LOCAL"> | |
41 | - <non-jta-data-source>jdbc/__default</non-jta-data-source> | |
42 | - | |
43 | - <class>productor.MyEntity</class> | |
44 | - | |
45 | - <properties> | |
46 | - <property name="hibernate.show_sql" value="true" /> | |
47 | - <property name="hibernate.format_sql" value="false" /> | |
48 | - <property name="hibernate.hbm2ddl.auto" value="create-drop" /> | |
49 | - </properties> | |
50 | - </persistence-unit> | |
51 | - | |
52 | - <persistence-unit name="pu2" transaction-type="RESOURCE_LOCAL"> | |
53 | - <non-jta-data-source>jdbc/__default</non-jta-data-source> | |
54 | - | |
55 | - <class>productor.MyEntity</class> | |
56 | - | |
57 | - <properties> | |
58 | - <property name="hibernate.show_sql" value="true" /> | |
59 | - <property name="hibernate.format_sql" value="false" /> | |
60 | - <property name="hibernate.hbm2ddl.auto" value="create-drop" /> | |
61 | - </properties> | |
62 | - </persistence-unit> | |
63 | - | |
64 | -</persistence> | |
65 | 0 | \ No newline at end of file |
impl/extension/jta/src/test/resources/beans.xml
... | ... | @@ -1,46 +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 | -<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"> | |
38 | - | |
39 | - <interceptors> | |
40 | - <class>br.gov.frameworkdemoiselle.transaction.TransactionalInterceptor</class> | |
41 | - <class>br.gov.frameworkdemoiselle.security.RequiredPermissionInterceptor</class> | |
42 | - <class>br.gov.frameworkdemoiselle.security.RequiredRoleInterceptor</class> | |
43 | - <class>br.gov.frameworkdemoiselle.exception.ExceptionHandlerInterceptor</class> | |
44 | - </interceptors> | |
45 | - | |
46 | -</beans> |
... | ... | @@ -0,0 +1,46 @@ |
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 | +<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"> | |
38 | + | |
39 | + <interceptors> | |
40 | + <class>br.gov.frameworkdemoiselle.transaction.TransactionalInterceptor</class> | |
41 | + <class>br.gov.frameworkdemoiselle.security.RequiredPermissionInterceptor</class> | |
42 | + <class>br.gov.frameworkdemoiselle.security.RequiredRoleInterceptor</class> | |
43 | + <class>br.gov.frameworkdemoiselle.exception.ExceptionHandlerInterceptor</class> | |
44 | + </interceptors> | |
45 | + | |
46 | +</beans> | ... | ... |
impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/security/Credentials.java
... | ... | @@ -41,6 +41,13 @@ import java.io.Serializable; |
41 | 41 | import javax.enterprise.context.RequestScoped; |
42 | 42 | import javax.inject.Named; |
43 | 43 | |
44 | +/** | |
45 | + * This classes keeps credential informations, username and password. | |
46 | + * | |
47 | + * @author SERPRO | |
48 | + * | |
49 | + */ | |
50 | + | |
44 | 51 | @Named |
45 | 52 | @RequestScoped |
46 | 53 | public class Credentials implements Serializable { |
... | ... | @@ -51,6 +58,9 @@ public class Credentials implements Serializable { |
51 | 58 | |
52 | 59 | private String password; |
53 | 60 | |
61 | + /** | |
62 | + * Cleans the stored information, setting username and password to null. | |
63 | + */ | |
54 | 64 | public void clear() { |
55 | 65 | this.username = null; |
56 | 66 | this.password = null; | ... | ... |
impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/security/ServletAuthenticator.java
... | ... | @@ -48,6 +48,14 @@ import br.gov.frameworkdemoiselle.util.Beans; |
48 | 48 | import br.gov.frameworkdemoiselle.util.NameQualifier; |
49 | 49 | import br.gov.frameworkdemoiselle.util.ResourceBundle; |
50 | 50 | |
51 | +/** | |
52 | + * Implements the {@link Authenticator} interface, offering a way to implement | |
53 | + * offering a manner to use the authenticator's functionalities. | |
54 | + * | |
55 | + * @author SERPRO | |
56 | + * | |
57 | + */ | |
58 | + | |
51 | 59 | @Priority(L2_PRIORITY) |
52 | 60 | public class ServletAuthenticator implements Authenticator { |
53 | 61 | ... | ... |
impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/security/ServletAuthorizer.java
... | ... | @@ -46,6 +46,14 @@ import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer; |
46 | 46 | import br.gov.frameworkdemoiselle.util.Beans; |
47 | 47 | import br.gov.frameworkdemoiselle.util.ResourceBundle; |
48 | 48 | |
49 | +/** | |
50 | + * Implements the {@link Authorizer} interface, offering a way to implement | |
51 | + * offering a manner to use the authorizer's functionalities. | |
52 | + * | |
53 | + * @author SERPRO | |
54 | + * | |
55 | + */ | |
56 | + | |
49 | 57 | @Priority(L2_PRIORITY) |
50 | 58 | public class ServletAuthorizer implements Authorizer { |
51 | 59 | ... | ... |
impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/util/ServletFilter.java
... | ... | @@ -45,6 +45,13 @@ import javax.servlet.ServletException; |
45 | 45 | import javax.servlet.ServletRequest; |
46 | 46 | import javax.servlet.ServletResponse; |
47 | 47 | |
48 | +/** | |
49 | + * Implements the {@link javax.servlet.Filter} interface. | |
50 | + * | |
51 | + * @author SERPRO | |
52 | + * | |
53 | + */ | |
54 | + | |
48 | 55 | public class ServletFilter implements Filter { |
49 | 56 | |
50 | 57 | @Override | ... | ... |
impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/util/ServletListener.java
... | ... | @@ -41,6 +41,14 @@ import javax.servlet.ServletContextEvent; |
41 | 41 | import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess; |
42 | 42 | import br.gov.frameworkdemoiselle.lifecycle.AfterStartupProccess; |
43 | 43 | |
44 | +/** | |
45 | + * Implements the {@link javax.servlet.ServletContextListener} interface, and fire two events: | |
46 | + * {@link AfterStartupProccess} and {@link AfterShutdownProccess}. | |
47 | + * | |
48 | + * @author SERPRO | |
49 | + * | |
50 | + */ | |
51 | + | |
44 | 52 | public class ServletListener implements javax.servlet.ServletContextListener { |
45 | 53 | |
46 | 54 | @Override | ... | ... |