You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2022/12/23 20:26:43 UTC
[myfaces] branch main updated: fixed quarkus compile errors
This is an automated email from the ASF dual-hosted git repository.
tandraschko pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/myfaces.git
The following commit(s) were added to refs/heads/main by this push:
new c65508027 fixed quarkus compile errors
c65508027 is described below
commit c65508027ed8259f252927a27d3c211d8c9f5f17
Author: tandraschko <ta...@apache.org>
AuthorDate: Fri Dec 23 21:26:36 2022 +0100
fixed quarkus compile errors
---
extensions/quarkus/pom.xml | 2 --
extensions/quarkus/showcase/pom.xml | 4 +--
.../org/apache/myfaces/cdi/FacesScopeContext.java | 19 ++++++++++++++
.../apache/myfaces/cdi/view/ViewScopeContext.java | 19 ++++++++++++++
.../cdi/view/ViewTransientScopeContext.java | 24 ++++++++++++++++++
.../apache/myfaces/flow/cdi/FlowScopeContext.java | 29 ++++++++++++++++++++++
6 files changed, 93 insertions(+), 4 deletions(-)
diff --git a/extensions/quarkus/pom.xml b/extensions/quarkus/pom.xml
index a7d5169a9..087b0aef2 100644
--- a/extensions/quarkus/pom.xml
+++ b/extensions/quarkus/pom.xml
@@ -37,9 +37,7 @@
<modules>
<module>deployment</module>
<module>runtime</module>
- <!--
<module>showcase</module>
- -->
</modules>
<properties>
diff --git a/extensions/quarkus/showcase/pom.xml b/extensions/quarkus/showcase/pom.xml
index e32bd6d5c..02ea0fbc8 100644
--- a/extensions/quarkus/showcase/pom.xml
+++ b/extensions/quarkus/showcase/pom.xml
@@ -25,8 +25,8 @@
<name>Apache MyFaces Core 4.0 - Extensions - Quarkus - Showcase</name>
<properties>
- <quarkus.version>2.12.2.Final</quarkus.version>
- <myfaces.version>2.3-next-SNAPSHOT</myfaces.version>
+ <quarkus.version>3.0.0.Alpha2</quarkus.version>
+ <myfaces.version>4.0.0-SNAPSHOT</myfaces.version>
<failsafe.version>2.22.0</failsafe.version>
<surefire.version>2.22.0</surefire.version>
diff --git a/impl/src/main/java/org/apache/myfaces/cdi/FacesScopeContext.java b/impl/src/main/java/org/apache/myfaces/cdi/FacesScopeContext.java
index 2a4e22a48..a9762e41c 100644
--- a/impl/src/main/java/org/apache/myfaces/cdi/FacesScopeContext.java
+++ b/impl/src/main/java/org/apache/myfaces/cdi/FacesScopeContext.java
@@ -147,6 +147,25 @@ public class FacesScopeContext implements Context
return storage;
}
+ public boolean destroy(Contextual bean)
+ {
+ ContextualStorage storage = getContextualStorage(false, FacesContext.getCurrentInstance());
+ if (storage == null)
+ {
+ return false;
+ }
+
+ ContextualInstanceInfo<?> contextualInstanceInfo = storage.getStorage().get(storage.getBeanKey(bean));
+ if (contextualInstanceInfo == null)
+ {
+ return false;
+ }
+
+ bean.destroy(contextualInstanceInfo.getContextualInstance(), contextualInstanceInfo.getCreationalContext());
+
+ return true;
+ }
+
public static void destroyAll(FacesContext facesContext)
{
if (facesContext == null)
diff --git a/impl/src/main/java/org/apache/myfaces/cdi/view/ViewScopeContext.java b/impl/src/main/java/org/apache/myfaces/cdi/view/ViewScopeContext.java
index 904961426..ef828cd37 100644
--- a/impl/src/main/java/org/apache/myfaces/cdi/view/ViewScopeContext.java
+++ b/impl/src/main/java/org/apache/myfaces/cdi/view/ViewScopeContext.java
@@ -185,6 +185,25 @@ public class ViewScopeContext implements Context
}
}
+ public boolean destroy(Contextual bean)
+ {
+ ViewScopeContextualStorage storage = getContextualStorage(FacesContext.getCurrentInstance(), false);
+ if (storage == null)
+ {
+ return false;
+ }
+
+ ContextualInstanceInfo<?> contextualInstanceInfo = storage.getStorage().get(storage.getBeanKey(bean));
+ if (contextualInstanceInfo == null)
+ {
+ return false;
+ }
+
+ bean.destroy(contextualInstanceInfo.getContextualInstance(), contextualInstanceInfo.getCreationalContext());
+
+ return true;
+ }
+
public static void destroyAll(FacesContext facesContext)
{
ViewScopeContextualStorageHolder storageHolder = ViewScopeContextualStorageHolder.getInstance(facesContext);
diff --git a/impl/src/main/java/org/apache/myfaces/cdi/view/ViewTransientScopeContext.java b/impl/src/main/java/org/apache/myfaces/cdi/view/ViewTransientScopeContext.java
index 67b02be92..9ba9b34ff 100644
--- a/impl/src/main/java/org/apache/myfaces/cdi/view/ViewTransientScopeContext.java
+++ b/impl/src/main/java/org/apache/myfaces/cdi/view/ViewTransientScopeContext.java
@@ -162,6 +162,30 @@ public class ViewTransientScopeContext implements Context
}
}
+ /**
+ * Destroy the Contextual Instance of the given Bean.
+ * @param bean dictates which bean shall get cleaned up
+ * @return <code>true</code> if the bean was destroyed, <code>false</code> if there was no such bean.
+ */
+ public boolean destroy(Contextual bean)
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ ContextualStorage storage = getContextualStorage(false, facesContext);
+ if (storage == null)
+ {
+ return false;
+ }
+ ContextualInstanceInfo<?> contextualInstanceInfo = storage.getStorage().get(storage.getBeanKey(bean));
+
+ if (contextualInstanceInfo == null)
+ {
+ return false;
+ }
+
+ bean.destroy(contextualInstanceInfo.getContextualInstance(), contextualInstanceInfo.getCreationalContext());
+ return true;
+ }
+
public static void destroyAll(FacesContext facesContext)
{
if (facesContext == null
diff --git a/impl/src/main/java/org/apache/myfaces/flow/cdi/FlowScopeContext.java b/impl/src/main/java/org/apache/myfaces/flow/cdi/FlowScopeContext.java
index d0ee3b63f..e88be9c21 100644
--- a/impl/src/main/java/org/apache/myfaces/flow/cdi/FlowScopeContext.java
+++ b/impl/src/main/java/org/apache/myfaces/flow/cdi/FlowScopeContext.java
@@ -287,6 +287,35 @@ public class FlowScopeContext implements Context
return getStorageHolder(context).getContextualStorage(clientWindowFlowId, createIfNotExist);
}
+ /**
+ * Destroy the Contextual Instance of the given Bean.
+ * @param bean dictates which bean shall get cleaned up
+ * @return <code>true</code> if the bean was destroyed, <code>false</code> if there was no such bean.
+ */
+ public boolean destroy(Contextual bean)
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ List<String> activeFlowMapKeys = getStorageHolder(facesContext).getActiveFlowMapKeys(facesContext);
+ for (String flowMapKey : activeFlowMapKeys)
+ {
+ ContextualStorage storage = getContextualStorage(facesContext, false, flowMapKey);
+ if (storage == null)
+ {
+ continue;
+ }
+ ContextualInstanceInfo<?> contextualInstanceInfo = storage.getStorage().get(storage.getBeanKey(bean));
+
+ if (contextualInstanceInfo == null)
+ {
+ continue;
+ }
+
+ bean.destroy(contextualInstanceInfo.getContextualInstance(), contextualInstanceInfo.getCreationalContext());
+ return true;
+ }
+ return false;
+ }
+
public static void destroyAll(FacesContext facesContext)
{
FlowScopeContextualStorageHolder manager = FlowScopeContextualStorageHolder.getInstance(facesContext);