tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andygumbre...@apache.org
Subject [06/33] tomee git commit: Align SNAPSHOT versions & reformat examples
Date Fri, 25 Sep 2015 10:42:41 GMT
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-webservice/src/main/java/org/superbiz/calculator/ws/CalculatorWs.java
----------------------------------------------------------------------
diff --git a/examples/simple-webservice/src/main/java/org/superbiz/calculator/ws/CalculatorWs.java b/examples/simple-webservice/src/main/java/org/superbiz/calculator/ws/CalculatorWs.java
index d6e633f..b8e37c3 100644
--- a/examples/simple-webservice/src/main/java/org/superbiz/calculator/ws/CalculatorWs.java
+++ b/examples/simple-webservice/src/main/java/org/superbiz/calculator/ws/CalculatorWs.java
@@ -1,27 +1,27 @@
-/**
- * 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.superbiz.calculator.ws;
-
-import javax.jws.WebService;
-
-@WebService(targetNamespace = "http://superbiz.org/wsdl")
-public interface CalculatorWs {
-
-    public int sum(int add1, int add2);
-
-    public int multiply(int mul1, int mul2);
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.superbiz.calculator.ws;
+
+import javax.jws.WebService;
+
+@WebService(targetNamespace = "http://superbiz.org/wsdl")
+public interface CalculatorWs {
+
+    public int sum(int add1, int add2);
+
+    public int multiply(int mul1, int mul2);
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/simple-webservice/src/test/java/org/superbiz/calculator/ws/CalculatorTest.java
----------------------------------------------------------------------
diff --git a/examples/simple-webservice/src/test/java/org/superbiz/calculator/ws/CalculatorTest.java b/examples/simple-webservice/src/test/java/org/superbiz/calculator/ws/CalculatorTest.java
index 7ea0cce..426c97a 100644
--- a/examples/simple-webservice/src/test/java/org/superbiz/calculator/ws/CalculatorTest.java
+++ b/examples/simple-webservice/src/test/java/org/superbiz/calculator/ws/CalculatorTest.java
@@ -1,62 +1,62 @@
-/**
- * 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.superbiz.calculator.ws;
-
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import javax.ejb.embeddable.EJBContainer;
-import javax.xml.namespace.QName;
-import javax.xml.ws.Service;
-import java.net.URL;
-import java.util.Properties;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-public class CalculatorTest {
-
-	//Random port to avoid test conflicts
-    private static final int port = Integer.parseInt(System.getProperty("httpejbd.port", "" + org.apache.openejb.util.NetworkUtil.getNextAvailablePort()));
-
-    @BeforeClass
-    public static void setUp() throws Exception {
-        Properties properties = new Properties();
-        properties.setProperty("openejb.embedded.remotable", "true");
-		
-		//Just for this test we change the default port from 4204 to avoid conflicts
-		properties.setProperty("httpejbd.port", "" + port);
-		
-        // properties.setProperty("httpejbd.print", "true");
-        // properties.setProperty("httpejbd.indent.xml", "true");
-        // properties.setProperty("logging.level.OpenEJB.server.http", "FINE");
-        EJBContainer.createEJBContainer(properties);
-    }
-
-    @Test
-    public void test() throws Exception {
-        Service calculatorService = Service.create(
-                                                      new URL("http://localhost:" + port + "/simple-webservice/Calculator?wsdl"),
-                                                      new QName("http://superbiz.org/wsdl", "CalculatorService"));
-
-        assertNotNull(calculatorService);
-
-        CalculatorWs calculator = calculatorService.getPort(CalculatorWs.class);
-        assertEquals(10, calculator.sum(4, 6));
-        assertEquals(12, calculator.multiply(3, 4));
-    }
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.superbiz.calculator.ws;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import java.net.URL;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class CalculatorTest {
+
+    //Random port to avoid test conflicts
+    private static final int port = Integer.parseInt(System.getProperty("httpejbd.port", "" + org.apache.openejb.util.NetworkUtil.getNextAvailablePort()));
+
+    @BeforeClass
+    public static void setUp() throws Exception {
+        Properties properties = new Properties();
+        properties.setProperty("openejb.embedded.remotable", "true");
+
+        //Just for this test we change the default port from 4204 to avoid conflicts
+        properties.setProperty("httpejbd.port", "" + port);
+
+        // properties.setProperty("httpejbd.print", "true");
+        // properties.setProperty("httpejbd.indent.xml", "true");
+        // properties.setProperty("logging.level.OpenEJB.server.http", "FINE");
+        EJBContainer.createEJBContainer(properties);
+    }
+
+    @Test
+    public void test() throws Exception {
+        Service calculatorService = Service.create(
+                new URL("http://localhost:" + port + "/simple-webservice/Calculator?wsdl"),
+                new QName("http://superbiz.org/wsdl", "CalculatorService"));
+
+        assertNotNull(calculatorService);
+
+        CalculatorWs calculator = calculatorService.getPort(CalculatorWs.class);
+        assertEquals(10, calculator.sum(4, 6));
+        assertEquals(12, calculator.multiply(3, 4));
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/spring-data-proxy-meta/src/main/java/org/superbiz/dynamic/api/Metatype.java
----------------------------------------------------------------------
diff --git a/examples/spring-data-proxy-meta/src/main/java/org/superbiz/dynamic/api/Metatype.java b/examples/spring-data-proxy-meta/src/main/java/org/superbiz/dynamic/api/Metatype.java
index 6a8fead..d4c61a8 100644
--- a/examples/spring-data-proxy-meta/src/main/java/org/superbiz/dynamic/api/Metatype.java
+++ b/examples/spring-data-proxy-meta/src/main/java/org/superbiz/dynamic/api/Metatype.java
@@ -1,30 +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.superbiz.dynamic.api;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Metatype
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.ANNOTATION_TYPE)
-public @interface Metatype {
-
-}
-
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.superbiz.dynamic.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Metatype
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Metatype {
+
+}
+

http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/spring-data-proxy-meta/src/main/java/org/superbiz/dynamic/api/SpringRepository.java
----------------------------------------------------------------------
diff --git a/examples/spring-data-proxy-meta/src/main/java/org/superbiz/dynamic/api/SpringRepository.java b/examples/spring-data-proxy-meta/src/main/java/org/superbiz/dynamic/api/SpringRepository.java
index 9f905f6..2b2d26d 100644
--- a/examples/spring-data-proxy-meta/src/main/java/org/superbiz/dynamic/api/SpringRepository.java
+++ b/examples/spring-data-proxy-meta/src/main/java/org/superbiz/dynamic/api/SpringRepository.java
@@ -1,36 +1,36 @@
-/**
- * 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.superbiz.dynamic.api;
-
-import org.apache.openejb.api.Proxy;
-import org.superbiz.dynamic.framework.SpringDataProxy;
-
-import javax.ejb.Stateless;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Metatype
-@Stateless
-@Proxy(SpringDataProxy.class)
-@Target(ElementType.TYPE)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface SpringRepository {
-
-}
-
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.superbiz.dynamic.api;
+
+import org.apache.openejb.api.Proxy;
+import org.superbiz.dynamic.framework.SpringDataProxy;
+
+import javax.ejb.Stateless;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Metatype
+@Stateless
+@Proxy(SpringDataProxy.class)
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface SpringRepository {
+
+}
+

http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/spring-data-proxy-meta/src/main/java/org/superbiz/dynamic/framework/SpringDataProxy.java
----------------------------------------------------------------------
diff --git a/examples/spring-data-proxy-meta/src/main/java/org/superbiz/dynamic/framework/SpringDataProxy.java b/examples/spring-data-proxy-meta/src/main/java/org/superbiz/dynamic/framework/SpringDataProxy.java
index 16f6c6d..662c95e 100644
--- a/examples/spring-data-proxy-meta/src/main/java/org/superbiz/dynamic/framework/SpringDataProxy.java
+++ b/examples/spring-data-proxy-meta/src/main/java/org/superbiz/dynamic/framework/SpringDataProxy.java
@@ -1,50 +1,50 @@
-/**
- * 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.superbiz.dynamic.framework;
-
-import org.springframework.data.jpa.repository.support.JpaRepositoryFactory;
-import org.springframework.data.repository.Repository;
-
-import javax.annotation.Resource;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.util.concurrent.atomic.AtomicReference;
-
-public class SpringDataProxy implements InvocationHandler {
-
-    @PersistenceContext(unitName = "dynamic")
-    private EntityManager em;
-
-    @Resource(name = "implementingInterfaceClass")
-    private Class<Repository<?, ?>> implementingInterfaceClass; // implicitly for this kind of proxy
-
-    private final AtomicReference<Repository<?, ?>> repository = new AtomicReference<Repository<?, ?>>();
-
-    @Override
-    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-        if (repository.get() == null) {
-            synchronized (this) {
-                if (repository.get() == null) {
-                    repository.set(new JpaRepositoryFactory(em).getRepository(implementingInterfaceClass));
-                }
-            }
-        }
-        return method.invoke(repository.get(), args);
-    }
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.superbiz.dynamic.framework;
+
+import org.springframework.data.jpa.repository.support.JpaRepositoryFactory;
+import org.springframework.data.repository.Repository;
+
+import javax.annotation.Resource;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.concurrent.atomic.AtomicReference;
+
+public class SpringDataProxy implements InvocationHandler {
+
+    @PersistenceContext(unitName = "dynamic")
+    private EntityManager em;
+
+    @Resource(name = "implementingInterfaceClass")
+    private Class<Repository<?, ?>> implementingInterfaceClass; // implicitly for this kind of proxy
+
+    private final AtomicReference<Repository<?, ?>> repository = new AtomicReference<Repository<?, ?>>();
+
+    @Override
+    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+        if (repository.get() == null) {
+            synchronized (this) {
+                if (repository.get() == null) {
+                    repository.set(new JpaRepositoryFactory(em).getRepository(implementingInterfaceClass));
+                }
+            }
+        }
+        return method.invoke(repository.get(), args);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/spring-data-proxy/src/main/java/org/superbiz/dynamic/SpringDataProxy.java
----------------------------------------------------------------------
diff --git a/examples/spring-data-proxy/src/main/java/org/superbiz/dynamic/SpringDataProxy.java b/examples/spring-data-proxy/src/main/java/org/superbiz/dynamic/SpringDataProxy.java
index 2704223..c36abf0 100644
--- a/examples/spring-data-proxy/src/main/java/org/superbiz/dynamic/SpringDataProxy.java
+++ b/examples/spring-data-proxy/src/main/java/org/superbiz/dynamic/SpringDataProxy.java
@@ -1,50 +1,50 @@
-/**
- * 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.superbiz.dynamic;
-
-import org.springframework.data.jpa.repository.support.JpaRepositoryFactory;
-import org.springframework.data.repository.Repository;
-
-import javax.annotation.Resource;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.util.concurrent.atomic.AtomicReference;
-
-public class SpringDataProxy implements InvocationHandler {
-
-    @PersistenceContext
-    private EntityManager em;
-
-    @Resource(name = "implementingInterfaceClass")
-    private Class<Repository<?, ?>> implementingInterfaceClass; // implicitly for this kind of proxy
-
-    private final AtomicReference<Repository<?, ?>> repository = new AtomicReference<Repository<?, ?>>();
-
-    @Override
-    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-        if (repository.get() == null) {
-            synchronized (this) {
-                if (repository.get() == null) {
-                    repository.set(new JpaRepositoryFactory(em).getRepository(implementingInterfaceClass));
-                }
-            }
-        }
-        return method.invoke(repository.get(), args);
-    }
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.superbiz.dynamic;
+
+import org.springframework.data.jpa.repository.support.JpaRepositoryFactory;
+import org.springframework.data.repository.Repository;
+
+import javax.annotation.Resource;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.concurrent.atomic.AtomicReference;
+
+public class SpringDataProxy implements InvocationHandler {
+
+    @PersistenceContext
+    private EntityManager em;
+
+    @Resource(name = "implementingInterfaceClass")
+    private Class<Repository<?, ?>> implementingInterfaceClass; // implicitly for this kind of proxy
+
+    private final AtomicReference<Repository<?, ?>> repository = new AtomicReference<Repository<?, ?>>();
+
+    @Override
+    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+        if (repository.get() == null) {
+            synchronized (this) {
+                if (repository.get() == null) {
+                    repository.set(new JpaRepositoryFactory(em).getRepository(implementingInterfaceClass));
+                }
+            }
+        }
+        return method.invoke(repository.get(), args);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/struts/src/main/java/org/superbiz/struts/AddUser.java
----------------------------------------------------------------------
diff --git a/examples/struts/src/main/java/org/superbiz/struts/AddUser.java b/examples/struts/src/main/java/org/superbiz/struts/AddUser.java
index 034feac..3fdef15 100644
--- a/examples/struts/src/main/java/org/superbiz/struts/AddUser.java
+++ b/examples/struts/src/main/java/org/superbiz/struts/AddUser.java
@@ -1,80 +1,80 @@
-/*
-
-    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.superbiz.struts;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import java.util.Properties;
-
-public class AddUser {
-
-    private int id;
-    private String firstName;
-    private String lastName;
-    private String errorMessage;
-
-    public String getFirstName() {
-        return firstName;
-    }
-
-    public void setFirstName(String firstName) {
-        this.firstName = firstName;
-    }
-
-    public String getLastName() {
-        return lastName;
-    }
-
-    public void setLastName(String lastName) {
-        this.lastName = lastName;
-    }
-
-    public String getErrorMessage() {
-        return errorMessage;
-    }
-
-    public void setErrorMessage(String errorMessage) {
-        this.errorMessage = errorMessage;
-    }
-
-    public int getId() {
-        return id;
-    }
-
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    public String execute() {
-
-        try {
-            UserService service = null;
-            Properties props = new Properties();
-            props.put(Context.INITIAL_CONTEXT_FACTORY,
-                      "org.apache.openejb.core.LocalInitialContextFactory");
-            Context ctx = new InitialContext(props);
-            service = (UserService) ctx.lookup("UserServiceImplLocal");
-            service.add(new User(id, firstName, lastName));
-        } catch (Exception e) {
-            this.errorMessage = e.getMessage();
-            return "failure";
-        }
-
-        return "success";
-    }
-}
+/*
+
+    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.superbiz.struts;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import java.util.Properties;
+
+public class AddUser {
+
+    private int id;
+    private String firstName;
+    private String lastName;
+    private String errorMessage;
+
+    public String getFirstName() {
+        return firstName;
+    }
+
+    public void setFirstName(String firstName) {
+        this.firstName = firstName;
+    }
+
+    public String getLastName() {
+        return lastName;
+    }
+
+    public void setLastName(String lastName) {
+        this.lastName = lastName;
+    }
+
+    public String getErrorMessage() {
+        return errorMessage;
+    }
+
+    public void setErrorMessage(String errorMessage) {
+        this.errorMessage = errorMessage;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String execute() {
+
+        try {
+            UserService service = null;
+            Properties props = new Properties();
+            props.put(Context.INITIAL_CONTEXT_FACTORY,
+                    "org.apache.openejb.core.LocalInitialContextFactory");
+            Context ctx = new InitialContext(props);
+            service = (UserService) ctx.lookup("UserServiceImplLocal");
+            service.add(new User(id, firstName, lastName));
+        } catch (Exception e) {
+            this.errorMessage = e.getMessage();
+            return "failure";
+        }
+
+        return "success";
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/struts/src/main/java/org/superbiz/struts/FindUser.java
----------------------------------------------------------------------
diff --git a/examples/struts/src/main/java/org/superbiz/struts/FindUser.java b/examples/struts/src/main/java/org/superbiz/struts/FindUser.java
index 2344da9..b46a722 100644
--- a/examples/struts/src/main/java/org/superbiz/struts/FindUser.java
+++ b/examples/struts/src/main/java/org/superbiz/struts/FindUser.java
@@ -1,71 +1,71 @@
-/*
-
- 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.superbiz.struts;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import java.util.Properties;
-
-public class FindUser {
-
-    private int id;
-    private String errorMessage;
-    private User user;
-
-    public User getUser() {
-        return user;
-    }
-
-    public void setUser(User user) {
-        this.user = user;
-    }
-
-    public String getErrorMessage() {
-        return errorMessage;
-    }
-
-    public void setErrorMessage(String errorMessage) {
-        this.errorMessage = errorMessage;
-    }
-
-    public int getId() {
-        return id;
-    }
-
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    public String execute() {
-
-        try {
-            UserService service = null;
-            Properties props = new Properties();
-            props.put(Context.INITIAL_CONTEXT_FACTORY,
-                      "org.apache.openejb.core.LocalInitialContextFactory");
-            Context ctx = new InitialContext(props);
-            service = (UserService) ctx.lookup("UserServiceImplLocal");
-            this.user = service.find(id);
-        } catch (Exception e) {
-            this.errorMessage = e.getMessage();
-            return "failure";
-        }
-
-        return "success";
-    }
-}
+/*
+
+ 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.superbiz.struts;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import java.util.Properties;
+
+public class FindUser {
+
+    private int id;
+    private String errorMessage;
+    private User user;
+
+    public User getUser() {
+        return user;
+    }
+
+    public void setUser(User user) {
+        this.user = user;
+    }
+
+    public String getErrorMessage() {
+        return errorMessage;
+    }
+
+    public void setErrorMessage(String errorMessage) {
+        this.errorMessage = errorMessage;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String execute() {
+
+        try {
+            UserService service = null;
+            Properties props = new Properties();
+            props.put(Context.INITIAL_CONTEXT_FACTORY,
+                    "org.apache.openejb.core.LocalInitialContextFactory");
+            Context ctx = new InitialContext(props);
+            service = (UserService) ctx.lookup("UserServiceImplLocal");
+            this.user = service.find(id);
+        } catch (Exception e) {
+            this.errorMessage = e.getMessage();
+            return "failure";
+        }
+
+        return "success";
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/struts/src/main/java/org/superbiz/struts/ListAllUsers.java
----------------------------------------------------------------------
diff --git a/examples/struts/src/main/java/org/superbiz/struts/ListAllUsers.java b/examples/struts/src/main/java/org/superbiz/struts/ListAllUsers.java
index 2c4d447..98ecd2e 100644
--- a/examples/struts/src/main/java/org/superbiz/struts/ListAllUsers.java
+++ b/examples/struts/src/main/java/org/superbiz/struts/ListAllUsers.java
@@ -1,72 +1,72 @@
-/*
-
- 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.superbiz.struts;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import java.util.List;
-import java.util.Properties;
-
-public class ListAllUsers {
-
-    private int id;
-    private String errorMessage;
-    private List<User> users;
-
-    public List<User> getUsers() {
-        return users;
-    }
-
-    public void setUsers(List<User> users) {
-        this.users = users;
-    }
-
-    public String getErrorMessage() {
-        return errorMessage;
-    }
-
-    public void setErrorMessage(String errorMessage) {
-        this.errorMessage = errorMessage;
-    }
-
-    public int getId() {
-        return id;
-    }
-
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    public String execute() {
-
-        try {
-            UserService service = null;
-            Properties props = new Properties();
-            props.put(Context.INITIAL_CONTEXT_FACTORY,
-                      "org.apache.openejb.core.LocalInitialContextFactory");
-            Context ctx = new InitialContext(props);
-            service = (UserService) ctx.lookup("UserServiceImplLocal");
-            this.users = service.findAll();
-        } catch (Exception e) {
-            this.errorMessage = e.getMessage();
-            return "failure";
-        }
-
-        return "success";
-    }
-}
+/*
+
+ 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.superbiz.struts;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import java.util.List;
+import java.util.Properties;
+
+public class ListAllUsers {
+
+    private int id;
+    private String errorMessage;
+    private List<User> users;
+
+    public List<User> getUsers() {
+        return users;
+    }
+
+    public void setUsers(List<User> users) {
+        this.users = users;
+    }
+
+    public String getErrorMessage() {
+        return errorMessage;
+    }
+
+    public void setErrorMessage(String errorMessage) {
+        this.errorMessage = errorMessage;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String execute() {
+
+        try {
+            UserService service = null;
+            Properties props = new Properties();
+            props.put(Context.INITIAL_CONTEXT_FACTORY,
+                    "org.apache.openejb.core.LocalInitialContextFactory");
+            Context ctx = new InitialContext(props);
+            service = (UserService) ctx.lookup("UserServiceImplLocal");
+            this.users = service.findAll();
+        } catch (Exception e) {
+            this.errorMessage = e.getMessage();
+            return "failure";
+        }
+
+        return "success";
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/telephone-stateful/src/main/java/org/superbiz/telephone/Telephone.java
----------------------------------------------------------------------
diff --git a/examples/telephone-stateful/src/main/java/org/superbiz/telephone/Telephone.java b/examples/telephone-stateful/src/main/java/org/superbiz/telephone/Telephone.java
index cff3f9b..41fbd49 100644
--- a/examples/telephone-stateful/src/main/java/org/superbiz/telephone/Telephone.java
+++ b/examples/telephone-stateful/src/main/java/org/superbiz/telephone/Telephone.java
@@ -1,26 +1,26 @@
-/**
- * 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.
- */
-//START SNIPPET: code
-package org.superbiz.telephone;
-
-public interface Telephone {
-
-    void speak(String words);
-
-    String listen();
-}
-//END SNIPPET: code
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+//START SNIPPET: code
+package org.superbiz.telephone;
+
+public interface Telephone {
+
+    void speak(String words);
+
+    String listen();
+}
+//END SNIPPET: code

http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/telephone-stateful/src/main/java/org/superbiz/telephone/TelephoneBean.java
----------------------------------------------------------------------
diff --git a/examples/telephone-stateful/src/main/java/org/superbiz/telephone/TelephoneBean.java b/examples/telephone-stateful/src/main/java/org/superbiz/telephone/TelephoneBean.java
index ae466ac..c9ae5da 100644
--- a/examples/telephone-stateful/src/main/java/org/superbiz/telephone/TelephoneBean.java
+++ b/examples/telephone-stateful/src/main/java/org/superbiz/telephone/TelephoneBean.java
@@ -1,58 +1,58 @@
-/**
- * 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.
- */
-//START SNIPPET: code
-package org.superbiz.telephone;
-
-import javax.ejb.Remote;
-import javax.ejb.Stateful;
-import java.util.ArrayList;
-import java.util.List;
-
-@Remote
-@Stateful
-public class TelephoneBean implements Telephone {
-
-    private static final String[] answers = {
-                                                "How nice.",
-                                                "Oh, of course.",
-                                                "Interesting.",
-                                                "Really?",
-                                                "No.",
-                                                "Definitely.",
-                                                "I wondered about that.",
-                                                "Good idea.",
-                                                "You don't say!",
-    };
-
-    private final List<String> conversation = new ArrayList<String>();
-
-    @Override
-    public void speak(final String words) {
-        conversation.add(words);
-    }
-
-    @Override
-    public String listen() {
-        if (conversation.size() == 0) {
-            return "Nothing has been said";
-        }
-
-        final String lastThingSaid = conversation.get(conversation.size() - 1);
-        return answers[Math.abs(lastThingSaid.hashCode()) % answers.length];
-    }
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+//START SNIPPET: code
+package org.superbiz.telephone;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateful;
+import java.util.ArrayList;
+import java.util.List;
+
+@Remote
+@Stateful
+public class TelephoneBean implements Telephone {
+
+    private static final String[] answers = {
+            "How nice.",
+            "Oh, of course.",
+            "Interesting.",
+            "Really?",
+            "No.",
+            "Definitely.",
+            "I wondered about that.",
+            "Good idea.",
+            "You don't say!",
+    };
+
+    private final List<String> conversation = new ArrayList<String>();
+
+    @Override
+    public void speak(final String words) {
+        conversation.add(words);
+    }
+
+    @Override
+    public String listen() {
+        if (conversation.size() == 0) {
+            return "Nothing has been said";
+        }
+
+        final String lastThingSaid = conversation.get(conversation.size() - 1);
+        return answers[Math.abs(lastThingSaid.hashCode()) % answers.length];
+    }
+}
 //END SNIPPET: code
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/telephone-stateful/src/test/java/org/superbiz/telephone/TelephoneTest.java
----------------------------------------------------------------------
diff --git a/examples/telephone-stateful/src/test/java/org/superbiz/telephone/TelephoneTest.java b/examples/telephone-stateful/src/test/java/org/superbiz/telephone/TelephoneTest.java
index 474003f..740467b 100644
--- a/examples/telephone-stateful/src/test/java/org/superbiz/telephone/TelephoneTest.java
+++ b/examples/telephone-stateful/src/test/java/org/superbiz/telephone/TelephoneTest.java
@@ -1,115 +1,115 @@
-/**
- * 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.superbiz.telephone;
-
-import junit.framework.TestCase;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import java.util.Properties;
-
-/**
- * @version $Rev$ $Date$
- */
-public class TelephoneTest extends TestCase {
-
-    //START SNIPPET: setup
-	
-	//Random port to avoid test conflicts
-    private static final int port = Integer.parseInt(System.getProperty("ejbd.port", "" + org.apache.openejb.util.NetworkUtil.getNextAvailablePort()));
-
-    @Override
-    protected void setUp() throws Exception {
-        final Properties properties = new Properties();
-        properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory");
-        properties.setProperty("openejb.embedded.remotable", "true");
-		
-		//Just for this test we change the default port from 4204 to avoid conflicts
-		properties.setProperty("ejbd.port", "" + port);
-		
-        // Uncomment these properties to change the defaults
-        //properties.setProperty("ejbd.bind", "localhost");
-        //properties.setProperty("ejbd.threads", "200");
-        //properties.setProperty("ejbd.disabled", "false");
-        //properties.setProperty("ejbd.only_from", "127.0.0.1,192.168.1.1");
-
-        new InitialContext(properties);
-    }
-    //END SNIPPET: setup
-
-    /**
-     * Lookup the Telephone bean via its remote interface but using the LocalInitialContextFactory
-     *
-     * @throws Exception
-     */
-    //START SNIPPET: localcontext
-    public void testTalkOverLocalNetwork() throws Exception {
-
-        final Properties properties = new Properties();
-        properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory");
-        final InitialContext localContext = new InitialContext(properties);
-
-        final Telephone telephone = (Telephone) localContext.lookup("TelephoneBeanRemote");
-
-        telephone.speak("Did you know I am talking directly through the embedded container?");
-
-        assertEquals("Interesting.", telephone.listen());
-
-        telephone.speak("Yep, I'm using the bean's remote interface but since the ejb container is embedded " +
-                        "in the same vm I'm just using the LocalInitialContextFactory.");
-
-        assertEquals("Really?", telephone.listen());
-
-        telephone.speak("Right, you really only have to use the RemoteInitialContextFactory if you're in a different vm.");
-
-        assertEquals("Oh, of course.", telephone.listen());
-    }
-    //END SNIPPET: localcontext
-
-    /**
-     * Lookup the Telephone bean via its remote interface using the RemoteInitialContextFactory
-     *
-     * @throws Exception
-     */
-    //START SNIPPET: remotecontext
-    public void testTalkOverRemoteNetwork() throws Exception {
-        final Properties properties = new Properties();
-        properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
-        properties.setProperty(Context.PROVIDER_URL, "ejbd://localhost:" + port);
-        final InitialContext remoteContext = new InitialContext(properties);
-
-        final Telephone telephone = (Telephone) remoteContext.lookup("TelephoneBeanRemote");
-
-        telephone.speak("Is this a local call?");
-
-        assertEquals("No.", telephone.listen());
-
-        telephone.speak("This would be a lot cooler if I was connecting from another VM then, huh?");
-
-        assertEquals("I wondered about that.", telephone.listen());
-
-        telephone.speak("I suppose I should hangup and call back over the LocalInitialContextFactory.");
-
-        assertEquals("Good idea.", telephone.listen());
-
-        telephone.speak("I'll remember this though in case I ever have to call you accross a network.");
-
-        assertEquals("Definitely.", telephone.listen());
-    }
-    //END SNIPPET: remotecontext
-
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.superbiz.telephone;
+
+import junit.framework.TestCase;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import java.util.Properties;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TelephoneTest extends TestCase {
+
+    //START SNIPPET: setup
+
+    //Random port to avoid test conflicts
+    private static final int port = Integer.parseInt(System.getProperty("ejbd.port", "" + org.apache.openejb.util.NetworkUtil.getNextAvailablePort()));
+
+    @Override
+    protected void setUp() throws Exception {
+        final Properties properties = new Properties();
+        properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory");
+        properties.setProperty("openejb.embedded.remotable", "true");
+
+        //Just for this test we change the default port from 4204 to avoid conflicts
+        properties.setProperty("ejbd.port", "" + port);
+
+        // Uncomment these properties to change the defaults
+        //properties.setProperty("ejbd.bind", "localhost");
+        //properties.setProperty("ejbd.threads", "200");
+        //properties.setProperty("ejbd.disabled", "false");
+        //properties.setProperty("ejbd.only_from", "127.0.0.1,192.168.1.1");
+
+        new InitialContext(properties);
+    }
+    //END SNIPPET: setup
+
+    /**
+     * Lookup the Telephone bean via its remote interface but using the LocalInitialContextFactory
+     *
+     * @throws Exception
+     */
+    //START SNIPPET: localcontext
+    public void testTalkOverLocalNetwork() throws Exception {
+
+        final Properties properties = new Properties();
+        properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory");
+        final InitialContext localContext = new InitialContext(properties);
+
+        final Telephone telephone = (Telephone) localContext.lookup("TelephoneBeanRemote");
+
+        telephone.speak("Did you know I am talking directly through the embedded container?");
+
+        assertEquals("Interesting.", telephone.listen());
+
+        telephone.speak("Yep, I'm using the bean's remote interface but since the ejb container is embedded " +
+                "in the same vm I'm just using the LocalInitialContextFactory.");
+
+        assertEquals("Really?", telephone.listen());
+
+        telephone.speak("Right, you really only have to use the RemoteInitialContextFactory if you're in a different vm.");
+
+        assertEquals("Oh, of course.", telephone.listen());
+    }
+    //END SNIPPET: localcontext
+
+    /**
+     * Lookup the Telephone bean via its remote interface using the RemoteInitialContextFactory
+     *
+     * @throws Exception
+     */
+    //START SNIPPET: remotecontext
+    public void testTalkOverRemoteNetwork() throws Exception {
+        final Properties properties = new Properties();
+        properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
+        properties.setProperty(Context.PROVIDER_URL, "ejbd://localhost:" + port);
+        final InitialContext remoteContext = new InitialContext(properties);
+
+        final Telephone telephone = (Telephone) remoteContext.lookup("TelephoneBeanRemote");
+
+        telephone.speak("Is this a local call?");
+
+        assertEquals("No.", telephone.listen());
+
+        telephone.speak("This would be a lot cooler if I was connecting from another VM then, huh?");
+
+        assertEquals("I wondered about that.", telephone.listen());
+
+        telephone.speak("I suppose I should hangup and call back over the LocalInitialContextFactory.");
+
+        assertEquals("Good idea.", telephone.listen());
+
+        telephone.speak("I'll remember this though in case I ever have to call you accross a network.");
+
+        assertEquals("Definitely.", telephone.listen());
+    }
+    //END SNIPPET: remotecontext
+
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/testcase-injection/src/main/java/org/superbiz/testinjection/Movie.java
----------------------------------------------------------------------
diff --git a/examples/testcase-injection/src/main/java/org/superbiz/testinjection/Movie.java b/examples/testcase-injection/src/main/java/org/superbiz/testinjection/Movie.java
index d51142a..9f4d4a7 100644
--- a/examples/testcase-injection/src/main/java/org/superbiz/testinjection/Movie.java
+++ b/examples/testcase-injection/src/main/java/org/superbiz/testinjection/Movie.java
@@ -1,61 +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.superbiz.testinjection;
-
-import javax.persistence.Entity;
-
-@Entity
-public class Movie {
-
-    private String director;
-    private String title;
-    private int year;
-
-    public Movie() {
-    }
-
-    public Movie(String director, String title, int year) {
-        this.director = director;
-        this.title = title;
-        this.year = year;
-    }
-
-    public String getDirector() {
-        return director;
-    }
-
-    public void setDirector(String director) {
-        this.director = director;
-    }
-
-    public String getTitle() {
-        return title;
-    }
-
-    public void setTitle(String title) {
-        this.title = title;
-    }
-
-    public int getYear() {
-        return year;
-    }
-
-    public void setYear(int year) {
-        this.year = year;
-    }
-
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.superbiz.testinjection;
+
+import javax.persistence.Entity;
+
+@Entity
+public class Movie {
+
+    private String director;
+    private String title;
+    private int year;
+
+    public Movie() {
+    }
+
+    public Movie(String director, String title, int year) {
+        this.director = director;
+        this.title = title;
+        this.year = year;
+    }
+
+    public String getDirector() {
+        return director;
+    }
+
+    public void setDirector(String director) {
+        this.director = director;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public int getYear() {
+        return year;
+    }
+
+    public void setYear(int year) {
+        this.year = year;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/testcase-injection/src/main/java/org/superbiz/testinjection/Movies.java
----------------------------------------------------------------------
diff --git a/examples/testcase-injection/src/main/java/org/superbiz/testinjection/Movies.java b/examples/testcase-injection/src/main/java/org/superbiz/testinjection/Movies.java
index 58fd742..dbab1b7 100644
--- a/examples/testcase-injection/src/main/java/org/superbiz/testinjection/Movies.java
+++ b/examples/testcase-injection/src/main/java/org/superbiz/testinjection/Movies.java
@@ -1,50 +1,50 @@
-/**
- * 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.superbiz.testinjection;
-
-import javax.ejb.Stateful;
-import javax.ejb.TransactionAttribute;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
-import javax.persistence.Query;
-import java.util.List;
-
-import static javax.ejb.TransactionAttributeType.MANDATORY;
-
-//START SNIPPET: code
-@Stateful
-@TransactionAttribute(MANDATORY)
-public class Movies {
-
-    @PersistenceContext(unitName = "movie-unit", type = PersistenceContextType.TRANSACTION)
-    private EntityManager entityManager;
-
-    public void addMovie(Movie movie) throws Exception {
-        entityManager.persist(movie);
-    }
-
-    public void deleteMovie(Movie movie) throws Exception {
-        entityManager.remove(movie);
-    }
-
-    public List<Movie> getMovies() throws Exception {
-        Query query = entityManager.createQuery("SELECT m from Movie as m");
-        return query.getResultList();
-    }
-}
-//END SNIPPET: code
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.superbiz.testinjection;
+
+import javax.ejb.Stateful;
+import javax.ejb.TransactionAttribute;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceContextType;
+import javax.persistence.Query;
+import java.util.List;
+
+import static javax.ejb.TransactionAttributeType.MANDATORY;
+
+//START SNIPPET: code
+@Stateful
+@TransactionAttribute(MANDATORY)
+public class Movies {
+
+    @PersistenceContext(unitName = "movie-unit", type = PersistenceContextType.TRANSACTION)
+    private EntityManager entityManager;
+
+    public void addMovie(Movie movie) throws Exception {
+        entityManager.persist(movie);
+    }
+
+    public void deleteMovie(Movie movie) throws Exception {
+        entityManager.remove(movie);
+    }
+
+    public List<Movie> getMovies() throws Exception {
+        Query query = entityManager.createQuery("SELECT m from Movie as m");
+        return query.getResultList();
+    }
+}
+//END SNIPPET: code

http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/testcase-injection/src/test/java/org/superbiz/testinjection/MoviesTest.java
----------------------------------------------------------------------
diff --git a/examples/testcase-injection/src/test/java/org/superbiz/testinjection/MoviesTest.java b/examples/testcase-injection/src/test/java/org/superbiz/testinjection/MoviesTest.java
index 728229b..d02389d 100644
--- a/examples/testcase-injection/src/test/java/org/superbiz/testinjection/MoviesTest.java
+++ b/examples/testcase-injection/src/test/java/org/superbiz/testinjection/MoviesTest.java
@@ -1,75 +1,75 @@
-/**
- * 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.superbiz.testinjection;
-
-import junit.framework.TestCase;
-
-import javax.annotation.Resource;
-import javax.ejb.EJB;
-import javax.ejb.embeddable.EJBContainer;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.transaction.UserTransaction;
-import java.util.List;
-import java.util.Properties;
-
-//START SNIPPET: code
-public class MoviesTest extends TestCase {
-
-    @EJB
-    private Movies movies;
-
-    @Resource
-    private UserTransaction userTransaction;
-
-    @PersistenceContext
-    private EntityManager entityManager;
-
-    public void setUp() throws Exception {
-        Properties p = new Properties();
-        p.put("movieDatabase", "new://Resource?type=DataSource");
-        p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
-        p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
-
-        EJBContainer.createEJBContainer(p).getContext().bind("inject", this);
-    }
-
-    public void test() throws Exception {
-
-        userTransaction.begin();
-
-        try {
-            entityManager.persist(new Movie("Quentin Tarantino", "Reservoir Dogs", 1992));
-            entityManager.persist(new Movie("Joel Coen", "Fargo", 1996));
-            entityManager.persist(new Movie("Joel Coen", "The Big Lebowski", 1998));
-
-            List<Movie> list = movies.getMovies();
-            assertEquals("List.size()", 3, list.size());
-
-            for (Movie movie : list) {
-                movies.deleteMovie(movie);
-            }
-
-            assertEquals("Movies.getMovies()", 0, movies.getMovies().size());
-
-        } finally {
-            userTransaction.commit();
-        }
-
-    }
-}
-//END SNIPPET: code
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.superbiz.testinjection;
+
+import junit.framework.TestCase;
+
+import javax.annotation.Resource;
+import javax.ejb.EJB;
+import javax.ejb.embeddable.EJBContainer;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.transaction.UserTransaction;
+import java.util.List;
+import java.util.Properties;
+
+//START SNIPPET: code
+public class MoviesTest extends TestCase {
+
+    @EJB
+    private Movies movies;
+
+    @Resource
+    private UserTransaction userTransaction;
+
+    @PersistenceContext
+    private EntityManager entityManager;
+
+    public void setUp() throws Exception {
+        Properties p = new Properties();
+        p.put("movieDatabase", "new://Resource?type=DataSource");
+        p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
+        p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
+
+        EJBContainer.createEJBContainer(p).getContext().bind("inject", this);
+    }
+
+    public void test() throws Exception {
+
+        userTransaction.begin();
+
+        try {
+            entityManager.persist(new Movie("Quentin Tarantino", "Reservoir Dogs", 1992));
+            entityManager.persist(new Movie("Joel Coen", "Fargo", 1996));
+            entityManager.persist(new Movie("Joel Coen", "The Big Lebowski", 1998));
+
+            List<Movie> list = movies.getMovies();
+            assertEquals("List.size()", 3, list.size());
+
+            for (Movie movie : list) {
+                movies.deleteMovie(movie);
+            }
+
+            assertEquals("Movies.getMovies()", 0, movies.getMovies().size());
+
+        } finally {
+            userTransaction.commit();
+        }
+
+    }
+}
+//END SNIPPET: code

http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/testing-security-2/src/main/java/org/superbiz/injection/secure/Movie.java
----------------------------------------------------------------------
diff --git a/examples/testing-security-2/src/main/java/org/superbiz/injection/secure/Movie.java b/examples/testing-security-2/src/main/java/org/superbiz/injection/secure/Movie.java
index b5df45c..73fdf33 100644
--- a/examples/testing-security-2/src/main/java/org/superbiz/injection/secure/Movie.java
+++ b/examples/testing-security-2/src/main/java/org/superbiz/injection/secure/Movie.java
@@ -1,61 +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.superbiz.injection.secure;
-
-import javax.persistence.Entity;
-
-@Entity
-public class Movie {
-
-    private String director;
-    private String title;
-    private int year;
-
-    public Movie() {
-    }
-
-    public Movie(String director, String title, int year) {
-        this.director = director;
-        this.title = title;
-        this.year = year;
-    }
-
-    public String getDirector() {
-        return director;
-    }
-
-    public void setDirector(String director) {
-        this.director = director;
-    }
-
-    public String getTitle() {
-        return title;
-    }
-
-    public void setTitle(String title) {
-        this.title = title;
-    }
-
-    public int getYear() {
-        return year;
-    }
-
-    public void setYear(int year) {
-        this.year = year;
-    }
-
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.superbiz.injection.secure;
+
+import javax.persistence.Entity;
+
+@Entity
+public class Movie {
+
+    private String director;
+    private String title;
+    private int year;
+
+    public Movie() {
+    }
+
+    public Movie(String director, String title, int year) {
+        this.director = director;
+        this.title = title;
+        this.year = year;
+    }
+
+    public String getDirector() {
+        return director;
+    }
+
+    public void setDirector(String director) {
+        this.director = director;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public int getYear() {
+        return year;
+    }
+
+    public void setYear(int year) {
+        this.year = year;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/testing-security-2/src/main/java/org/superbiz/injection/secure/Movies.java
----------------------------------------------------------------------
diff --git a/examples/testing-security-2/src/main/java/org/superbiz/injection/secure/Movies.java b/examples/testing-security-2/src/main/java/org/superbiz/injection/secure/Movies.java
index b3ba8e8..100598b 100644
--- a/examples/testing-security-2/src/main/java/org/superbiz/injection/secure/Movies.java
+++ b/examples/testing-security-2/src/main/java/org/superbiz/injection/secure/Movies.java
@@ -1,55 +1,55 @@
-/**
- * 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.superbiz.injection.secure;
-
-//START SNIPPET: code
-
-import javax.annotation.security.PermitAll;
-import javax.annotation.security.RolesAllowed;
-import javax.ejb.Stateful;
-import javax.ejb.TransactionAttribute;
-import javax.ejb.TransactionAttributeType;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
-import javax.persistence.Query;
-import java.util.List;
-
-@Stateful
-public class Movies {
-
-    @PersistenceContext(unitName = "movie-unit", type = PersistenceContextType.EXTENDED)
-    private EntityManager entityManager;
-
-    @RolesAllowed({"Employee", "Manager"})
-    public void addMovie(Movie movie) throws Exception {
-        entityManager.persist(movie);
-    }
-
-    @RolesAllowed({"Manager"})
-    public void deleteMovie(Movie movie) throws Exception {
-        entityManager.remove(movie);
-    }
-
-    @PermitAll
-    @TransactionAttribute(TransactionAttributeType.SUPPORTS)
-    public List<Movie> getMovies() throws Exception {
-        Query query = entityManager.createQuery("SELECT m from Movie as m");
-        return query.getResultList();
-    }
-}
-//END SNIPPET: code
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.superbiz.injection.secure;
+
+//START SNIPPET: code
+
+import javax.annotation.security.PermitAll;
+import javax.annotation.security.RolesAllowed;
+import javax.ejb.Stateful;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceContextType;
+import javax.persistence.Query;
+import java.util.List;
+
+@Stateful
+public class Movies {
+
+    @PersistenceContext(unitName = "movie-unit", type = PersistenceContextType.EXTENDED)
+    private EntityManager entityManager;
+
+    @RolesAllowed({"Employee", "Manager"})
+    public void addMovie(Movie movie) throws Exception {
+        entityManager.persist(movie);
+    }
+
+    @RolesAllowed({"Manager"})
+    public void deleteMovie(Movie movie) throws Exception {
+        entityManager.remove(movie);
+    }
+
+    @PermitAll
+    @TransactionAttribute(TransactionAttributeType.SUPPORTS)
+    public List<Movie> getMovies() throws Exception {
+        Query query = entityManager.createQuery("SELECT m from Movie as m");
+        return query.getResultList();
+    }
+}
+//END SNIPPET: code


Mime
View raw message