[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openejb-cvs
Subject:    svn commit: r672566 [2/9] - in /openejb/trunk/openejb3: ./ api/
From:       dblevins () apache ! org
Date:       2008-06-28 18:48:33
Message-ID: 20080628184840.35CEE2388A3E () eris ! apache ! org
[Download RAW message or body]

Added: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbHomeHandler.java
                
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/ma \
in/java/org/apache/openejb/core/singleton/SingletonEjbHomeHandler.java?rev=672566&view=auto
 ==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbHomeHandler.java \
                (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbHomeHandler.java \
Sat Jun 28 11:48:28 2008 @@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.core.singleton;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import javax.ejb.RemoveException;
+
+import org.apache.openejb.InterfaceType;
+import org.apache.openejb.DeploymentInfo;
+import org.apache.openejb.core.ivm.EjbHomeProxyHandler;
+import org.apache.openejb.core.ivm.EjbObjectProxyHandler;
+
+public class SingletonEjbHomeHandler extends EjbHomeProxyHandler {
+
+    public SingletonEjbHomeHandler(DeploymentInfo deploymentInfo, InterfaceType \
interfaceType, List<Class> interfaces) { +        super(deploymentInfo, \
interfaceType, interfaces); +    }
+
+    protected Object findX(Class interfce, Method method, Object[] args, Object \
proxy) throws Throwable { +        throw new UnsupportedOperationException("Stateful \
beans may not have find methods"); +    }
+
+    protected Object removeByPrimaryKey(Class interfce, Method method, Object[] \
args, Object proxy) throws Throwable { +        throw new RemoveException("Session \
objects are private resources and do not have primary keys"); +    }
+
+    protected Object removeWithHandle(Class interfce, Method method, Object[] args, \
Object proxy) throws Throwable { +        // stateless can't be removed
+        return null;
+    }
+
+    protected EjbObjectProxyHandler newEjbObjectHandler(DeploymentInfo \
deploymentInfo, Object pk, InterfaceType interfaceType, List<Class> interfaces) { +   \
return new SingletonEjbObjectHandler(getDeploymentInfo(), pk, interfaceType, \
interfaces); +    }
+
+}

Propchange: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbHomeHandler.java
                
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author Id Revision HeadURL

Added: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbObjectHandler.java
                
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/ma \
in/java/org/apache/openejb/core/singleton/SingletonEjbObjectHandler.java?rev=672566&view=auto
 ==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbObjectHandler.java \
                (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbObjectHandler.java \
Sat Jun 28 11:48:28 2008 @@ -0,0 +1,68 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.core.singleton;
+
+import org.apache.openejb.Container;
+import org.apache.openejb.InterfaceType;
+import org.apache.openejb.DeploymentInfo;
+import org.apache.openejb.core.ivm.EjbObjectProxyHandler;
+import org.apache.openejb.util.proxy.ProxyManager;
+
+import java.lang.reflect.Method;
+import java.rmi.RemoteException;
+import java.util.List;
+
+public class SingletonEjbObjectHandler extends EjbObjectProxyHandler {
+    public Object registryId;
+
+    public SingletonEjbObjectHandler(DeploymentInfo deploymentInfo, Object pk, \
InterfaceType interfaceType, List<Class> interfaces) { +        super(deploymentInfo, \
pk, interfaceType, interfaces); +    }
+
+    public static Object createRegistryId(Object primKey, Object deployId, Container \
contnr) { +        return "" + deployId + contnr.getContainerID();
+    }
+
+    public Object getRegistryId() {
+        if (registryId == null)
+            registryId = createRegistryId(primaryKey, deploymentID, container);
+        return registryId;
+    }
+
+    protected Object getPrimaryKey(Method method, Object[] args, Object proxy) \
throws Throwable { +        throw new RemoteException("Session objects are private \
resources and do not have primary keys"); +    }
+
+    protected Object isIdentical(Method method, Object[] args, Object proxy) throws \
Throwable { +        try {
+            EjbObjectProxyHandler handler = (EjbObjectProxyHandler) \
ProxyManager.getInvocationHandler(args[0]); +            return new \
Boolean(deploymentID.equals(handler.deploymentID)); +        } catch (Throwable t) {
+            return Boolean.FALSE;
+
+        }
+    }
+
+    public void invalidateReference() {
+        // stateless can't be removed
+    }
+
+    protected Object remove(Class interfce, Method method, Object[] args, Object \
proxy) throws Throwable { +        // stateless can't be removed
+        return null;
+    }
+}

Propchange: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonEjbObjectHandler.java
                
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author Id Revision HeadURL

Added: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonInstanceManager.java
                
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/ma \
in/java/org/apache/openejb/core/singleton/SingletonInstanceManager.java?rev=672566&view=auto
 ==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonInstanceManager.java \
                (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonInstanceManager.java \
Sat Jun 28 11:48:28 2008 @@ -0,0 +1,372 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.core.singleton;
+
+import java.lang.reflect.Method;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Semaphore;
+
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.transaction.TransactionManager;
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.openejb.Injection;
+import org.apache.openejb.OpenEJBException;
+import org.apache.openejb.SystemException;
+import org.apache.openejb.core.BaseContext;
+import org.apache.openejb.core.CoreDeploymentInfo;
+import org.apache.openejb.core.Operation;
+import org.apache.openejb.core.ThreadContext;
+import org.apache.openejb.core.interceptor.InterceptorData;
+import org.apache.openejb.core.interceptor.InterceptorStack;
+import org.apache.openejb.spi.SecurityService;
+import org.apache.openejb.util.LinkedListStack;
+import org.apache.openejb.util.LogCategory;
+import org.apache.openejb.util.Logger;
+import org.apache.openejb.util.SafeToolkit;
+import org.apache.openejb.util.Stack;
+import org.apache.xbean.recipe.ConstructionException;
+import org.apache.xbean.recipe.ObjectRecipe;
+import org.apache.xbean.recipe.Option;
+import org.apache.xbean.recipe.StaticRecipe;
+
+public class SingletonInstanceManager {
+    private static final Logger logger = Logger.getInstance(LogCategory.OPENEJB, \
"org.apache.openejb.util.resources"); +
+    protected int poolLimit = 0;
+    protected int beanCount = 0;
+    protected boolean strictPooling = false;
+
+    protected HashMap<Object,Semaphore> semaphores;
+
+    protected final SafeToolkit toolkit = \
SafeToolkit.getToolkit("SingletonInstanceManager"); +    private TransactionManager \
transactionManager; +    private SecurityService securityService;
+
+    public SingletonInstanceManager(TransactionManager transactionManager, \
SecurityService securityService) { +        this.transactionManager = \
transactionManager; +        this.securityService = securityService;
+        this.poolLimit = 1;
+        this.strictPooling = true;
+
+        if (this.strictPooling) {
+            this.semaphores = new HashMap();
+        }
+    }
+
+    /**
+     * Removes an instance from the pool and returns it for use
+     * by the container in business methods.
+     *
+     * If the pool is at it's limit the StrictPooling flag will
+     * cause this thread to wait.
+     *
+     * If StrictPooling is not enabled this method will create a
+     * new stateless bean instance performing all required injection
+     * and callbacks before returning it in a method ready state.
+     * 
+     * @param callContext
+     * @return
+     * @throws OpenEJBException
+     */
+    public Object getInstance(ThreadContext callContext)
+            throws OpenEJBException {
+        CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
+        Data data = (Data) deploymentInfo.getContainerData();
+        Stack pool = data.getPool();
+        if(strictPooling){
+            try {
+                semaphores.get(deploymentInfo.getDeploymentID()).acquire();
+            } catch (InterruptedException e2) {
+                throw new OpenEJBException("Unexpected Interruption of current \
thread: ",e2); +            }
+        }
+        Object bean = pool.pop();
+
+        if (bean == null) {
+
+            Class beanClass = deploymentInfo.getBeanClass();
+            ObjectRecipe objectRecipe = new ObjectRecipe(beanClass);
+            objectRecipe.allow(Option.FIELD_INJECTION);
+            objectRecipe.allow(Option.PRIVATE_PROPERTIES);
+            objectRecipe.allow(Option.IGNORE_MISSING_PROPERTIES);
+            objectRecipe.allow(Option.NAMED_PARAMETERS);
+
+            Operation originalOperation = callContext.getCurrentOperation();
+            BaseContext.State[] originalAllowedStates = \
callContext.getCurrentAllowedStates(); +
+            try {
+                Context ctx = deploymentInfo.getJndiEnc();                
+                SessionContext sessionContext;
+                // This needs to be synchronized as this code is multi-threaded.
+                // In between the lookup and the bind a bind may take place in \
another Thread. +                // This is a fix for GERONIMO-3444
+                synchronized(this){
+                    try {                    
+                        sessionContext = (SessionContext) \
ctx.lookup("java:comp/EJBContext"); +                    } catch (NamingException e1) \
{ +                        sessionContext = createSessionContext();
+                        // TODO: This should work
+                        ctx.bind("java:comp/EJBContext", sessionContext);
+                    }                  
+                }
+                if (javax.ejb.SessionBean.class.isAssignableFrom(beanClass) || \
hasSetSessionContext(beanClass)) { +                    \
callContext.setCurrentOperation(Operation.INJECTION); +                    \
callContext.setCurrentAllowedStates(SingletonContext.getStates()); +                  \
objectRecipe.setProperty("sessionContext", new StaticRecipe(sessionContext)); +       \
}      +                
+                WebServiceContext wsContext;
+                // This is a fix for GERONIMO-3444
+                synchronized(this){
+                    try {
+                        wsContext = (WebServiceContext) \
ctx.lookup("java:comp/WebServiceContext"); +                    } catch \
(NamingException e) { +                        wsContext = new \
EjbWsContext(sessionContext); +                        \
ctx.bind("java:comp/WebServiceContext", wsContext); +                    }
+                }
+
+                fillInjectionProperties(objectRecipe, beanClass, deploymentInfo, \
ctx); +
+                bean = objectRecipe.create(beanClass.getClassLoader());
+                Map unsetProperties = objectRecipe.getUnsetProperties();
+                if (unsetProperties.size() > 0) {
+                    for (Object property : unsetProperties.keySet()) {
+                        logger.warning("Injection: No such property '" + property + \
"' in class " + beanClass.getName()); +                    }
+                }
+
+                HashMap<String, Object> interceptorInstances = new HashMap<String, \
Object>(); +                for (InterceptorData interceptorData : \
deploymentInfo.getAllInterceptors()) { +                    if \
(interceptorData.getInterceptorClass().equals(beanClass)) continue; +
+                    Class clazz = interceptorData.getInterceptorClass();
+                    ObjectRecipe interceptorRecipe = new ObjectRecipe(clazz);
+                    interceptorRecipe.allow(Option.FIELD_INJECTION);
+                    interceptorRecipe.allow(Option.PRIVATE_PROPERTIES);
+                    interceptorRecipe.allow(Option.IGNORE_MISSING_PROPERTIES);
+                    interceptorRecipe.allow(Option.NAMED_PARAMETERS);
+
+                    fillInjectionProperties(interceptorRecipe, clazz, \
deploymentInfo, ctx); +
+                    try {
+                        Object interceptorInstance = \
interceptorRecipe.create(clazz.getClassLoader()); +                        \
interceptorInstances.put(clazz.getName(), interceptorInstance); +                    \
} catch (ConstructionException e) { +                        throw new \
Exception("Failed to create interceptor: " + clazz.getName(), e); +                   \
} +                }
+
+                interceptorInstances.put(beanClass.getName(), bean);
+
+
+                try {
+                    callContext.setCurrentOperation(Operation.POST_CONSTRUCT);
+                    \
callContext.setCurrentAllowedStates(SingletonContext.getStates()); +
+                    List<InterceptorData> callbackInterceptors = \
deploymentInfo.getCallbackInterceptors(); +                    InterceptorStack \
interceptorStack = new InterceptorStack(bean, null, Operation.POST_CONSTRUCT, \
callbackInterceptors, interceptorInstances); +                    \
interceptorStack.invoke(); +                } catch (Exception e) {
+                    throw e;
+                }
+
+                try {
+                    if (bean instanceof SessionBean){
+                        callContext.setCurrentOperation(Operation.CREATE);
+                        \
callContext.setCurrentAllowedStates(SingletonContext.getStates()); +                  \
Method create = deploymentInfo.getCreateMethod(); +                        \
InterceptorStack interceptorStack = new InterceptorStack(bean, create, \
Operation.CREATE, new ArrayList<InterceptorData>(), new HashMap()); +                 \
interceptorStack.invoke(); +                    }
+                } catch (Exception e) {
+                    throw e;
+                }
+
+                bean = new Instance(bean, interceptorInstances);
+            } catch (Throwable e) {
+                if (e instanceof java.lang.reflect.InvocationTargetException) {
+                    e = ((java.lang.reflect.InvocationTargetException) \
e).getTargetException(); +                }
+                String t = "The bean instance " + bean + " threw a system \
exception:" + e; +                logger.error(t, e);
+                throw new org.apache.openejb.ApplicationException(new \
RemoteException("Cannot obtain a free instance.", e)); +            } finally {
+                callContext.setCurrentOperation(originalOperation);
+                callContext.setCurrentAllowedStates(originalAllowedStates);
+            }
+        }
+        return bean;
+    }
+
+    private static void fillInjectionProperties(ObjectRecipe objectRecipe, Class \
clazz, CoreDeploymentInfo deploymentInfo, Context context) { +        boolean \
usePrefix = true; +
+        try {
+            clazz.getConstructor();
+        } catch (NoSuchMethodException e) {
+            // Using constructor injection
+            // xbean can't handle the prefix yet
+            usePrefix = false;
+        }
+
+        for (Injection injection : deploymentInfo.getInjections()) {
+            if (!injection.getTarget().isAssignableFrom(clazz)) continue;
+            try {
+                String jndiName = injection.getJndiName();
+                Object object = context.lookup("java:comp/env/" + jndiName);
+                String prefix;
+                if (usePrefix) {
+                    prefix = injection.getTarget().getName() + "/";
+                } else {
+                    prefix = "";
+                }
+
+                if (object instanceof String) {
+                    String string = (String) object;
+                    // Pass it in raw so it could be potentially converted to
+                    // another data type by an xbean-reflect property editor
+                    objectRecipe.setProperty(prefix + injection.getName(), string);
+                } else {
+                    objectRecipe.setProperty(prefix + injection.getName(), new \
StaticRecipe(object)); +                }
+            } catch (NamingException e) {
+                logger.warning("Injection data not found in enc: jndiName='" + \
injection.getJndiName() + "', target=" + injection.getTarget() + "/" + \
injection.getName()); +            }
+        }
+    }
+
+    private boolean hasSetSessionContext(Class beanClass) {
+        try {
+            beanClass.getMethod("setSessionContext", SessionContext.class);
+            return true;
+        } catch (NoSuchMethodException e) {
+            return false;
+        }
+    }
+
+    private SessionContext createSessionContext() {
+        return new SingletonContext(transactionManager, securityService);
+    }
+
+    /**
+     * All instances are removed from the pool in getInstance(...).  They are only
+     * returned by the StatelessContainer via this method under two circumstances.
+     *
+     * 1.  The business method returns normally
+     * 2.  The business method throws an application exception
+     *
+     * Instances are not returned to the pool if the business method threw a system
+     * exception.
+     *
+     * @param callContext
+     * @param bean
+     * @throws OpenEJBException
+     */
+    public void poolInstance(ThreadContext callContext, Object bean) throws \
OpenEJBException { +        if (bean == null) {
+            throw new SystemException("Invalid arguments");
+        }
+
+        CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
+        Data data = (Data) deploymentInfo.getContainerData();
+        Stack pool = data.getPool();
+
+        if (strictPooling) {
+            pool.push(bean);
+            semaphores.get(deploymentInfo.getDeploymentID()).release();
+        } else {
+            if (pool.size() >= poolLimit) {
+                freeInstance(callContext, (Instance)bean);
+            } else {
+                pool.push(bean);
+            }
+        }
+    }
+
+    private void freeInstance(ThreadContext callContext, Instance instance) {
+        try {
+            callContext.setCurrentOperation(Operation.PRE_DESTROY);
+            callContext.setCurrentAllowedStates(SingletonContext.getStates());
+            CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
+
+            Method remove = instance.bean instanceof SessionBean? \
deploymentInfo.getCreateMethod(): null; +
+            List<InterceptorData> callbackInterceptors = \
deploymentInfo.getCallbackInterceptors(); +            InterceptorStack \
interceptorStack = new InterceptorStack(instance.bean, remove, Operation.PRE_DESTROY, \
callbackInterceptors, instance.interceptors); +
+            interceptorStack.invoke();
+        } catch (Throwable re) {
+            logger.error("The bean instance " + instance + " threw a system \
exception:" + re, re); +        }
+
+    }
+
+    /**
+     * This method has no work to do as all instances are removed from
+     * the pool on getInstance(...) and not returned via poolInstance(...)
+     * if they threw a system exception.
+     *
+     * @param callContext
+     * @param bean
+     */
+    public void discardInstance(ThreadContext callContext, Object bean) {
+
+    }
+
+    public void deploy(CoreDeploymentInfo deploymentInfo) {
+        Data data = new Data(poolLimit);
+        deploymentInfo.setContainerData(data);      
+        if (this.strictPooling) {
+            this.semaphores.put(deploymentInfo.getDeploymentID(), new \
Semaphore(poolLimit)); +        }
+
+    }
+
+    public void undeploy(CoreDeploymentInfo deploymentInfo) {
+        Data data = (Data) deploymentInfo.getContainerData();
+        if (this.strictPooling) {
+            semaphores.remove(deploymentInfo.getDeploymentID());
+        }
+        if (data == null) return;
+        Stack pool = data.getPool();
+        //TODO ejbRemove on each bean in pool.
+        //clean pool
+        deploymentInfo.setContainerData(null);
+    }
+
+    private static final class Data {
+        private final Stack pool;
+
+        public Data(int poolLimit) {
+            pool = new LinkedListStack(poolLimit);
+        }
+
+        public Stack getPool() {
+            return pool;
+        }
+    }
+
+}

Propchange: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonInstanceManager.java
                
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author Id Revision HeadURL

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.embedded/service-jar.xml
                
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/ma \
in/resources/META-INF/org.apache.openejb.embedded/service-jar.xml?rev=672566&r1=672565&r2=672566&view=diff
 ==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.embedded/service-jar.xml \
                (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.embedded/service-jar.xml \
Sat Jun 28 11:48:28 2008 @@ -112,6 +112,20 @@
 
   </ServiceProvider>
 
+  <!--
+  # ==========================================================
+  # Default Singleton SessinBean Container
+  # ==========================================================
+  -->
+  <ServiceProvider
+          id="Default Singleton Container"
+          service="Container"
+          types="SINGLETON"
+          constructor="id, transactionManager, securityService"
+          class-name="org.apache.openejb.core.singleton.SingletonContainer">
+
+  </ServiceProvider>
+
 
   <!--
   # ==========================================================

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/service-jar.xml
                
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/ma \
in/resources/META-INF/org.apache.openejb/service-jar.xml?rev=672566&r1=672565&r2=672566&view=diff
 ==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/service-jar.xml \
                (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/service-jar.xml \
Sat Jun 28 11:48:28 2008 @@ -117,6 +117,21 @@
 
   <!--
   # ==========================================================
+  # Default Singleton SessinBean Container
+  # ==========================================================
+  -->
+  <ServiceProvider
+          id="Default Singleton Container"
+          service="Container"
+          types="SINGLETON"
+          constructor="id, transactionManager, securityService"
+          class-name="org.apache.openejb.core.singleton.SingletonContainer">
+
+  </ServiceProvider>
+
+
+  <!--
+  # ==========================================================
   # Default Stateful SessinBean Container
   # ==========================================================
   -->

Added: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/singleton/SingletonContainerTest.java
                
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/te \
st/java/org/apache/openejb/core/singleton/SingletonContainerTest.java?rev=672566&view=auto
 ==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/singleton/SingletonContainerTest.java \
                (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/singleton/SingletonContainerTest.java \
Sat Jun 28 11:48:28 2008 @@ -0,0 +1,162 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.core.singleton;
+
+import junit.framework.TestCase;
+
+import javax.naming.InitialContext;
+import javax.ejb.SessionContext;
+import java.util.List;
+import java.util.Arrays;
+import java.util.Stack;
+
+import org.apache.openejb.core.ivm.naming.InitContextFactory;
+import org.apache.openejb.config.ConfigurationFactory;
+import org.apache.openejb.assembler.classic.Assembler;
+import org.apache.openejb.assembler.classic.ProxyFactoryInfo;
+import org.apache.openejb.assembler.classic.TransactionServiceInfo;
+import org.apache.openejb.assembler.classic.SecurityServiceInfo;
+import org.apache.openejb.assembler.classic.SingletonSessionContainerInfo;
+import org.apache.openejb.jee.SingletonBean;
+import org.apache.openejb.jee.EjbJar;
+
+/**
+ * @version $Revision: 581127 $ $Date: 2007-10-01 19:13:16 -0700 (Mon, 01 Oct 2007) \
$ + */
+public class SingletonContainerTest extends TestCase {
+
+    public void testPojoStyleBean() throws Exception {
+        List expected = Arrays.asList(Lifecycle.values());
+        InitialContext ctx = new InitialContext();
+
+        {
+            WidgetBean.lifecycle.clear();
+
+            Object object = ctx.lookup("WidgetBeanLocal");
+
+            assertTrue("instanceof widget", object instanceof Widget);
+
+            Widget widget = (Widget) object;
+
+            // Do a business method...
+            Stack<Lifecycle> lifecycle = widget.getLifecycle();
+            assertNotNull("lifecycle", lifecycle);
+            assertSame("lifecycle", lifecycle, WidgetBean.lifecycle);
+
+            // Check the lifecycle of the bean
+            assertEquals(join("\n", expected), join("\n", lifecycle));
+        }
+        {
+
+            WidgetBean.lifecycle.clear();
+
+            Object object = ctx.lookup("WidgetBeanRemote");
+
+            assertTrue("instanceof widget", object instanceof RemoteWidget);
+
+            RemoteWidget remoteWidget = (RemoteWidget) object;
+
+            // Do a business method...
+            Stack<Lifecycle> lifecycle = remoteWidget.getLifecycle();
+            assertNotNull("lifecycle", lifecycle);
+            assertNotSame("lifecycle", lifecycle, WidgetBean.lifecycle);
+
+            // Check the lifecycle of the bean
+            assertEquals(Lifecycle.BUSINESS_METHOD + "\n", join("\n", lifecycle));
+        }
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, \
InitContextFactory.class.getName()); +
+        ConfigurationFactory config = new ConfigurationFactory();
+        Assembler assembler = new Assembler();
+
+        assembler.createProxyFactory(config.configureService(ProxyFactoryInfo.class));
 +        assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
 +        assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
 +
+        // containers
+        SingletonSessionContainerInfo singletonContainerInfo = \
config.configureService(SingletonSessionContainerInfo.class); +//        \
singletonContainerInfo.properties.setProperty("TimeOut", "10"); +//        \
singletonContainerInfo.properties.setProperty("PoolSize", "0"); +//        \
singletonContainerInfo.properties.setProperty("StrictPooling", "false"); +        \
assembler.createContainer(singletonContainerInfo); +
+        // Setup the descriptor information
+
+        SingletonBean bean = new SingletonBean(WidgetBean.class);
+        bean.addBusinessLocal(Widget.class.getName());
+        bean.addBusinessRemote(RemoteWidget.class.getName());
+        bean.addPostConstruct("init");
+        bean.addPreDestroy("destroy");
+
+        EjbJar ejbJar = new EjbJar();
+        ejbJar.addEnterpriseBean(bean);
+
+        assembler.createApplication(config.configureApplication(ejbJar));
+
+    }
+
+    private static String join(String delimeter, List items) {
+        StringBuffer sb = new StringBuffer();
+        for (Object item : items) {
+            sb.append(item.toString()).append(delimeter);
+        }
+        return sb.toString();
+    }
+
+    public static interface Widget {
+        Stack<Lifecycle> getLifecycle();
+    }
+
+    public static interface RemoteWidget extends Widget {
+
+    }
+
+    public static enum Lifecycle {
+        CONSTRUCTOR, INJECTION, POST_CONSTRUCT, BUSINESS_METHOD
+    }
+
+    public static class WidgetBean implements Widget, RemoteWidget {
+
+        private static Stack<Lifecycle> lifecycle = new Stack<Lifecycle>();
+
+        public WidgetBean() {
+            WidgetBean.lifecycle.push(Lifecycle.CONSTRUCTOR);
+        }
+
+        public void setSessionContext(SessionContext sessionContext) {
+            WidgetBean.lifecycle.push(Lifecycle.INJECTION);
+        }
+
+        public Stack<Lifecycle> getLifecycle() {
+            WidgetBean.lifecycle.push(Lifecycle.BUSINESS_METHOD);
+            return WidgetBean.lifecycle;
+        }
+
+        public void init() {
+            WidgetBean.lifecycle.push(Lifecycle.POST_CONSTRUCT);
+        }
+
+        public void destroy() {
+//            WidgetBean.lifecycle.push(Lifecycle.PRE_DESTROY);
+        }
+    }
+}

Modified: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/iTest.java
                
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/iTest.java?rev=672566&r1=672565&r2=672566&view=diff
 ==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/iTest.java \
                (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/iTest.java \
Sat Jun 28 11:48:28 2008 @@ -20,6 +20,7 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 import org.apache.openejb.test.TestManager;
+import org.apache.openejb.test.singleton.SingletonLocalTestSuite;
 import org.apache.openejb.test.entity.bmp.BmpLocalTestSuite;
 import org.apache.openejb.test.entity.cmp.CmpLocalTestSuite;
 import org.apache.openejb.test.entity.cmp2.Cmp2TestSuite;
@@ -74,6 +75,7 @@
 
     public static Test suite() {
         TestSuite suite = new iTest();
+        suite.addTest(SingletonLocalTestSuite.suite());
         suite.addTest(StatelessLocalTestSuite.suite());
         suite.addTest(StatefulLocalTestSuite.suite());
         suite.addTest(BmpLocalTestSuite.suite());

Modified: openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/SessionType.java
                
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/mai \
n/java/org/apache/openejb/jee/SessionType.java?rev=672566&r1=672565&r2=672566&view=diff
 ==============================================================================
--- openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/SessionType.java \
                (original)
+++ openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/SessionType.java \
Sat Jun 28 11:48:28 2008 @@ -22,5 +22,6 @@
 
 public enum SessionType {
     @XmlEnumValue("Stateful") STATEFUL,
-    @XmlEnumValue("Stateless") STATELESS
+    @XmlEnumValue("Stateless") STATELESS,
+    @XmlEnumValue("Singleton") SINGLETON
 }

Added: openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/SingletonBean.java
                
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/SingletonBean.java?rev=672566&view=auto
 ==============================================================================
--- openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/SingletonBean.java \
                (added)
+++ openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/SingletonBean.java \
Sat Jun 28 11:48:28 2008 @@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.jee;
+
+import java.util.Collections;
+
+/**
+ * @version $Revision: 605052 $ $Date: 2007-12-17 16:24:24 -0800 (Mon, 17 Dec 2007) \
$ + */
+public class SingletonBean extends SessionBean {
+    public SingletonBean(String ejbName, String ejbClass) {
+        super(ejbName, ejbClass, SessionType.SINGLETON);
+        postActivate = Collections.emptyList();
+        prePassivate = Collections.emptyList();
+    }
+
+    public SingletonBean(Class<?> ejbClass) {
+        this(ejbClass.getSimpleName(), ejbClass.getName());
+    }
+
+    public SingletonBean(String name, Class<?> ejbClass) {
+        this(name, ejbClass.getName());
+    }
+
+    public SingletonBean() {
+        this(null, (String)null);
+    }
+
+    public void setSessionType(SessionType value) {
+    }
+
+}

Modified: openejb/trunk/openejb3/itests/openejb-itests-app/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-app/pom.xml?rev=672566&r1=672565&r2=672566&view=diff
 ==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-app/pom.xml (original)
+++ openejb/trunk/openejb3/itests/openejb-itests-app/pom.xml Sat Jun 28 11:48:28 2008
@@ -77,6 +77,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.openejb</groupId>
+      <artifactId>ejb31-api-experimental</artifactId>
+      <version>${version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
       <artifactId>openejb-itests-beans</artifactId>
       <version>${version}</version>
       <type>ejb</type>

Modified: openejb/trunk/openejb3/itests/openejb-itests-beans/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-beans/pom.xml?rev=672566&r1=672565&r2=672566&view=diff
 ==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-beans/pom.xml (original)
+++ openejb/trunk/openejb3/itests/openejb-itests-beans/pom.xml Sat Jun 28 11:48:28 \
2008 @@ -34,6 +34,11 @@
       <scope>provided</scope>
     </dependency>
     <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>ejb31-api-experimental</artifactId>
+      <version>${version}</version>
+    </dependency>
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <scope>compile</scope>

Added: openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/AnnotatedFieldInjectionSingletonBean.java
                
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-beans/s \
rc/main/java/org/apache/openejb/test/singleton/AnnotatedFieldInjectionSingletonBean.java?rev=672566&view=auto
 ==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/AnnotatedFieldInjectionSingletonBean.java \
                (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/AnnotatedFieldInjectionSingletonBean.java \
Sat Jun 28 11:48:28 2008 @@ -0,0 +1,322 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.test.singleton;
+
+import junit.framework.Assert;
+import junit.framework.AssertionFailedError;
+import org.apache.openejb.test.TestFailureException;
+import org.apache.openejb.test.entity.bmp.BasicBmpHome;
+import org.apache.openejb.test.stateful.BasicStatefulBusinessLocal;
+import org.apache.openejb.test.stateful.BasicStatefulBusinessRemote;
+import org.apache.openejb.test.stateful.BasicStatefulHome;
+
+import javax.annotation.Resource;
+import javax.ejb.CreateException;
+import javax.ejb.EJB;
+import javax.ejb.SessionContext;
+import javax.ejb.Singleton;
+import javax.ejb.RemoteHome;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceUnit;
+import javax.persistence.PersistenceContext;
+import javax.sql.DataSource;
+import javax.jms.ConnectionFactory;
+import javax.jms.Session;
+import javax.jms.Topic;
+import javax.jms.MessageProducer;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.JMSException;
+
+@RemoteHome(org.apache.openejb.test.singleton.EncSingletonHome.class)
+@Singleton
+public class AnnotatedFieldInjectionSingletonBean {
+
+    @Resource
+    private SessionContext ejbContext;
+    @EJB(beanName = "BasicBmpBean")
+    private BasicBmpHome bmpHome;
+    @EJB(beanName = "BasicStatefulBean")
+    private BasicStatefulHome statefulHome;
+    @EJB(beanName = "BasicSingletonBean")
+    private BasicSingletonHome singletonHome;
+    @Resource
+    private String striing = "1";
+    @Resource
+    private Double doouble = 1.0D;
+    @Resource
+    private Long loong = 1L;
+    @Resource
+    private Float flooat = 1.0F;
+    @Resource
+    private Integer inteeger = 1;
+    @Resource
+    private Short shoort = (short)1;
+    @Resource
+    private Boolean booolean = true;
+    @Resource
+    private Byte byyte = (byte)1;
+    @Resource
+    private Character chaaracter = 'D';
+    @Resource
+    private DataSource daataSource;
+    @Resource
+    private ConnectionFactory coonnectionFactory;
+    @Resource
+    private QueueConnectionFactory queueCoonnectionFactory;
+    @Resource
+    private TopicConnectionFactory topicCoonnectionFactory;
+    @PersistenceUnit(unitName = "openjpa-test-unit")
+    private EntityManagerFactory emf;
+    @PersistenceContext(unitName = "openjpa-test-unit")
+    private EntityManager em;
+    @EJB
+    private BasicSingletonBusinessLocal singletonBusinessLocal;
+    @EJB
+    private BasicSingletonBusinessRemote singletonBusinessRemote;
+    @EJB
+    private BasicStatefulBusinessLocal statefulBusinessLocal;
+    @EJB
+    private BasicStatefulBusinessRemote statefulBusinessRemote;
+
+
+    public void ejbCreate() throws CreateException {
+    }
+
+    public void lookupEntityBean() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EJBObject is null", bmpHome);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupStatefulBean() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EJBObject is null", statefulHome);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupSingletonBean() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EJBObject is null", singletonHome);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupSingletonBusinessLocal() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EJB BusinessLocal is null", \
singletonBusinessLocal); +        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupSingletonBusinessRemote() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EJB BusinessRemote is null", \
singletonBusinessRemote); +        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupStatefulBusinessLocal() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EJB BusinessLocal is null", \
statefulBusinessLocal); +        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupStatefulBusinessRemote() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EJB BusinessRemote is null", \
statefulBusinessRemote); +        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupStringEntry() throws TestFailureException {
+        try {
+            String expected = new String("1");
+            Assert.assertNotNull("The String looked up is null", striing);
+            Assert.assertEquals(expected, striing);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupDoubleEntry() throws TestFailureException {
+        try {
+            Double expected = new Double(1.0D);
+
+            Assert.assertNotNull("The Double looked up is null", doouble);
+            Assert.assertEquals(expected, doouble);
+
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupLongEntry() throws TestFailureException {
+        try {
+            Long expected = new Long(1L);
+
+            Assert.assertNotNull("The Long looked up is null", loong);
+            Assert.assertEquals(expected, loong);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupFloatEntry() throws TestFailureException {
+        try {
+            Float expected = new Float(1.0F);
+
+            Assert.assertNotNull("The Float looked up is null", flooat);
+            Assert.assertEquals(expected, flooat);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupIntegerEntry() throws TestFailureException {
+        try {
+            Integer expected = new Integer(1);
+
+            Assert.assertNotNull("The Integer looked up is null", inteeger);
+            Assert.assertEquals(expected, inteeger);
+
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupShortEntry() throws TestFailureException {
+        try {
+            Short expected = new Short((short) 1);
+
+            Assert.assertNotNull("The Short looked up is null", shoort);
+            Assert.assertEquals(expected, shoort);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupBooleanEntry() throws TestFailureException {
+        try {
+            Boolean expected = new Boolean(true);
+
+            Assert.assertNotNull("The Boolean looked up is null", booolean);
+            Assert.assertEquals(expected, booolean);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupByteEntry() throws TestFailureException {
+        try {
+            Byte expected = new Byte((byte) 1);
+
+            Assert.assertNotNull("The Byte looked up is null", byyte);
+            Assert.assertEquals(expected, byyte);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupCharacterEntry() throws TestFailureException {
+        try {
+            Character expected = new Character('D');
+
+            Assert.assertNotNull("The Character looked up is null", chaaracter);
+            Assert.assertEquals(expected, chaaracter);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupResource() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The DataSource is null", daataSource);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupJMSConnectionFactory() throws TestFailureException{
+        try{
+            try{
+                testJmsConnection(coonnectionFactory.createConnection());
+                testJmsConnection(queueCoonnectionFactory.createConnection());
+                testJmsConnection(topicCoonnectionFactory.createConnection());
+            } catch (Exception e){
+                e.printStackTrace();
+                Assert.fail("Received Exception "+e.getClass()+ " : \
"+e.getMessage()); +            }
+        } catch (AssertionFailedError afe){
+            throw new TestFailureException(afe);
+        }
+    }
+
+    private void testJmsConnection(javax.jms.Connection connection) throws \
JMSException { +        Session session = connection.createSession(false, \
Session.DUPS_OK_ACKNOWLEDGE); +        Topic topic = session.createTopic("test");
+        MessageProducer producer = session.createProducer(topic);
+        producer.send(session.createMessage());
+        producer.close();
+        session.close();
+        connection.close();
+    }
+
+    public void lookupPersistenceUnit() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EntityManagerFactory is null", emf);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupPersistenceContext() throws TestFailureException {
+        try {
+            Assert.assertNotNull("The EntityManager is null", em);
+
+            try {
+                // call a do nothing method to assure entity manager actually exists
+                em.getFlushMode();
+            } catch (Exception e) {
+                Assert.fail("Received Exception " + e.getClass() + " : " + \
e.getMessage()); +            }
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+    }
+
+    public void lookupSessionContext() throws TestFailureException {
+        try {
+// TODO: DMB: Can't seem to find where to make this work
+//            Assert.assertNotNull("The SessionContext is null", ejbContext);
+        } catch (AssertionFailedError afe) {
+            throw new TestFailureException(afe);
+        }
+
+    }
+}

Added: openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonBean.java
                
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-beans/s \
rc/main/java/org/apache/openejb/test/singleton/BasicSingletonBean.java?rev=672566&view=auto
 ==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonBean.java \
                (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonBean.java \
Sat Jun 28 11:48:28 2008 @@ -0,0 +1,276 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.test.singleton;
+
+import java.rmi.RemoteException;
+import java.util.Hashtable;
+import java.util.Properties;
+import javax.ejb.EJBException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+import javax.ejb.TimedObject;
+import javax.ejb.Timer;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.openejb.test.ApplicationException;
+import org.apache.openejb.test.beans.TimerSync;
+import org.apache.openejb.test.object.OperationsPolicy;
+
+
+/**
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public class BasicSingletonBean implements SessionBean, TimedObject {
+
+    private String name;
+    private SessionContext ejbContext;
+    private static Hashtable allowedOperationsTable = new Hashtable();
+
+    //=============================
+    // Home interface methods
+    //    
+    //    
+    // Home interface methods
+    //=============================
+
+    //=============================
+    // Remote interface methods
+    //    
+
+    /**
+     * Maps to BasicSingletonObject.businessMethod
+     *
+     * @return
+     * @see BasicSingletonObject#businessMethod
+     */
+    public String businessMethod(String text) {
+        testAllowedOperations("businessMethod");
+        StringBuffer b = new StringBuffer(text);
+        return b.reverse().toString();
+    }
+
+    public void scheduleTimer(String name) {
+        ejbContext.getTimerService().createTimer(1, name);
+    }
+
+    /**
+     * Throws an ApplicationException when invoked
+     */
+    public void throwApplicationException() throws ApplicationException {
+        throw new ApplicationException("Testing ability to throw Application \
Exceptions"); +    }
+
+    /**
+     * Throws a java.lang.NullPointerException when invoked
+     * This is a system exception and should result in the
+     * destruction of the instance and invalidation of the
+     * remote reference.
+     */
+    public void throwSystemException_NullPointer() {
+        throw new NullPointerException("Testing ability to throw System \
Exceptions"); +    }
+
+    /**
+     * Maps to BasicSingletonObject.getPermissionsReport
+     * <p/>
+     * Returns a report of the bean's
+     * runtime permissions
+     *
+     * @return
+     * @see BasicSingletonObject#getPermissionsReport
+     */
+    public Properties getPermissionsReport() {
+        /* TO DO: */
+        return null;
+    }
+
+    /**
+     * Maps to BasicSingletonObject.getAllowedOperationsReport
+     * <p/>
+     * Returns a report of the allowed opperations
+     * for one of the bean's methods.
+     *
+     * @param methodName The method for which to get the allowed opperations report
+     * @return
+     * @see BasicSingletonObject#getAllowedOperationsReport
+     */
+    public OperationsPolicy getAllowedOperationsReport(String methodName) {
+        return (OperationsPolicy) allowedOperationsTable.get(methodName);
+    }
+    
+    public String remove(String str){
+        return str;
+    }    
+
+    //    
+    // Remote interface methods
+    //=============================
+
+    //================================
+    // SessionBean interface methods
+    //    
+
+    /**
+     * Set the associated session context. The container calls this method
+     * after the instance creation.
+     */
+    public void setSessionContext(SessionContext ctx) throws EJBException, \
RemoteException { +        ejbContext = ctx;
+        testAllowedOperations("setSessionContext");
+    }
+
+    /**
+     * @throws javax.ejb.CreateException
+     */
+    public void ejbCreateObject() throws javax.ejb.CreateException {
+        testAllowedOperations("ejbCreate");
+        this.name = "nameless automaton";
+    }
+
+    /**
+     * A container invokes this method before it ends the life of the session
+     * object. This happens as a result of a client's invoking a remove
+     * operation, or when a container decides to terminate the session object
+     * after a timeout.
+     */
+    public void ejbRemove() throws EJBException, RemoteException {
+        testAllowedOperations("ejbRemove");
+    }
+
+    /**
+     * The activate method is called when the instance is activated
+     * from its "passive" state. The instance should acquire any resource
+     * that it has released earlier in the ejbPassivate() method.
+     */
+    public void ejbActivate() throws EJBException, RemoteException {
+        testAllowedOperations("ejbActivate");
+        // Should never called.
+    }
+
+    /**
+     * The passivate method is called before the instance enters
+     * the "passive" state. The instance should release any resources that
+     * it can re-acquire later in the ejbActivate() method.
+     */
+    public void ejbPassivate() throws EJBException, RemoteException {
+        testAllowedOperations("ejbPassivate");
+        // Should never called.
+    }
+
+    public void ejbTimeout(Timer timer) {
+        testAllowedOperations("ejbTimeout");
+        try {
+            String name = (String) timer.getInfo();
+            TimerSync timerSync = (TimerSync) \
ejbContext.lookup("TimerSyncBeanBusinessRemote"); +            \
timerSync.countDown(name); +        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    //
+    // SessionBean interface methods
+    //================================
+
+    protected void testAllowedOperations(String methodName) {
+        OperationsPolicy policy = new OperationsPolicy();
+
+        /*[0] Test getEJBHome /////////////////*/
+        try {
+            ejbContext.getEJBHome();
+            policy.allow(OperationsPolicy.Context_getEJBHome);
+        } catch (IllegalStateException ise) {
+        }
+
+        /*[1] Test getCallerPrincipal /////////*/
+        try {
+            ejbContext.getCallerPrincipal();
+            policy.allow(OperationsPolicy.Context_getCallerPrincipal);
+        } catch (IllegalStateException ise) {
+        }
+
+        /*[2] Test isCallerInRole /////////////*/
+        try {
+            ejbContext.isCallerInRole("TheMan");
+            policy.allow(OperationsPolicy.Context_isCallerInRole);
+        } catch (IllegalStateException ise) {
+        }
+
+        /*[3] Test getRollbackOnly ////////////*/
+        try {
+            ejbContext.getRollbackOnly();
+            policy.allow(OperationsPolicy.Context_getRollbackOnly);
+        } catch (IllegalStateException ise) {
+        }
+
+        /*[4] Test setRollbackOnly ////////////*/
+        try {
+            ejbContext.setRollbackOnly();
+            policy.allow(OperationsPolicy.Context_setRollbackOnly);
+        } catch (IllegalStateException ise) {
+        }
+
+        /*[5] Test getUserTransaction /////////*/
+        try {
+            ejbContext.getUserTransaction();
+            policy.allow(OperationsPolicy.Context_getUserTransaction);
+        } catch (IllegalStateException ise) {
+        }
+
+        /*[6] Test getEJBObject ///////////////*/
+        try {
+            ejbContext.getEJBObject();
+            policy.allow(OperationsPolicy.Context_getEJBObject);
+        } catch (IllegalStateException ise) {
+        }
+
+        /*[7] Test Context_getPrimaryKey ///////////////
+                  *
+                  * Can't really do this
+                  */
+
+        /*[8] Test JNDI_access_to_java_comp_env ///////////////*/
+        try {
+            InitialContext jndiContext = new InitialContext();
+
+            String actual = (String) \
jndiContext.lookup("java:comp/env/singleton/references/JNDI_access_to_java_comp_env");
 +
+            policy.allow(OperationsPolicy.JNDI_access_to_java_comp_env);
+        } catch (IllegalStateException ise) {
+        } catch (NamingException ne) {
+        }
+
+        /*[11] Test lookup /////////*/
+        try {
+            ejbContext.lookup("singleton/references/JNDI_access_to_java_comp_env");
+            policy.allow(OperationsPolicy.Context_lookup);
+        } catch (IllegalArgumentException ise) {
+        }
+
+        /*[12] Test getTimerService/////////*/
+        try {
+            ejbContext.getTimerService();
+            policy.allow(OperationsPolicy.Context_getTimerService);
+        } catch (IllegalStateException ise) {
+        }
+
+        allowedOperationsTable.put(methodName, policy);
+    }
+
+}

Added: openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonBusinessLocal.java
                
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-beans/s \
rc/main/java/org/apache/openejb/test/singleton/BasicSingletonBusinessLocal.java?rev=672566&view=auto
 ==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonBusinessLocal.java \
                (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonBusinessLocal.java \
Sat Jun 28 11:48:28 2008 @@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.test.singleton;
+
+import org.apache.openejb.test.ApplicationException;
+import org.apache.openejb.test.object.OperationsPolicy;
+
+import java.util.Properties;
+
+/**
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public interface BasicSingletonBusinessLocal {
+
+    /**
+     * Reverses the string passed in then returns it
+     *
+     * @return string
+     */
+    public String businessMethod(String text);
+
+    public Object echo(Object object);
+
+    /**
+     * Throws an ApplicationException when invoked
+     *
+     */
+    public void throwApplicationException() throws ApplicationException;
+
+    /**
+     * Throws a java.lang.NullPointerException when invoked
+     * This is a system exception and should result in the
+     * destruction of the instance and invalidation of the
+     * remote reference.
+     *
+     */
+    public void throwSystemException_NullPointer();
+
+    /**
+     * Returns a report of the bean's
+     * runtime permissions
+     *
+     * @return properties
+     */
+    public Properties getPermissionsReport();
+
+    /**
+     * Returns a report of the allowed opperations
+     * for one of the bean's methods.
+     *
+     * @param methodName The method for which to get the allowed opperations report
+     * @return operations policy
+     */
+    public OperationsPolicy getAllowedOperationsReport(String methodName);
+    
+    /**
+     * Verify if we can invoke remove() on a singleton session bean as a business \
method +     */    
+    public Object remove();
+
+}

Added: openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonBusinessRemote.java
                
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-beans/s \
rc/main/java/org/apache/openejb/test/singleton/BasicSingletonBusinessRemote.java?rev=672566&view=auto
 ==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonBusinessRemote.java \
                (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonBusinessRemote.java \
Sat Jun 28 11:48:28 2008 @@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.test.singleton;
+
+import org.apache.openejb.test.ApplicationException;
+import org.apache.openejb.test.object.OperationsPolicy;
+
+import java.util.Properties;
+
+/**
+ *
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public interface BasicSingletonBusinessRemote {
+
+    /**
+     * Reverses the string passed in then returns it
+     *
+     * @return string
+     */
+    public String businessMethod(String text);
+
+    public Object echo(Object object);
+
+    /**
+     * Throws an ApplicationException when invoked
+     *
+     */
+    public void throwApplicationException() throws ApplicationException;
+
+    /**
+     * Throws a java.lang.NullPointerException when invoked
+     * This is a system exception and should result in the
+     * destruction of the instance and invalidation of the
+     * remote reference.
+     *
+     */
+    public void throwSystemException_NullPointer();
+
+    /**
+     * Returns a report of the bean's
+     * runtime permissions
+     *
+     * @return properties
+     */
+    public Properties getPermissionsReport();
+
+    /**
+     * Returns a report of the allowed opperations
+     * for one of the bean's methods.
+     *
+     * @param methodName The method for which to get the allowed opperations report
+     * @return operations policy
+     */
+    public OperationsPolicy getAllowedOperationsReport(String methodName);
+    
+    /**
+     * Verify if we can invoke remove() on a singleton session bean as a business \
method +     */    
+    public Object remove();
+}

Added: openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonHome.java
                
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-beans/s \
rc/main/java/org/apache/openejb/test/singleton/BasicSingletonHome.java?rev=672566&view=auto
 ==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonHome.java \
                (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonHome.java \
Sat Jun 28 11:48:28 2008 @@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.test.singleton;
+
+
+/**
+ * 
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public interface BasicSingletonHome extends javax.ejb.EJBHome {
+
+    public BasicSingletonObject createObject()
+    throws javax.ejb.CreateException, java.rmi.RemoteException;
+}

Added: openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonInterceptedBean.java
                
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-beans/s \
rc/main/java/org/apache/openejb/test/singleton/BasicSingletonInterceptedBean.java?rev=672566&view=auto
 ==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonInterceptedBean.java \
                (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonInterceptedBean.java \
Sat Jun 28 11:48:28 2008 @@ -0,0 +1,124 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.test.singleton;
+
+import java.util.Map;
+import java.util.LinkedHashMap;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.ejb.Singleton;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.ExcludeClassInterceptors;
+import javax.interceptor.Interceptors;
+import javax.interceptor.InvocationContext;
+
+import org.apache.openejb.test.SuperInterceptedBean;
+import org.apache.openejb.test.interceptor.ClassInterceptor;
+import org.apache.openejb.test.interceptor.Interceptor;
+import org.apache.openejb.test.interceptor.MethodInterceptor;
+
+/**
+ * @version $Rev: 607077 $ $Date: 2007-12-27 06:55:23 -0800 (Thu, 27 Dec 2007) $
+ */
+@Singleton(name="BasicSingletonIntercepted")
+@Interceptors({ClassInterceptor.class})
+public class BasicSingletonInterceptedBean extends SuperInterceptedBean 
+                  implements BasicSingletonInterceptedLocal, \
BasicSingletonInterceptedRemote { +    
+    private static Map<String, Object> contextData = new LinkedHashMap<String, \
Object>(); +
+    /**
+     * A simple dummy business method to concat 2 strings
+     */
+    public String concat(String str1, String str2) {
+        return str1.concat(str2);
+    }
+
+    /**
+     * A simple dummy busines method to reverse a string
+     */
+    @Interceptors({MethodInterceptor.class})
+    public String reverse(String str) {
+        StringBuffer b = new StringBuffer(str);
+        return b.reverse().toString();
+    }
+    
+    /**
+     * @param ctxData the contextData to set
+     */
+    private void setContextData(Map<String, Object> ctxData) {
+        BasicSingletonInterceptedBean.contextData.putAll(ctxData);
+    }
+
+    /**
+     * <code>ClassInterceptor</code> should not intercept this.
+     * 
+     * @return the contextData
+     */
+    @ExcludeClassInterceptors
+    public Map<String, Object> getContextData() {
+        return contextData;
+    }
+
+    /**
+     * The interceptor method. 
+     * This should intercept all business methods in this bean class.
+     * It cannot exclude even those annotated with \
<code>@ExcludeClassInterceptors</code> +     * 
+     * @param ctx - InvocationContext
+     * 
+     * @return - the result of the next method invoked. If a method returns void, \
proceed returns null.  +     * For lifecycle callback interceptor methods, if there \
is no callback method defined on the bean class,  +     * the invocation of proceed \
in the last interceptor method in the chain is a no-op, and null is returned.  +     \
* If there is more than one such interceptor method, the invocation of proceed causes \
the container to execute those methods in order. +     * 
+     * @throws Exception runtime exceptions or application exceptions that are \
allowed in the throws clause of the business method. +     */
+    @AroundInvoke
+    public Object inBeanInterceptor(InvocationContext ctx) throws Exception {
+        Map<String, Object> ctxData = Interceptor.profile(ctx, "inBeanInterceptor");
+        setContextData(ctxData);
+        return ctx.proceed();
+    }
+
+    /**
+     * The interceptor method. 
+     * This should intercept postConstruct of the bean
+     * 
+     * @throws Exception runtime exceptions.
+     */    
+    @PostConstruct
+    public void inBeanInterceptorPostConstruct() throws Exception {
+        Map<String, Object> ctxData = Interceptor.profile(this, \
"inBeanInterceptorPostConstruct"); +        setContextData(ctxData);
+    }
+    
+      
+    /**
+     * The interceptor method. 
+     * This should intercept preDestroy of the bean.
+     * 
+     * @throws Exception runtime exceptions.
+     */    
+    @PreDestroy
+    public void inBeanInterceptorPreDestroy() throws Exception {
+        Map<String, Object> ctxData = Interceptor.profile(this, \
"inBeanInterceptorPreDestroy"); +        setContextData(ctxData);
+    }
+
+}

Added: openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonInterceptedLocal.java
                
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-beans/s \
rc/main/java/org/apache/openejb/test/singleton/BasicSingletonInterceptedLocal.java?rev=672566&view=auto
 ==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonInterceptedLocal.java \
                (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonInterceptedLocal.java \
Sat Jun 28 11:48:28 2008 @@ -0,0 +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.apache.openejb.test.singleton;
+
+import java.util.Map;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:goyathlay.geronimo@gmail.com">Prasad Kashyap</a>
+ *
+ * @version $Rev: 607077 $ $Date: 2007-12-27 06:55:23 -0800 (Thu, 27 Dec 2007) $
+ */
+public interface BasicSingletonInterceptedLocal {
+    
+    public String reverse(String str);
+    
+    public String concat(String str1, String str2);
+    
+    public Map<String, Object> getContextData();
+
+}

Added: openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonInterceptedRemote.java
                
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-beans/s \
rc/main/java/org/apache/openejb/test/singleton/BasicSingletonInterceptedRemote.java?rev=672566&view=auto
 ==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonInterceptedRemote.java \
                (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonInterceptedRemote.java \
Sat Jun 28 11:48:28 2008 @@ -0,0 +1,35 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.test.singleton;
+
+import java.util.Map;
+
+import javax.ejb.Remote;
+
+/**
+ * @version $Rev: 607077 $ $Date: 2007-12-27 06:55:23 -0800 (Thu, 27 Dec 2007) $
+ */
+@Remote
+public interface BasicSingletonInterceptedRemote {
+    
+    public String reverse(String str);
+    
+    public String concat(String str1, String str2);
+    
+    public Map<String, Object> getContextData();
+
+}

Added: openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonLocalHome.java
                
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-beans/s \
rc/main/java/org/apache/openejb/test/singleton/BasicSingletonLocalHome.java?rev=672566&view=auto
 ==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonLocalHome.java \
                (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonLocalHome.java \
Sat Jun 28 11:48:28 2008 @@ -0,0 +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.apache.openejb.test.singleton;
+
+
+/**
+ * 
+ * @author <a href="mailto:nour.mohammad@gmail.com">Mohammad Nour El-Din</a>
+ */
+public interface BasicSingletonLocalHome extends javax.ejb.EJBLocalHome {
+
+    public BasicSingletonLocalObject create() throws javax.ejb.CreateException;
+}

Added: openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonLocalObject.java
                
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-beans/s \
rc/main/java/org/apache/openejb/test/singleton/BasicSingletonLocalObject.java?rev=672566&view=auto
 ==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonLocalObject.java \
                (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonLocalObject.java \
Sat Jun 28 11:48:28 2008 @@ -0,0 +1,79 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.test.singleton;
+
+import java.rmi.RemoteException;
+import java.util.Properties;
+
+import org.apache.openejb.test.ApplicationException;
+import org.apache.openejb.test.object.OperationsPolicy;
+
+/**
+ * 
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ * @author <a href="mailto:nour.mohammad@gmail.com">Mohammad Nour El-Din</a>
+ */
+public interface BasicSingletonLocalObject extends javax.ejb.EJBLocalObject{
+    
+    /**
+     * Reverses the string passed in then returns it
+     * 
+     * @return string
+     */
+    public String businessMethod(String text);
+    
+    /**
+     * Throws an ApplicationException when invoked
+     * 
+     */
+    public void throwApplicationException() throws ApplicationException;
+    
+    /**
+     * Throws a java.lang.NullPointerException when invoked
+     * This is a system exception and should result in the 
+     * destruction of the instance and invalidation of the
+     * remote reference.
+     * 
+     */
+    public void throwSystemException_NullPointer();
+    
+    /**
+     * Returns a report of the bean's 
+     * runtime permissions
+     * 
+     * @return properties
+     */
+    public Properties getPermissionsReport();
+    
+    /**
+     * Returns a report of the allowed opperations
+     * for one of the bean's methods.
+     * 
+     * @param methodName The method for which to get the allowed opperations report
+     * @return operations policy 
+     */
+    public OperationsPolicy getAllowedOperationsReport(String methodName);
+
+    /**
+     * Schedules a timer with the specified name.  This name is used to notify via \
the TimerSyncBean. +     * @param name the name used to notify via the TimerSyncBean
+     */
+    public void scheduleTimer(String name);
+    
+    public String remove(String obj);
+}

Added: openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonObject.java
                
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-beans/s \
rc/main/java/org/apache/openejb/test/singleton/BasicSingletonObject.java?rev=672566&view=auto
 ==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonObject.java \
                (added)
+++ openejb/trunk/openejb3/itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/singleton/BasicSingletonObject.java \
Sat Jun 28 11:48:28 2008 @@ -0,0 +1,78 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.test.singleton;
+
+import java.rmi.RemoteException;
+import java.util.Properties;
+
+import org.apache.openejb.test.ApplicationException;
+import org.apache.openejb.test.object.OperationsPolicy;
+
+/**
+ * 
+ * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
+ * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
+ */
+public interface BasicSingletonObject extends javax.ejb.EJBObject{
+    
+    /**
+     * Reverses the string passed in then returns it
+     * 
+     * @return string
+     */
+    public String businessMethod(String text) throws RemoteException;
+    
+    /**
+     * Throws an ApplicationException when invoked
+     * 
+     */
+    public void throwApplicationException() throws RemoteException, \
ApplicationException; +    
+    /**
+     * Throws a java.lang.NullPointerException when invoked
+     * This is a system exception and should result in the 
+     * destruction of the instance and invalidation of the
+     * remote reference.
+     * 
+     */
+    public void throwSystemException_NullPointer() throws RemoteException;
+    
+    /**
+     * Returns a report of the bean's 
+     * runtime permissions
+     * 
+     * @return properties
+     */
+    public Properties getPermissionsReport() throws RemoteException;
+    
+    /**
+     * Returns a report of the allowed opperations
+     * for one of the bean's methods.
+     * 
+     * @param methodName The method for which to get the allowed opperations report
+     * @return operations policy 
+     */
+    public OperationsPolicy getAllowedOperationsReport(String methodName) throws \
RemoteException; +
+    /**
+     * Schedules a timer with the specified name.  This name is used to notify via \
the TimerSyncBean. +     * @param name the name used to notify via the TimerSyncBean
+     */
+    public void scheduleTimer(String name) throws RemoteException;
+    
+    public String remove(String obj) throws RemoteException;
+}


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic