You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2018/02/21 09:39:02 UTC

[isis] 01/04: ISIS-1756 JEE 7+ Isis App life-cycling

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch ISIS-1779-jax-rs-2
in repository https://gitbox.apache.org/repos/asf/isis.git

commit f9f9031422938aedad90b0babe3e2fe7ff43f399
Author: Andi Huber <ah...@apache.org>
AuthorDate: Sun Oct 29 09:29:38 2017 +0100

    ISIS-1756 JEE 7+ Isis App life-cycling
---
 .../webapp/jee/IsisDomainAppLifecycleBean.java     | 61 ++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/core/runtime/src/main/java/org/apache/isis/core/webapp/jee/IsisDomainAppLifecycleBean.java b/core/runtime/src/main/java/org/apache/isis/core/webapp/jee/IsisDomainAppLifecycleBean.java
new file mode 100644
index 0000000..07881e3
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/isis/core/webapp/jee/IsisDomainAppLifecycleBean.java
@@ -0,0 +1,61 @@
+/*
+ * 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.isis.core.webapp.jee;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.ejb.Singleton;
+import javax.ejb.Startup;
+import javax.enterprise.context.ApplicationScoped;
+
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * 
+ * JEE singleton that hooks into an Isis-Application's life-cycle. 
+ * 
+ * <p>
+ * This CDI managed Bean ensures proper destruction of Isis's context.
+ * </p>
+ * 
+ * @author ahuber@apache.org
+ *
+ */
+@Singleton
+@Startup
+@ApplicationScoped
+public class IsisDomainAppLifecycleBean {
+
+	private static final Logger log = LoggerFactory.getLogger(IsisDomainAppLifecycleBean.class);
+	
+	@PostConstruct
+	public void init() {
+		log.info("initializing ...");
+	}
+	
+	@PreDestroy
+	public void destroy() {
+		IsisContext.destroy();
+		log.info("detroyed.");
+	}
+	
+}

-- 
To stop receiving notification emails like this one, please contact
ahuber@apache.org.