You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by ge...@apache.org on 2009/07/15 22:41:29 UTC

svn commit: r794407 - in /incubator/openwebbeans/trunk/samples/guess/src/main: java/org/apache/webbeans/sample/bean/EchoManaged.java java/org/apache/webbeans/sample/ejb/Echo.java java/org/apache/webbeans/sample/ejb/EchoBean.java webapp/echo.xhtml

Author: gerdogdu
Date: Wed Jul 15 20:41:29 2009
New Revision: 794407

URL: http://svn.apache.org/viewvc?rev=794407&view=rev
Log:
Another ejb example.

Added:
    incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bean/EchoManaged.java   (with props)
    incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/ejb/Echo.java   (with props)
    incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/ejb/EchoBean.java   (with props)
    incubator/openwebbeans/trunk/samples/guess/src/main/webapp/echo.xhtml   (with props)

Added: incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bean/EchoManaged.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bean/EchoManaged.java?rev=794407&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bean/EchoManaged.java (added)
+++ incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/bean/EchoManaged.java Wed Jul 15 20:41:29 2009
@@ -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.webbeans.sample.bean;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Current;
+import javax.enterprise.inject.Named;
+
+import org.apache.webbeans.sample.ejb.Echo;
+
+
+@RequestScoped
+@Named("echo")
+public class EchoManaged
+{
+    private @Current Echo echo;
+
+    private String text;
+    
+    private String name;
+    
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+
+    public String echo()
+    {
+        this.text = echo.echo(name);
+        
+        return null;
+    }
+
+    public String getText()
+    {
+        return text;
+    }
+
+    public void setText(String text)
+    {
+        this.text = text;
+    }
+    
+    
+}

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

Added: incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/ejb/Echo.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/ejb/Echo.java?rev=794407&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/ejb/Echo.java (added)
+++ incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/ejb/Echo.java Wed Jul 15 20:41:29 2009
@@ -0,0 +1,22 @@
+/*
+ * 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.ejb;
+
+import javax.ejb.Local;
+
+@Local
+public interface Echo
+{
+    public String echo(String name);    
+}

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

Added: incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/ejb/EchoBean.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/ejb/EchoBean.java?rev=794407&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/ejb/EchoBean.java (added)
+++ incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/ejb/EchoBean.java Wed Jul 15 20:41:29 2009
@@ -0,0 +1,32 @@
+/*
+ * 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.ejb;
+
+import javax.ejb.Stateless;
+import javax.enterprise.context.Dependent;
+import javax.interceptor.Interceptors;
+
+import org.apache.webbeans.ejb.interceptor.OpenWebBeansEjbInterceptor;
+
+@Stateless
+@Dependent
+@Interceptors(value=OpenWebBeansEjbInterceptor.class)
+public class EchoBean implements Echo
+{
+    public String echo(String name)
+    {
+        return "Hello " + name; 
+    }    
+
+}

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

Added: incubator/openwebbeans/trunk/samples/guess/src/main/webapp/echo.xhtml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/guess/src/main/webapp/echo.xhtml?rev=794407&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/guess/src/main/webapp/echo.xhtml (added)
+++ incubator/openwebbeans/trunk/samples/guess/src/main/webapp/echo.xhtml Wed Jul 15 20:41:29 2009
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+	
+	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.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:f="http://java.sun.com/jsf/core"
+    xmlns:h="http://java.sun.com/jsf/html"
+    xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<head>
+  <title>OpenWebBeans :: Examples :: EJB Sample</title>
+</head>
+
+<body>
+  
+  <div id="container">
+    <div id="content">
+		<h:messages globalOnly="false" showSummary="true" infoStyle="font-weight:bold;"></h:messages>
+		
+		<h:form id="form">
+						
+			<div style="border:1px solid black;margin: 25px 75px;">
+			
+				<h:panelGrid columns="2">
+					
+					<h:outputLabel for="text">
+						<h:outputText value="Your Name : "></h:outputText>
+					</h:outputLabel>
+					<h:inputText id="text" value="#{echo.name}" required="true" requiredMessage="Please give a name!"></h:inputText>
+										
+					<h:commandButton action="#{echo.echo}" value="Echo..."></h:commandButton>
+					
+					<f:verbatim/>
+					<h:outputText value="#{echo.text}"></h:outputText>
+					
+				</h:panelGrid>				
+			</div>
+		</h:form>
+	    </div>
+    
+  </div>
+</body>
+</html>
\ No newline at end of file

Propchange: incubator/openwebbeans/trunk/samples/guess/src/main/webapp/echo.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native