DELTASPIKE-525 unification of @Initialized and @Destroyed
Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/ad9ed6d5 Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/ad9ed6d5 Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/ad9ed6d5 Branch: refs/heads/master Commit: ad9ed6d5a73e92b616fdc7df75f934129a2d22b5 Parents: e88f290 Author: gpetracek <[email protected]> Authored: Thu Feb 20 09:40:59 2014 +0100 Committer: gpetracek <[email protected]> Committed: Thu Feb 20 09:40:59 2014 +0100 ---------------------------------------------------------------------- .../core/api/lifecycle/Destroyed.java | 43 +++++++++++++ .../core/api/lifecycle/Initialized.java | 43 +++++++++++++ .../core/api/literal/DestroyedLiteral.java | 35 +++++++++++ .../core/api/literal/InitializedLiteral.java | 35 +++++++++++ .../data/impl/handler/QueryHandler.java | 2 +- .../deltaspike/data/impl/meta/Initialized.java | 42 ------------- .../impl/meta/RepositoryComponentsFactory.java | 2 + .../api/listener/request/AfterJsfRequest.java | 50 --------------- .../api/listener/request/BeforeJsfRequest.java | 46 -------------- .../BeforeAfterJsfRequestBroadcaster.java | 64 -------------------- .../request/DeltaSpikeFacesContextWrapper.java | 18 +++--- .../request/DeltaSpikeLifecycleWrapper.java | 24 ++++---- .../listener/request/JsfRequestBroadcaster.java | 63 +++++++++++++++++++ .../deltaspike/servlet/api/Destroyed.java | 43 ------------- .../deltaspike/servlet/api/Initialized.java | 43 ------------- .../servlet/api/literal/DestroyedLiteral.java | 35 ----------- .../servlet/api/literal/InitializedLiteral.java | 35 ----------- .../impl/event/EventBridgeContextListener.java | 4 +- .../servlet/impl/event/EventBridgeFilter.java | 4 +- .../impl/event/EventBridgeSessionListener.java | 4 +- .../context/ServletContextEventsObserver.java | 4 +- .../request/RequestResponseEventsObserver.java | 4 +- .../event/session/SessionEventsObserver.java | 4 +- 23 files changed, 255 insertions(+), 392 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ad9ed6d5/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/lifecycle/Destroyed.java ---------------------------------------------------------------------- diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/lifecycle/Destroyed.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/lifecycle/Destroyed.java new file mode 100644 index 0000000..35e4d48 --- /dev/null +++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/lifecycle/Destroyed.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.core.api.lifecycle; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import javax.inject.Qualifier; + +/** + * Qualifier for events which are fired when servlet objects are destroyed. + */ +@Qualifier +@Target({ TYPE, METHOD, PARAMETER, FIELD }) +@Retention(RUNTIME) +@Documented +public @interface Destroyed +{ + +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ad9ed6d5/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/lifecycle/Initialized.java ---------------------------------------------------------------------- diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/lifecycle/Initialized.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/lifecycle/Initialized.java new file mode 100644 index 0000000..7278fb6 --- /dev/null +++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/lifecycle/Initialized.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.core.api.lifecycle; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import javax.inject.Qualifier; + +/** + * Qualifier for events which are fired when servlet objects are created. + */ +@Qualifier +@Target({ TYPE, METHOD, PARAMETER, FIELD }) +@Retention(RUNTIME) +@Documented +public @interface Initialized +{ + +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ad9ed6d5/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/literal/DestroyedLiteral.java ---------------------------------------------------------------------- diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/literal/DestroyedLiteral.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/literal/DestroyedLiteral.java new file mode 100644 index 0000000..e986b67 --- /dev/null +++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/literal/DestroyedLiteral.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.core.api.literal; + +import javax.enterprise.util.AnnotationLiteral; + +import org.apache.deltaspike.core.api.lifecycle.Destroyed; + +/** + * Annotation literal for {@link Destroyed}. + */ +public class DestroyedLiteral extends AnnotationLiteral<Destroyed> implements Destroyed +{ + + public static final Destroyed INSTANCE = new DestroyedLiteral(); + + private static final long serialVersionUID = 8310730593030223981L; + +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ad9ed6d5/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/literal/InitializedLiteral.java ---------------------------------------------------------------------- diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/literal/InitializedLiteral.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/literal/InitializedLiteral.java new file mode 100644 index 0000000..9fd311b --- /dev/null +++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/literal/InitializedLiteral.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.core.api.literal; + +import javax.enterprise.util.AnnotationLiteral; + +import org.apache.deltaspike.core.api.lifecycle.Initialized; + +/** + * Annotation literal for {@link Initialized}. + */ +public class InitializedLiteral extends AnnotationLiteral<Initialized> implements Initialized +{ + + public static final Initialized INSTANCE = new InitializedLiteral(); + + private static final long serialVersionUID = 2392444150652655120L; + +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ad9ed6d5/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/QueryHandler.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/QueryHandler.java b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/QueryHandler.java index f743cb8..6ce2af8 100755 --- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/QueryHandler.java +++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/QueryHandler.java @@ -31,11 +31,11 @@ import java.util.logging.Logger; import javax.inject.Inject; import javax.persistence.PersistenceException; +import org.apache.deltaspike.core.api.lifecycle.Initialized; import org.apache.deltaspike.data.api.QueryInvocationException; import org.apache.deltaspike.data.api.Repository; import org.apache.deltaspike.data.impl.builder.QueryBuilder; import org.apache.deltaspike.data.impl.builder.QueryBuilderFactory; -import org.apache.deltaspike.data.impl.meta.Initialized; import org.apache.deltaspike.data.impl.meta.RepositoryComponent; import org.apache.deltaspike.data.impl.meta.RepositoryComponents; import org.apache.deltaspike.data.impl.meta.RepositoryMethod; http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ad9ed6d5/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/Initialized.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/Initialized.java b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/Initialized.java deleted file mode 100644 index f9ea3fb..0000000 --- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/Initialized.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.deltaspike.data.impl.meta; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Documented; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import javax.inject.Qualifier; - -/** - * CDI qualifier. Mainly used for producers which create an initialized instance. - */ -@Qualifier -@Target({ TYPE, METHOD, PARAMETER, FIELD }) -@Retention(RUNTIME) -@Documented -public @interface Initialized -{ -} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ad9ed6d5/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/RepositoryComponentsFactory.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/RepositoryComponentsFactory.java b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/RepositoryComponentsFactory.java index efa340f..76af024 100644 --- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/RepositoryComponentsFactory.java +++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/RepositoryComponentsFactory.java @@ -18,6 +18,8 @@ */ package org.apache.deltaspike.data.impl.meta; +import org.apache.deltaspike.core.api.lifecycle.Initialized; + import javax.enterprise.inject.Produces; /** http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ad9ed6d5/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/listener/request/AfterJsfRequest.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/listener/request/AfterJsfRequest.java b/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/listener/request/AfterJsfRequest.java deleted file mode 100644 index 1346319..0000000 --- a/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/listener/request/AfterJsfRequest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.deltaspike.jsf.api.listener.request; - -import javax.inject.Qualifier; -import java.lang.annotation.Documented; - -import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.ElementType.FIELD; - -import java.lang.annotation.Retention; - -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Target; - -/** - * Qualifier for observers which should be invoked before the current {@link javax.faces.context.FacesContext} gets - * destroyed. - * <p/> - * Parameter-type of the observer: {@link javax.faces.context.FacesContext} - * <p/> - * Attention: referencing @ApplicationScoped or @Singleton scoped beans might lead to issues with a CDI implementation - * (e.g. if the ServletRequestListener of OWB gets called earlier) - */ - -@Target({ PARAMETER, FIELD }) -@Retention(RUNTIME) -@Documented - -@Qualifier -public @interface AfterJsfRequest -{ -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ad9ed6d5/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/listener/request/BeforeJsfRequest.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/listener/request/BeforeJsfRequest.java b/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/listener/request/BeforeJsfRequest.java deleted file mode 100644 index 611cd74..0000000 --- a/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/api/listener/request/BeforeJsfRequest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.deltaspike.jsf.api.listener.request; - -import javax.inject.Qualifier; -import java.lang.annotation.Documented; - -import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.ElementType.FIELD; - -import java.lang.annotation.Retention; - -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Target; - -/** - * Qualifier for observers which should be invoked as soon as a jsf request is started. - * <p/> - * Parameter-type of the observer: {@link javax.faces.context.FacesContext} - */ - -@Target({ PARAMETER, FIELD }) -@Retention(RUNTIME) -@Documented - -@Qualifier -public @interface BeforeJsfRequest -{ -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ad9ed6d5/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/BeforeAfterJsfRequestBroadcaster.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/BeforeAfterJsfRequestBroadcaster.java b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/BeforeAfterJsfRequestBroadcaster.java deleted file mode 100644 index 1272d63..0000000 --- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/BeforeAfterJsfRequestBroadcaster.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.deltaspike.jsf.impl.listener.request; - -import org.apache.deltaspike.core.spi.activation.Deactivatable; -import org.apache.deltaspike.jsf.api.listener.request.AfterJsfRequest; -import org.apache.deltaspike.jsf.api.listener.request.BeforeJsfRequest; - -import javax.enterprise.context.ApplicationScoped; -import javax.enterprise.event.Event; -import javax.faces.context.FacesContext; -import javax.inject.Inject; - -/** - * Broadcaster for {@link org.apache.deltaspike.jsf.api.listener.request.BeforeJsfRequest} and - * {@link org.apache.deltaspike.jsf.api.listener.request.AfterJsfRequest} - */ -@ApplicationScoped -public class BeforeAfterJsfRequestBroadcaster implements Deactivatable -{ - @Inject - @BeforeJsfRequest - private Event<FacesContext> beforeJsfRequestEvent; - - @Inject - @AfterJsfRequest - private Event<FacesContext> afterJsfRequestEvent; - - /** - * Broadcasts the {@link org.apache.deltaspike.jsf.api.listener.request.BeforeJsfRequest} event - * - * @param facesContext current faces-context - */ - public void broadcastBeforeJsfRequestEvent(FacesContext facesContext) - { - this.beforeJsfRequestEvent.fire(facesContext); - } - - /** - * Broadcasts the {@link org.apache.deltaspike.jsf.api.listener.request.AfterJsfRequest} event - * - * @param facesContext current faces-context - */ - public void broadcastAfterJsfRequestEvent(FacesContext facesContext) - { - this.afterJsfRequestEvent.fire(facesContext); - } -} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ad9ed6d5/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextWrapper.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextWrapper.java b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextWrapper.java index 2ad8a54..18d5e72 100644 --- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextWrapper.java +++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextWrapper.java @@ -43,7 +43,7 @@ class DeltaSpikeFacesContextWrapper extends FacesContextWrapper { private final FacesContext wrappedFacesContext; - private BeforeAfterJsfRequestBroadcaster beforeAfterJsfRequestBroadcaster; + private JsfRequestBroadcaster jsfRequestBroadcaster; private boolean defaultErrorViewExceptionHandlerActivated; @@ -73,7 +73,7 @@ class DeltaSpikeFacesContextWrapper extends FacesContextWrapper } /** - * Broadcasts the {@link org.apache.deltaspike.jsf.api.listener.request.AfterJsfRequest} event + * Broadcasts the {@link org.apache.deltaspike.core.api.lifecycle.Destroyed} event * {@inheritDoc} */ @Override @@ -81,7 +81,7 @@ class DeltaSpikeFacesContextWrapper extends FacesContextWrapper { if (!this.wrappedFacesContext.getApplication().getResourceHandler().isResourceRequest(this.wrappedFacesContext)) { - broadcastAfterJsfRequestEvent(); + broadcastDestroyedJsfRequestEvent(); } wrappedFacesContext.release(); @@ -101,12 +101,12 @@ class DeltaSpikeFacesContextWrapper extends FacesContextWrapper return exceptionHandler; } - private void broadcastAfterJsfRequestEvent() + private void broadcastDestroyedJsfRequestEvent() { lazyInit(); - if (this.beforeAfterJsfRequestBroadcaster != null) + if (this.jsfRequestBroadcaster != null) { - this.beforeAfterJsfRequestBroadcaster.broadcastAfterJsfRequestEvent(this); + this.jsfRequestBroadcaster.broadcastDestroyedJsfRequestEvent(this); } } @@ -125,10 +125,10 @@ class DeltaSpikeFacesContextWrapper extends FacesContextWrapper { this.jsfModuleConfig = BeanProvider.getContextualReference(JsfModuleConfig.class); - if (ClassDeactivationUtils.isActivated(BeforeAfterJsfRequestBroadcaster.class)) + if (ClassDeactivationUtils.isActivated(JsfRequestBroadcaster.class)) { - this.beforeAfterJsfRequestBroadcaster = - BeanProvider.getContextualReference(BeforeAfterJsfRequestBroadcaster.class, true); + this.jsfRequestBroadcaster = + BeanProvider.getContextualReference(JsfRequestBroadcaster.class, true); } ViewConfigResolver viewConfigResolver = BeanProvider.getContextualReference(ViewConfigResolver.class); http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ad9ed6d5/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeLifecycleWrapper.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeLifecycleWrapper.java b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeLifecycleWrapper.java index 050083b..864b867 100644 --- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeLifecycleWrapper.java +++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeLifecycleWrapper.java @@ -31,7 +31,7 @@ class DeltaSpikeLifecycleWrapper extends Lifecycle { private final Lifecycle wrapped; - private BeforeAfterJsfRequestBroadcaster beforeAfterJsfRequestBroadcaster; + private JsfRequestBroadcaster jsfRequestBroadcaster; private ClientWindow clientWindow; private WindowContext windowContext; @@ -56,8 +56,8 @@ class DeltaSpikeLifecycleWrapper extends Lifecycle /** * Broadcasts - * {@link org.apache.deltaspike.jsf.api.listener.request.BeforeJsfRequest} and - * {@link org.apache.deltaspike.jsf.api.listener.request.AfterJsfRequest} + * {@link org.apache.deltaspike.core.api.lifecycle.Initialized} and + * {@link org.apache.deltaspike.core.api.lifecycle.Destroyed} * //TODO StartupEvent */ @Override @@ -72,7 +72,7 @@ class DeltaSpikeLifecycleWrapper extends Lifecycle lazyInit(); //TODO broadcastApplicationStartupBroadcaster(); - broadcastBeforeFacesRequestEvent(facesContext); + broadcastInitializedJsfRequestEvent(facesContext); // ClientWindow handling String windowId = clientWindow.getWindowId(facesContext); @@ -108,11 +108,11 @@ class DeltaSpikeLifecycleWrapper extends Lifecycle this.wrapped.render(facesContext); } - private void broadcastBeforeFacesRequestEvent(FacesContext facesContext) + private void broadcastInitializedJsfRequestEvent(FacesContext facesContext) { - if (this.beforeAfterJsfRequestBroadcaster != null) + if (this.jsfRequestBroadcaster != null) { - this.beforeAfterJsfRequestBroadcaster.broadcastBeforeJsfRequestEvent(facesContext); + this.jsfRequestBroadcaster.broadcastInitializedJsfRequestEvent(facesContext); } } @@ -127,18 +127,18 @@ class DeltaSpikeLifecycleWrapper extends Lifecycle private synchronized void init() { // switch into paranoia mode - if (initialized == null) + if (this.initialized == null) { - if (ClassDeactivationUtils.isActivated(BeforeAfterJsfRequestBroadcaster.class)) + if (ClassDeactivationUtils.isActivated(JsfRequestBroadcaster.class)) { - beforeAfterJsfRequestBroadcaster = - BeanProvider.getContextualReference(BeforeAfterJsfRequestBroadcaster.class, true); + this.jsfRequestBroadcaster = + BeanProvider.getContextualReference(JsfRequestBroadcaster.class, true); } clientWindow = BeanProvider.getContextualReference(ClientWindow.class, true); windowContext = BeanProvider.getContextualReference(WindowContext.class, true); - initialized = true; + this.initialized = true; } } } http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ad9ed6d5/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/JsfRequestBroadcaster.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/JsfRequestBroadcaster.java b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/JsfRequestBroadcaster.java new file mode 100644 index 0000000..4b677b6 --- /dev/null +++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/JsfRequestBroadcaster.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.jsf.impl.listener.request; + +import org.apache.deltaspike.core.api.lifecycle.Destroyed; +import org.apache.deltaspike.core.api.lifecycle.Initialized; +import org.apache.deltaspike.core.spi.activation.Deactivatable; + +import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.event.Event; +import javax.faces.context.FacesContext; +import javax.inject.Inject; + +/** + * Broadcaster for {@link Initialized} and {@link Destroyed} + */ +@ApplicationScoped +public class JsfRequestBroadcaster implements Deactivatable +{ + @Inject + @Initialized + private Event<FacesContext> initializedJsfRequestEvent; + + @Inject + @Destroyed + private Event<FacesContext> destroyedJsfRequestEvent; + + /** + * Broadcasts the {@link Initialized} event + * + * @param facesContext current faces-context + */ + public void broadcastInitializedJsfRequestEvent(FacesContext facesContext) + { + this.initializedJsfRequestEvent.fire(facesContext); + } + + /** + * Broadcasts the {@link Destroyed} event + * + * @param facesContext current faces-context + */ + public void broadcastDestroyedJsfRequestEvent(FacesContext facesContext) + { + this.destroyedJsfRequestEvent.fire(facesContext); + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ad9ed6d5/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/Destroyed.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/Destroyed.java b/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/Destroyed.java deleted file mode 100644 index 8c289b4..0000000 --- a/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/Destroyed.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.deltaspike.servlet.api; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Documented; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import javax.inject.Qualifier; - -/** - * Qualifier for events which are fired when servlet objects are destroyed. - */ -@Qualifier -@Target({ TYPE, METHOD, PARAMETER, FIELD }) -@Retention(RUNTIME) -@Documented -public @interface Destroyed -{ - -} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ad9ed6d5/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/Initialized.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/Initialized.java b/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/Initialized.java deleted file mode 100644 index 40354b9..0000000 --- a/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/Initialized.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.deltaspike.servlet.api; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Documented; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import javax.inject.Qualifier; - -/** - * Qualifier for events which are fired when servlet objects are created. - */ -@Qualifier -@Target({ TYPE, METHOD, PARAMETER, FIELD }) -@Retention(RUNTIME) -@Documented -public @interface Initialized -{ - -} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ad9ed6d5/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/literal/DestroyedLiteral.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/literal/DestroyedLiteral.java b/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/literal/DestroyedLiteral.java deleted file mode 100644 index 1bd7ac0..0000000 --- a/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/literal/DestroyedLiteral.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.deltaspike.servlet.api.literal; - -import javax.enterprise.util.AnnotationLiteral; - -import org.apache.deltaspike.servlet.api.Destroyed; - -/** - * Annotation literal for {@link Destroyed}. - */ -public class DestroyedLiteral extends AnnotationLiteral<Destroyed> implements Destroyed -{ - - public static final Destroyed INSTANCE = new DestroyedLiteral(); - - private static final long serialVersionUID = 8310730593030223981L; - -} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ad9ed6d5/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/literal/InitializedLiteral.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/literal/InitializedLiteral.java b/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/literal/InitializedLiteral.java deleted file mode 100644 index 74222dc..0000000 --- a/deltaspike/modules/servlet/api/src/main/java/org/apache/deltaspike/servlet/api/literal/InitializedLiteral.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.deltaspike.servlet.api.literal; - -import javax.enterprise.util.AnnotationLiteral; - -import org.apache.deltaspike.servlet.api.Initialized; - -/** - * Annotation literal for {@link Initialized}. - */ -public class InitializedLiteral extends AnnotationLiteral<Initialized> implements Initialized -{ - - public static final Initialized INSTANCE = new InitializedLiteral(); - - private static final long serialVersionUID = 2392444150652655120L; - -} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ad9ed6d5/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/event/EventBridgeContextListener.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/event/EventBridgeContextListener.java b/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/event/EventBridgeContextListener.java index 8bdbb2b..f8239ea 100644 --- a/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/event/EventBridgeContextListener.java +++ b/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/event/EventBridgeContextListener.java @@ -21,8 +21,8 @@ package org.apache.deltaspike.servlet.impl.event; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; -import org.apache.deltaspike.servlet.api.literal.DestroyedLiteral; -import org.apache.deltaspike.servlet.api.literal.InitializedLiteral; +import org.apache.deltaspike.core.api.literal.DestroyedLiteral; +import org.apache.deltaspike.core.api.literal.InitializedLiteral; /** * This class listens for servlet context events and forwards them to the CDI event bus. http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ad9ed6d5/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/event/EventBridgeFilter.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/event/EventBridgeFilter.java b/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/event/EventBridgeFilter.java index 905bc29..f75a174 100644 --- a/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/event/EventBridgeFilter.java +++ b/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/event/EventBridgeFilter.java @@ -27,8 +27,8 @@ import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; -import org.apache.deltaspike.servlet.api.literal.DestroyedLiteral; -import org.apache.deltaspike.servlet.api.literal.InitializedLiteral; +import org.apache.deltaspike.core.api.literal.DestroyedLiteral; +import org.apache.deltaspike.core.api.literal.InitializedLiteral; /** * This filter sends events to the CDI event bus when requests and responses get created and destroyed. http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ad9ed6d5/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/event/EventBridgeSessionListener.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/event/EventBridgeSessionListener.java b/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/event/EventBridgeSessionListener.java index bd1ed5d..8cf1281 100644 --- a/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/event/EventBridgeSessionListener.java +++ b/deltaspike/modules/servlet/impl/src/main/java/org/apache/deltaspike/servlet/impl/event/EventBridgeSessionListener.java @@ -21,8 +21,8 @@ package org.apache.deltaspike.servlet.impl.event; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; -import org.apache.deltaspike.servlet.api.literal.DestroyedLiteral; -import org.apache.deltaspike.servlet.api.literal.InitializedLiteral; +import org.apache.deltaspike.core.api.literal.DestroyedLiteral; +import org.apache.deltaspike.core.api.literal.InitializedLiteral; /** * This class listens for HTTP session events and forwards them to the CDI event bus. http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ad9ed6d5/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/context/ServletContextEventsObserver.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/context/ServletContextEventsObserver.java b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/context/ServletContextEventsObserver.java index bbca727..b2e5e3b 100644 --- a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/context/ServletContextEventsObserver.java +++ b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/context/ServletContextEventsObserver.java @@ -26,8 +26,8 @@ import javax.enterprise.context.ApplicationScoped; import javax.enterprise.event.Observes; import javax.servlet.ServletContext; -import org.apache.deltaspike.servlet.api.Destroyed; -import org.apache.deltaspike.servlet.api.Initialized; +import org.apache.deltaspike.core.api.lifecycle.Destroyed; +import org.apache.deltaspike.core.api.lifecycle.Initialized; /** * Application scoped observer which listens for {@link ServletContext} events on the CDI event bus. http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ad9ed6d5/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/request/RequestResponseEventsObserver.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/request/RequestResponseEventsObserver.java b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/request/RequestResponseEventsObserver.java index dde9d59..e908c4c 100644 --- a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/request/RequestResponseEventsObserver.java +++ b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/request/RequestResponseEventsObserver.java @@ -27,8 +27,8 @@ import javax.enterprise.event.Observes; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.deltaspike.servlet.api.Destroyed; -import org.apache.deltaspike.servlet.api.Initialized; +import org.apache.deltaspike.core.api.lifecycle.Destroyed; +import org.apache.deltaspike.core.api.lifecycle.Initialized; /** * Application scoped observer which listens for {@link HttpServletRequest} and {@link HttpServletResponse} events on http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ad9ed6d5/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/session/SessionEventsObserver.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/session/SessionEventsObserver.java b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/session/SessionEventsObserver.java index ea7bd5e..90a95f2 100644 --- a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/session/SessionEventsObserver.java +++ b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/session/SessionEventsObserver.java @@ -26,8 +26,8 @@ import javax.enterprise.context.ApplicationScoped; import javax.enterprise.event.Observes; import javax.servlet.http.HttpSession; -import org.apache.deltaspike.servlet.api.Destroyed; -import org.apache.deltaspike.servlet.api.Initialized; +import org.apache.deltaspike.core.api.lifecycle.Destroyed; +import org.apache.deltaspike.core.api.lifecycle.Initialized; /** * Application scoped observer which listens for {@link HttpSession} events on the CDI event bus.
