[webbeans-commits] Webbeans SVN: r1667 - in examples/trunk: se and 20 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Mon Feb 23 19:15:25 EST 2009


Author: peteroyle
Date: 2009-02-23 19:15:25 -0500 (Mon, 23 Feb 2009)
New Revision: 1667

Added:
   examples/trunk/se/
   examples/trunk/se/hello-world/
   examples/trunk/se/hello-world/nbactions.xml
   examples/trunk/se/hello-world/pom.xml
   examples/trunk/se/hello-world/src/
   examples/trunk/se/hello-world/src/etc/
   examples/trunk/se/hello-world/src/etc/header.txt
   examples/trunk/se/hello-world/src/main/
   examples/trunk/se/hello-world/src/main/java/
   examples/trunk/se/hello-world/src/main/java/org/
   examples/trunk/se/hello-world/src/main/java/org/jboss/
   examples/trunk/se/hello-world/src/main/java/org/jboss/webbeans/
   examples/trunk/se/hello-world/src/main/java/org/jboss/webbeans/environment/
   examples/trunk/se/hello-world/src/main/java/org/jboss/webbeans/environment/se/
   examples/trunk/se/hello-world/src/main/java/org/jboss/webbeans/environment/se/example/
   examples/trunk/se/hello-world/src/main/java/org/jboss/webbeans/environment/se/example/simple/
   examples/trunk/se/hello-world/src/main/java/org/jboss/webbeans/environment/se/example/simple/CommandLineArgsValidator.java
   examples/trunk/se/hello-world/src/main/java/org/jboss/webbeans/environment/se/example/simple/HelloWorld.java
   examples/trunk/se/hello-world/src/main/resources/
   examples/trunk/se/hello-world/src/main/resources/beans.xml
   examples/trunk/se/hello-world/src/main/resources/log4j.properties
   examples/trunk/se/hello-world/src/test/
   examples/trunk/se/hello-world/src/test/java/
   examples/trunk/se/hello-world/src/test/java/com/
   examples/trunk/se/hello-world/src/test/java/com/screamingcoder/
   examples/trunk/se/hello-world/src/test/java/com/screamingcoder/plebeians/
   examples/trunk/se/hello-world/src/test/java/com/screamingcoder/plebeians/example/
   examples/trunk/se/hello-world/src/test/java/com/screamingcoder/plebeians/example/helloworld/
   examples/trunk/se/hello-world/src/test/java/com/screamingcoder/plebeians/example/helloworld/AppTest.java
Log:
initial checkin of webbeans se module, hello world example

Added: examples/trunk/se/hello-world/nbactions.xml
===================================================================
--- examples/trunk/se/hello-world/nbactions.xml	                        (rev 0)
+++ examples/trunk/se/hello-world/nbactions.xml	2009-02-24 00:15:25 UTC (rev 1667)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    JBoss, Home of Professional Open Source
+    Copyright 2008, Red Hat Middleware LLC, and individual contributors
+    by the @authors tag. See the copyright.txt in the distribution for a
+    full listing of individual contributors.
+
+    Licensed 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.
+
+--><actions>
+        <action>
+            <actionName>run</actionName>
+            <goals>
+                <goal>process-classes</goal>
+                <goal>org.codehaus.mojo:exec-maven-plugin:1.1:exec</goal>
+            </goals>
+            <properties>
+                <exec.args>-classpath %classpath org.jboss.webbeans.environment.se.StartMain Possums</exec.args>
+                <exec.executable>java</exec.executable>
+            </properties>
+        </action>
+        <action>
+            <actionName>debug</actionName>
+            <goals>
+                <goal>process-classes</goal>
+                <goal>org.codehaus.mojo:exec-maven-plugin:1.1:exec</goal>
+            </goals>
+            <properties>
+                <exec.args>-Xdebug -Djava.compiler=none -Xnoagent -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath org.jboss.webbeans.environment.se.StartMain Possums</exec.args>
+                <jpda.listen>true</jpda.listen>
+                <exec.executable>java</exec.executable>
+            </properties>
+        </action>
+        <action>
+            <actionName>CUSTOM-Jalopy Format</actionName>
+            <displayName>Jalopy Format</displayName>
+            <goals>
+                <goal>jalopy:format</goal>
+            </goals>
+        </action>
+        <action>
+            <actionName>CUSTOM-License Format</actionName>
+            <displayName>License Format</displayName>
+            <goals>
+                <goal>license:format</goal>
+            </goals>
+        </action>
+    </actions>

Added: examples/trunk/se/hello-world/pom.xml
===================================================================
--- examples/trunk/se/hello-world/pom.xml	                        (rev 0)
+++ examples/trunk/se/hello-world/pom.xml	2009-02-24 00:15:25 UTC (rev 1667)
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+    <groupId>org.jboss.webbeans</groupId>
+    <artifactId>hello-world-se</artifactId>
+    <packaging>jar</packaging>
+    <version>1.0-SNAPSHOT</version>
+    <name>Hello World SE</name>
+    <url>http://maven.apache.org</url>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.0.2</version>
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>jalopy-maven-plugin</artifactId>
+                <version>1.0-alpha-1</version>
+                <!-- This wipes out UNDO in IDEs. Run manually instead.
+                <executions>
+                    <execution>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>format</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                -->
+            </plugin>
+            <plugin>
+                <groupId>com.google.code.maven-license-plugin</groupId>
+                <artifactId>maven-license-plugin</artifactId>
+                <version>1.4.0</version>
+                <configuration>
+                    <basedir>${basedir}</basedir>
+                    <header>${basedir}/src/etc/header.txt</header>
+                    <quiet>false</quiet>
+                    <failIfMissing>true</failIfMissing>
+                    <aggregate>false</aggregate>
+                    <encoding>UTF-8</encoding>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>format</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <repositories>
+        <repository>
+            <id>repository.jboss.org</id>
+            <name>JBoss Repository</name>
+            <url>http://repository.jboss.org/maven2</url>
+            <releases>
+            </releases>
+            <snapshots>
+                <enabled>false</enabled>
+            </snapshots>
+        </repository>
+        <repository>
+            <id>snapshots.jboss.org</id>
+            <name>JBoss Snapshots Repository</name>
+            <url>http://snapshots.jboss.org/maven2</url>
+            <releases>
+                <enabled>false</enabled>
+            </releases>
+            <snapshots>
+                <updatePolicy>always</updatePolicy>
+            </snapshots>
+        </repository>
+        <repository>
+            <id>repository.codehaus.org</id>
+            <name>Codehaus Repository</name>
+            <url>http://repository.codehaus.org</url>
+        </repository>
+    </repositories>
+    
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>3.8.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.webbeans</groupId>
+            <artifactId>se-module</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+</project>

Added: examples/trunk/se/hello-world/src/etc/header.txt
===================================================================
--- examples/trunk/se/hello-world/src/etc/header.txt	                        (rev 0)
+++ examples/trunk/se/hello-world/src/etc/header.txt	2009-02-24 00:15:25 UTC (rev 1667)
@@ -0,0 +1,14 @@
+JBoss, Home of Professional Open Source
+Copyright 2008, Red Hat Middleware LLC, and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+Licensed 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.

Added: examples/trunk/se/hello-world/src/main/java/org/jboss/webbeans/environment/se/example/simple/CommandLineArgsValidator.java
===================================================================
--- examples/trunk/se/hello-world/src/main/java/org/jboss/webbeans/environment/se/example/simple/CommandLineArgsValidator.java	                        (rev 0)
+++ examples/trunk/se/hello-world/src/main/java/org/jboss/webbeans/environment/se/example/simple/CommandLineArgsValidator.java	2009-02-24 00:15:25 UTC (rev 1667)
@@ -0,0 +1,61 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.webbeans.environment.se.example.simple;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.context.ApplicationScoped;
+import javax.inject.Current;
+import javax.inject.Initializer;
+import org.jboss.webbeans.environment.se.bindings.Parameters;
+
+/**
+ * Validates command line arguments, producing errors where applicable.
+ * @author Peter Royle
+ */
+ at ApplicationScoped
+public class CommandLineArgsValidator
+{
+
+    private @Parameters List<String> validParams;
+    private List<String> errors = new ArrayList<String>();
+
+    @Initializer
+    public void checkParameters()
+    {
+        if (validParams.size() != 1)
+        {
+            errors.add( "Please supply just one parameter: your first name" );
+            validParams.clear();
+        }
+    }
+
+    public boolean hasErrors()
+    {
+        return !this.errors.isEmpty();
+    }
+
+    public List<String> getErrors()
+    {
+        return errors;
+    }
+
+    public List<String> getValidParameters()
+    {
+        return validParams;
+    }
+}

Added: examples/trunk/se/hello-world/src/main/java/org/jboss/webbeans/environment/se/example/simple/HelloWorld.java
===================================================================
--- examples/trunk/se/hello-world/src/main/java/org/jboss/webbeans/environment/se/example/simple/HelloWorld.java	                        (rev 0)
+++ examples/trunk/se/hello-world/src/main/java/org/jboss/webbeans/environment/se/example/simple/HelloWorld.java	2009-02-24 00:15:25 UTC (rev 1667)
@@ -0,0 +1,48 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.webbeans.environment.se.example.simple;
+
+import javax.event.Observes;
+import javax.inject.Current;
+import javax.inject.manager.Deployed;
+import javax.inject.manager.Manager;
+
+/**
+ * @author Peter Royle
+ */
+public class HelloWorld
+{
+
+    @Current
+    CommandLineArgsValidator argsVlidator;
+
+    /**
+     * Prints a hello message using the first name.
+     * @param firstName The first name.
+     */
+    public void printHello( @Observes
+            @Deployed Manager manager )
+    {
+        if (!argsVlidator.hasErrors())
+        {
+            System.out.println( "Hello " + argsVlidator.getValidParameters().get( 0 ) );
+        } else
+        {
+            System.out.println( "Please provide just one argument: your first name" );
+        }
+    }
+}

Added: examples/trunk/se/hello-world/src/main/resources/beans.xml
===================================================================
--- examples/trunk/se/hello-world/src/main/resources/beans.xml	                        (rev 0)
+++ examples/trunk/se/hello-world/src/main/resources/beans.xml	2009-02-24 00:15:25 UTC (rev 1667)
@@ -0,0 +1,19 @@
+<!--
+
+    JBoss, Home of Professional Open Source
+    Copyright 2008, Red Hat Middleware LLC, and individual contributors
+    by the @authors tag. See the copyright.txt in the distribution for a
+    full listing of individual contributors.
+
+    Licensed 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>

Added: examples/trunk/se/hello-world/src/main/resources/log4j.properties
===================================================================
--- examples/trunk/se/hello-world/src/main/resources/log4j.properties	                        (rev 0)
+++ examples/trunk/se/hello-world/src/main/resources/log4j.properties	2009-02-24 00:15:25 UTC (rev 1667)
@@ -0,0 +1,25 @@
+#
+# JBoss, Home of Professional Open Source
+# Copyright 2008, Red Hat Middleware LLC, and individual contributors
+# by the @authors tag. See the copyright.txt in the distribution for a
+# full listing of individual contributors.
+#
+# Licensed 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.
+#
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=WARN, A1
+
+# A1 is set to be a ConsoleAppender.
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

Added: examples/trunk/se/hello-world/src/test/java/com/screamingcoder/plebeians/example/helloworld/AppTest.java
===================================================================
--- examples/trunk/se/hello-world/src/test/java/com/screamingcoder/plebeians/example/helloworld/AppTest.java	                        (rev 0)
+++ examples/trunk/se/hello-world/src/test/java/com/screamingcoder/plebeians/example/helloworld/AppTest.java	2009-02-24 00:15:25 UTC (rev 1667)
@@ -0,0 +1,54 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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 com.screamingcoder.plebeians.example.helloworld;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest
+    extends TestCase
+{
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public AppTest( String testName )
+    {
+        super( testName );
+    }
+
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite(  )
+    {
+        return new TestSuite( AppTest.class );
+    }
+
+    /**
+     * Rigourous Test :-)
+     */
+    public void testApp(  )
+    {
+        assertTrue( true );
+    }
+}




More information about the weld-commits mailing list