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/08/16 22:16:31 UTC
svn commit: r804760 - in /incubator/openwebbeans/trunk/webbeans-impl: ./
src/main/java/org/apache/webbeans/
src/main/java/org/apache/webbeans/component/
src/main/java/org/apache/webbeans/config/
src/main/java/org/apache/webbeans/container/ src/main/jav...
Author: gerdogdu
Date: Sun Aug 16 20:16:30 2009
New Revision: 804760
URL: http://svn.apache.org/viewvc?rev=804760&view=rev
Log:
XML configuration update.
Added:
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/JmsBeanMarker.java (with props)
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/OpenWebBeansJmsPlugin.java (with props)
incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/strict/
incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/strict/XMLSpecStrictTest.java (with props)
incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/
incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/DummyDecorator.java (with props)
incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/DummyInterceptor.java (with props)
incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/nameSpaceNotDeclared.xml (contents, props changed)
- copied, changed from r802587, incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/nameSpaceNotDeclared.xml
incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/
incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/decorators.xml (with props)
incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/interceptors.xml (with props)
Modified:
incubator/openwebbeans/trunk/webbeans-impl/pom.xml
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/WebBeansConstants.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractBean.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BaseBean.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.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/container/BeanManagerImpl.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/BeanObserverImpl.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.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/plugins/AbstractOpenWebBeansPlugin.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/OpenWebBeansPlugin.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/PluginLoader.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/resources/META-INF/openwebbeans/openwebbeans-default.properties
incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLAnnotTypeTest.java
incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLFieldTest.java
incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLTest.java
incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/definition/XMLDefinitionTest.java
Modified: incubator/openwebbeans/trunk/webbeans-impl/pom.xml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/pom.xml?rev=804760&r1=804759&r2=804760&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/pom.xml (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/pom.xml Sun Aug 16 20:16:30 2009
@@ -89,11 +89,6 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-ejb_3.0_spec</artifactId>
- <optional>true</optional>
- </dependency>
<!-- the following dependencies are needed for tests only -->
</dependencies>
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=804760&r1=804759&r2=804760&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 Sun Aug 16 20:16:30 2009
@@ -45,6 +45,12 @@
/** <Interceptors> XML Element */
public static final String WEB_BEANS_XML_INTERCEPTORS_ELEMENT = "Interceptors";
+
+ public static final String WEB_BEANS_XML_SPEC_SPECIFIC_INTERCEPTORS_ELEMENT = "interceptors";
+
+ public static final String WEB_BEANS_XML_SPEC_SPECIFIC_DECORATORS_ELEMENT = "decorators";
+
+ public static final String WEB_BEANS_XML_SPEC_SPECIFIC_DEPLOY_ELEMENT = "deploy";
public static final String WEB_BEANS_XML_INTERCEPTOR_ELEMENT = "Interceptor";
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractBean.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractBean.java?rev=804760&r1=804759&r2=804760&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractBean.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractBean.java Sun Aug 16 20:16:30 2009
@@ -442,6 +442,11 @@
object = BeanManagerImpl.getManager().getReference(dependentComponent, injectionPoint.getType(), dependentCreational);
CreationalContextImpl<T> cc = (CreationalContextImpl<T>)this.creationalContext;
+
+ if(cc == null)
+ {
+ System.out.println(this);
+ }
//Put this into the dependent map
cc.addDependent(dependentComponent, object);
@@ -595,6 +600,14 @@
/**
* {@inheritDoc}
+ */
+ public void setCreationalContext(CreationalContext<T> creationalContext)
+ {
+ this.creationalContext = creationalContext;
+ }
+
+ /**
+ * {@inheritDoc}
*/
//TODO Replaces @Deploymeny Types, no starting work for now!
public boolean isPolicy()
@@ -642,4 +655,9 @@
return builder.toString();
}
+
+ protected WebBeansLogger getLogger()
+ {
+ return this.logger;
+ }
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BaseBean.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BaseBean.java?rev=804760&r1=804759&r2=804760&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BaseBean.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BaseBean.java Sun Aug 16 20:16:30 2009
@@ -221,4 +221,10 @@
* @return creational context of bean instance.
*/
public abstract CreationalContext<T> getCreationalContext();
+
+ /**
+ * Set creational context
+ * @param creationalContext creational context
+ */
+ public abstract void setCreationalContext(CreationalContext<T> creationalContext);
}
\ No newline at end of file
Added: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/JmsBeanMarker.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/JmsBeanMarker.java?rev=804760&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/JmsBeanMarker.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/JmsBeanMarker.java Sun Aug 16 20:16:30 2009
@@ -0,0 +1,19 @@
+/*
+ * 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.component;
+
+public interface JmsBeanMarker
+{
+
+}
Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/JmsBeanMarker.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java?rev=804760&r1=804759&r2=804760&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java Sun Aug 16 20:16:30 2009
@@ -64,8 +64,6 @@
import org.apache.webbeans.inject.impl.InjectionPointFactory;
import org.apache.webbeans.intercept.WebBeansInterceptorConfig;
import org.apache.webbeans.intercept.ejb.EJBInterceptorConfig;
-import org.apache.webbeans.plugins.OpenWebBeansPlugin;
-import org.apache.webbeans.plugins.PluginLoader;
import org.apache.webbeans.util.AnnotationUtil;
import org.apache.webbeans.util.Asserts;
import org.apache.webbeans.util.ClassUtil;
@@ -1188,22 +1186,5 @@
{
WebBeansUtil.addInjectedImplicitEventComponent(injectionPoint);
}
- else
- {
- Type injectionPointType = injectionPoint.getType();
-
- if(injectionPointType instanceof Class)
- {
- List<OpenWebBeansPlugin> plugins = PluginLoader.getInstance().getPlugins();
-
- for(OpenWebBeansPlugin plugin : plugins)
- {
- if(plugin.addImplicitComponentForInjectionPoint(injectionPoint))
- {
- break;
- }
- }
- }
- }
}
}
\ No newline at end of file
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java?rev=804760&r1=804759&r2=804760&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java Sun Aug 16 20:16:30 2009
@@ -45,6 +45,12 @@
/**Conversation periodic delay in ms.*/
public static final String CONVERSATION_PERIODIC_DELAY = "org.apache.webbeans.conversation.Conversation.periodicDelay";
+ /**Use OWB Specific XML Configuration or Strict Spec XML*/
+ public static final String USE_OWB_SPECIFIC_XML_CONFIGURATION = "org.apache.webbeans.useOwbSpecificXmlConfig";
+
+ /**Use EJB Discovery or not*/
+ public static final String USE_EJB_DISCOVERY = "org.apache.webbeans.spi.deployer.UseEjbMetaDataDiscoveryService";
+
public static OpenWebBeansConfiguration getInstance() {
return (OpenWebBeansConfiguration) WebBeansFinder.getSingletonInstance(OpenWebBeansConfiguration.class.getName());
}
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=804760&r1=804759&r2=804760&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 Sun Aug 16 20:16:30 2009
@@ -87,6 +87,9 @@
/**XML Configurator*/
protected WebBeansXMLConfigurator xmlConfigurator = null;
+
+ /**Discover ejb or not*/
+ protected boolean discoverEjb = false;
/**
* Creates a new deployer with given xml configurator.
@@ -96,6 +99,8 @@
public WebBeansContainerDeployer(WebBeansXMLConfigurator xmlConfigurator)
{
this.xmlConfigurator = xmlConfigurator;
+ String usage = OpenWebBeansConfiguration.getInstance().getProperty(OpenWebBeansConfiguration.USE_EJB_DISCOVERY);
+ this.discoverEjb = Boolean.parseBoolean(usage);
}
/**
@@ -316,10 +321,14 @@
logger.info("Managed Bean with class name : " + componentClassName + " is found");
defineManagedBean(implClass);
}
- else if (EJBWebBeansConfigurator.isSessionBean(implClass))
- {
- logger.info("Enterprise Bean with class name : " + componentClassName + " is found");
- defineEnterpriseWebBean(implClass);
+ else if(this.discoverEjb)
+ {
+ if(EJBWebBeansConfigurator.isSessionBean(implClass))
+ {
+ logger.info("Enterprise Bean with class name : " + componentClassName + " is found");
+ defineEnterpriseWebBean(implClass);
+
+ }
}
}
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=804760&r1=804759&r2=804760&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java Sun Aug 16 20:16:30 2009
@@ -59,6 +59,7 @@
import org.apache.webbeans.component.AbstractBean;
import org.apache.webbeans.component.EnterpriseBeanMarker;
+import org.apache.webbeans.component.JmsBeanMarker;
import org.apache.webbeans.component.third.ThirdpartyBeanImpl;
import org.apache.webbeans.container.activity.ActivityManager;
import org.apache.webbeans.context.ContextFactory;
@@ -74,6 +75,7 @@
import org.apache.webbeans.intercept.WebBeansInterceptorConfig;
import org.apache.webbeans.intercept.webbeans.WebBeansInterceptor;
import org.apache.webbeans.plugins.OpenWebBeansEjbPlugin;
+import org.apache.webbeans.plugins.OpenWebBeansJmsPlugin;
import org.apache.webbeans.plugins.PluginLoader;
import org.apache.webbeans.portable.AnnotatedElementFactory;
import org.apache.webbeans.proxy.JavassistProxyFactory;
@@ -704,9 +706,17 @@
return ejbPlugin.getSessionBeanProxy(bean,ClassUtil.getClazz(beanType));
}
-
- /* @ScopeType is normal */
- if (WebBeansUtil.isScopeTypeNormal(bean.getScopeType()))
+ else if(bean instanceof JmsBeanMarker)
+ {
+ OpenWebBeansJmsPlugin jmsPlugin = PluginLoader.getInstance().getJmsPlugin();
+ if(jmsPlugin == null)
+ {
+ throw new IllegalStateException("There is no JMS plugin provider. Injection is failed for bean : " + bean);
+ }
+
+ return jmsPlugin.getJmsBeanProxy(bean, ClassUtil.getClass(beanType));
+ }
+ else if (WebBeansUtil.isScopeTypeNormal(bean.getScopeType()))
{
if (this.proxyMap.containsKey(bean))
@@ -719,7 +729,6 @@
this.proxyMap.put(bean, instance);
}
}
- /* @ScopeType is not normal, like @Dependent */
else
{
context = getContext(bean.getScopeType());
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java?rev=804760&r1=804759&r2=804760&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java Sun Aug 16 20:16:30 2009
@@ -228,6 +228,8 @@
public T create(CreationalContext<T> context)
{
T proxy = (T)JavassistProxyFactory.createNewProxyInstance(this);
+
+ this.wrappedBean.setCreationalContext(context);
return proxy;
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/BeanObserverImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/BeanObserverImpl.java?rev=804760&r1=804759&r2=804760&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/BeanObserverImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/BeanObserverImpl.java Sun Aug 16 20:16:30 2009
@@ -160,8 +160,7 @@
{
if (baseComponent.getScopeType().equals(Dependent.class))
{
- //TODO Creational Context
- baseComponent.destroy(object,null);
+ baseComponent.destroy(object,baseComponent.getCreationalContext());
}
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java?rev=804760&r1=804759&r2=804760&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java Sun Aug 16 20:16:30 2009
@@ -20,8 +20,6 @@
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
-import javax.ejb.PostActivate;
-import javax.ejb.PrePassivate;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Initializer;
@@ -78,10 +76,10 @@
{
return AroundInvoke.class;
}
- else if (type.equals(InterceptionType.POST_ACTIVATE))
- {
- return PostActivate.class;
- }
+// else if (type.equals(InterceptionType.POST_ACTIVATE))
+// {
+// return O;
+// }
else if (type.equals(InterceptionType.POST_CONSTRUCT))
{
return PostConstruct.class;
@@ -90,10 +88,10 @@
{
return PreDestroy.class;
}
- else if (type.equals(InterceptionType.PRE_PASSIVATE))
- {
- return PrePassivate.class;
- }
+// else if (type.equals(InterceptionType.PRE_PASSIVATE))
+// {
+// return PrePassivate.class;
+// }
else
{
throw new WebBeansException("Undefined interceotion type");
@@ -138,7 +136,10 @@
Method[] methods = clazz.getDeclaredMethods();
for (Method method : methods)
{
- if (AnnotationUtil.isMethodHasAnnotation(method, PostConstruct.class) || AnnotationUtil.isMethodHasAnnotation(method, PreDestroy.class) || AnnotationUtil.isMethodHasAnnotation(method, PostActivate.class) || AnnotationUtil.isMethodHasAnnotation(method, PrePassivate.class))
+ if (AnnotationUtil.isMethodHasAnnotation(method, PostConstruct.class) || AnnotationUtil.isMethodHasAnnotation(method, PreDestroy.class)
+// AnnotationUtil.isMethodHasAnnotation(method, PostActivate.class) ||
+// AnnotationUtil.isMethodHasAnnotation(method, PrePassivate.class)
+ )
{
if (ClassUtil.isMethodHasParameter(method))
{
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java?rev=804760&r1=804759&r2=804760&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java Sun Aug 16 20:16:30 2009
@@ -252,11 +252,10 @@
{
T proxy = (T)JavassistProxyFactory.createNewProxyInstance(this);
- this.creationalContext = creationalContext;
+ this.delegateComponent.setCreationalContext(creationalContext);
return proxy;
- // return delegateComponent.create();
}
public void setInjections(Object proxy)
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=804760&r1=804759&r2=804760&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 Sun Aug 16 20:16:30 2009
@@ -35,6 +35,7 @@
import org.apache.webbeans.container.BeanManagerImpl;
import org.apache.webbeans.container.activity.ActivityManager;
import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.context.creational.CreationalContextFactory;
import org.apache.webbeans.conversation.ConversationManager;
import org.apache.webbeans.el.WebBeansELResolver;
import org.apache.webbeans.exception.WebBeansException;
@@ -208,6 +209,9 @@
//Clear singleton list
WebBeansFinder.clearInstances();
+ //Clear CreationalContext
+ CreationalContextFactory.getInstance().clear();
+
logger.info("Dependency injection container is stopped for context path : " + event.getServletContext().getContextPath());
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/AbstractOpenWebBeansPlugin.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/AbstractOpenWebBeansPlugin.java?rev=804760&r1=804759&r2=804760&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/AbstractOpenWebBeansPlugin.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/AbstractOpenWebBeansPlugin.java Sun Aug 16 20:16:30 2009
@@ -19,8 +19,6 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
-import javax.enterprise.inject.spi.InjectionPoint;
-
import org.apache.webbeans.exception.WebBeansConfigurationException;
/**
@@ -94,11 +92,4 @@
}
- public <T> boolean addImplicitComponentForInjectionPoint(InjectionPoint injectionPoint)
- {
- return false;
- }
-
-
-
}
Added: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/OpenWebBeansJmsPlugin.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/OpenWebBeansJmsPlugin.java?rev=804760&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/OpenWebBeansJmsPlugin.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/OpenWebBeansJmsPlugin.java Sun Aug 16 20:16:30 2009
@@ -0,0 +1,25 @@
+/*
+ * 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.plugins;
+
+import javax.enterprise.inject.spi.Bean;
+
+import org.apache.webbeans.jms.JMSModel;
+
+public interface OpenWebBeansJmsPlugin extends OpenWebBeansPlugin
+{
+ public Bean<?> getJmsBean(JMSModel jmsModel);
+
+ public Object getJmsBeanProxy(Bean<?> bean, Class<?> iface);
+}
Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/OpenWebBeansJmsPlugin.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/OpenWebBeansPlugin.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/OpenWebBeansPlugin.java?rev=804760&r1=804759&r2=804760&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/OpenWebBeansPlugin.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/OpenWebBeansPlugin.java Sun Aug 16 20:16:30 2009
@@ -16,8 +16,6 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
-import javax.enterprise.inject.spi.InjectionPoint;
-
import org.apache.webbeans.exception.WebBeansConfigurationException;
/**
@@ -70,14 +68,6 @@
*/
public void isManagedBean(Class<?> clazz) throws WebBeansConfigurationException;
- /**
- * If plugins applicable, it adds the component for the given {@code InjectionPoint}
- * jms related bean into the manager.
- *
- * @param injectionPoint injection point for the jms bean
- * @return <code>true</code> if plugin is capable for handling the injection point, <code>false</code> otherwise
- */
- public <T> boolean addImplicitComponentForInjectionPoint(InjectionPoint injectionPoint);
/**
* Check whether the given annotation class represents a resource which
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/PluginLoader.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/PluginLoader.java?rev=804760&r1=804759&r2=804760&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/PluginLoader.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/PluginLoader.java Sun Aug 16 20:16:30 2009
@@ -144,4 +144,23 @@
return null;
}
+
+ /**
+ * Gets ejb plugin
+ *
+ * @return ejb plugin
+ */
+ public OpenWebBeansJmsPlugin getJmsPlugin()
+ {
+ for(OpenWebBeansPlugin plugin : this.plugins)
+ {
+ if(plugin instanceof OpenWebBeansJmsPlugin)
+ {
+ return (OpenWebBeansJmsPlugin)plugin;
+ }
+ }
+
+ return null;
+ }
+
}
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=804760&r1=804759&r2=804760&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 Sun Aug 16 20:16:30 2009
@@ -52,6 +52,7 @@
import org.apache.webbeans.component.xml.XMLProducerBean;
import org.apache.webbeans.config.DefinitionUtil;
import org.apache.webbeans.config.ManagedBeanConfigurator;
+import org.apache.webbeans.config.OpenWebBeansConfiguration;
import org.apache.webbeans.container.BeanManagerImpl;
import org.apache.webbeans.decorator.DecoratorsManager;
import org.apache.webbeans.deployment.DeploymentTypeManager;
@@ -71,6 +72,7 @@
import org.apache.webbeans.jms.JMSModel;
import org.apache.webbeans.jms.JMSModel.JMSType;
import org.apache.webbeans.plugins.OpenWebBeansEjbPlugin;
+import org.apache.webbeans.plugins.OpenWebBeansJmsPlugin;
import org.apache.webbeans.plugins.PluginLoader;
import org.apache.webbeans.proxy.JavassistProxyFactory;
import org.apache.webbeans.util.AnnotationUtil;
@@ -96,6 +98,9 @@
/** Current configuration file name */
private String CURRENT_SCAN_FILE_NAME = null;
+
+ /**OWB specific or not*/
+ private boolean owbSpecificConfiguration = false;
/** Annotation type manager that manages the XML defined annotations */
private XMLAnnotationTypeManager xmlAnnotTypeManager = XMLAnnotationTypeManager.getInstance();
@@ -105,16 +110,60 @@
*/
public WebBeansXMLConfigurator()
{
-
+ String usage = OpenWebBeansConfiguration.getInstance().getProperty(OpenWebBeansConfiguration.USE_OWB_SPECIFIC_XML_CONFIGURATION);
+ this.owbSpecificConfiguration = Boolean.parseBoolean(usage);
}
+ /**
+ * Configures XML configuration file.
+ * @param xmlStream xml configuration file
+ */
public void configure(InputStream xmlStream)
{
try
{
if(xmlStream.available() > 0)
{
- configure(xmlStream, "No-name XML Stream");
+ //Use OWB Specific XML Configuration
+ if(this.owbSpecificConfiguration)
+ {
+ configureOwbSpecific(xmlStream, "No-name XML Stream");
+ }
+ else
+ {
+ configureSpecSpecific(xmlStream, "No-name XML Stream");
+ }
+
+ }
+ }
+ catch (IOException e)
+ {
+ throw new WebBeansConfigurationException(e);
+ }
+
+ }
+
+ /**
+ * Configures XML configuration file.
+ * @param xmlStream xml configuration file
+ * @param fileName file name
+ */
+ public void configure(InputStream xmlStream, String fileName)
+ {
+ try
+ {
+ if(xmlStream.available() > 0)
+ {
+ //Use OWB Specific XML Configuration
+ if(this.owbSpecificConfiguration)
+ {
+ configureOwbSpecific(xmlStream, fileName);
+ }
+ else
+ {
+ configureSpecSpecific(xmlStream, fileName);
+ }
+
}
}
catch (IOException e)
@@ -123,6 +172,7 @@
}
}
+
/**
* Configures the web beans from the given input stream.
@@ -130,7 +180,7 @@
* @param xmlStream xml file containing the web beans definitions.
* @param fileName name of the configuration file
*/
- public void configure(InputStream xmlStream, String fileName)
+ public void configureOwbSpecific(InputStream xmlStream, String fileName)
{
try
{
@@ -145,7 +195,37 @@
Element webBeansRoot = XMLUtil.getRootElement(xmlStream);
//Start configuration
- configure(webBeansRoot);
+ configureOwbSpecific(webBeansRoot);
+ }
+ }
+ catch (IOException e)
+ {
+ throw new WebBeansConfigurationException(e);
+ }
+ }
+
+ /**
+ * Configures the web beans from the given input stream.
+ *
+ * @param xmlStream xml file containing the web beans definitions.
+ * @param fileName name of the configuration file
+ */
+ public void configureSpecSpecific(InputStream xmlStream, String fileName)
+ {
+ try
+ {
+ if(xmlStream.available() > 0)
+ {
+ Asserts.assertNotNull(xmlStream,"xmlStream parameter can not be null!");
+ Asserts.assertNotNull(fileName,"fileName parameter can not be null!");
+
+ CURRENT_SCAN_FILE_NAME = fileName;
+
+ //Get root element of the XML document
+ Element webBeansRoot = XMLUtil.getSpecStrictRootElement(xmlStream);
+
+ //Start configuration
+ configureSpecSpecific(webBeansRoot);
}
}
catch (IOException e)
@@ -153,13 +233,14 @@
throw new WebBeansConfigurationException(e);
}
}
+
/**
* Configures the xml file root element.
*
* @param webBeansRoot root element of the configuration xml file
*/
- private void configure(Element webBeansRoot)
+ private void configureOwbSpecific(Element webBeansRoot)
{
List<Element> webBeanDeclerationList = new ArrayList<Element>();
List<Element> childs = webBeansRoot.elements();
@@ -262,6 +343,83 @@
}
/**
+ * Configures the xml file root element.
+ *
+ * @param webBeansRoot root element of the configuration xml file
+ */
+ private void configureSpecSpecific(Element webBeansRoot)
+ {
+ List<Element> childs = webBeansRoot.elements();
+ Iterator<Element> it = childs.iterator();
+
+ Element child = null;
+ while (it.hasNext())
+ {
+ child = it.next();
+
+ /* <Deploy> element decleration */
+ if (XMLUtil.getName(child).equals(WebBeansConstants.WEB_BEANS_XML_SPEC_SPECIFIC_DEPLOY_ELEMENT))
+ {
+ if (DEPLOY_IS_DEFINED)
+ {
+ throw new DeploymentException("There can not be more than one web-beans.xml file that declares <deploy> element");
+ }
+ else
+ {
+ if (!XMLUtil.isElementChildExist(child, WebBeansConstants.WEB_BEANS_XML_STANDART_ELEMENT))
+ {
+ throw new DeploymentException("<Deploy> element must have <Standard/> deployment type in the web-beans.xml");
+ }
+
+ DeploymentTypeManager.getInstance().removeProduction();
+
+ configureDeploymentTypes(child);
+ DEPLOY_IS_DEFINED = true;
+
+ }
+ }
+ /* <Interceptors> element decleration */
+ else if (XMLUtil.getName(child).equals(WebBeansConstants.WEB_BEANS_XML_SPEC_SPECIFIC_INTERCEPTORS_ELEMENT))
+ {
+ if (INTERCEPTORS_IS_DEFINED)
+ {
+ throw new WebBeansConfigurationException("There can not be more than one web-beans.xml file that declares <interceptors> element");
+ }
+ else
+ {
+ configureInterceptorsElement(child);
+ INTERCEPTORS_IS_DEFINED = true;
+
+ }
+ }
+ /* <Decorators> element decleration */
+ else if (XMLUtil.getName(child).equals(WebBeansConstants.WEB_BEANS_XML_SPEC_SPECIFIC_DECORATORS_ELEMENT))
+ {
+ if (DECORATORS_IS_DEFINED)
+ {
+ throw new WebBeansConfigurationException("There can not be more than one web-beans.xml file that declares <decorators> element");
+ }
+ else
+ {
+ configureDecoratorsElement(child);
+ DECORATORS_IS_DEFINED = true;
+
+ }
+ }
+ }
+
+ /*
+ * If no <Deploy> element is defined in any webbeans.xml in the current
+ * application
+ */
+ if (!DEPLOY_IS_DEFINED)
+ {
+ DeploymentTypeManager.getInstance().addNewDeploymentType(Production.class, 1);
+ }
+
+ }
+
+ /**
* Configures the webbeans defined in the xml file.
*
* @param listOfWebBeanDecleration list of element that specifies new
@@ -414,7 +572,16 @@
while (itChilds.hasNext())
{
Element child = itChilds.next();
- Class<?> clazz = XMLUtil.getElementJavaType(child);
+ Class<?> clazz = null;
+
+ if(this.owbSpecificConfiguration)
+ {
+ clazz = XMLUtil.getElementJavaType(child);
+ }
+ else
+ {
+ clazz = ClassUtil.getClassFromName(child.getTextTrim());
+ }
if (clazz == null)
{
@@ -453,7 +620,16 @@
while (itChilds.hasNext())
{
Element child = itChilds.next();
- Class<?> clazz = XMLUtil.getElementJavaType(child);
+ Class<?> clazz = null;
+
+ if(this.owbSpecificConfiguration)
+ {
+ clazz = XMLUtil.getElementJavaType(child);
+ }
+ else
+ {
+ clazz = ClassUtil.getClassFromName(child.getTextTrim());
+ }
if (clazz == null)
{
@@ -488,7 +664,16 @@
while (itChilds.hasNext())
{
Element child = itChilds.next();
- Class<?> clazz = XMLUtil.getElementJavaType(child);
+ Class<?> clazz = null;
+
+ if(this.owbSpecificConfiguration)
+ {
+ clazz = XMLUtil.getElementJavaType(child);
+ }
+ else
+ {
+ clazz = ClassUtil.getClassFromName(child.getTextTrim());
+ }
if (clazz == null)
{
@@ -1564,6 +1749,10 @@
{
model.addBinding(ann);
}
+
+ //Adding JMS Beans
+ OpenWebBeansJmsPlugin plugin = PluginLoader.getInstance().getJmsPlugin();
+ BeanManagerImpl.getManager().addBean(plugin.getJmsBean(model));
}
/**
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java?rev=804760&r1=804759&r2=804760&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLUtil.java Sun Aug 16 20:16:30 2009
@@ -103,18 +103,24 @@
public void onStart(ElementPath path)
{
Element element = path.getCurrent();
-
- if (element.isRootElement())
+ if (element.getNamespaceURI() == null || element.getNamespaceURI().equals(""))
{
- WebBeansNameSpaceContainer.getInstance().addNewPackageNameSpace(element.getNamespace().getURI());
+ throw new WebBeansConfigurationException("All elements in the beans.xml file have to declare name space.");
+ }
+ else
+ {
+ if (element.isRootElement())
+ {
+ WebBeansNameSpaceContainer.getInstance().addNewPackageNameSpace(element.getNamespace().getURI());
- List allNs = element.declaredNamespaces();
- Iterator itNs = allNs.iterator();
+ List allNs = element.declaredNamespaces();
+ Iterator itNs = allNs.iterator();
- while (itNs.hasNext())
- {
- Namespace namespace = (Namespace)itNs.next();
- WebBeansNameSpaceContainer.getInstance().addNewPackageNameSpace(namespace.getURI());
+ while (itNs.hasNext())
+ {
+ Namespace namespace = (Namespace)itNs.next();
+ WebBeansNameSpaceContainer.getInstance().addNewPackageNameSpace(namespace.getURI());
+ }
}
}
}
@@ -132,6 +138,36 @@
throw new WebBeansException("Unable to read root element of the given input stream", e);
}
}
+
+ /**
+ * Gets the root element of the parsed document.
+ *
+ * @param stream parsed document
+ * @return root element of the document
+ * @throws WebBeansException if any runtime exception occurs
+ */
+ public static Element getSpecStrictRootElement(InputStream stream) throws WebBeansException
+ {
+ try
+ {
+ SAXReader saxReader = getSaxReader();
+ saxReader.setMergeAdjacentText(true);
+ saxReader.setStripWhitespaceText(true);
+ saxReader.setErrorHandler(new WebBeansErrorHandler());
+ saxReader.setEntityResolver(new WebBeansResolver());
+ saxReader.setValidation(false);
+ Document document = saxReader.read(stream);
+
+ return document.getRootElement();
+
+ }
+ catch (DocumentException e)
+ {
+ log.fatal("Unable to read root element of the given input stream", e);
+ throw new WebBeansException("Unable to read root element of the given input stream", e);
+ }
+ }
+
public static boolean isElementInNamespace(Element element, String namespace)
{
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=804760&r1=804759&r2=804760&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 Sun Aug 16 20:16:30 2009
@@ -52,5 +52,8 @@
#use embedded openejb metadata discovery
org.apache.webbeans.spi.deployer.UseEjbMetaDataDiscoveryService=false
+#use OWB Specific XML Configuration
+org.apache.webbeans.useOwbSpecificXmlConfig=false
+
#conversation service
org.apache.webbeans.spi.conversation.ConversationService=org.apache.webbeans.spi.conversation.jsf.JSFConversationServiceImpl
\ No newline at end of file
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLAnnotTypeTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLAnnotTypeTest.java?rev=804760&r1=804759&r2=804760&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLAnnotTypeTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLAnnotTypeTest.java Sun Aug 16 20:16:30 2009
@@ -20,6 +20,7 @@
import junit.framework.Assert;
import org.apache.webbeans.test.servlet.TestContext;
+import org.apache.webbeans.xml.WebBeansXMLConfigurator;
import org.apache.webbeans.xml.XMLAnnotationTypeManager;
import org.junit.Test;
@@ -40,7 +41,9 @@
{
InputStream stream = XMLFieldTest.class.getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/bindingTypeAnnot.xml");
Assert.assertNotNull(stream);
- configureFromXML(stream, "bindingTypeAnnot.xml");
+
+ WebBeansXMLConfigurator configurator = new WebBeansXMLConfigurator();
+ configurator.configureOwbSpecific(stream, "bindingTypeAnnot.xml");
Set<Class<? extends Annotation>> aanns = XMLAnnotationTypeManager.getInstance().getBindingTypes();
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLFieldTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLFieldTest.java?rev=804760&r1=804759&r2=804760&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLFieldTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLFieldTest.java Sun Aug 16 20:16:30 2009
@@ -48,7 +48,7 @@
/* Clear the manager component list */
clear();
- this.xmlConfigurator.configure(stream, "fieldTest.xml");
+ this.xmlConfigurator.configureOwbSpecific(stream, "fieldTest.xml");
ComponentForField cff = (ComponentForField) getManager().getInstanceByName("componentForField");
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLTest.java?rev=804760&r1=804759&r2=804760&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/XMLTest.java Sun Aug 16 20:16:30 2009
@@ -15,12 +15,10 @@
import java.io.InputStream;
-import javax.enterprise.inject.spi.BeanManager;
import javax.servlet.ServletContext;
import junit.framework.Assert;
-import org.apache.webbeans.container.BeanManagerImpl;
import org.apache.webbeans.test.servlet.TestContext;
import org.apache.webbeans.xml.XMLUtil;
import org.dom4j.Element;
@@ -29,8 +27,6 @@
public class XMLTest extends TestContext
{
- private BeanManager container = null;
-
public XMLTest()
{
super(XMLTest.class.getSimpleName());
@@ -44,7 +40,6 @@
@Before
public void init()
{
- this.container = BeanManagerImpl.getManager();
}
public void startTests(ServletContext ctx)
@@ -74,4 +69,23 @@
Assert.assertNull(e);
}
+ @Test
+ public void nameSpacesNotDeclared()
+ {
+ Throwable e = null;
+ try
+ {
+ InputStream stream = XMLTest.class.getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/nameSpaceNotDeclared.xml");
+ Assert.assertNotNull(stream);
+
+ XMLUtil.getRootElement(stream);
+
+ }
+ catch (Throwable e1)
+ {
+ e = e1;
+ }
+
+ Assert.assertNotNull(e);
+ }
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/definition/XMLDefinitionTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/definition/XMLDefinitionTest.java?rev=804760&r1=804759&r2=804760&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/definition/XMLDefinitionTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/definition/XMLDefinitionTest.java Sun Aug 16 20:16:30 2009
@@ -23,9 +23,6 @@
import org.apache.webbeans.test.servlet.TestContext;
import org.apache.webbeans.test.xml.definition.Definition1;
import org.apache.webbeans.test.xml.definition.Definition2;
-import org.apache.webbeans.test.xml.definition.MockAsynchronousCreditCardPaymentProcessor;
-import org.apache.webbeans.test.xml.definition.PaymentProcessor;
-import org.apache.webbeans.test.xml.definition.SystemConfig;
import org.apache.webbeans.test.xml.definition.TstBeanConstructor;
import org.apache.webbeans.test.xml.definition.TstBeanUnnamed;
import org.junit.Before;
Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/strict/XMLSpecStrictTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/strict/XMLSpecStrictTest.java?rev=804760&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/strict/XMLSpecStrictTest.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/strict/XMLSpecStrictTest.java Sun Aug 16 20:16:30 2009
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
+ * or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.apache.webbeans.test.unittests.xml.strict;
+
+import java.io.InputStream;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.decorator.DecoratorsManager;
+import org.apache.webbeans.intercept.InterceptorsManager;
+import org.apache.webbeans.test.servlet.TestContext;
+import org.apache.webbeans.test.unittests.xml.XMLTest;
+import org.apache.webbeans.test.xml.strict.DummyDecorator;
+import org.apache.webbeans.test.xml.strict.DummyInterceptor;
+import org.apache.webbeans.xml.WebBeansXMLConfigurator;
+import org.junit.Test;
+
+public class XMLSpecStrictTest extends TestContext
+{
+ public XMLSpecStrictTest()
+ {
+ super(XMLSpecStrictTest.class.getName());
+ }
+
+ @Test
+ public void testXMLSpecStrictDecorators()
+ {
+ InputStream stream = XMLTest.class.getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/strict/decorators.xml");
+ Assert.assertNotNull(stream);
+
+ WebBeansXMLConfigurator configurator = new WebBeansXMLConfigurator();
+ configurator.configureSpecSpecific(stream, "decorators.xml");
+
+ boolean enable = DecoratorsManager.getInstance().isDecoratorEnabled(DummyDecorator.class);
+ Assert.assertTrue(enable);
+ }
+
+ @Test
+ public void testXMLSpecStrictInterceptors()
+ {
+ InputStream stream = XMLTest.class.getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/strict/interceptors.xml");
+ Assert.assertNotNull(stream);
+
+ WebBeansXMLConfigurator configurator = new WebBeansXMLConfigurator();
+ configurator.configureSpecSpecific(stream, "interceptors.xml");
+
+ boolean enable = InterceptorsManager.getInstance().isInterceptorEnabled(DummyInterceptor.class);
+ Assert.assertTrue(enable);
+ }
+
+}
Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/strict/XMLSpecStrictTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/DummyDecorator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/DummyDecorator.java?rev=804760&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/DummyDecorator.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/DummyDecorator.java Sun Aug 16 20:16:30 2009
@@ -0,0 +1,22 @@
+/*
+ * 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.test.xml.strict;
+
+import javax.decorator.Decorator;
+
+@Decorator
+public class DummyDecorator
+{
+
+}
Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/DummyDecorator.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/DummyInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/DummyInterceptor.java?rev=804760&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/DummyInterceptor.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/DummyInterceptor.java Sun Aug 16 20:16:30 2009
@@ -0,0 +1,24 @@
+/*
+ * 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.test.xml.strict;
+
+import javax.interceptor.Interceptor;
+
+import org.apache.webbeans.test.component.intercept.webbeans.bindings.Secure;
+
+@Secure @Interceptor
+public class DummyInterceptor
+{
+
+}
Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/strict/DummyInterceptor.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/nameSpaceNotDeclared.xml (from r802587, incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/nameSpaceNotDeclared.xml)
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/nameSpaceNotDeclared.xml?p2=incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/nameSpaceNotDeclared.xml&p1=incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/nameSpaceNotDeclared.xml&r1=802587&r2=804760&rev=804760&view=diff
==============================================================================
(empty)
Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/nameSpaceNotDeclared.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/decorators.xml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/decorators.xml?rev=804760&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/decorators.xml (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/decorators.xml Sun Aug 16 20:16:30 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<beans>
+ <decorators>
+ <class>org.apache.webbeans.test.xml.strict.DummyDecorator</class>
+ </decorators>
+</beans>
Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/decorators.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/interceptors.xml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/interceptors.xml?rev=804760&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/interceptors.xml (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/interceptors.xml Sun Aug 16 20:16:30 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<beans>
+ <interceptors>
+ <class>org.apache.webbeans.test.xml.strict.DummyInterceptor</class>
+ </interceptors>
+</beans>
Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/interceptors.xml
------------------------------------------------------------------------------
svn:eol-style = native