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/27 21:46:39 UTC
svn commit: r769129 - in
/incubator/openwebbeans/trunk/webbeans-impl/src/main:
java/org/apache/webbeans/ java/org/apache/webbeans/config/
java/org/apache/webbeans/inject/ java/org/apache/webbeans/lifecycle/
java/org/apache/webbeans/spi/ee/ java/org/apa...
Author: gerdogdu
Date: Mon Apr 27 19:46:38 2009
New Revision: 769129
URL: http://svn.apache.org/viewvc?rev=769129&view=rev
Log:
Updated for JMS implementation.
Modified:
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/WebBeansConstants.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/WebBeansLifeCycle.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/spi/ee/JNDIServiceEnterpriseImpl.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/JNDIUtil.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/resources/META-INF/openwebbeans/openwebbeans-default.properties
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/WebBeansConstants.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/WebBeansConstants.java?rev=769129&r1=769128&r2=769129&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/WebBeansConstants.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/WebBeansConstants.java Mon Apr 27 19:46:38 2009
@@ -53,10 +53,10 @@
public static final String WEB_BEANS_XML_DECORATOR_ELEMENT = "Decorator";
/** <Queue> XML Element */
- public static final String WEB_BEANS_XML_TOPIC_ELEMENT = "Queue";
+ public static final String WEB_BEANS_XML_TOPIC_ELEMENT = "Topic";
/** <Topic> XML Element */
- public static final String WEB_BEANS_XML_QUEUE_ELEMENT = "Topic";
+ public static final String WEB_BEANS_XML_QUEUE_ELEMENT = "Queue";
public static final String WEB_BEANS_XML_JMS_RESOURCE = "Resource";
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java?rev=769129&r1=769128&r2=769129&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java Mon Apr 27 19:46:38 2009
@@ -36,6 +36,7 @@
import javax.interceptor.Interceptor;
import javax.webbeans.Model;
+import org.apache.webbeans.WebBeansConstants;
import org.apache.webbeans.annotation.DeployedManagerLiteral;
import org.apache.webbeans.annotation.InitializedManagerLiteral;
import org.apache.webbeans.component.ComponentImpl;
@@ -48,6 +49,8 @@
import org.apache.webbeans.exception.WebBeansConfigurationException;
import org.apache.webbeans.exception.WebBeansDeploymentException;
import org.apache.webbeans.logger.WebBeansLogger;
+import org.apache.webbeans.spi.JNDIService;
+import org.apache.webbeans.spi.ServiceLoader;
import org.apache.webbeans.spi.deployer.MetaDataDiscoveryService;
import org.apache.webbeans.util.AnnotationUtil;
import org.apache.webbeans.util.ClassUtil;
@@ -98,8 +101,9 @@
// Register InjectionPoint bean
ManagerImpl.getManager().addBean(WebBeansUtil.getInjectionPointComponent());
- // JNDI bind
- //X TODO JNDIUtil.bind(WebBeansConstants.WEB_BEANS_MANAGER_JNDI_NAME, ManagerImpl.getManager());
+ // Bind manager
+ JNDIService service = ServiceLoader.getService(JNDIService.class);
+ service.bind(WebBeansConstants.WEB_BEANS_MANAGER_JNDI_NAME, ManagerImpl.getManager());
deployFromXML(scanner);
checkStereoTypes(scanner);
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java?rev=769129&r1=769128&r2=769129&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableField.java Mon Apr 27 19:46:38 2009
@@ -96,7 +96,9 @@
field.setAccessible(true);
}
- field.set(instance, inject(clazz, args, bindingAnnos));
+ Object object = inject(clazz, args, bindingAnnos);
+
+ field.set(instance, object);
}
catch (IllegalAccessException e)
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/WebBeansLifeCycle.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/WebBeansLifeCycle.java?rev=769129&r1=769128&r2=769129&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/WebBeansLifeCycle.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/WebBeansLifeCycle.java Mon Apr 27 19:46:38 2009
@@ -177,11 +177,11 @@
this.service = null;
this.xmlDeployer = null;
this.rootManager = null;
-
- WebBeansFinder.clearInstances();
// finally free all plugin resources
PluginLoader.getInstance().shutDown();
+
+ WebBeansFinder.clearInstances();
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/spi/ee/JNDIServiceEnterpriseImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/spi/ee/JNDIServiceEnterpriseImpl.java?rev=769129&r1=769128&r2=769129&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/spi/ee/JNDIServiceEnterpriseImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/spi/ee/JNDIServiceEnterpriseImpl.java Mon Apr 27 19:46:38 2009
@@ -26,8 +26,9 @@
*/
public final class JNDIServiceEnterpriseImpl implements JNDIService
{
- private JNDIServiceEnterpriseImpl()
+ public JNDIServiceEnterpriseImpl()
{
+
}
/**
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java?rev=769129&r1=769128&r2=769129&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java Mon Apr 27 19:46:38 2009
@@ -527,7 +527,7 @@
List<String> list = new ArrayList<String>();
Class<?> clazz = Object.class;
- Method[] methods = clazz.getMethods();
+ Method[] methods = clazz.getDeclaredMethods();
for (Method method : methods)
{
list.add(method.getName());
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/JNDIUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/JNDIUtil.java?rev=769129&r1=769128&r2=769129&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/JNDIUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/JNDIUtil.java Mon Apr 27 19:46:38 2009
@@ -13,7 +13,9 @@
*/
package org.apache.webbeans.util;
+import javax.naming.Context;
import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
import org.apache.webbeans.exception.WebBeansException;
@@ -60,8 +62,24 @@
try
{
- initialContext.bind(name, object);
-
+ Context context = initialContext;
+
+ String[] parts = name.split("/");
+
+ for(int i=0;i< parts.length -1;i++)
+ {
+ try
+ {
+ context = (Context)initialContext.lookup(parts[i]);
+
+ }catch(NameNotFoundException e)
+ {
+ context = initialContext.createSubcontext(parts[i]);
+ }
+
+ }
+
+ context.bind(parts[parts.length -1], object);
}
catch (NamingException e)
{
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java?rev=769129&r1=769128&r2=769129&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java Mon Apr 27 19:46:38 2009
@@ -1514,12 +1514,14 @@
*/
private void configureJMSEndpointComponent(Element webBeanElement)
{
+ List<Element> childs = webBeanElement.elements();
Element resource = webBeanElement.element(WebBeansConstants.WEB_BEANS_XML_JMS_RESOURCE);
+
if(resource == null)
{
throw new WebBeansConfigurationException("Topic or Queue resource mut be defined in the XML");
}
-
+
Element name = resource.element(WebBeansConstants.WEB_BEANS_XML_JMS_RESOURCE_NAME);
Element mappedName = resource.element(WebBeansConstants.WEB_BEANS_XML_JMS_RESOURCE_MAPPED_NAME);
@@ -1528,6 +1530,18 @@
throw new WebBeansConfigurationException("Topic or Queue must define name or mapped name for the JNDI");
}
+ List<Annotation> bindingTypes = new ArrayList<Annotation>();
+ for(Element child : childs)
+ {
+ Class<? extends Annotation> binding = (Class<Annotation>)XMLUtil.getElementJavaType(child);
+
+ if(AnnotationUtil.isBindingAnnotation(binding))
+ {
+ bindingTypes.add(JavassistProxyFactory.createNewAnnotationProxy(binding));
+ }
+
+ }
+
JMSType type = null;
if(webBeanElement.getName().equals(WebBeansConstants.WEB_BEANS_XML_TOPIC_ELEMENT))
@@ -1539,13 +1553,18 @@
type = JMSType.QUEUE;
}
+
String jndiName = name == null ? null : name.getTextTrim();
String mapName = mappedName== null ? null : mappedName.getTextTrim();
- JMSModel model = new JMSModel(type,jndiName,mapName);
-
+ JMSModel model = new JMSModel(type,jndiName,mapName);
JMSManager.getInstance().addJmsModel(model);
+
+ for(Annotation ann : bindingTypes)
+ {
+ model.addBinding(ann);
+ }
}
/**
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/resources/META-INF/openwebbeans/openwebbeans-default.properties
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/resources/META-INF/openwebbeans/openwebbeans-default.properties?rev=769129&r1=769128&r2=769129&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/resources/META-INF/openwebbeans/openwebbeans-default.properties (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/resources/META-INF/openwebbeans/openwebbeans-default.properties Mon Apr 27 19:46:38 2009
@@ -13,7 +13,7 @@
# The key is the Interface, the value the implementation of the service
# use the static HashMap instead of storing objects in JNDI as default
-org.apache.webbeans.spi.JNDIService=org.apache.webbeans.spi.se.JNDIServiceStaticImpl
+org.apache.webbeans.spi.JNDIService=org.apache.webbeans.spi.ee.JNDIServiceEnterpriseImpl
# lookup the javax.transaction.TransactionManager via JNDI as default
org.apache.webbeans.spi.TransactionService=org.apache.webbeans.spi.ee.TransactionServiceJndiImpl