Commit 8d9216eb587d94a36ebdbe3d4d87c48445d923d7
1 parent
74b7da8a
Removendo produtores que conflitam com aqueles encontrados no CDI 1.1
Showing
15 changed files
with
184 additions
and
254 deletions
Show diff stats
archetype/jsf-jpa/src/main/resources/archetype-resources/pom.xml
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/AbstractLifecycleBootstrap.java
@@ -36,33 +36,23 @@ | @@ -36,33 +36,23 @@ | ||
36 | */ | 36 | */ |
37 | package br.gov.frameworkdemoiselle.internal.bootstrap; | 37 | package br.gov.frameworkdemoiselle.internal.bootstrap; |
38 | 38 | ||
39 | -import java.lang.annotation.Annotation; | ||
40 | -import java.util.ArrayList; | ||
41 | -import java.util.Collections; | ||
42 | -import java.util.HashMap; | ||
43 | -import java.util.Iterator; | ||
44 | -import java.util.List; | ||
45 | -import java.util.logging.Logger; | ||
46 | - | ||
47 | -import javax.enterprise.event.Observes; | ||
48 | -import javax.enterprise.inject.spi.AnnotatedMethod; | ||
49 | -import javax.enterprise.inject.spi.AnnotatedType; | ||
50 | -import javax.enterprise.inject.spi.Extension; | ||
51 | -import javax.enterprise.inject.spi.ProcessAnnotatedType; | ||
52 | - | ||
53 | import br.gov.frameworkdemoiselle.DemoiselleException; | 39 | import br.gov.frameworkdemoiselle.DemoiselleException; |
54 | -import br.gov.frameworkdemoiselle.context.ConversationContext; | ||
55 | -import br.gov.frameworkdemoiselle.context.CustomContext; | ||
56 | -import br.gov.frameworkdemoiselle.context.RequestContext; | ||
57 | -import br.gov.frameworkdemoiselle.context.SessionContext; | ||
58 | -import br.gov.frameworkdemoiselle.context.ViewContext; | ||
59 | -import br.gov.frameworkdemoiselle.internal.context.TemporaryViewContextImpl; | 40 | +import br.gov.frameworkdemoiselle.context.*; |
60 | import br.gov.frameworkdemoiselle.internal.implementation.AnnotatedMethodProcessor; | 41 | import br.gov.frameworkdemoiselle.internal.implementation.AnnotatedMethodProcessor; |
61 | import br.gov.frameworkdemoiselle.util.Beans; | 42 | import br.gov.frameworkdemoiselle.util.Beans; |
62 | import br.gov.frameworkdemoiselle.util.NameQualifier; | 43 | import br.gov.frameworkdemoiselle.util.NameQualifier; |
63 | import br.gov.frameworkdemoiselle.util.Reflections; | 44 | import br.gov.frameworkdemoiselle.util.Reflections; |
64 | import br.gov.frameworkdemoiselle.util.ResourceBundle; | 45 | import br.gov.frameworkdemoiselle.util.ResourceBundle; |
65 | 46 | ||
47 | +import javax.enterprise.event.Observes; | ||
48 | +import javax.enterprise.inject.spi.AnnotatedMethod; | ||
49 | +import javax.enterprise.inject.spi.AnnotatedType; | ||
50 | +import javax.enterprise.inject.spi.Extension; | ||
51 | +import javax.enterprise.inject.spi.ProcessAnnotatedType; | ||
52 | +import java.lang.annotation.Annotation; | ||
53 | +import java.util.*; | ||
54 | +import java.util.logging.Logger; | ||
55 | + | ||
66 | public abstract class AbstractLifecycleBootstrap<A extends Annotation> implements Extension { | 56 | public abstract class AbstractLifecycleBootstrap<A extends Annotation> implements Extension { |
67 | 57 | ||
68 | private Class<A> annotationClass; | 58 | private Class<A> annotationClass; |
@@ -149,7 +139,7 @@ public abstract class AbstractLifecycleBootstrap<A extends Annotation> implement | @@ -149,7 +139,7 @@ public abstract class AbstractLifecycleBootstrap<A extends Annotation> implement | ||
149 | if (!registered) { | 139 | if (!registered) { |
150 | RequestContext requestContext = Beans.getReference(RequestContext.class); | 140 | RequestContext requestContext = Beans.getReference(RequestContext.class); |
151 | SessionContext sessionContext = Beans.getReference(SessionContext.class); | 141 | SessionContext sessionContext = Beans.getReference(SessionContext.class); |
152 | - ViewContext viewContext = Beans.getReference(ViewContext.class); | 142 | + // ViewContext viewContext = Beans.getReference(ViewContext.class); |
153 | ConversationContext conversationContext = Beans.getReference(ConversationContext.class); | 143 | ConversationContext conversationContext = Beans.getReference(ConversationContext.class); |
154 | 144 | ||
155 | if (requestContext != null) { | 145 | if (requestContext != null) { |
@@ -166,7 +156,7 @@ public abstract class AbstractLifecycleBootstrap<A extends Annotation> implement | @@ -166,7 +156,7 @@ public abstract class AbstractLifecycleBootstrap<A extends Annotation> implement | ||
166 | 156 | ||
167 | // Contexto temporário de visão precisa de tratamento especial | 157 | // Contexto temporário de visão precisa de tratamento especial |
168 | // para evitar conflito com o contexto presente na extensão demoiselle-jsf | 158 | // para evitar conflito com o contexto presente na extensão demoiselle-jsf |
169 | - if (viewContext != null) { | 159 | + /*if (viewContext != null) { |
170 | if (TemporaryViewContextImpl.class.isInstance(viewContext)) { | 160 | if (TemporaryViewContextImpl.class.isInstance(viewContext)) { |
171 | startedContextHere.put("view", viewContext.activate()); | 161 | startedContextHere.put("view", viewContext.activate()); |
172 | } else { | 162 | } else { |
@@ -185,7 +175,7 @@ public abstract class AbstractLifecycleBootstrap<A extends Annotation> implement | @@ -185,7 +175,7 @@ public abstract class AbstractLifecycleBootstrap<A extends Annotation> implement | ||
185 | } | 175 | } |
186 | } | 176 | } |
187 | } | 177 | } |
188 | - } | 178 | + }*/ |
189 | 179 | ||
190 | registered = true; | 180 | registered = true; |
191 | } | 181 | } |
@@ -212,7 +202,7 @@ public abstract class AbstractLifecycleBootstrap<A extends Annotation> implement | @@ -212,7 +202,7 @@ public abstract class AbstractLifecycleBootstrap<A extends Annotation> implement | ||
212 | 202 | ||
213 | // Contexto temporário de visão precisa de tratamento especial | 203 | // Contexto temporário de visão precisa de tratamento especial |
214 | // para evitar conflito com o contexto presente na extensão demoiselle-jsf | 204 | // para evitar conflito com o contexto presente na extensão demoiselle-jsf |
215 | - if (viewContext != null) { | 205 | + /*if (viewContext != null) { |
216 | if (TemporaryViewContextImpl.class.isInstance(viewContext) && startedContextHere.get("view")) { | 206 | if (TemporaryViewContextImpl.class.isInstance(viewContext) && startedContextHere.get("view")) { |
217 | viewContext.deactivate(); | 207 | viewContext.deactivate(); |
218 | 208 | ||
@@ -221,7 +211,7 @@ public abstract class AbstractLifecycleBootstrap<A extends Annotation> implement | @@ -221,7 +211,7 @@ public abstract class AbstractLifecycleBootstrap<A extends Annotation> implement | ||
221 | backupContext = null; | 211 | backupContext = null; |
222 | } | 212 | } |
223 | } | 213 | } |
224 | - } | 214 | + }*/ |
225 | } | 215 | } |
226 | } | 216 | } |
227 | } | 217 | } |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/CustomContextBootstrap.java
@@ -15,7 +15,6 @@ import br.gov.frameworkdemoiselle.internal.context.StaticContextImpl; | @@ -15,7 +15,6 @@ import br.gov.frameworkdemoiselle.internal.context.StaticContextImpl; | ||
15 | import br.gov.frameworkdemoiselle.internal.context.TemporaryConversationContextImpl; | 15 | import br.gov.frameworkdemoiselle.internal.context.TemporaryConversationContextImpl; |
16 | import br.gov.frameworkdemoiselle.internal.context.TemporaryRequestContextImpl; | 16 | import br.gov.frameworkdemoiselle.internal.context.TemporaryRequestContextImpl; |
17 | import br.gov.frameworkdemoiselle.internal.context.TemporarySessionContextImpl; | 17 | import br.gov.frameworkdemoiselle.internal.context.TemporarySessionContextImpl; |
18 | -import br.gov.frameworkdemoiselle.internal.context.TemporaryViewContextImpl; | ||
19 | import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess; | 18 | import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess; |
20 | 19 | ||
21 | /** | 20 | /** |
@@ -54,9 +53,6 @@ public class CustomContextBootstrap implements Extension{ | @@ -54,9 +53,6 @@ public class CustomContextBootstrap implements Extension{ | ||
54 | ctx = new StaticContextImpl(); | 53 | ctx = new StaticContextImpl(); |
55 | contexts.add(ctx); | 54 | contexts.add(ctx); |
56 | 55 | ||
57 | - ctx = new TemporaryViewContextImpl(); | ||
58 | - contexts.add(ctx); | ||
59 | - | ||
60 | ctx = new TemporaryConversationContextImpl(); | 56 | ctx = new TemporaryConversationContextImpl(); |
61 | contexts.add(ctx); | 57 | contexts.add(ctx); |
62 | 58 |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/context/TemporaryViewContextImpl.java
@@ -1,75 +0,0 @@ | @@ -1,75 +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 | -/* | ||
38 | - * Demoiselle Framework Copyright (c) 2010 Serpro and other contributors as indicated by the @author tag. See the | ||
39 | - * copyright.txt in the distribution for a full listing of contributors. Demoiselle Framework is an open source Java EE | ||
40 | - * library designed to accelerate the development of transactional database Web applications. Demoiselle Framework is | ||
41 | - * released under the terms of the LGPL license 3 http://www.gnu.org/licenses/lgpl.html LGPL License 3 This file is part | ||
42 | - * of Demoiselle Framework. Demoiselle Framework is free software: you can redistribute it and/or modify it under the | ||
43 | - * terms of the GNU Lesser General Public License 3 as published by the Free Software Foundation. Demoiselle Framework | ||
44 | - * is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
45 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You | ||
46 | - * should have received a copy of the GNU Lesser General Public License along with Demoiselle Framework. If not, see | ||
47 | - * <http://www.gnu.org/licenses/>. | ||
48 | - */ | ||
49 | -package br.gov.frameworkdemoiselle.internal.context; | ||
50 | - | ||
51 | -import javax.enterprise.inject.Alternative; | ||
52 | - | ||
53 | -import br.gov.frameworkdemoiselle.annotation.Priority; | ||
54 | -import br.gov.frameworkdemoiselle.context.ViewContext; | ||
55 | -import br.gov.frameworkdemoiselle.lifecycle.ViewScoped; | ||
56 | - | ||
57 | -/** | ||
58 | - * | ||
59 | - * Temporary context meant to replace the view context on environments | ||
60 | - * that doesn't provide a default context for the view scope. Such | ||
61 | - * environments include desktop applications or remote JMX calls, that by CDI | ||
62 | - * specification doesn't provide scopes and only have the application scope active. | ||
63 | - * | ||
64 | - * @author serpro | ||
65 | - * | ||
66 | - */ | ||
67 | -@Priority(Priority.MIN_PRIORITY) | ||
68 | -@Alternative | ||
69 | -public class TemporaryViewContextImpl extends AbstractThreadLocalContext implements ViewContext { | ||
70 | - | ||
71 | - public TemporaryViewContextImpl() { | ||
72 | - super(ViewScoped.class); | ||
73 | - } | ||
74 | - | ||
75 | -} |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/producer/ResourceBundleProducer.java
@@ -73,7 +73,10 @@ public class ResourceBundleProducer implements Serializable { | @@ -73,7 +73,10 @@ public class ResourceBundleProducer implements Serializable { | ||
73 | @Name("") | 73 | @Name("") |
74 | @Produces | 74 | @Produces |
75 | public ResourceBundle createNamed(InjectionPoint ip) { | 75 | public ResourceBundle createNamed(InjectionPoint ip) { |
76 | - String baseName = ip.getAnnotated().getAnnotation(Name.class).value(); | 76 | + String baseName = ""; |
77 | + if (ip != null) { | ||
78 | + baseName = ip.getAnnotated().getAnnotation(Name.class).value(); | ||
79 | + } | ||
77 | return new ResourceBundle(baseName, Beans.getReference(Locale.class)); | 80 | return new ResourceBundle(baseName, Beans.getReference(Locale.class)); |
78 | } | 81 | } |
79 | } | 82 | } |
impl/core/src/main/java/br/gov/frameworkdemoiselle/lifecycle/ViewScoped.java
@@ -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 | -package br.gov.frameworkdemoiselle.lifecycle; | ||
38 | - | ||
39 | -import static java.lang.annotation.ElementType.FIELD; | ||
40 | -import static java.lang.annotation.ElementType.METHOD; | ||
41 | -import static java.lang.annotation.ElementType.TYPE; | ||
42 | -import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
43 | - | ||
44 | -import java.lang.annotation.Inherited; | ||
45 | -import java.lang.annotation.Retention; | ||
46 | -import java.lang.annotation.Target; | ||
47 | - | ||
48 | -import javax.enterprise.context.NormalScope; | ||
49 | - | ||
50 | -/** | ||
51 | - * This scope maintains the context for viewed page; when the viewed page change, the data will be lost. | ||
52 | - * | ||
53 | - * @author SERPRO | ||
54 | - * | ||
55 | - * @deprecated | ||
56 | - */ | ||
57 | -@Inherited | ||
58 | -@Target({ METHOD, TYPE, FIELD }) | ||
59 | -@Retention(RUNTIME) | ||
60 | -@NormalScope(passivating = true) | ||
61 | -@Deprecated | ||
62 | -public @interface ViewScoped { | ||
63 | - | ||
64 | -} |
impl/core/src/main/java/br/gov/frameworkdemoiselle/stereotype/ViewController.java
@@ -1,72 +0,0 @@ | @@ -1,72 +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.stereotype; | ||
38 | - | ||
39 | -import static java.lang.annotation.ElementType.TYPE; | ||
40 | -import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
41 | - | ||
42 | -import java.lang.annotation.Inherited; | ||
43 | -import java.lang.annotation.Retention; | ||
44 | -import java.lang.annotation.Target; | ||
45 | - | ||
46 | -import javax.enterprise.inject.Stereotype; | ||
47 | -import javax.inject.Named; | ||
48 | - | ||
49 | -import br.gov.frameworkdemoiselle.lifecycle.ViewScoped; | ||
50 | - | ||
51 | -/** | ||
52 | - * Identifies a <b>view controller</b> class. A view controller class is intend to respond to events initiated in the | ||
53 | - * application front-view. It should have attributes and methods intented to populate the view. | ||
54 | - * <p> | ||
55 | - * A <i>View Controller</i> is: | ||
56 | - * <ul> | ||
57 | - * <li>defined when annotated with {@code @ViewController}</li> | ||
58 | - * <li>automatically injected whenever {@code @Inject} is used</li> | ||
59 | - * </ul> | ||
60 | - * | ||
61 | - * @author SERPRO | ||
62 | - * @see @Controller | ||
63 | - */ | ||
64 | -@Named | ||
65 | -@Controller | ||
66 | -@Stereotype | ||
67 | -@ViewScoped | ||
68 | -@Inherited | ||
69 | -@Target(TYPE) | ||
70 | -@Retention(RUNTIME) | ||
71 | -public @interface ViewController { | ||
72 | -} |
impl/core/src/main/java/br/gov/frameworkdemoiselle/util/Beans.java
@@ -46,10 +46,8 @@ import java.util.Set; | @@ -46,10 +46,8 @@ import java.util.Set; | ||
46 | 46 | ||
47 | import javax.enterprise.context.spi.CreationalContext; | 47 | import javax.enterprise.context.spi.CreationalContext; |
48 | import javax.enterprise.inject.AmbiguousResolutionException; | 48 | import javax.enterprise.inject.AmbiguousResolutionException; |
49 | -import javax.enterprise.inject.spi.Annotated; | ||
50 | -import javax.enterprise.inject.spi.Bean; | ||
51 | -import javax.enterprise.inject.spi.BeanManager; | ||
52 | -import javax.enterprise.inject.spi.InjectionPoint; | 49 | +import javax.enterprise.inject.Instance; |
50 | +import javax.enterprise.inject.spi.*; | ||
53 | 51 | ||
54 | import br.gov.frameworkdemoiselle.DemoiselleException; | 52 | import br.gov.frameworkdemoiselle.DemoiselleException; |
55 | 53 | ||
@@ -118,6 +116,16 @@ public final class Beans { | @@ -118,6 +116,16 @@ public final class Beans { | ||
118 | * if no bean are avaliable to be injected for the given Class and qualifiers. | 116 | * if no bean are avaliable to be injected for the given Class and qualifiers. |
119 | */ | 117 | */ |
120 | public static <T> T getReference(final Class<T> beanClass, Annotation... qualifiers) { | 118 | public static <T> T getReference(final Class<T> beanClass, Annotation... qualifiers) { |
119 | + | ||
120 | + Instance<T> selectedInstance = CDI.current().select(beanClass, qualifiers); | ||
121 | + if (selectedInstance != null) | ||
122 | + { | ||
123 | + return selectedInstance.get(); | ||
124 | + } | ||
125 | + | ||
126 | + return null; | ||
127 | + | ||
128 | + /* | ||
121 | T instance; | 129 | T instance; |
122 | 130 | ||
123 | try { | 131 | try { |
@@ -145,7 +153,7 @@ public final class Beans { | @@ -145,7 +153,7 @@ public final class Beans { | ||
145 | throw new DemoiselleException(message, cause); | 153 | throw new DemoiselleException(message, cause); |
146 | } | 154 | } |
147 | 155 | ||
148 | - return instance; | 156 | + return instance;*/ |
149 | } | 157 | } |
150 | 158 | ||
151 | @SuppressWarnings("unchecked") | 159 | @SuppressWarnings("unchecked") |
@@ -158,15 +166,16 @@ public final class Beans { | @@ -158,15 +166,16 @@ public final class Beans { | ||
158 | Bean<?> bean = beans.iterator().next(); | 166 | Bean<?> bean = beans.iterator().next(); |
159 | CreationalContext<?> context = getBeanManager().createCreationalContext(bean); | 167 | CreationalContext<?> context = getBeanManager().createCreationalContext(bean); |
160 | Type beanType = beanClass == null ? bean.getBeanClass() : beanClass; | 168 | Type beanType = beanClass == null ? bean.getBeanClass() : beanClass; |
161 | - InjectionPoint injectionPoint; | 169 | + /*InjectionPoint injectionPoint; |
162 | 170 | ||
163 | if (qualifiers == null) { | 171 | if (qualifiers == null) { |
164 | injectionPoint = new ProgramaticInjectionPoint(bean, beanType); | 172 | injectionPoint = new ProgramaticInjectionPoint(bean, beanType); |
165 | } else { | 173 | } else { |
166 | injectionPoint = new ProgramaticInjectionPoint(bean, beanType, qualifiers); | 174 | injectionPoint = new ProgramaticInjectionPoint(bean, beanType, qualifiers); |
167 | - } | 175 | + }*/ |
168 | 176 | ||
169 | - return (T) getBeanManager().getInjectableReference(injectionPoint, context); | 177 | + //return (T) getBeanManager().getInjectableReference(injectionPoint, context); |
178 | + return (T) getBeanManager().getReference(bean, beanType, context); | ||
170 | } | 179 | } |
171 | 180 | ||
172 | /* | 181 | /* |
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/JsfBootstrap.java
@@ -46,9 +46,10 @@ import br.gov.frameworkdemoiselle.internal.context.FacesViewContextImpl; | @@ -46,9 +46,10 @@ import br.gov.frameworkdemoiselle.internal.context.FacesViewContextImpl; | ||
46 | import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess; | 46 | import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess; |
47 | import br.gov.frameworkdemoiselle.util.Beans; | 47 | import br.gov.frameworkdemoiselle.util.Beans; |
48 | 48 | ||
49 | +@Deprecated | ||
49 | public class JsfBootstrap implements Extension { | 50 | public class JsfBootstrap implements Extension { |
50 | 51 | ||
51 | - private FacesViewContextImpl context; | 52 | + /*private FacesViewContextImpl context; |
52 | 53 | ||
53 | private boolean contextActivatedHere; | 54 | private boolean contextActivatedHere; |
54 | 55 | ||
@@ -74,5 +75,5 @@ public class JsfBootstrap implements Extension { | @@ -74,5 +75,5 @@ public class JsfBootstrap implements Extension { | ||
74 | if (contextActivatedHere) { | 75 | if (contextActivatedHere) { |
75 | context.deactivate(); | 76 | context.deactivate(); |
76 | } | 77 | } |
77 | - } | 78 | + }*/ |
78 | } | 79 | } |
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/internal/context/FacesViewBeanStore.java
@@ -17,6 +17,7 @@ import br.gov.frameworkdemoiselle.util.ResourceBundle; | @@ -17,6 +17,7 @@ import br.gov.frameworkdemoiselle.util.ResourceBundle; | ||
17 | * | 17 | * |
18 | * @author SERPRO | 18 | * @author SERPRO |
19 | */ | 19 | */ |
20 | +@Deprecated | ||
20 | public class FacesViewBeanStore implements Serializable { | 21 | public class FacesViewBeanStore implements Serializable { |
21 | 22 | ||
22 | private static final long serialVersionUID = -8265458933971929432L; | 23 | private static final long serialVersionUID = -8265458933971929432L; |
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/lifecycle/ViewScoped.java
0 → 100644
@@ -0,0 +1,59 @@ | @@ -0,0 +1,59 @@ | ||
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.lifecycle; | ||
38 | + | ||
39 | +import static java.lang.annotation.ElementType.FIELD; | ||
40 | +import static java.lang.annotation.ElementType.METHOD; | ||
41 | +import static java.lang.annotation.ElementType.TYPE; | ||
42 | +import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
43 | + | ||
44 | +import java.lang.annotation.Inherited; | ||
45 | +import java.lang.annotation.Retention; | ||
46 | +import java.lang.annotation.Target; | ||
47 | + | ||
48 | +import javax.enterprise.context.NormalScope; | ||
49 | + | ||
50 | +/** | ||
51 | + * This scope maintains the context for viewed page; when the viewed page change, the data will be lost. | ||
52 | + * | ||
53 | + * @author SERPRO | ||
54 | + * | ||
55 | + * @deprecated Use {@link javax.faces.view.ViewScoped} instead. | ||
56 | + */ | ||
57 | +@javax.faces.view.ViewScoped | ||
58 | +@Deprecated | ||
59 | +public @interface ViewScoped {} |
impl/extension/jsf/src/main/java/br/gov/frameworkdemoiselle/stereotype/ViewController.java
0 → 100644
@@ -0,0 +1,72 @@ | @@ -0,0 +1,72 @@ | ||
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.stereotype; | ||
38 | + | ||
39 | +import static java.lang.annotation.ElementType.TYPE; | ||
40 | +import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
41 | + | ||
42 | +import java.lang.annotation.Inherited; | ||
43 | +import java.lang.annotation.Retention; | ||
44 | +import java.lang.annotation.Target; | ||
45 | + | ||
46 | +import javax.enterprise.inject.Stereotype; | ||
47 | +import javax.inject.Named; | ||
48 | + | ||
49 | +import br.gov.frameworkdemoiselle.lifecycle.ViewScoped; | ||
50 | + | ||
51 | +/** | ||
52 | + * Identifies a <b>view controller</b> class. A view controller class is intend to respond to events initiated in the | ||
53 | + * application front-view. It should have attributes and methods intented to populate the view. | ||
54 | + * <p> | ||
55 | + * A <i>View Controller</i> is: | ||
56 | + * <ul> | ||
57 | + * <li>defined when annotated with {@code @ViewController}</li> | ||
58 | + * <li>automatically injected whenever {@code @Inject} is used</li> | ||
59 | + * </ul> | ||
60 | + * | ||
61 | + * @author SERPRO | ||
62 | + * @see @Controller | ||
63 | + */ | ||
64 | +@Named | ||
65 | +@Controller | ||
66 | +@Stereotype | ||
67 | +@ViewScoped | ||
68 | +@Inherited | ||
69 | +@Target(TYPE) | ||
70 | +@Retention(RUNTIME) | ||
71 | +public @interface ViewController { | ||
72 | +} |
impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/internal/producer/HttpServletRequestProducer.java
@@ -39,18 +39,20 @@ package br.gov.frameworkdemoiselle.internal.producer; | @@ -39,18 +39,20 @@ package br.gov.frameworkdemoiselle.internal.producer; | ||
39 | import java.io.Serializable; | 39 | import java.io.Serializable; |
40 | 40 | ||
41 | import javax.enterprise.context.RequestScoped; | 41 | import javax.enterprise.context.RequestScoped; |
42 | +import javax.enterprise.inject.Alternative; | ||
42 | import javax.enterprise.inject.Default; | 43 | import javax.enterprise.inject.Default; |
43 | import javax.enterprise.inject.Produces; | 44 | import javax.enterprise.inject.Produces; |
44 | import javax.servlet.http.HttpServletRequest; | 45 | import javax.servlet.http.HttpServletRequest; |
45 | 46 | ||
46 | @RequestScoped | 47 | @RequestScoped |
48 | +@Deprecated | ||
47 | public class HttpServletRequestProducer implements Serializable { | 49 | public class HttpServletRequestProducer implements Serializable { |
48 | 50 | ||
49 | private static final long serialVersionUID = 1L; | 51 | private static final long serialVersionUID = 1L; |
50 | 52 | ||
51 | private transient HttpServletRequest request; | 53 | private transient HttpServletRequest request; |
52 | 54 | ||
53 | - @Default | 55 | + @Alternative |
54 | @Produces | 56 | @Produces |
55 | public HttpServletRequest create() { | 57 | public HttpServletRequest create() { |
56 | return this.request; | 58 | return this.request; |
impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/internal/producer/HttpServletResponseProducer.java
@@ -39,18 +39,20 @@ package br.gov.frameworkdemoiselle.internal.producer; | @@ -39,18 +39,20 @@ package br.gov.frameworkdemoiselle.internal.producer; | ||
39 | import java.io.Serializable; | 39 | import java.io.Serializable; |
40 | 40 | ||
41 | import javax.enterprise.context.RequestScoped; | 41 | import javax.enterprise.context.RequestScoped; |
42 | +import javax.enterprise.inject.Alternative; | ||
42 | import javax.enterprise.inject.Default; | 43 | import javax.enterprise.inject.Default; |
43 | import javax.enterprise.inject.Produces; | 44 | import javax.enterprise.inject.Produces; |
44 | import javax.servlet.http.HttpServletResponse; | 45 | import javax.servlet.http.HttpServletResponse; |
45 | 46 | ||
46 | @RequestScoped | 47 | @RequestScoped |
48 | +@Deprecated | ||
47 | public class HttpServletResponseProducer implements Serializable { | 49 | public class HttpServletResponseProducer implements Serializable { |
48 | 50 | ||
49 | private static final long serialVersionUID = 1L; | 51 | private static final long serialVersionUID = 1L; |
50 | 52 | ||
51 | private transient HttpServletResponse response; | 53 | private transient HttpServletResponse response; |
52 | 54 | ||
53 | - @Default | 55 | + @Alternative |
54 | @Produces | 56 | @Produces |
55 | public HttpServletResponse create() { | 57 | public HttpServletResponse create() { |
56 | return this.response; | 58 | return this.response; |
impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/internal/producer/HttpSessionProducer.java
@@ -38,16 +38,18 @@ package br.gov.frameworkdemoiselle.internal.producer; | @@ -38,16 +38,18 @@ package br.gov.frameworkdemoiselle.internal.producer; | ||
38 | 38 | ||
39 | import java.io.Serializable; | 39 | import java.io.Serializable; |
40 | 40 | ||
41 | +import javax.enterprise.inject.Alternative; | ||
41 | import javax.enterprise.inject.Default; | 42 | import javax.enterprise.inject.Default; |
42 | import javax.enterprise.inject.Produces; | 43 | import javax.enterprise.inject.Produces; |
43 | import javax.servlet.http.HttpServletRequest; | 44 | import javax.servlet.http.HttpServletRequest; |
44 | import javax.servlet.http.HttpSession; | 45 | import javax.servlet.http.HttpSession; |
45 | 46 | ||
47 | +@Deprecated | ||
46 | public class HttpSessionProducer implements Serializable { | 48 | public class HttpSessionProducer implements Serializable { |
47 | 49 | ||
48 | private static final long serialVersionUID = 1L; | 50 | private static final long serialVersionUID = 1L; |
49 | 51 | ||
50 | - @Default | 52 | + @Alternative |
51 | @Produces | 53 | @Produces |
52 | public HttpSession create(HttpServletRequest request) { | 54 | public HttpSession create(HttpServletRequest request) { |
53 | return request != null ? request.getSession() : null; | 55 | return request != null ? request.getSession() : null; |