openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r938811 - in /openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample: bean/AppObject.java bean/ApplicationScopeProducer.java bean/LoginBean.java bindings/AppScopeBinding.java
Date Wed, 28 Apr 2010 07:44:14 GMT
Author: gerdogdu
Date: Wed Apr 28 07:44:14 2010
New Revision: 938811

URL: http://svn.apache.org/viewvc?rev=938811&view=rev
Log:
Adding example for ApplicationScoped producer method disposing

Added:
    openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bean/AppObject.java
  (with props)
    openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bean/ApplicationScopeProducer.java
  (with props)
    openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bindings/AppScopeBinding.java
  (with props)
Modified:
    openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bean/LoginBean.java

Added: openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bean/AppObject.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bean/AppObject.java?rev=938811&view=auto
==============================================================================
--- openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bean/AppObject.java
(added)
+++ openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bean/AppObject.java
Wed Apr 28 07:44:14 2010
@@ -0,0 +1,28 @@
+/*
+ * 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.webbeans.sample.bean;
+
+public class AppObject
+{
+    public boolean config = false;
+    public AppObject()
+    {
+        config = true;
+    }
+}

Propchange: openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bean/AppObject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bean/ApplicationScopeProducer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bean/ApplicationScopeProducer.java?rev=938811&view=auto
==============================================================================
--- openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bean/ApplicationScopeProducer.java
(added)
+++ openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bean/ApplicationScopeProducer.java
Wed Apr 28 07:44:14 2010
@@ -0,0 +1,46 @@
+/*
+ * 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.webbeans.sample.bean;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+import org.apache.webbeans.sample.bindings.AppScopeBinding;
+
+public class ApplicationScopeProducer
+{
+    
+    @AppScopeBinding
+    @Produces 
+    @ApplicationScoped 
+    @Named
+    public AppObject newObject()
+    {
+        AppObject object = new AppObject();
+        System.out.println("Creating AppObject : " + object.toString());
+        return object;
+    }
+    
+    public void dispose(@Disposes @AppScopeBinding AppObject object)
+    {
+        System.out.println("Disposing AppObject : " + object.toString());
+    }
+}

Propchange: openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bean/ApplicationScopeProducer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bean/LoginBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bean/LoginBean.java?rev=938811&r1=938810&r2=938811&view=diff
==============================================================================
--- openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bean/LoginBean.java
(original)
+++ openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bean/LoginBean.java
Wed Apr 28 07:44:14 2010
@@ -28,6 +28,7 @@ import javax.inject.Named;
 import javax.enterprise.inject.Produces;
 import javax.faces.application.FacesMessage;
 
+import org.apache.webbeans.sample.bindings.AppScopeBinding;
 import org.apache.webbeans.sample.bindings.LoggedInUser;
 import org.apache.webbeans.sample.dependent.LoginCheck;
 import org.apache.webbeans.sample.event.LoggedInEvent;
@@ -50,6 +51,8 @@ public class LoginBean
 	
 	private @Inject @Any Event<LoggedInEvent> event;
 	
+	private @Inject @AppScopeBinding AppObject applicationScopedString;
+	
 	public LoginBean()
 	{
 		
@@ -77,6 +80,7 @@ public class LoginBean
 	public void afterLoggedIn(@Observes LoggedInEvent event)
 	{
 		messageUtil.addMessage(FacesMessage.SEVERITY_INFO, "Login Successfull", "Login Successfull");
+		System.out.println("Application scoped string : " + applicationScopedString);
 	}
 	
 	

Added: openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bindings/AppScopeBinding.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bindings/AppScopeBinding.java?rev=938811&view=auto
==============================================================================
--- openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bindings/AppScopeBinding.java
(added)
+++ openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bindings/AppScopeBinding.java
Wed Apr 28 07:44:14 2010
@@ -0,0 +1,33 @@
+/*
+ *  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.webbeans.sample.bindings;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.FIELD,ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER})
+public @interface AppScopeBinding
+{
+
+}

Propchange: openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bindings/AppScopeBinding.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message