openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r826477 - in /incubator/openwebbeans/trunk/samples/standalone-sample: ./ src/ src/assembly/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/webbeans/ src/main/java/org/apache/webbeans/se/ src/m...
Date Sun, 18 Oct 2009 18:10:47 GMT
Author: gerdogdu
Date: Sun Oct 18 18:10:46 2009
New Revision: 826477

URL: http://svn.apache.org/viewvc?rev=826477&view=rev
Log:
OpenWebBeans Java SE Standalone Example

Added:
    incubator/openwebbeans/trunk/samples/standalone-sample/
    incubator/openwebbeans/trunk/samples/standalone-sample/pom.xml   (with props)
    incubator/openwebbeans/trunk/samples/standalone-sample/src/
    incubator/openwebbeans/trunk/samples/standalone-sample/src/assembly/
    incubator/openwebbeans/trunk/samples/standalone-sample/src/assembly/dist-binary.xml  
(with props)
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Boot.java
  (with props)
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Controller.java
  (with props)
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/LoggerFactory.java
  (with props)
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Login.java
  (with props)
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/beans/
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/beans/FileLogin.java
  (with props)
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/beans/JavaLoggerFactory.java
  (with props)
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/bindings/
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/bindings/FileLoginBinding.java
  (with props)
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/bindings/JavaLogger.java
  (with props)
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/gui/
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/gui/LoginWindow.java
  (with props)
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/resources/
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/resources/META-INF/
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/resources/META-INF/beans.xml
  (with props)
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/resources/META-INF/openwebbeans/
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
  (with props)
    incubator/openwebbeans/trunk/samples/standalone-sample/src/main/resources/login.properties
  (with props)
    incubator/openwebbeans/trunk/samples/standalone-sample/src/test/
    incubator/openwebbeans/trunk/samples/standalone-sample/src/test/java/
    incubator/openwebbeans/trunk/samples/standalone-sample/src/test/resources/

Added: incubator/openwebbeans/trunk/samples/standalone-sample/pom.xml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/standalone-sample/pom.xml?rev=826477&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/standalone-sample/pom.xml (added)
+++ incubator/openwebbeans/trunk/samples/standalone-sample/pom.xml Sun Oct 18 18:10:46 2009
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+	<!--
+
+		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.
+	-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.apache.openwebbeans</groupId>
+		<artifactId>openwebbeans</artifactId>
+		<version>1.0.0-incubating-SNAPSHOT</version>
+	</parent>
+	<artifactId>standalone-sample</artifactId>
+	<name>Apache OpenWebBeans :: OpenWebBeans Java SE Sample</name>
+	<packaging>jar</packaging>
+	<description>Java SE Sample</description>
+
+	<dependencies>
+
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.openwebbeans</groupId>
+			<artifactId>openwebbeans-impl</artifactId>
+			<version>1.0.0-incubating-SNAPSHOT</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.geronimo.specs</groupId>
+			<artifactId>geronimo-el_1.0_spec</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.geronimo.specs</groupId>
+			<artifactId>geronimo-interceptor_3.0_spec</artifactId>
+			<optional>true</optional>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.geronimo.specs</groupId>
+			<artifactId>geronimo-jta_1.1_spec</artifactId>
+			<optional>true</optional>
+		</dependency>
+
+	</dependencies>
+
+	<build>
+		<plugins>
+
+			<plugin>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifest>
+                            <mainClass>org.apache.webbeans.se.sample.Boot</mainClass>
+                            <addClasspath>true</addClasspath>
+                        </manifest>
+                    </archive>
+                </configuration>
+            </plugin>
+
+			<plugin>
+				<artifactId>maven-assembly-plugin</artifactId>
+				<configuration>
+					<descriptors>
+						<descriptor>src/assembly/dist-binary.xml</descriptor>
+					</descriptors>
+					<finalName>standalone-sample</finalName>
+					<appendAssemblyId>false</appendAssemblyId>
+				</configuration>
+				<executions>
+					<execution>
+						<id>make-assembly</id><!-- this is used for inheritance merges -->
+						<phase>package</phase><!-- append to the packaging phase. -->
+						<goals>
+							<goal>attached</goal><!-- goals == mojos -->
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+
+
+		</plugins>
+	</build>
+
+</project>

Propchange: incubator/openwebbeans/trunk/samples/standalone-sample/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/standalone-sample/src/assembly/dist-binary.xml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/standalone-sample/src/assembly/dist-binary.xml?rev=826477&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/standalone-sample/src/assembly/dist-binary.xml (added)
+++ incubator/openwebbeans/trunk/samples/standalone-sample/src/assembly/dist-binary.xml Sun
Oct 18 18:10:46 2009
@@ -0,0 +1,64 @@
+<!--
+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.
+-->
+<assembly xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/assembly-1.1.0-SNAPSHOT.xsd">
+
+
+    <id>binary</id>
+    <formats>
+        <format>jar</format>
+    </formats>
+
+    <includeBaseDirectory>false</includeBaseDirectory>
+
+    <dependencySets>
+		
+		<dependencySet>
+            <outputDirectory/>
+            <includes>
+                <include>org.apache.openwebbeans:standalone-sample</include>
+            </includes>
+        </dependencySet>
+		
+		
+        <dependencySet>
+            <outputDirectory></outputDirectory>
+            <includes>
+                <include>org.apache.openwebbeans:atinject-api</include>
+                <include>org.apache.openwebbeans:openwebbeans-api</include>
+                <include>org.apache.openwebbeans:openwebbeans-impl</include>
+                <include>org.apache.geronimo.specs:geronimo-el_1.0_spec</include>
+				<include>org.apache.geronimo.specs:geronimo-interceptor_3.0_spec</include>
+				<include>org.apache.geronimo.specs:geronimo-jta_1.1_spec</include>
+				<include>log4j:log4j</include>
+				<include>dom4j:dom4j</include>
+				<include>javassist:javassist</include>
+				<include>net.sf.scannotation:scannotation</include>
+            </includes>
+	    <excludes>
+			<exclude>org.apache.openwebbeans:atinject-api:jar:sources</exclude>
+			<exclude>org.apache.openwebbeans:openwebbeans-api:jar:sources</exclude>
+			<exclude>org.apache.openwebbeans:openwebbeans-impl:jar:sources</exclude>
+	    </excludes>
+        </dependencySet>
+
+
+    </dependencySets>
+
+
+</assembly>

Propchange: incubator/openwebbeans/trunk/samples/standalone-sample/src/assembly/dist-binary.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Boot.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Boot.java?rev=826477&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Boot.java
(added)
+++ incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Boot.java
Sun Oct 18 18:10:46 2009
@@ -0,0 +1,102 @@
+/*
+ * 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.se.sample;
+
+import java.awt.BorderLayout;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.swing.JFrame;
+
+import org.apache.webbeans.lifecycle.LifecycleFactory;
+import org.apache.webbeans.se.sample.gui.LoginWindow;
+import org.apache.webbeans.spi.Lifecycle;
+
+public class Boot
+{
+    private static Lifecycle lifecycle = null;
+    
+    private static JFrame frame = null;
+    
+    private static void boot(Object startupObject) throws Exception
+    {
+        try
+        {
+            lifecycle = LifecycleFactory.getInstance().getLifecycle();
+            lifecycle.applicationStarted(startupObject);
+            
+        }catch(Exception e)
+        {
+            throw e;
+        }        
+    }
+    
+    private static void shutdown(Object endObject) throws Exception
+    {
+        try
+        {
+            lifecycle = LifecycleFactory.getInstance().getLifecycle();
+            lifecycle.applicationEnded(endObject);
+            
+        }catch(Exception e)
+        {
+            throw e;
+        }
+        
+    }
+    
+    
+    public static void main(String[] args) throws Exception
+    {
+        boot(null);
+     
+        frame = new JFrame();
+        
+        BeanManager beanManager = lifecycle.getBeanManager();
+        Bean<?> bean = beanManager.getBeans("loginWindow").iterator().next();
+        
+        LoginWindow loginWindow = (LoginWindow) lifecycle.getBeanManager().getReference(bean,
LoginWindow.class, beanManager.createCreationalContext(bean));
+        
+        frame.setTitle("OWB @ Java-SE");
+        frame.add(loginWindow,BorderLayout.CENTER);        
+        frame.setLocation(400, 300);        
+        frame.addWindowListener(new WindowAdapter(){
+
+            @Override
+            public void windowClosed(WindowEvent e)
+            {
+                try
+                {
+                    Boot.shutdown(e);
+                }
+                catch (Exception e1)
+                {
+                    e1.printStackTrace();
+                }
+            }            
+            
+        });
+        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+        frame.pack();
+        frame.setVisible(true);
+        
+    }
+    
+    public static JFrame getFrame()
+    {
+        return frame;
+    }
+}

Propchange: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Boot.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Controller.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Controller.java?rev=826477&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Controller.java
(added)
+++ incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Controller.java
Sun Oct 18 18:10:46 2009
@@ -0,0 +1,20 @@
+/*
+ * 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.se.sample;
+
+public class Controller
+{
+    
+
+}

Propchange: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Controller.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/LoggerFactory.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/LoggerFactory.java?rev=826477&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/LoggerFactory.java
(added)
+++ incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/LoggerFactory.java
Sun Oct 18 18:10:46 2009
@@ -0,0 +1,19 @@
+/*
+ * 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.se.sample;
+
+public interface LoggerFactory
+{
+    public <T> T getLogger(Class<?> logger, Class<T> loggerType);
+}

Propchange: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/LoggerFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Login.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Login.java?rev=826477&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Login.java
(added)
+++ incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Login.java
Sun Oct 18 18:10:46 2009
@@ -0,0 +1,21 @@
+/*
+ * 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.se.sample;
+
+public interface Login
+{
+    public boolean login(String userName, char[] password);
+
+    public void logout();
+}

Propchange: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/Login.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/beans/FileLogin.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/beans/FileLogin.java?rev=826477&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/beans/FileLogin.java
(added)
+++ incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/beans/FileLogin.java
Sun Oct 18 18:10:46 2009
@@ -0,0 +1,70 @@
+/*
+ * 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.se.sample.beans;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Properties;
+
+import javax.inject.Singleton;
+
+import org.apache.webbeans.se.sample.Login;
+import org.apache.webbeans.se.sample.bindings.FileLoginBinding;
+
+@FileLoginBinding
+@Singleton
+public class FileLogin implements Login
+{
+    private static Properties properties = null;
+
+    static
+    {
+        properties = new Properties();
+        try
+        {
+            properties.load(FileLogin.class.getResourceAsStream("/login.properties"));
+        }
+        catch (IOException e)
+        {
+            e.printStackTrace();
+        }
+    }
+    
+    @Override
+    public void logout()
+    {
+        
+    }
+
+    @Override
+    public boolean login(String userName, char[] password)
+    {
+        Object value = properties.get(userName);
+        if(value == null)
+        {
+            return false;
+        }
+        
+        char[] pass = value.toString().toCharArray();
+        
+        if(Arrays.equals(pass, password))
+        {
+            Arrays.fill(pass, '0');
+            return true;
+        }
+        
+        return false;
+    }
+
+}

Propchange: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/beans/FileLogin.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/beans/JavaLoggerFactory.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/beans/JavaLoggerFactory.java?rev=826477&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/beans/JavaLoggerFactory.java
(added)
+++ incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/beans/JavaLoggerFactory.java
Sun Oct 18 18:10:46 2009
@@ -0,0 +1,34 @@
+/*
+ * 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.se.sample.beans;
+
+import java.util.logging.Logger;
+
+import javax.inject.Singleton;
+
+import org.apache.webbeans.se.sample.LoggerFactory;
+import org.apache.webbeans.se.sample.bindings.JavaLogger;
+
+@JavaLogger
+@Singleton
+public class JavaLoggerFactory implements LoggerFactory
+{
+
+    public <T> T getLogger(Class<?> clazz, Class<T> type)
+    {
+        Object logger = Logger.getLogger(clazz.getName());
+        
+        return type.cast(logger);
+    }
+}

Propchange: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/beans/JavaLoggerFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/bindings/FileLoginBinding.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/bindings/FileLoginBinding.java?rev=826477&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/bindings/FileLoginBinding.java
(added)
+++ incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/bindings/FileLoginBinding.java
Sun Oct 18 18:10:46 2009
@@ -0,0 +1,30 @@
+/*
+ * 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.se.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 FileLoginBinding 
+{
+
+}

Propchange: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/bindings/FileLoginBinding.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/bindings/JavaLogger.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/bindings/JavaLogger.java?rev=826477&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/bindings/JavaLogger.java
(added)
+++ incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/bindings/JavaLogger.java
Sun Oct 18 18:10:46 2009
@@ -0,0 +1,30 @@
+/*
+ * 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.se.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 JavaLogger 
+{
+
+}

Propchange: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/bindings/JavaLogger.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/gui/LoginWindow.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/gui/LoginWindow.java?rev=826477&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/gui/LoginWindow.java
(added)
+++ incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/gui/LoginWindow.java
Sun Oct 18 18:10:46 2009
@@ -0,0 +1,125 @@
+/*
+ * 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.se.sample.gui;
+
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Arrays;
+import java.util.logging.Logger;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JPasswordField;
+import javax.swing.JTextField;
+
+import org.apache.webbeans.se.sample.Boot;
+import org.apache.webbeans.se.sample.LoggerFactory;
+import org.apache.webbeans.se.sample.Login;
+import org.apache.webbeans.se.sample.bindings.FileLoginBinding;
+import org.apache.webbeans.se.sample.bindings.JavaLogger;
+
+@Named
+public class LoginWindow extends JPanel
+{
+    private static final long serialVersionUID = 3330746610475053600L;
+
+    @Inject @FileLoginBinding Login loginBean; 
+    
+    private JLabel lblUserName;
+    
+    private JLabel lblPassword;
+    
+    private JTextField txtUserName;
+    
+    private JPasswordField txtPassword;
+    
+    private JButton btnLogin;
+    
+    private JButton btnCancel;
+    
+    private Logger logger = null;
+    
+    @Inject
+    public LoginWindow(@JavaLogger LoggerFactory loggerFactory)
+    {
+        logger = loggerFactory.getLogger(LoginWindow.class, Logger.class);
+        
+        setBorder(BorderFactory.createTitledBorder("Login Information"));
+        initialize();
+    }
+    
+    public void initialize()
+    {
+        GridLayout gridLayout = new GridLayout(3,2,3,5);
+        setLayout(gridLayout);
+        
+        lblUserName = new JLabel("User Name : ");
+        add(lblUserName);
+        
+        txtUserName = new JTextField(10);
+        add(txtUserName);
+        
+        lblPassword = new JLabel("Password : ");
+        add(lblPassword);
+        
+        txtPassword =  new JPasswordField(10);
+        add(txtPassword);
+        
+        btnLogin = new JButton("Login");
+        add(btnLogin);
+        
+        btnLogin.addActionListener(new ActionListener(){
+
+            @Override
+            public void actionPerformed(ActionEvent e)
+            {
+                LoginWindow.this.logger.info("Starting to login with user name : " + txtUserName.getText().trim());
+                
+                char[] passwd = txtPassword.getPassword();
+                boolean result = LoginWindow.this.loginBean.login(txtUserName.getText().trim(),
passwd);
+                Arrays.fill(passwd, '0');
+                
+                if(!result)
+                {
+                    JOptionPane.showMessageDialog(null, "Wrong password or user name, try
again with 'gurkan:erdogdu','mark:struberg','david.blevins'");
+                }
+                else
+                {
+                    JOptionPane.showMessageDialog(null, "This demo shows simple usage of
OpenWebBeans in Java Swing client. OpenWebBeans, 2009");
+                }
+            }
+            
+        });
+        
+        btnCancel = new JButton("Cancel");
+        
+        btnCancel.addActionListener(new ActionListener(){
+
+            @Override
+            public void actionPerformed(ActionEvent e)
+            {
+                Boot.getFrame().dispose();
+            }
+            
+        });
+        
+        add(btnCancel);
+    }
+}

Propchange: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/gui/LoginWindow.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/resources/META-INF/beans.xml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/standalone-sample/src/main/resources/META-INF/beans.xml?rev=826477&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/standalone-sample/src/main/resources/META-INF/beans.xml
(added)
+++ incubator/openwebbeans/trunk/samples/standalone-sample/src/main/resources/META-INF/beans.xml
Sun Oct 18 18:10:46 2009
@@ -0,0 +1,17 @@
+	<!--
+
+		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.
+	-->
+	<beans></beans>
\ No newline at end of file

Propchange: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/resources/META-INF/beans.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/standalone-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties?rev=826477&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/standalone-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
(added)
+++ incubator/openwebbeans/trunk/samples/standalone-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
Sun Oct 18 18:10:46 2009
@@ -0,0 +1,42 @@
+#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.
+
+#---------------------------------------------------------------
+# The default configuration for OpenWebBeans
+#
+# The default configuration is intended for a JDK and a simple ServletContainer
+# like jetty, resin or tomcat.
+# 
+#---------------------------------------------------------------
+
+#general configuration section
+
+
+# the service section:
+# The key is the Interface, the value the implementation of the service
+
+# use the static HashMap instead of storing objects in JNDI as default  
+org.apache.webbeans.spi.JNDIService=org.apache.webbeans.spi.se.JNDIServiceStaticImpl
+
+# lookup the javax.transaction.TransactionManager via JNDI as default 
+org.apache.webbeans.spi.TransactionService=org.apache.webbeans.spi.se.TransactionServiceNonJTA
+
+#use the web metadata as default
+org.apache.webbeans.spi.deployer.MetaDataDiscoveryService=org.apache.webbeans.spi.se.deployer.MetaDataDiscoveryStandard
+
+#Lifecycle to start container
+org.apache.webbeans.spi.Lifecycle=org.apache.webbeans.lifecycle.StandaloneLifeCycle
\ No newline at end of file

Propchange: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/resources/META-INF/openwebbeans/openwebbeans.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/resources/login.properties
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/standalone-sample/src/main/resources/login.properties?rev=826477&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/samples/standalone-sample/src/main/resources/login.properties
(added)
+++ incubator/openwebbeans/trunk/samples/standalone-sample/src/main/resources/login.properties
Sun Oct 18 18:10:46 2009
@@ -0,0 +1,19 @@
+#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.
+gurkan=erdogdu
+mark=struberg
+david=blevins
\ No newline at end of file

Propchange: incubator/openwebbeans/trunk/samples/standalone-sample/src/main/resources/login.properties
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message