Commit af0ec35d4793a94945a292056d599000afd6bd2c

Authored by Emerson Oliveira
2 parents 92951006 226e32ff
Exists in master

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

Showing 27 changed files with 290 additions and 237 deletions   Show diff stats
documentation/reference/pt-BR/gerenciamento.xml
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 <para>Ao implantar um sistema para produção, muitas vezes é necessário monitorar aspectos sobre o funcionamento desse sistema. Quanta memória 11 <para>Ao implantar um sistema para produção, muitas vezes é necessário monitorar aspectos sobre o funcionamento desse sistema. Quanta memória
12 ele está utilizando? Qual o pico de MIPS utilizados? Quantas sessões estão autenticadas no momento?</para> 12 ele está utilizando? Qual o pico de MIPS utilizados? Quantas sessões estão autenticadas no momento?</para>
13 13
14 - <para>Além de monitorar um sistema, as vezes é necessário gerencia-lo alterando aspectos de seu comportamento. Se o sistema está implantado em um 14 + <para>Além de monitorar um sistema, as vezes é necessário gerenciá-lo alterando aspectos de seu comportamento. Se o sistema está implantado em um
15 servidor alugado, talvez seja necessário ajustar o uso de MIPS para reduzir custos ou talvez deseje-se solicitar que o sistema limpe dados de sessão 15 servidor alugado, talvez seja necessário ajustar o uso de MIPS para reduzir custos ou talvez deseje-se solicitar que o sistema limpe dados de sessão
16 de autenticação abandonados por usuários que desligaram suas estações sem efetuar "logoff".</para> 16 de autenticação abandonados por usuários que desligaram suas estações sem efetuar "logoff".</para>
17 17
@@ -20,8 +20,9 @@ @@ -20,8 +20,9 @@
20 <emphasis>Java Management Extension</emphasis> (JMX).</para> 20 <emphasis>Java Management Extension</emphasis> (JMX).</para>
21 21
22 <para>O <emphasis>Demoiselle Framework</emphasis> dispõe de uma série de ferramentas para nivelar 22 <para>O <emphasis>Demoiselle Framework</emphasis> dispõe de uma série de ferramentas para nivelar
23 - o conhecimento do desenvolvedor e facilitar o uso e integraçao de várias tecnologias de gerenciamento e monitoração. Através de seu  
24 - uso o desenvolvedor pode se despreocupar com detalhes de implementação de cada tecnologia individual e facilmente integrar tais tecnologias.</para> 23 + o conhecimento do desenvolvedor e facilitar o uso e integraçao de várias tecnologias de gerenciamento e
  24 + monitoração. Através de seu uso o desenvolvedor pode facilmente integrar tais tecnologias, despreocupando-se
  25 + com detalhes de implementação de cada uma delas.</para>
25 </section> 26 </section>
26 27
27 <section> 28 <section>
@@ -35,7 +36,7 @@ @@ -35,7 +36,7 @@
35 @ManagementController 36 @ManagementController
36 public class GerenciadorUsuarios]]></programlisting> 37 public class GerenciadorUsuarios]]></programlisting>
37 38
38 - <para>Essa anotação é suficiente para o mecanismo de gerenciamento descobrir sua classe e disponibiliza-la para ser monitorada e gerenciada.</para> 39 + <para>Essa anotação é suficiente para o mecanismo de gerenciamento descobrir sua classe e disponibilizá-la para ser monitorada e gerenciada.</para>
39 40
40 <para>Contudo, a simples anotação acima não informa ao mecanismo quais aspectos da classe serão expostos. Por padrão, um <emphasis>Management Controller</emphasis> 41 <para>Contudo, a simples anotação acima não informa ao mecanismo quais aspectos da classe serão expostos. Por padrão, um <emphasis>Management Controller</emphasis>
41 não expõe nenhum aspecto seu. Para selecionar quais aspectos serão expostos usamos as anotações 42 não expõe nenhum aspecto seu. Para selecionar quais aspectos serão expostos usamos as anotações
@@ -43,7 +44,7 @@ public class GerenciadorUsuarios]]&gt;&lt;/programlisting&gt; @@ -43,7 +44,7 @@ public class GerenciadorUsuarios]]&gt;&lt;/programlisting&gt;
43 de classes anotadas com <code>@ManagementController</code>.</para> 44 de classes anotadas com <code>@ManagementController</code>.</para>
44 45
45 <informaltable> 46 <informaltable>
46 - <tgroup cols="3"> 47 + <tgroup cols="3" rowsep="1" colsep="1">
47 <thead> 48 <thead>
48 <row> 49 <row>
49 <entry>Anotação</entry> 50 <entry>Anotação</entry>
@@ -53,7 +54,7 @@ public class GerenciadorUsuarios]]&gt;&lt;/programlisting&gt; @@ -53,7 +54,7 @@ public class GerenciadorUsuarios]]&gt;&lt;/programlisting&gt;
53 </thead> 54 </thead>
54 55
55 <tbody> 56 <tbody>
56 - <row> 57 + <row valign="top">
57 <entry> 58 <entry>
58 <emphasis role="BOLD">@ManagedProperty</emphasis> 59 <emphasis role="BOLD">@ManagedProperty</emphasis>
59 </entry> 60 </entry>
@@ -76,7 +77,7 @@ public class GerenciadorUsuarios]]&gt;&lt;/programlisting&gt; @@ -76,7 +77,7 @@ public class GerenciadorUsuarios]]&gt;&lt;/programlisting&gt;
76 </entry> 77 </entry>
77 </row> 78 </row>
78 79
79 - <row> 80 + <row valign="top">
80 <entry> 81 <entry>
81 <emphasis role="BOLD">@ManagedOperation</emphasis> 82 <emphasis role="BOLD">@ManagedOperation</emphasis>
82 </entry> 83 </entry>
@@ -98,7 +99,7 @@ public class GerenciadorUsuarios]]&gt;&lt;/programlisting&gt; @@ -98,7 +99,7 @@ public class GerenciadorUsuarios]]&gt;&lt;/programlisting&gt;
98 </entry> 99 </entry>
99 </row> 100 </row>
100 101
101 - <row> 102 + <row valign="top">
102 <entry> 103 <entry>
103 <emphasis role="BOLD">@OperationParameter</emphasis> 104 <emphasis role="BOLD">@OperationParameter</emphasis>
104 </entry> 105 </entry>
@@ -148,6 +149,24 @@ public class ControleAcesso{ @@ -148,6 +149,24 @@ public class ControleAcesso{
148 monitorLogin.setContadorLogin( monitorLogin.getContadorLogin() + 1 ); 149 monitorLogin.setContadorLogin( monitorLogin.getContadorLogin() + 1 );
149 } 150 }
150 }]]></programlisting> 151 }]]></programlisting>
  152 +
  153 + <programlisting role="JAVA"><![CDATA[
  154 +@ManagementController
  155 +public class MonitorLogin{
  156 +
  157 + @ManagedProperty
  158 + private int contadorLogin;
  159 +
  160 + @ManagedOperation
  161 + public void setContadorLogin(int qtdUsuarioLogados){
  162 + contadorLogin = qtdUsuarioLogados;
  163 + }
  164 +
  165 + @ManagedOperation
  166 + public int getContatorLogin(){
  167 + return contadorLogin;
  168 + }
  169 +}]]></programlisting>
151 170
152 <para>Como é possível ver, classes anotadas com <emphasis>@ManagementController</emphasis> podem ser injetadas em qualquer ponto do código. Valores definidos 171 <para>Como é possível ver, classes anotadas com <emphasis>@ManagementController</emphasis> podem ser injetadas em qualquer ponto do código. Valores definidos
153 para seus atributos retêm seu estado, então um cliente que acesse remotamente o sistema e monitore o valor do atributo <emphasis>contadorLogin</emphasis> verá 172 para seus atributos retêm seu estado, então um cliente que acesse remotamente o sistema e monitore o valor do atributo <emphasis>contadorLogin</emphasis> verá
@@ -181,7 +200,7 @@ public class ControleAcesso{ @@ -181,7 +200,7 @@ public class ControleAcesso{
181 individualmente, as classes monitoradas serão então expostas para todas as extensões escolhidas.</para> 200 individualmente, as classes monitoradas serão então expostas para todas as extensões escolhidas.</para>
182 </tip> 201 </tip>
183 202
184 - <para>A figura <xref linkend="exemplo_jconsole"/> mostra como uma classe monitorada na aplicação <emphasis>Bookmark</emphasis> é exibida no <emphasis>JConsole</emphasis>.</para> 203 + <para>A figura <xref linkend="exemplo_jconsole" /> mostra como uma classe monitorada na aplicação <emphasis>Bookmark</emphasis> é exibida no <emphasis>JConsole</emphasis>.</para>
185 204
186 <programlisting role="JAVA"><![CDATA[ 205 <programlisting role="JAVA"><![CDATA[
187 @ManagementController 206 @ManagementController
impl/core/src/main/java/br/gov/frameworkdemoiselle/management/AttributeChangeNotification.java
@@ -40,7 +40,7 @@ package br.gov.frameworkdemoiselle.management; @@ -40,7 +40,7 @@ package br.gov.frameworkdemoiselle.management;
40 * Special notification to denote an attribute has changed values. 40 * Special notification to denote an attribute has changed values.
41 * 41 *
42 * @see GenericNotification 42 * @see GenericNotification
43 - * @author serpro 43 + * @author SERPRO
44 */ 44 */
45 public class AttributeChangeNotification extends GenericNotification { 45 public class AttributeChangeNotification extends GenericNotification {
46 46
impl/core/src/main/java/br/gov/frameworkdemoiselle/management/GenericNotification.java
@@ -39,7 +39,7 @@ package br.gov.frameworkdemoiselle.management; @@ -39,7 +39,7 @@ package br.gov.frameworkdemoiselle.management;
39 /** 39 /**
40 * Notification that can be sent by the {@link NotificationManager}. 40 * Notification that can be sent by the {@link NotificationManager}.
41 * 41 *
42 - * @author serpro 42 + * @author SERPRO
43 */ 43 */
44 public class GenericNotification { 44 public class GenericNotification {
45 45
impl/core/src/main/java/br/gov/frameworkdemoiselle/management/ManagedAttributeNotFoundException.java
  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 + */
1 package br.gov.frameworkdemoiselle.management; 37 package br.gov.frameworkdemoiselle.management;
2 38
3 import br.gov.frameworkdemoiselle.DemoiselleException; 39 import br.gov.frameworkdemoiselle.DemoiselleException;
@@ -7,7 +43,7 @@ import br.gov.frameworkdemoiselle.DemoiselleException; @@ -7,7 +43,7 @@ import br.gov.frameworkdemoiselle.DemoiselleException;
7 * Thrown when a management client tries to read or write a property, but the 43 * Thrown when a management client tries to read or write a property, but the
8 * management engine has no knowledge of an attribute with the given name. 44 * management engine has no knowledge of an attribute with the given name.
9 * 45 *
10 - * @author serpro 46 + * @author SERPRO
11 * 47 *
12 */ 48 */
13 public class ManagedAttributeNotFoundException extends DemoiselleException { 49 public class ManagedAttributeNotFoundException extends DemoiselleException {
impl/core/src/main/java/br/gov/frameworkdemoiselle/management/ManagedInvokationException.java
  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 + */
1 package br.gov.frameworkdemoiselle.management; 37 package br.gov.frameworkdemoiselle.management;
2 38
3 import br.gov.frameworkdemoiselle.DemoiselleException; 39 import br.gov.frameworkdemoiselle.DemoiselleException;
4 40
5 - 41 +/**
  42 + *
  43 + * Thrown In case the operation doesn't exist or have a different signature
  44 + *
  45 + * @author SERPRO
  46 + *
  47 + */
6 public class ManagedInvokationException extends DemoiselleException { 48 public class ManagedInvokationException extends DemoiselleException {
7 49
8 private static final long serialVersionUID = -1542365184737242152L; 50 private static final long serialVersionUID = -1542365184737242152L;
impl/core/src/main/java/br/gov/frameworkdemoiselle/management/ManagementNotificationEvent.java
  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 + */
1 package br.gov.frameworkdemoiselle.management; 37 package br.gov.frameworkdemoiselle.management;
2 38
3 /** 39 /**
@@ -5,7 +41,7 @@ package br.gov.frameworkdemoiselle.management; @@ -5,7 +41,7 @@ package br.gov.frameworkdemoiselle.management;
5 * Implementators can capture this event and be notified when the {@link NotificationManager} 41 * Implementators can capture this event and be notified when the {@link NotificationManager}
6 * sends notifications, so they can pass the notification to the underlying technology. 42 * sends notifications, so they can pass the notification to the underlying technology.
7 * 43 *
8 - * @author serpro 44 + * @author SERPRO
9 * 45 *
10 */ 46 */
11 public interface ManagementNotificationEvent { 47 public interface ManagementNotificationEvent {
impl/core/src/main/java/br/gov/frameworkdemoiselle/management/NotificationManager.java
@@ -59,7 +59,7 @@ import br.gov.frameworkdemoiselle.util.Beans; @@ -59,7 +59,7 @@ import br.gov.frameworkdemoiselle.util.Beans;
59 * the implementator can use qualifiers like the {@link Generic} and {@link AttributeChange} qualifiers 59 * the implementator can use qualifiers like the {@link Generic} and {@link AttributeChange} qualifiers
60 * to filter what king of notifications they will handle. One example of an implementator is the <b>demoiselle-jmx</b> extension.</p> 60 * to filter what king of notifications they will handle. One example of an implementator is the <b>demoiselle-jmx</b> extension.</p>
61 * 61 *
62 - * @author serpro 62 + * @author SERPRO
63 * 63 *
64 */ 64 */
65 @ApplicationScoped 65 @ApplicationScoped
impl/extension/jpa/src/test/java/productor/MyEntity.java
@@ -1,29 +0,0 @@ @@ -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,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
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +frameworkdemoiselle.persistence.default.unit.name=pu
0 \ No newline at end of file 2 \ No newline at end of file
impl/extension/jpa/src/test/resources/productor/demoiselle.properties
@@ -1 +0,0 @@ @@ -1 +0,0 @@
1 -frameworkdemoiselle.persistence.default.unit.name=pu  
2 \ No newline at end of file 0 \ No newline at end of file
impl/extension/jpa/src/test/resources/productor/persistence.xml
@@ -1,64 +0,0 @@ @@ -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 \ No newline at end of file 0 \ No newline at end of file
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/annotation/NextView.java
@@ -47,8 +47,12 @@ import java.lang.annotation.Inherited; @@ -47,8 +47,12 @@ import java.lang.annotation.Inherited;
47 import java.lang.annotation.Retention; 47 import java.lang.annotation.Retention;
48 import java.lang.annotation.Target; 48 import java.lang.annotation.Target;
49 49
  50 +/**
  51 + * Used to indicate which page to redirect after the execution of some method.
  52 + *
  53 + * @author SERPRO
  54 + */
50 55
51 -// TODO Este qualifier é realmente necessário? Verificar também na anotação PreviousView.  
52 @Inherited 56 @Inherited
53 @Documented 57 @Documented
54 @Target({ TYPE, FIELD, METHOD, PARAMETER }) 58 @Target({ TYPE, FIELD, METHOD, PARAMETER })
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/annotation/PreviousView.java
@@ -47,6 +47,11 @@ import java.lang.annotation.Inherited; @@ -47,6 +47,11 @@ import java.lang.annotation.Inherited;
47 import java.lang.annotation.Retention; 47 import java.lang.annotation.Retention;
48 import java.lang.annotation.Target; 48 import java.lang.annotation.Target;
49 49
  50 +/**
  51 + * Used to indicate which page to return after the execution of some method.
  52 + *
  53 + * @author SERPRO
  54 + */
50 @Inherited 55 @Inherited
51 @Documented 56 @Documented
52 @Target({ TYPE, FIELD, METHOD, PARAMETER }) 57 @Target({ TYPE, FIELD, METHOD, PARAMETER })
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/template/AbstractEditPageBean.java
@@ -48,6 +48,17 @@ import br.gov.frameworkdemoiselle.util.Parameter; @@ -48,6 +48,17 @@ import br.gov.frameworkdemoiselle.util.Parameter;
48 import br.gov.frameworkdemoiselle.util.Reflections; 48 import br.gov.frameworkdemoiselle.util.Reflections;
49 import br.gov.frameworkdemoiselle.util.ResourceBundle; 49 import br.gov.frameworkdemoiselle.util.ResourceBundle;
50 50
  51 +/**
  52 + * Template Managed Bean class that implements the methods defined by the interface EditPageBean.
  53 + *
  54 + * @param <T>
  55 + * bean object type
  56 + * @param <I>
  57 + * bean id type
  58 + *
  59 + * @author SERPRO
  60 + * @see EditPageBean
  61 + */
51 public abstract class AbstractEditPageBean<T, I> extends AbstractPageBean implements EditPageBean<T> { 62 public abstract class AbstractEditPageBean<T, I> extends AbstractPageBean implements EditPageBean<T> {
52 63
53 private static final long serialVersionUID = 1L; 64 private static final long serialVersionUID = 1L;
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/template/AbstractListPageBean.java
@@ -49,7 +49,17 @@ import javax.inject.Inject; @@ -49,7 +49,17 @@ import javax.inject.Inject;
49 import br.gov.frameworkdemoiselle.pagination.Pagination; 49 import br.gov.frameworkdemoiselle.pagination.Pagination;
50 import br.gov.frameworkdemoiselle.pagination.PaginationContext; 50 import br.gov.frameworkdemoiselle.pagination.PaginationContext;
51 import br.gov.frameworkdemoiselle.util.Reflections; 51 import br.gov.frameworkdemoiselle.util.Reflections;
52 - 52 +/**
  53 + * Template Managed Bean class that implements the methods defined by the interface ListPageBean.
  54 + *
  55 + * @param <T>
  56 + * bean object type
  57 + * @param <I>
  58 + * bean id type
  59 + *
  60 + * @author SERPRO
  61 + * @see ListPageBean
  62 + */
53 public abstract class AbstractListPageBean<T, I> extends AbstractPageBean implements ListPageBean<T, I> { 63 public abstract class AbstractListPageBean<T, I> extends AbstractPageBean implements ListPageBean<T, I> {
54 64
55 private static final long serialVersionUID = 1L; 65 private static final long serialVersionUID = 1L;
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/template/AbstractPageBean.java
@@ -42,6 +42,12 @@ import javax.inject.Inject; @@ -42,6 +42,12 @@ import javax.inject.Inject;
42 import br.gov.frameworkdemoiselle.annotation.NextView; 42 import br.gov.frameworkdemoiselle.annotation.NextView;
43 import br.gov.frameworkdemoiselle.annotation.PreviousView; 43 import br.gov.frameworkdemoiselle.annotation.PreviousView;
44 44
  45 +/**
  46 + * Template Managed Bean class that implements the methods defined by the interface PageBean.
  47 + *
  48 + * @author SERPRO
  49 + * @see PageBean
  50 + */
45 public abstract class AbstractPageBean implements PageBean { 51 public abstract class AbstractPageBean implements PageBean {
46 52
47 private static final long serialVersionUID = 1L; 53 private static final long serialVersionUID = 1L;
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/template/EditPageBean.java
@@ -36,6 +36,15 @@ @@ -36,6 +36,15 @@
36 */ 36 */
37 package br.gov.frameworkdemoiselle.template; 37 package br.gov.frameworkdemoiselle.template;
38 38
  39 +/**
  40 + * Interface that defines a contract of facilities that a page with funcionalities of insert, edit and delete could implement.
  41 + *
  42 + * @param <T>
  43 + * bean object type
  44 + *
  45 + * @author SERPRO
  46 + *
  47 + */
39 public interface EditPageBean<T> extends PageBean { 48 public interface EditPageBean<T> extends PageBean {
40 49
41 String delete(); 50 String delete();
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/template/ListPageBean.java
@@ -41,6 +41,17 @@ import java.util.Map; @@ -41,6 +41,17 @@ import java.util.Map;
41 41
42 import javax.faces.model.DataModel; 42 import javax.faces.model.DataModel;
43 43
  44 +/**
  45 + * Interface that defines a contract of facilities that a page with the funcionality of list could implement.
  46 + *
  47 + * @param <T>
  48 + * bean object type
  49 + * @param <I>
  50 + * bean id type
  51 + *
  52 + * @author SERPRO
  53 + *
  54 + */
44 public interface ListPageBean<T, I> extends PageBean { 55 public interface ListPageBean<T, I> extends PageBean {
45 56
46 DataModel<T> getDataModel(); 57 DataModel<T> getDataModel();
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/template/PageBean.java
@@ -38,6 +38,12 @@ package br.gov.frameworkdemoiselle.template; @@ -38,6 +38,12 @@ package br.gov.frameworkdemoiselle.template;
38 38
39 import java.io.Serializable; 39 import java.io.Serializable;
40 40
  41 +/**
  42 + * Interface that defines a contract of facilities that all pages could implement.
  43 + *
  44 + * @author SERPRO
  45 + *
  46 + */
41 public interface PageBean extends Serializable { 47 public interface PageBean extends Serializable {
42 48
43 String getCurrentView(); 49 String getCurrentView();
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/util/Faces.java
@@ -55,6 +55,11 @@ import br.gov.frameworkdemoiselle.exception.ApplicationException; @@ -55,6 +55,11 @@ import br.gov.frameworkdemoiselle.exception.ApplicationException;
55 import br.gov.frameworkdemoiselle.message.Message; 55 import br.gov.frameworkdemoiselle.message.Message;
56 import br.gov.frameworkdemoiselle.message.SeverityType; 56 import br.gov.frameworkdemoiselle.message.SeverityType;
57 57
  58 +/**
  59 + * Utility class to insert messages in the FacesContext.
  60 + *
  61 + * @author SERPRO
  62 + * */
58 public class Faces { 63 public class Faces {
59 64
60 private Faces() { 65 private Faces() {
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/util/Locales.java
@@ -43,6 +43,11 @@ import javax.faces.context.FacesContext; @@ -43,6 +43,11 @@ import javax.faces.context.FacesContext;
43 import javax.inject.Inject; 43 import javax.inject.Inject;
44 import javax.inject.Named; 44 import javax.inject.Named;
45 45
  46 +/**
  47 + * Utility class to configure the Locale.
  48 + *
  49 + * @author SERPRO
  50 + * */
46 @Named 51 @Named
47 public class Locales implements Serializable { 52 public class Locales implements Serializable {
48 53
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/util/PageNotFoundException.java
@@ -38,6 +38,12 @@ package br.gov.frameworkdemoiselle.util; @@ -38,6 +38,12 @@ package br.gov.frameworkdemoiselle.util;
38 38
39 import br.gov.frameworkdemoiselle.DemoiselleException; 39 import br.gov.frameworkdemoiselle.DemoiselleException;
40 40
  41 +/**
  42 + *
  43 + * Utility class that serves as the exception to be thrown when a page is not found.
  44 + *
  45 + * @author SERPRO
  46 + * */
41 public class PageNotFoundException extends DemoiselleException { 47 public class PageNotFoundException extends DemoiselleException {
42 48
43 private static final long serialVersionUID = 1L; 49 private static final long serialVersionUID = 1L;
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/util/Parameter.java
@@ -40,6 +40,15 @@ import java.io.Serializable; @@ -40,6 +40,15 @@ import java.io.Serializable;
40 40
41 import javax.faces.convert.Converter; 41 import javax.faces.convert.Converter;
42 42
  43 +/**
  44 + *
  45 + * Interface that defines the methods to be implemented to get and set values on a parameter.
  46 + *
  47 + * @param <T>
  48 + * bean object type
  49 + *
  50 + * @author SERPRO
  51 + * */
43 public interface Parameter<T extends Serializable> { 52 public interface Parameter<T extends Serializable> {
44 53
45 void setValue(T value); 54 void setValue(T value);
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/util/Redirector.java
@@ -47,6 +47,12 @@ import javax.faces.FacesException; @@ -47,6 +47,12 @@ import javax.faces.FacesException;
47 import javax.faces.application.ViewHandler; 47 import javax.faces.application.ViewHandler;
48 import javax.faces.context.FacesContext; 48 import javax.faces.context.FacesContext;
49 49
  50 +/**
  51 + *
  52 + * Utility class to redirect determined page to another one.
  53 + *
  54 + * @author SERPRO
  55 + * */
50 public class Redirector { 56 public class Redirector {
51 57
52 private Redirector() { 58 private Redirector() {
impl/extension/jta/src/test/resources/beans.xml
@@ -1,46 +0,0 @@ @@ -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>  
impl/extension/jta/src/test/resources/test/beans.xml 0 → 100644
@@ -0,0 +1,46 @@ @@ -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>