You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by ge...@apache.org on 2009/04/26 09:52:52 UTC

svn commit: r768682 - in /incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms: component/JmsComponentFactory.java component/JmsComponentImpl.java plugin/OpenWebBeansJmsPlugin.java util/JmsProxyHandler.java util/JmsUtil.java

Author: gerdogdu
Date: Sun Apr 26 07:52:51 2009
New Revision: 768682

URL: http://svn.apache.org/viewvc?rev=768682&view=rev
Log:
Adding JMS plugin support

Added:
    incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/component/JmsComponentFactory.java   (with props)
    incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsProxyHandler.java   (with props)
    incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsUtil.java   (with props)
Modified:
    incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/component/JmsComponentImpl.java
    incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/plugin/OpenWebBeansJmsPlugin.java

Added: incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/component/JmsComponentFactory.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/component/JmsComponentFactory.java?rev=768682&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/component/JmsComponentFactory.java (added)
+++ incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/component/JmsComponentFactory.java Sun Apr 26 07:52:51 2009
@@ -0,0 +1,43 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.webbeans.jms.component;
+
+import org.apache.webbeans.jms.JMSModel;
+import org.apache.webbeans.util.Asserts;
+
+public final class JmsComponentFactory
+{
+    private static JmsComponentFactory instance = new JmsComponentFactory();
+
+    private JmsComponentFactory()
+    {
+        
+    }
+    
+    public static JmsComponentFactory getJmsComponentFactory()
+    {
+        return instance;
+    }
+    
+    public <T> JmsComponentImpl<T> getJmsComponent(JMSModel model, Class<T> clazz)
+    {
+        Asserts.assertNotNull(model,"model parameter can not be null");
+        Asserts.assertNotNull(clazz, "clazz parameter can not be null");
+        
+        return new JmsComponentImpl<T>(model,clazz);
+    }
+}

Propchange: incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/component/JmsComponentFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/component/JmsComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/component/JmsComponentImpl.java?rev=768682&r1=768681&r2=768682&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/component/JmsComponentImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/component/JmsComponentImpl.java Sun Apr 26 07:52:51 2009
@@ -16,28 +16,77 @@
  */
 package org.apache.webbeans.jms.component;
 
+import java.lang.reflect.Method;
+
 import javax.context.CreationalContext;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
 
 import org.apache.webbeans.component.AbstractComponent;
 import org.apache.webbeans.component.WebBeansType;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.jms.JMSModel;
+import org.apache.webbeans.jms.util.JmsUtil;
 
 public class JmsComponentImpl<T> extends AbstractComponent<T> 
 {
-    public JmsComponentImpl()
+    private JMSModel jmsModel = null;
+    
+    private Class<T> jmsClass = null;
+    
+    private Object jmsObject;
+    
+    JmsComponentImpl(JMSModel jmsModel, Class<T> jmsClass)
     {
         super(WebBeansType.JMS);
+        
+        this.jmsModel = jmsModel;
+        this.jmsClass = jmsClass;
     }
 
     @Override
     protected T createInstance(CreationalContext<T> creationalContext)
     {
-        return null;
+        T jmsProxyInstance = JmsUtil.createNewJmsProxy(this);
+         
+        return jmsProxyInstance;
     }
 
     @Override
     protected void destroyInstance(T instance)
     {        
-        
+        if(Session.class.isAssignableFrom(jmsClass) ||
+                MessageConsumer.class.isAssignableFrom(jmsClass) ||
+                MessageProducer.class.isAssignableFrom(jmsClass))
+        {
+            try
+            {
+                Method method = jmsClass.getClass().getMethod("close", new Class[]{});
+                
+                method.invoke(this.jmsObject, new Object[]{});
+            }
+            
+            catch (Exception e)
+            {
+                throw new WebBeansException("Unable to destroy instance " + this.toString() ,e);
+            }
+            
+        }
+    }
+    
+    public void setJmsObject(Object jmsObject)
+    {
+        this.jmsObject = jmsObject;
     }
 
+    public Class<T> getJmsClass()
+    {
+        return this.jmsClass;
+    }
+    
+    public JMSModel getJmsModel()
+    {
+        return this.jmsModel;
+    }
 }

Modified: incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/plugin/OpenWebBeansJmsPlugin.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/plugin/OpenWebBeansJmsPlugin.java?rev=768682&r1=768681&r2=768682&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/plugin/OpenWebBeansJmsPlugin.java (original)
+++ incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/plugin/OpenWebBeansJmsPlugin.java Sun Apr 26 07:52:51 2009
@@ -16,6 +16,20 @@
  */
 package org.apache.webbeans.jms.plugin;
 
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import javax.inject.manager.InjectionPoint;
+
+import org.apache.webbeans.container.ManagerImpl;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.jms.JMSManager;
+import org.apache.webbeans.jms.JMSModel;
+import org.apache.webbeans.jms.JMSModel.JMSType;
+import org.apache.webbeans.jms.component.JmsComponentFactory;
+import org.apache.webbeans.jms.component.JmsComponentImpl;
+import org.apache.webbeans.jms.util.JmsProxyHandler;
+import org.apache.webbeans.jms.util.JmsUtil;
 import org.apache.webbeans.plugins.AbstractOpenWebBeansPlugin;
 
 /**
@@ -29,6 +43,55 @@
     {
         super();
     }
+
+    
+    
+    @Override
+    @SuppressWarnings("unchecked")
+    public <T> boolean addJMSBean(InjectionPoint injectionPoint)
+    {        
+        Type injectionPointType = injectionPoint.getType();
+        if(injectionPointType instanceof Class)
+        {
+            Class<T> injectionPointClazz = (Class<T>)injectionPointType;
+            
+            if(JmsUtil.isJmsResourceClass(injectionPointClazz))
+            {
+                JMSType type = null;
+                
+                if(JmsUtil.isJmsQueueTypeResource(injectionPointClazz))
+                {
+                    type = JMSType.QUEUE;
+                }
+                else
+                {
+                    type = JMSType.TOPIC;
+                }
+                
+                Annotation[] bindings = injectionPoint.getBindings().toArray(new Annotation[0]);
+                JMSModel jmsModel = JMSManager.getInstance().getModel(type, bindings);
+                
+                JmsComponentImpl<T> bean = JmsComponentFactory.getJmsComponentFactory().getJmsComponent(jmsModel,injectionPointClazz);
+                
+                ManagerImpl.getManager().addBean(bean);
+                
+                return true;
+            }            
+        }
+             
+        return false;
+    }
+
+
+
+    /* (non-Javadoc)
+     * @see org.apache.webbeans.plugins.AbstractOpenWebBeansPlugin#shutDown()
+     */
+    @Override
+    public void shutDown() throws WebBeansConfigurationException
+    {
+        JmsProxyHandler.clearConnections();
+    }
     
     
     

Added: incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsProxyHandler.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsProxyHandler.java?rev=768682&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsProxyHandler.java (added)
+++ incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsProxyHandler.java Sun Apr 26 07:52:51 2009
@@ -0,0 +1,298 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.webbeans.jms.util;
+
+import java.lang.reflect.Method;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.Session;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+
+
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.jms.JMSModel;
+import org.apache.webbeans.jms.JMSModel.JMSType;
+import org.apache.webbeans.jms.component.JmsComponentImpl;
+
+import javassist.util.proxy.MethodHandler;
+
+public class JmsProxyHandler implements MethodHandler
+{
+    private JmsComponentImpl<?> jmsComponent = null;
+    
+    private static ConnectionFactory connectionFactory = null;
+    
+    private AtomicBoolean cfSet = new AtomicBoolean(false);
+    
+    private static Map<JMSType,Connection> connections = new ConcurrentHashMap<JMSType, Connection>();
+    
+    private static Map<String,Topic> topics = new ConcurrentHashMap<String,Topic>();
+    
+    private static Map<String,Queue> queues = new ConcurrentHashMap<String,Queue>();
+    
+    public JmsProxyHandler(JmsComponentImpl<?> jmsComponent)
+    {
+        this.jmsComponent = jmsComponent;
+    }
+
+    public Object invoke(Object instance, Method method, Method proceed, Object[] arguments) throws Exception
+    {
+        Object cf = createOrReturnConnectionFactory();
+        
+        if(cf == null)
+        {
+            cf = createOrReturnQueueOrTopicConnection();
+        }
+        
+        
+        if(cf == null)
+        {
+            cf = createOrReturnQueueOrTopic();
+            
+        }        
+                
+        if(cf == null)
+        {
+            cf = createSession();
+        }
+        
+        if(cf == null)
+        {
+            cf = createMessageProducers();
+        }
+        
+        if(cf == null)
+        {
+            cf = createMessageConsumers();
+        }
+                
+        if(method.getName().equals("close"))
+        {
+            throw new UnsupportedOperationException("close method is not supported for JMS resources");
+        }
+        
+        this.jmsComponent.setJmsObject(cf);
+        
+        return method.invoke(cf, arguments);
+    }
+
+    private Object createOrReturnConnectionFactory()
+    {
+        if(ConnectionFactory.class.isAssignableFrom(jmsComponent.getJmsClass()))
+        {
+            if(connectionFactory != null)
+            {
+                return connectionFactory;
+            }
+            else
+            {
+                if(cfSet.compareAndSet(false, true))
+                {
+                    connectionFactory = JmsUtil.getConnectionFactory();
+                    
+                    return connectionFactory;
+                }
+            }
+        }
+        
+        return null;
+    }
+    
+    private Session createSession()
+    {
+        try
+        {
+            if(Session.class.isAssignableFrom(jmsComponent.getJmsClass()))
+            {
+                Connection connection = createOrReturnQueueOrTopicConnection();
+                
+                return connection.createSession(false , Session.AUTO_ACKNOWLEDGE);
+            }
+            
+            
+        }catch(JMSException e)
+        {
+            throw new WebBeansException("Unable to create jms session",e);
+        }
+                
+        return null;
+    }
+   
+    private MessageProducer createMessageProducers()
+    {
+        try
+        {
+            if(MessageProducer.class.isAssignableFrom(jmsComponent.getJmsClass()))
+            {
+                return createSession().createProducer(createOrReturnQueueOrTopic());   
+            }
+        }
+        catch (JMSException e)
+        {
+            throw new WebBeansException("Unable to create jms message producer",e);
+        }
+        
+        return null;
+    }
+    
+    private MessageConsumer createMessageConsumers()
+    {
+        try
+        {
+            if(MessageConsumer.class.isAssignableFrom(jmsComponent.getJmsClass()))
+            {
+                return createSession().createConsumer(createOrReturnQueueOrTopic());   
+            }
+        }
+        catch (JMSException e)
+        {
+            throw new WebBeansException("Unable to create jms message producer",e);
+        }
+        
+        return null;
+    }
+    
+    
+    private Connection createOrReturnQueueOrTopicConnection()
+    {
+        JMSModel jmsModel = this.jmsComponent.getJmsModel();
+        
+        try
+        {
+            if(Connection.class.isAssignableFrom(jmsComponent.getJmsClass()))
+            {
+                if(jmsModel.getJmsType().equals(JMSType.QUEUE))
+                {
+                    if(connections.containsKey(JMSType.QUEUE))
+                    {
+                        return connections.get(JMSType.QUEUE);
+                    }
+                    else
+                    {
+                        QueueConnectionFactory ccf = (QueueConnectionFactory)connectionFactory;
+                        QueueConnection qc = ccf.createQueueConnection();
+                        connections.put(JMSType.QUEUE, qc);
+                        
+                        return qc;
+                    }
+                }
+                else if(jmsModel.getJmsType().equals(JMSType.TOPIC))
+                {
+                    if(connections.containsKey(JMSType.TOPIC))
+                    {
+                        return connections.get(JMSType.TOPIC);
+                    }
+                    else
+                    {
+                        TopicConnectionFactory ccf = (TopicConnectionFactory)connectionFactory;
+                        TopicConnection qc = ccf.createTopicConnection();
+                        connections.put(JMSType.TOPIC, qc);
+                        
+                        return qc;
+                    }
+                    
+                }
+            }
+            
+            
+        }catch(JMSException e)
+        {
+            throw new WebBeansException("Unable to create jms connection",e);
+        }
+        
+         
+        return null;
+    }
+    
+    private Destination createOrReturnQueueOrTopic()
+    {
+        JMSModel jmsModel = this.jmsComponent.getJmsModel();
+        String jndiName = jmsModel.isJndiNameDefined() ? jmsModel.getJndiName() : jmsModel.getMappedName();
+        
+        if(Topic.class.isAssignableFrom(jmsComponent.getJmsClass()))
+        {
+                        
+            if(topics.get(jndiName) != null)
+            {
+                return topics.get(jndiName);
+            }
+                        
+            Topic res = (Topic)JmsUtil.getInstanceFromJndi(this.jmsComponent.getJmsModel(), this.jmsComponent.getJmsClass());
+            
+            topics.put(jndiName , res);
+            
+            return res;
+        }
+        
+        else if(Queue.class.isAssignableFrom(jmsComponent.getJmsClass()))
+        {
+                        
+            if(queues.get(jndiName) != null)
+            {
+                return queues.get(jndiName);
+            }
+                        
+            Queue res = (Queue)JmsUtil.getInstanceFromJndi(this.jmsComponent.getJmsModel(), this.jmsComponent.getJmsClass());
+            
+            queues.put(jndiName , res);
+            
+            return res;
+        }
+        
+        
+        return null;
+    }
+    
+    public static void clearConnections()
+    {
+        try
+        {
+            connectionFactory = null;
+            
+            for(Connection connection : connections.values())
+            {
+                connection.close();
+            }        
+            
+            connections = null;
+            
+            topics.clear();
+            queues.clear();
+            
+            topics = null;
+            queues = null;
+            
+        }catch(Exception e)
+        {
+            throw new WebBeansException(e);
+        }
+    }
+    
+}

Propchange: incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsProxyHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsUtil.java?rev=768682&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsUtil.java (added)
+++ incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsUtil.java Sun Apr 26 07:52:51 2009
@@ -0,0 +1,178 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.webbeans.jms.util;
+
+import java.io.Serializable;
+
+import javassist.util.proxy.ProxyFactory;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+import javax.jms.TopicConnectionFactory;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSession;
+import javax.jms.TopicSubscriber;
+
+import org.apache.webbeans.exception.WebBeansCreationException;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.jms.JMSModel;
+import org.apache.webbeans.jms.component.JmsComponentImpl;
+import org.apache.webbeans.spi.JNDIService;
+import org.apache.webbeans.spi.ServiceLoader;
+import org.apache.webbeans.util.Asserts;
+
+public final class JmsUtil
+{
+    private JmsUtil()
+    {
+        
+    }
+
+    public static boolean isJmsResourceClass(Class<?> clazz)
+    {
+        Asserts.assertNotNull(clazz,"clazz parameter can not be null");
+        
+        if(ConnectionFactory.class.isAssignableFrom(clazz) ||
+                Connection.class.isAssignableFrom(clazz) || 
+                Queue.class.isAssignableFrom(clazz) || 
+                Topic.class.isAssignableFrom(clazz) || 
+                MessageProducer.class.isAssignableFrom(clazz) ||
+                MessageConsumer.class.isAssignableFrom(clazz) ||
+                Session.class.isAssignableFrom(clazz))
+        {
+            return true;
+        }
+        
+        return false;
+        
+    }
+    
+    public static boolean isJmsQueueTypeResource(Class<?> clazz)
+    {
+        if(QueueConnectionFactory.class.isAssignableFrom(clazz) ||
+                QueueConnection.class.isAssignableFrom(clazz) ||                 
+                QueueSender.class.isAssignableFrom(clazz) ||
+                QueueReceiver.class.isAssignableFrom(clazz) ||
+                QueueSession.class.isAssignableFrom(clazz))
+        {
+            return true;
+        }
+        
+        return false;
+    }
+    
+    public static boolean isJmsQueueResource(Class<?> clazz)
+    {
+        if(Queue.class.isAssignableFrom(clazz))
+        {
+            return true;
+        }
+        
+        return false;
+    }
+    
+    public static boolean isJmsTopicResource(Class<?> clazz)
+    {
+        if(Topic.class.isAssignableFrom(clazz))
+        {
+            return true;
+        }
+        
+        return false;
+    }
+    
+    
+    public static boolean isJmsTopicTypeResource(Class<?> clazz)
+    {
+        if(TopicConnectionFactory.class.isAssignableFrom(clazz) ||
+                TopicConnection.class.isAssignableFrom(clazz) ||   
+                TopicSubscriber.class.isAssignableFrom(clazz) ||
+                TopicPublisher.class.isAssignableFrom(clazz) ||
+                TopicSession.class.isAssignableFrom(clazz))
+        {
+            return true;
+        }
+        
+        return false;
+    }
+    
+    private static JNDIService getJNDIService()
+    {
+       JNDIService jndiService = ServiceLoader.getService(JNDIService.class);
+        
+        if(jndiService == null)
+        {
+            throw new WebBeansCreationException("JNDI service is not available");            
+        }
+        
+        return jndiService;
+    }
+    
+    public static ConnectionFactory getConnectionFactory()
+    {
+        return getJNDIService().getObject("ConnectionFactory", ConnectionFactory.class);
+    }
+    
+    public static <T> T getInstanceFromJndi(JMSModel jmsModel, Class<T> jmsClass)
+    {
+        String jndiName = jmsModel.isJndiNameDefined() ? jmsModel.getJndiName() : jmsModel.getMappedName();
+        
+         
+        T instance = getJNDIService().getObject(jndiName, jmsClass);
+        
+        return instance;
+        
+    }
+    
+    @SuppressWarnings("unchecked")
+    public static <T> T createNewJmsProxy(JmsComponentImpl<T> jmsComponent)
+    {
+        T result = null;
+
+        try
+        {
+            ProxyFactory pf = new ProxyFactory();
+            pf.setInterfaces(new Class<?>[] {Serializable.class,ConnectionFactory.class,
+                    Connection.class,MessageConsumer.class,MessageProducer.class,Session.class,Topic.class,Queue.class});
+            
+            pf.setHandler(new JmsProxyHandler(jmsComponent));
+
+            result = (T)pf.createClass().newInstance();
+
+        }
+        catch (Exception e)
+        {
+            throw new WebBeansException(e);
+        }
+
+        return result;
+    }
+    
+    
+ 
+}

Propchange: incubator/openwebbeans/trunk/webbeans-jms/src/main/java/org/apache/webbeans/jms/util/JmsUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native