openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r728808 - in /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: config/ container/ decorator/ deployment/ event/ intercept/ jsf/ lifecycle/ servlet/ xml/
Date Mon, 22 Dec 2008 22:13:21 GMT
Author: gerdogdu
Date: Mon Dec 22 14:13:21 2008
New Revision: 728808

URL: http://svn.apache.org/viewvc?rev=728808&view=rev
Log:
Starting to test M1 release.

Added:
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansFinder.java   (with props)
Modified:
    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/config/WebBeansScanner.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/DeploymentTypeManager.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeManager.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jsf/ConversationManager.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/servlet/WebBeansConfigurationListener.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/XMLAnnotationTypeManager.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLSpecializesManager.java

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=728808&r1=728807&r2=728808&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 Dec 22 14:13:21 2008
@@ -62,15 +62,13 @@
 {
 	private static WebBeansLogger logger = WebBeansLogger.getLogger(WebBeansContainerDeployer.class);
 	
-	/**Check if deployment is already done*/
-	private static boolean deployed = false;
+	private boolean deployed = false;
 	
-	/**
-	 * Private constructor
-	 */
-	private WebBeansContainerDeployer()
+	private WebBeansXMLConfigurator xmlConfigurator = null;
+	
+	public WebBeansContainerDeployer(WebBeansXMLConfigurator xmlConfigurator)
 	{
-		throw new UnsupportedOperationException();
+		this.xmlConfigurator = xmlConfigurator;
 	}
 	
 	/**
@@ -81,9 +79,8 @@
 	 * </p>
 	 * @throws WebBeansDeploymentException if any deployment exception occurs
 	 */
-	public static void deploy() throws WebBeansDeploymentException
+	public void deploy(WebBeansScanner scanner) throws WebBeansDeploymentException
 	{
-		WebBeansScanner scanner = WebBeansScanner.getScannerInstance();
 		try
 		{
 			if(!deployed)
@@ -98,11 +95,11 @@
 				JNDIUtil.bind(WebBeansConstants.WEB_BEANS_MANAGER_JNDI_NAME, ManagerImpl.getManager());
 				
 				deployFromXML(scanner);
-				checkStereoTypes();				
+				checkStereoTypes(scanner);				
 				configureInterceptors(scanner);
 				configureDecorators(scanner);	
 				deployFromClassPath(scanner);
-				checkSpecializations();
+				checkSpecializations(scanner);
 				
 				deployed = true;
 			}
@@ -113,7 +110,7 @@
 		}
 	}
 	
-	private static void deployFromClassPath(WebBeansScanner scanner) throws ClassNotFoundException
+	private void deployFromClassPath(WebBeansScanner scanner) throws ClassNotFoundException
 	{
 		logger.info("Deploying configurations from class files is started");
 		
@@ -127,7 +124,7 @@
 			while(itPathClasses.hasNext())
 			{
 				String componentClassName = itPathClasses.next();
-				Class<?> implClass = Class.forName(componentClassName);
+				Class<?> implClass = ClassUtil.getClassFromName(componentClassName);
 				
 				if(SimpleWebBeansConfigurator.isSimpleWebBean(implClass))
 				{
@@ -146,7 +143,7 @@
 		
 	}
 	
-	private static void deployFromXML(WebBeansScanner scanner)
+	private void deployFromXML(WebBeansScanner scanner)
 	{
 		logger.info("Deploying configurations from XML files is started");
 		
@@ -157,13 +154,13 @@
 		while(it.hasNext())
 		{
 			String fileName = it.next();
-			WebBeansXMLConfigurator.configure(xmls.get(fileName), fileName);
+			this.xmlConfigurator.configure(xmls.get(fileName), fileName);
 		}
 		
 		logger.info("Deploying configurations from XML is ended succesfully");
 	}
 	
-	private static void configureInterceptors(WebBeansScanner scanner) throws ClassNotFoundException
+	private void configureInterceptors(WebBeansScanner scanner) throws ClassNotFoundException
 	{
 		logger.info("Configuring the Interceptors is started");
 		
@@ -175,7 +172,7 @@
 		{
 			for(String interceptorClazz : classes)
 			{
-				Class<?> implClass = Class.forName(interceptorClazz);
+				Class<?> implClass = ClassUtil.getClassFromName(interceptorClazz);
 					
 				logger.info("Simple WebBeans Interceptor Component with class name : " + interceptorClazz + " is found");
 				
@@ -187,7 +184,7 @@
 		
 	}
 	
-	private static void configureDecorators(WebBeansScanner scanner) throws ClassNotFoundException
+	private void configureDecorators(WebBeansScanner scanner) throws ClassNotFoundException
 	{
 		logger.info("Configuring the Decorators is started");
 		
@@ -198,7 +195,7 @@
 		{
 			for(String decoratorClazz : classes)
 			{
-				Class<?> implClass = Class.forName(decoratorClazz);
+				Class<?> implClass = ClassUtil.getClassFromName(decoratorClazz);
 				logger.info("Simple WebBeans Decorator Component with class name : " + decoratorClazz + " is found");
 				
 				defineSimpleWebBeansDecorators(implClass);
@@ -209,11 +206,11 @@
 		
 	}
 	
-	private static void checkSpecializations()
+	private void checkSpecializations(WebBeansScanner scanner)
 	{
 		logger.info("Checking Specialization constraints is started");
 		
-		  Map<String, Set<String>>  specialMap = WebBeansScanner.getScannerInstance().getANNOTATION_DB().getAnnotationIndex();
+		  Map<String, Set<String>>  specialMap = scanner.getANNOTATION_DB().getAnnotationIndex();
 		  if(specialMap != null && specialMap.size() > 0)
 		  {
 			  if(specialMap.containsKey(Specializes.class.getName()))
@@ -250,7 +247,7 @@
 		  logger.info("Checking Specialization constraints is ended");
 	}
 	
-	private static void checkXMLSpecializations()
+	private void checkXMLSpecializations()
 	{
 		  //Check XML specializations
 		  Set<Class<?>> clazzes = XMLSpecializesManager.getInstance().getXMLSpecializationClasses();
@@ -278,7 +275,7 @@
 		  }		
 	}
 	
-	public static void checkPassivationScopes()
+	public void checkPassivationScopes()
 	{
 		Set<Bean<?>> beans = ManagerImpl.getManager().getBeans();
 		
@@ -307,35 +304,30 @@
 		}
 	}
 	
-	public static void checkStereoTypes()
+	public void checkStereoTypes(WebBeansScanner scanner)
 	{
 		logger.info("Checking StereoTypes constraints is started");
 		  
-		Map<String, Set<String>>  stereotypeMap = WebBeansScanner.getScannerInstance().getANNOTATION_DB().getAnnotationIndex();
+		Map<String, Set<String>>  stereotypeMap = scanner.getANNOTATION_DB().getAnnotationIndex();
 		  if(stereotypeMap != null && stereotypeMap.size() > 0)
 		  {	
-			  if(stereotypeMap.containsKey(Stereotype.class.getName()))
+			  Set<String> stereoClassSet = stereotypeMap.keySet();
+			  Iterator<String> steIterator = stereoClassSet.iterator();
+			  while(steIterator.hasNext())
 			  {
-				  Set<String> stereoClassSet = stereotypeMap.keySet();
-				  Iterator<String> steIterator = stereoClassSet.iterator();
-				  while(steIterator.hasNext())
+				  String steroClassName = steIterator.next();
+				  
+				  Class<? extends Annotation> stereoClass = (Class<? extends Annotation>)ClassUtil.getClassFromName(steroClassName);
+				  
+				  if(AnnotationUtil.isStereoTypeAnnotation(stereoClass))
 				  {
-					  String steroClassName = steIterator.next();
-					  Set<String> stereoSet = stereotypeMap.get(steroClassName);
-					  
-					  for(String clazz : stereoSet)
+					  if(!XMLAnnotationTypeManager.getInstance().isStereoTypeExist(stereoClass))
 					  {
-						  Class<? extends Annotation> stereoClass = (Class<? extends Annotation>)ClassUtil.getClassFromName(clazz);
-						  
-						  if(!XMLAnnotationTypeManager.getInstance().isStereoTypeExist(stereoClass))
-						  {
-							  WebBeansUtil.checkStereoTypeClass(stereoClass);
-							  StereoTypeModel model = new StereoTypeModel(stereoClass);
-							  StereoTypeManager.getInstance().addStereoTypeModel(model);					  							  
-						  }
-					  }					  
-				  }
-				  
+						  WebBeansUtil.checkStereoTypeClass(stereoClass);
+						  StereoTypeModel model = new StereoTypeModel(stereoClass);
+						  StereoTypeManager.getInstance().addStereoTypeModel(model);					  							  
+					  }  
+				  }					  
 			  }
 		  }
 		  
@@ -343,7 +335,7 @@
 	}
 	
 	
-	private static <T> void defineSimpleWebBeans(Class<T> clazz)
+	private <T> void defineSimpleWebBeans(Class<T> clazz)
 	{
 		ComponentImpl<T> component = null;
 		
@@ -366,12 +358,12 @@
 	 * 
 	 * @param clazz interceptor class
 	 */
-	private static <T> void defineSimpleWebBeansInterceptors(Class<T> clazz)
+	private <T> void defineSimpleWebBeansInterceptors(Class<T> clazz)
 	{
 		WebBeansUtil.defineSimpleWebBeansInterceptors(clazz);
 	}
 	
-	private static <T> void defineSimpleWebBeansDecorators(Class<T> clazz)
+	private <T> void defineSimpleWebBeansDecorators(Class<T> clazz)
 	{
 		WebBeansUtil.defineSimpleWebBeansDecorators(clazz);
 	}

Added: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansFinder.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansFinder.java?rev=728808&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansFinder.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansFinder.java Mon Dec 22 14:13:21 2008
@@ -0,0 +1,89 @@
+/*
+ *  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.config;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.util.WebBeansUtil;
+
+public class WebBeansFinder
+{
+	public static final String SINGLETON_MANAGER = "org.apache.webbeans.container.ManagerImpl";
+	
+	public static final String SINGLETON_DECORATORS_MANAGER = "org.apache.webbeans.decorator.DecoratorsManager";
+	
+	public static final String SINGLETON_DEPLOYMENT_TYPE_MANAGER = "org.apache.webbeans.deployment.DeploymentTypeManager";
+	
+	public static final String SINGLETON_STEREOTYPE_MANAGER = "org.apache.webbeans.deployment.StereoTypeManager";
+	
+	public static final String SINGLETON_NOTIFICATION_MANAGER = "org.apache.webbeans.event.NotificationManager";
+	
+	public static final String SINGLETON_INTERCEPTORS_MANAGER = "org.apache.webbeans.intercept.InterceptorsManager";
+	
+	public static final String SINGLETON_CONVERSATION_MANAGER = "org.apache.webbeans.jsf.ConversationManager";
+	
+	public static final String SINGLETON_XML_ANNOTATION_TYPE_MANAGER = "org.apache.webbeans.xml.XMLAnnotationTypeManager";
+	
+	public static final String SINGLETON_XML_SPECIALIZES_MANAGER = "org.apache.webbeans.xml.XMLSpecializesManager";
+	
+	public static final String SINGLETON_INJECTION_RESOLVER = "org.apache.webbeans.container.InjectionResolver";
+	
+	private static Map<String, Map<ClassLoader, Object>> singletonMap = new HashMap<String, Map<ClassLoader,Object>>();
+
+	public static Object getSingletonInstance(String singletonName)
+	{
+		Object object = null;
+		
+		synchronized (singletonMap)
+		{
+			ClassLoader classLoader = WebBeansUtil.getCurrentClassLoader();
+			Map<ClassLoader, Object> managerMap = singletonMap.get(singletonName);
+			
+			if(managerMap == null)
+			{
+				managerMap = new HashMap<ClassLoader, Object>();
+				singletonMap.put(singletonName, managerMap);
+			}
+			object = managerMap.get(classLoader);
+			/*No singleton for this application, create one*/
+			if(object == null)
+			{
+				Class<?> clazz = ClassUtil.getClassFromName(singletonName);
+				try
+				{
+					object = clazz.newInstance();
+					managerMap.put(classLoader, object);
+					
+				} catch (InstantiationException e)
+				{
+					throw new WebBeansException("Unable to instantiate class : " + singletonName,e);
+					
+				} catch (IllegalAccessException e)
+				{
+					throw new WebBeansException("Illegal access exception in creating instance with class : " + singletonName ,e);
+				}
+			}			
+		}
+				
+		return object;
+		
+	}	
+}
\ No newline at end of file

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansFinder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansScanner.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansScanner.java?rev=728808&r1=728807&r2=728808&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansScanner.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansScanner.java Mon Dec 22 14:13:21 2008
@@ -61,16 +61,9 @@
 	/**It is configured or not*/
 	private boolean configure = false;
 	
-	/**Single instance defines within the {@link ServletContext} insance*/
-	private static WebBeansScanner scannerInstance = new WebBeansScanner();
-	
 	private ServletContext servletContext = null;
 	
-	/**
-	 * Configuration constructor.
-	 * @param context servlet context instance
-	 */
-	private WebBeansScanner()
+	public WebBeansScanner()
 	{
 		
 	}
@@ -244,18 +237,5 @@
 	public AnnotationDB getANNOTATION_DB()
 	{	
 		return ANNOTATION_DB;
-	}
-	
-	/**
-	 * Gets the context defined single configuration instance.
-	 * @return configurator instance 
-	 */
-	public static WebBeansScanner getScannerInstance()
-	{
-		if(scannerInstance == null)
-			throw new NullPointerException("WebBeansScanner instance is null.");
-		
-		return scannerInstance;
-	}
-	
+	}	
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java?rev=728808&r1=728807&r2=728808&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java Mon Dec 22 14:13:21 2008
@@ -29,6 +29,7 @@
 
 import org.apache.webbeans.annotation.CurrentLiteral;
 import org.apache.webbeans.component.ProducerComponentImpl;
+import org.apache.webbeans.config.WebBeansFinder;
 import org.apache.webbeans.deployment.DeploymentTypeManager;
 import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.Asserts;
@@ -37,17 +38,14 @@
 @SuppressWarnings("unchecked")
 public class InjectionResolver
 {
-	private static InjectionResolver instance = new InjectionResolver();
-	
-	private ManagerImpl manager = null;
-
-	private InjectionResolver()
+	public InjectionResolver()
 	{
-		manager = ManagerImpl.getManager();
+		
 	}
 	
 	public static InjectionResolver getInstance()
 	{
+		InjectionResolver instance = (InjectionResolver)WebBeansFinder.getSingletonInstance(WebBeansFinder.SINGLETON_INJECTION_RESOLVER);
 		return instance;
 	}
 	
@@ -55,9 +53,11 @@
 	{
 		Asserts.assertNotNull(name,"name parameter can not be null");
 		
+		ManagerImpl manager = ManagerImpl.getManager();
+		
 		Set<Bean<?>> resolvedComponents = new HashSet<Bean<?>>();
 		Bean<?> resolvedComponent = null;
-		Set<Bean<?>> deployedComponents = getInstance().manager.getBeans();
+		Set<Bean<?>> deployedComponents = manager.getBeans();
 		
 		Iterator<Bean<?>> it = deployedComponents.iterator();
 		while(it.hasNext())
@@ -98,6 +98,8 @@
 		Asserts.assertNotNull(apiType, "apiType parameter can not be null");
 		Asserts.assertNotNull(binding, "binding parameter can not be null");
 		
+		ManagerImpl manager = ManagerImpl.getManager();
+		
 		boolean currentBinding = false;
 		boolean returnAll = false;
 		
@@ -109,7 +111,7 @@
 		}
 		
 		Set<Bean<T>> results = new HashSet<Bean<T>>();
-		Set<Bean<?>> deployedComponents = getInstance().manager.getBeans();
+		Set<Bean<?>> deployedComponents = manager.getBeans();
 		
 		if(apiType.equals(Object.class) && currentBinding)
 		{

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java?rev=728808&r1=728807&r2=728808&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java Mon Dec 22 14:13:21 2008
@@ -45,6 +45,7 @@
 import javax.webbeans.manager.Manager;
 
 import org.apache.webbeans.component.AbstractComponent;
+import org.apache.webbeans.config.WebBeansFinder;
 import org.apache.webbeans.context.ContextFactory;
 import org.apache.webbeans.context.DependentContext;
 import org.apache.webbeans.decorator.DecoratorComparator;
@@ -72,8 +73,6 @@
 @SuppressWarnings("unchecked")
 public class ManagerImpl implements Manager, Referenceable
 {
-	private static ManagerImpl instance = null;
-		
 	private Map<Class<? extends Annotation>, Context> contextMap = new ConcurrentHashMap<Class<? extends Annotation>, Context>();
 	
 	private Set<Bean<?>> components = new CopyOnWriteArraySet<Bean<?>>();
@@ -86,7 +85,8 @@
 	
 	private InjectionResolver injectionResolver = null;
 	
-	private ManagerImpl()
+	
+	public ManagerImpl()
 	{		
 		injectionResolver = InjectionResolver.getInstance();
 		notificationManager = NotificationManager.getInstance();
@@ -94,10 +94,7 @@
 	
 	public static ManagerImpl getManager()
 	{
-		if(instance == null)
-		{
-			instance = new ManagerImpl();
-		}
+		ManagerImpl instance = (ManagerImpl) WebBeansFinder.getSingletonInstance(WebBeansFinder.SINGLETON_MANAGER);
 		
 		return instance;
 	}

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java?rev=728808&r1=728807&r2=728808&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java Mon Dec 22 14:13:21 2008
@@ -19,21 +19,22 @@
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
 
+import org.apache.webbeans.config.WebBeansFinder;
 import org.apache.webbeans.util.Asserts;
 
 public class DecoratorsManager
 {
-	private static DecoratorsManager instance = new DecoratorsManager();
-
 	private List<Class<?>> enabledDecorators = new CopyOnWriteArrayList<Class<?>>();
-
-	private DecoratorsManager()
+	
+	public DecoratorsManager()
 	{
 
 	}
 
-	public static DecoratorsManager getInstance()
+	public static  DecoratorsManager getInstance()
 	{
+		DecoratorsManager instance = (DecoratorsManager)WebBeansFinder.getSingletonInstance(WebBeansFinder.SINGLETON_DECORATORS_MANAGER);
+		
 		return instance;
 	}
 

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/DeploymentTypeManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/DeploymentTypeManager.java?rev=728808&r1=728807&r2=728808&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/DeploymentTypeManager.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/DeploymentTypeManager.java Mon Dec 22 14:13:21 2008
@@ -22,26 +22,22 @@
 
 import javax.webbeans.Standard;
 
+import org.apache.webbeans.config.WebBeansFinder;
 import org.apache.webbeans.util.Asserts;
 
 public class DeploymentTypeManager
 {
-	private static DeploymentTypeManager instance = null;
+	private Map<Class<? extends Annotation>, Integer> deploymentTypeMap = new ConcurrentHashMap<Class<? extends Annotation>, Integer>();  
 	
-	private Map<Class<? extends Annotation>, Integer> deploymentTypeMap = new ConcurrentHashMap<Class<? extends Annotation>, Integer>();
-
-	private DeploymentTypeManager()
+	public DeploymentTypeManager()
 	{
 		
 	}
 	
 	public static DeploymentTypeManager getInstance()
 	{
-		if(instance == null)
-		{
-			instance = new DeploymentTypeManager();
-			instance.deploymentTypeMap.put(Standard.class, Integer.valueOf(0));
-		}
+		DeploymentTypeManager instance = (DeploymentTypeManager) WebBeansFinder.getSingletonInstance(WebBeansFinder.SINGLETON_DEPLOYMENT_TYPE_MANAGER);
+		instance.deploymentTypeMap.put(Standard.class, Integer.valueOf(0));
 		
 		return instance;
 	}
@@ -54,9 +50,9 @@
 		
 		if(!deploymentType.equals(Standard.class))
 		{
-			if(!instance.deploymentTypeMap.containsKey(deploymentType))
+			if(!deploymentTypeMap.containsKey(deploymentType))
 			{
-				instance.deploymentTypeMap.put(deploymentType, precedence);
+				deploymentTypeMap.put(deploymentType, precedence);
 			}
 		}
 	}
@@ -65,13 +61,13 @@
 	{
 		Asserts.assertNotNull(deploymentType, "deploymentType parameter can not be null");
 		
-		if(!instance.deploymentTypeMap.containsKey(deploymentType))
+		if(!deploymentTypeMap.containsKey(deploymentType))
 		{
 			throw new IllegalArgumentException("Deployment type with annotation class : " + deploymentType.getName() + " is not applicable");
 		}
 		else
 		{
-			return instance.deploymentTypeMap.get(deploymentType);
+			return deploymentTypeMap.get(deploymentType);
 		}
 	}
 	
@@ -96,6 +92,6 @@
 	public boolean isDeploymentTypeEnabled(Class<? extends Annotation> deploymentType)
 	{
 		Asserts.assertNotNull(deploymentType, "deploymentType parameter can not be null");
-		return instance.deploymentTypeMap.containsKey(deploymentType);
+		return deploymentTypeMap.containsKey(deploymentType);
 	}
 }
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeManager.java?rev=728808&r1=728807&r2=728808&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeManager.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeManager.java Mon Dec 22 14:13:21 2008
@@ -19,22 +19,22 @@
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
+import org.apache.webbeans.config.WebBeansFinder;
 import org.apache.webbeans.deployment.stereotype.IStereoTypeModel;
 import org.apache.webbeans.util.Asserts;
 
 public class StereoTypeManager
 {
-	private static StereoTypeManager instance = new StereoTypeManager();
-
 	private Map<String, IStereoTypeModel> stereoTypeMap = new ConcurrentHashMap<String, IStereoTypeModel>();
 	
-	private StereoTypeManager()
+	public StereoTypeManager()
 	{
 		
 	}
 	
 	public static StereoTypeManager getInstance()
 	{
+		StereoTypeManager instance = (StereoTypeManager)WebBeansFinder.getSingletonInstance(WebBeansFinder.SINGLETON_STEREOTYPE_MANAGER);
 		return instance;
 	}
 	
@@ -42,16 +42,16 @@
 	{
 		Asserts.assertNotNull(model, "model parameter can not be null");
 		
-		getInstance().stereoTypeMap.put(model.getName(), model);
+		stereoTypeMap.put(model.getName(), model);
 	}
 	
 	public IStereoTypeModel getStereoTypeModel(String modelName)
 	{
 		Asserts.assertNotNull(modelName, "modelName parameter can not be null");
 		
-		if(getInstance().stereoTypeMap.containsKey(modelName))
+		if(stereoTypeMap.containsKey(modelName))
 		{
-			return getInstance().stereoTypeMap.get(modelName);
+			return stereoTypeMap.get(modelName);
 		}
 		
 		return null;

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java?rev=728808&r1=728807&r2=728808&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java Mon Dec 22 14:13:21 2008
@@ -36,6 +36,7 @@
 import javax.webbeans.TypeLiteral;
 
 import org.apache.webbeans.component.ObservesMethodsOwner;
+import org.apache.webbeans.config.WebBeansFinder;
 import org.apache.webbeans.logger.WebBeansLogger;
 import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.Asserts;
@@ -45,16 +46,13 @@
 {
 	private static final WebBeansLogger logger = WebBeansLogger.getLogger(NotificationManager.class);
 	
-	@SuppressWarnings("unchecked")
-	private static NotificationManager instance = new NotificationManager();
-	
 	private Map<Class<?>, Set<ObserverImpl<?>>> observers = new ConcurrentHashMap<Class<?>, Set<ObserverImpl<?>>>();
 		
 	private TransactionManager transactionManager;
 	
 	private Set<TransactionalNotifier> transactionSet = new CopyOnWriteArraySet<TransactionalNotifier>();
 	
-	private NotificationManager()
+	public NotificationManager()
 	{
 		
 	}
@@ -62,6 +60,7 @@
 	@SuppressWarnings("unchecked")
 	public static NotificationManager getInstance()
 	{
+		NotificationManager instance = (NotificationManager)WebBeansFinder.getSingletonInstance(WebBeansFinder.SINGLETON_NOTIFICATION_MANAGER);
 		return instance;
 	}
 	

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java?rev=728808&r1=728807&r2=728808&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java Mon Dec 22 14:13:21 2008
@@ -19,21 +19,21 @@
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
 
+import org.apache.webbeans.config.WebBeansFinder;
 import org.apache.webbeans.util.Asserts;
 
 public class InterceptorsManager
 {
-	private static InterceptorsManager instance = new InterceptorsManager();
-
 	private List<Class<?>> enabledInterceptors = new CopyOnWriteArrayList<Class<?>>();
 
-	private InterceptorsManager()
+	public InterceptorsManager()
 	{
 
 	}
 
 	public static InterceptorsManager getInstance()
 	{
+		InterceptorsManager instance = (InterceptorsManager)WebBeansFinder.getSingletonInstance(WebBeansFinder.SINGLETON_INTERCEPTORS_MANAGER);
 		return instance;
 	}
 

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jsf/ConversationManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jsf/ConversationManager.java?rev=728808&r1=728807&r2=728808&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jsf/ConversationManager.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jsf/ConversationManager.java Mon Dec 22 14:13:21 2008
@@ -25,28 +25,24 @@
 import javax.webbeans.manager.Bean;
 
 import org.apache.webbeans.annotation.CurrentLiteral;
+import org.apache.webbeans.config.WebBeansFinder;
 import org.apache.webbeans.container.ManagerImpl;
 import org.apache.webbeans.context.ConversationContext;
 import org.apache.webbeans.util.Asserts;
 
 public class ConversationManager
 {
-	private static ConversationManager manager = null;
-	
 	private Map<Conversation, ConversationContext> conversations = null;
 	
-	private ConversationManager()
+	public ConversationManager()
 	{
 		
 	}
 
 	public static ConversationManager getInstance()
 	{
-		if(manager == null)
-		{
-			manager = new ConversationManager();
-			manager.conversations = new ConcurrentHashMap<Conversation, ConversationContext>();
-		}
+		ConversationManager manager = (ConversationManager)WebBeansFinder.getSingletonInstance(WebBeansFinder.SINGLETON_CONVERSATION_MANAGER);
+		manager.conversations = new ConcurrentHashMap<Conversation, ConversationContext>();
 		
 		return manager;
 	}

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=728808&r1=728807&r2=728808&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 Dec 22 14:13:21 2008
@@ -39,38 +39,47 @@
 import org.apache.webbeans.jsf.ConversationManager;
 import org.apache.webbeans.logger.WebBeansLogger;
 import org.apache.webbeans.util.JNDIUtil;
+import org.apache.webbeans.xml.WebBeansXMLConfigurator;
 
 public final class WebBeansLifeCycle
 {
 	private static WebBeansLogger logger = WebBeansLogger.getLogger(WebBeansLifeCycle.class);
 	
-	private static ScheduledExecutorService service = null;
+	private ScheduledExecutorService service = null;
+	
+	private WebBeansScanner scanner = null;
+	
+	private WebBeansContainerDeployer deployer = null; 
 
-	private WebBeansLifeCycle()
+	private WebBeansXMLConfigurator xmlDeployer = null;
+	
+	public WebBeansLifeCycle()
 	{
-		
+		this.scanner = new WebBeansScanner();
+		this.xmlDeployer = new WebBeansXMLConfigurator();
+		this.deployer = new WebBeansContainerDeployer(xmlDeployer);
 	}
 	
 
-	public static void requestStarted(ServletRequestEvent event)
+	public void requestStarted(ServletRequestEvent event)
 	{
 		logger.info("Initializing of the Request Context with Remote Address : " + event.getServletRequest().getRemoteAddr());
 		ContextFactory.initRequestContext((HttpServletRequest)event.getServletRequest());		
 	}
 	
-	public static void requestEnded(ServletRequestEvent event)
+	public void requestEnded(ServletRequestEvent event)
 	{
 		logger.info("Destroying of the Request Context with Remote Address : " + event.getServletRequest().getRemoteAddr());
 		ContextFactory.destroyRequestContext((HttpServletRequest)event.getServletRequest());		
 	}
 	
-	public static void sessionStarted(HttpSessionEvent event)
+	public void sessionStarted(HttpSessionEvent event)
 	{
 		logger.info("Initializing of the Session Context with session id : " + event.getSession().getId());
 		ContextFactory.initSessionContext(event.getSession());		
 	}
 	
-	public static void sessionEnded(HttpSessionEvent event)
+	public void sessionEnded(HttpSessionEvent event)
 	{
 		logger.info("Destroying of the Session Context with session id : " + event.getSession().getId());
 		ContextFactory.destroySessionContext(event.getSession());	
@@ -79,7 +88,7 @@
 		conversationManager.destroyConversationContextWithSessionId(event.getSession().getId());		
 	}
 	
-	public static void applicationStarted(ServletContextEvent event)
+	public void applicationStarted(ServletContextEvent event)
 	{
 		//I do not know this is the correct way, spec is not so explicit.
 		service = Executors.newScheduledThreadPool(1);
@@ -98,12 +107,15 @@
 		long begin = System.currentTimeMillis();
 		
 		logger.info("Scanning classpaths for WebBeans artifacts is started");
-		WebBeansScanner scanner = WebBeansScanner.getScannerInstance();
+		
 		scanner.scan(event.getServletContext());
+		
 		logger.info("Scanning is ended.");
 		
 		logger.info("Deploying the scanned WebBeans artifacts."); 
-		WebBeansContainerDeployer.deploy();
+		
+		deployer.deploy(this.scanner);
+		
 		logger.info("Deploying is ended.");
 		
 		long end = System.currentTimeMillis();
@@ -134,13 +146,20 @@
 		
 	}
 	
-	public static void applicationEnded(ServletContextEvent event)
+	public void applicationEnded(ServletContextEvent event)
 	{
 		service.shutdownNow();
 		
 		logger.info("Destroying of the Application Context with Context Path : " + event.getServletContext().getContextPath());
 		ContextFactory.destroyApplicationContext(event.getServletContext());
-		JNDIUtil.unbind(WebBeansConstants.WEB_BEANS_MANAGER_JNDI_NAME);		
+				
+		JNDIUtil.unbind(WebBeansConstants.WEB_BEANS_MANAGER_JNDI_NAME);
+		
+		this.deployer = null;
+		this.scanner = null;
+		this.service = null;
+		this.xmlDeployer = null;
+
 	}
 	
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java?rev=728808&r1=728807&r2=728808&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java Mon Dec 22 14:13:21 2008
@@ -34,13 +34,14 @@
  */
 public class WebBeansConfigurationListener implements ServletContextListener,ServletRequestListener,HttpSessionListener
 {
+	private WebBeansLifeCycle lifeCycle = null;
 
 	/**
 	 * Performed when the servlet context destroyed.
 	 */
 	public void contextDestroyed(ServletContextEvent event)
 	{
-		WebBeansLifeCycle.applicationEnded(event);
+		this.lifeCycle.applicationEnded(event);
 	}
 
 	/**
@@ -48,7 +49,8 @@
 	 */
 	public void contextInitialized(ServletContextEvent event)
 	{
-		WebBeansLifeCycle.applicationStarted(event);
+		this.lifeCycle = new WebBeansLifeCycle();
+		this.lifeCycle.applicationStarted(event);
 	}
 
 	/**
@@ -56,7 +58,7 @@
 	 */
 	public void requestDestroyed(ServletRequestEvent event)
 	{
-		WebBeansLifeCycle.requestEnded(event);
+		this.lifeCycle.requestEnded(event);
 	}
 
 	/**
@@ -64,7 +66,7 @@
 	 */
 	public void requestInitialized(ServletRequestEvent event)
 	{
-		WebBeansLifeCycle.requestStarted(event);
+		this.lifeCycle.requestStarted(event);
 	}
 
 	/**
@@ -72,7 +74,7 @@
 	 */
 	public void sessionCreated(HttpSessionEvent event)
 	{
-		WebBeansLifeCycle.sessionStarted(event);
+		this.lifeCycle.sessionStarted(event);
 	}
 
 	/**
@@ -80,7 +82,7 @@
 	 */
 	public void sessionDestroyed(HttpSessionEvent event)
 	{
-		WebBeansLifeCycle.sessionEnded(event);
+		this.lifeCycle.sessionEnded(event);
 	}
 	
 }

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=728808&r1=728807&r2=728808&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 Dec 22 14:13:21 2008
@@ -89,26 +89,23 @@
 public final class WebBeansXMLConfigurator
 {
 	/**Enabled Deploy element check*/
-	private static boolean DEPLOY_IS_DEFINED = false;
+	private boolean DEPLOY_IS_DEFINED = false;
 	
 	/**Enabled Interceptors element check*/
-	private static boolean INTERCEPTORS_IS_DEFINED = false;
+	private boolean INTERCEPTORS_IS_DEFINED = false;
 	
 	/**Enabled Decorators element check*/
-	private static boolean DECORATORS_IS_DEFINED = false;
+	private boolean DECORATORS_IS_DEFINED = false;
 
 	/**Current configuration file name*/
-	private static String CURRENT_SCAN_FILE_NAME = null;
+	private String CURRENT_SCAN_FILE_NAME = null;
 	
 	/**Annotation type manager that manages the XML defined annotations*/
-	private static XMLAnnotationTypeManager xmlAnnotTypeManager = XMLAnnotationTypeManager.getInstance();
+	private XMLAnnotationTypeManager xmlAnnotTypeManager = XMLAnnotationTypeManager.getInstance();
 
-	/**
-	 * Private constructor
-	 */
-	private WebBeansXMLConfigurator()
+	public WebBeansXMLConfigurator()
 	{
-		throw new UnsupportedOperationException();
+		
 	}
 
 	/**
@@ -117,7 +114,7 @@
 	 * @param xmlStream xml file containing the web beans definitions.
 	 * @param fileName name of the configuration file
 	 */
-	public static void configure(InputStream xmlStream, String fileName)
+	public void configure(InputStream xmlStream, String fileName)
 	{
 		Asserts.assertNotNull(xmlStream);
 		Asserts.assertNotNull(fileName);
@@ -134,7 +131,7 @@
 	 * 
 	 * @param webBeansRoot root element of the configuration xml file
 	 */
-	private static void configure(Element webBeansRoot)
+	private  void configure(Element webBeansRoot)
 	{
 		List<Element> webBeanDeclerationList = new ArrayList<Element>();
 		List<Element> childs = webBeansRoot.elements();
@@ -232,7 +229,7 @@
 	 * 
 	 * @param listOfWebBeanDecleration list of element that specifies new webbean decleration 
 	 */
-	private static void configureWebBeansComponents(List<Element> listOfWebBeanDecleration)
+	private  void configureWebBeansComponents(List<Element> listOfWebBeanDecleration)
 	{
 		if(!listOfWebBeanDecleration.isEmpty())
 		{
@@ -259,7 +256,7 @@
 	 * 
 	 * @param bindingTypeElement new binding type element
 	 */
-	private static void addNewBindingType(Element bindingTypeElement)
+	private  void addNewBindingType(Element bindingTypeElement)
 	{
 		Class<?> clazz =XMLUtil.getElementJavaType(bindingTypeElement);
 		if(clazz == null)
@@ -290,7 +287,7 @@
 	 * 
 	 * @param interceptorBindingTypeElement new interceptor binding type element
 	 */
-	private static void addNewInterceptorBindingType(Element interceptorBindingTypeElement)
+	private  void addNewInterceptorBindingType(Element interceptorBindingTypeElement)
 	{
 		Class<?> clazz =XMLUtil.getElementJavaType(interceptorBindingTypeElement);
 		if(clazz == null)
@@ -338,7 +335,7 @@
 	 * 
 	 * @param stereoTypeElement new stereotype annotation element
 	 */
-	private static void addNewStereoTypeType(Element stereoTypeElement)
+	private  void addNewStereoTypeType(Element stereoTypeElement)
 	{
 		Class<?> clazz =XMLUtil.getElementJavaType(stereoTypeElement);
 		if(clazz == null)
@@ -370,7 +367,7 @@
 	 * 
 	 * @param interceptorsElement interceptors element
 	 */
-	private static void configureInterceptorsElement(Element interceptorsElement)
+	private  void configureInterceptorsElement(Element interceptorsElement)
 	{
 		List<Element> childs = interceptorsElement.elements();
 		Iterator<Element> itChilds = childs.iterator();
@@ -409,7 +406,7 @@
 	 * 
 	 * @param decoratorsElement decorators element
 	 */
-	private static void configureDecoratorsElement(Element decoratorsElement)
+	private  void configureDecoratorsElement(Element decoratorsElement)
 	{
 		List<Element> childs = decoratorsElement.elements();
 		Iterator<Element> itChilds = childs.iterator();
@@ -443,7 +440,7 @@
 	 * 
 	 * @param deployElement deploy element
 	 */
-	private static void configureDeploymentTypes(Element deployElement)
+	private  void configureDeploymentTypes(Element deployElement)
 	{
 		List<Element> childs = deployElement.elements();
 		Iterator<Element> itChilds = childs.iterator();
@@ -481,7 +478,7 @@
 	 * 
 	 * @param webBeanElement web beans element
 	 */
-	private static void configureNewWebBeanComponent(Element webBeanElement)
+	private  void configureNewWebBeanComponent(Element webBeanElement)
 	{
 		String ns = XMLUtil.getElementNameSpace(webBeanElement);
 		String packageName = WebBeansNameSpaceContainer.getInstance().getPackageNameFromNameSpace(ns);
@@ -527,7 +524,7 @@
 	 * @param simpleClass concrete java class defined in XML
 	 * @param webBeanDecleration webbeans decleration root element
 	 */
-	public static <T> XMLComponentImpl<T> configureSimpleWebBean(Class<T> simpleClass, Element webBeanDecleration)
+	public  <T> XMLComponentImpl<T> configureSimpleWebBean(Class<T> simpleClass, Element webBeanDecleration)
 	{
 		/*Checking XML defined simple webbeans condition check. Spec : 3.2.4*/
 		XMLDefinitionUtil.checkSimpleWebBeansInXML(simpleClass, webBeanDecleration, createConfigurationFailedMessage());
@@ -580,7 +577,7 @@
 	 * @param component xml webbeans element
 	 * @param webBeanDecleration webbeans element
 	 */
-	private static <T> void configureWebBeanDeclerationChilds(XMLComponentImpl<T> component, Element webBeanDecleration)
+	private  <T> void configureWebBeanDeclerationChilds(XMLComponentImpl<T> component, Element webBeanDecleration)
 	{
 		List<Element> childs = webBeanDecleration.elements();
 		Iterator<Element> it = childs.iterator();
@@ -711,7 +708,7 @@
 	 * @param annotationSet type level annotation set
 	 * @param webBeanDecleration webbeans decleration element
 	 */
-	public static <T> void configureTypeLevelMetaData(XMLComponentImpl<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList, Element webBeanDecleration)
+	public  <T> void configureTypeLevelMetaData(XMLComponentImpl<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList, Element webBeanDecleration)
 	{
 		boolean isInterceptor = false;
 		boolean isDecorator   = false;
@@ -774,7 +771,7 @@
 	 * @param annotationSet type level annotation set
 	 * @param webBeanDecleration webbeans decleration element
 	 */
-	public static <T> void configureProducerTypeLevelMetaData(AbstractComponent<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList, Element webBeanDecleration)
+	public  <T> void configureProducerTypeLevelMetaData(AbstractComponent<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList, Element webBeanDecleration)
 	{
 		//StereoType
 		configureStereoType(component, annotationSet, annotationElementList);
@@ -801,7 +798,7 @@
 	 * @throws DefinitionException if more than one constructor exists
 	 * @throws NonexistentConstructorException if no constructor exists
 	 */
-	private static <T> void configureConstructorMetaData(XMLComponentImpl<T> component, List<Class<?>> typeList, List<Element> constructorParameterListElement)
+	private  <T> void configureConstructorMetaData(XMLComponentImpl<T> component, List<Class<?>> typeList, List<Element> constructorParameterListElement)
 	{
 		Class<T> implClazz = component.getReturnType();
 		Constructor<T> cons[] = ClassUtil.getConstructors(implClazz);
@@ -877,7 +874,7 @@
 	 * @param component xml webbeans component
 	 * @param child field or method child element
 	 */
-	private static <T> void configureFieldOrMethodMetaData(XMLComponentImpl<T> component, Element child)
+	private  <T> void configureFieldOrMethodMetaData(XMLComponentImpl<T> component, Element child)
 	{
 		if (XMLUtil.isElementField(child))
 		{
@@ -902,7 +899,7 @@
 	 * @throws DefinitionException if contains more than one &lt;valuegt; element childs
 	 * 
 	 */
-	private static <T> void configureField(XMLComponentImpl<T> component, Element child)
+	private  <T> void configureField(XMLComponentImpl<T> component, Element child)
 	{
 		Class<?> clazz = component.getReturnType();
 
@@ -997,7 +994,7 @@
 	 * @throws NonexistentTypeException if method parameter types can not found
 	 * @throws DefinitionException if any other configuration related exception occurs.
 	 */
-	private static <T> void configureMethod(XMLComponentImpl<T> component, Element child)
+	private  <T> void configureMethod(XMLComponentImpl<T> component, Element child)
 	{
 		if (!ClassUtil.isMethodExistWithName(component.getReturnType(), XMLUtil.getName(child)))
 		{
@@ -1140,7 +1137,7 @@
 	 * @param annotChild element child
 	 * @param type type of the configuration method
 	 */
-	private static <T> void configureMethodAnnotationType(XMLComponentImpl<T> component, Method annotatedMethod, Element annotChild, int type, List<Element> methodParameterElements)
+	private  <T> void configureMethodAnnotationType(XMLComponentImpl<T> component, Method annotatedMethod, Element annotChild, int type, List<Element> methodParameterElements)
 	{
 		switch (type)
 		{
@@ -1178,7 +1175,7 @@
 	 * @param initializeMethod initialize method of the webbeans component
 	 * @param annotChild element child
 	 */
-	private static <T> void configureMethodInitializeAnnotation(XMLComponentImpl<T> component, Method initializeMethod, List<Element> methodParameterElements)
+	private  <T> void configureMethodInitializeAnnotation(XMLComponentImpl<T> component, Method initializeMethod, List<Element> methodParameterElements)
 	{
 		for(Element element : methodParameterElements)
 		{
@@ -1187,29 +1184,29 @@
 		}
 	}
 	
-	private static <T> void configureMethodDestructorAnnotation(XMLComponentImpl<T> component, Method destructorMethod, Element annotChild)
+	private  <T> void configureMethodDestructorAnnotation(XMLComponentImpl<T> component, Method destructorMethod, Element annotChild)
 	{
 		//TODO for EJB Stateful Session Bean
 	}
 
-	private static <T> void configureMethodProducesAnnotation(XMLComponentImpl<T> component, Method producesMethod,  Element annotChild)
+	private  <T> void configureMethodProducesAnnotation(XMLComponentImpl<T> component, Method producesMethod,  Element annotChild)
 	{
-		XMLProducerComponentImpl<T> producer = XMLDefinitionUtil.defineXMLProducerMethod(component, producesMethod, annotChild, createConfigurationFailedMessage());
+		XMLProducerComponentImpl<T> producer = XMLDefinitionUtil.defineXMLProducerMethod(this,component, producesMethod, annotChild, createConfigurationFailedMessage());
 		ManagerImpl.getManager().addBean(producer);
 	}
 
-	private static <T> void configureMethodDisposesAnnotation(XMLComponentImpl<T> component, Method disposalMethod, Element annotChild)
+	private  <T> void configureMethodDisposesAnnotation(XMLComponentImpl<T> component, Method disposalMethod, Element annotChild)
 	{
 		XMLDefinitionUtil.defineXMLDisposalMethod(component, disposalMethod, annotChild, createConfigurationFailedMessage());
 		
 	}
 
-	private static <T> void configureMethodObservesAnnotation(XMLComponentImpl<T> component, Method observesMethod, Element annotChild)
+	private  <T> void configureMethodObservesAnnotation(XMLComponentImpl<T> component, Method observesMethod, Element annotChild)
 	{
 		XMLDefinitionUtil.defineXMLObservesMethod(component, observesMethod, annotChild, createConfigurationFailedMessage());
 	}
 	
-	private static <T> void configureMethodInterceptorBindingTypeAnnotation(XMLComponentImpl<T> component, Method interceptorMethod, Element annotChild)
+	private  <T> void configureMethodInterceptorBindingTypeAnnotation(XMLComponentImpl<T> component, Method interceptorMethod, Element annotChild)
 	{
 		XMLDefinitionUtil.defineXMLMethodLevelInterceptorType(component, interceptorMethod, annotChild, createConfigurationFailedMessage());
 	}
@@ -1225,7 +1222,7 @@
 	 * @throws NonexistentMethodException if no method is exist with given name and method parameter types
 	 * @throws DefinitionException if more than one method satisfies the conditions 
 	 */
-	private static <T> Method checkConfigureMethodConditions(XMLComponentImpl<T> component, Element child, List<Class<?>> methodParameters)
+	private  <T> Method checkConfigureMethodConditions(XMLComponentImpl<T> component, Element child, List<Class<?>> methodParameters)
 	{
 		//Check with name and also parameter types
 		List<Method> definedMethods = ClassUtil.getClassMethodsWithTypes(component.getReturnType(), XMLUtil.getName(child), methodParameters);
@@ -1252,7 +1249,7 @@
 	 * 
 	 * @throws DefinitionException if disposes element can not contain exactly one child element 
 	 */
-	private static <T> void checkConfigureDisposes(AbstractComponent<T> component, Element disposes)
+	private  <T> void checkConfigureDisposes(AbstractComponent<T> component, Element disposes)
 	{
 		List<Element> disposesChilds = disposes.elements();
 
@@ -1273,7 +1270,7 @@
 	 * 		   it is not one of the {IfExists, AfterTransactionCompletion, AfterTransactionSuccess, 
 	 * 		   AfterTransactionFailure, BeforeTransactionCompletion} element.
 	 */
-	private static <T> void checkConfigureObserves(AbstractComponent<T> component, Element observes)
+	private  <T> void checkConfigureObserves(AbstractComponent<T> component, Element observes)
 	{
 		List<Element> observesChilds = observes.elements();
 
@@ -1299,7 +1296,7 @@
 	 * @param component xml defined web beans component
 	 * @param annotationSet all annotation defined in XML
 	 */
-	private static <T> void configureDeploymentType(AbstractComponent<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList)
+	private  <T> void configureDeploymentType(AbstractComponent<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList)
 	{
 		Class<? extends Annotation> deploymentType = XMLDefinitionUtil.defineXMLTypeMetaData(component, annotationSet, DeploymentType.class ,createConfigurationFailedMessage() + "@DeploymentType annotation is not configured correctly for class : " + component.getReturnType().getName());
 
@@ -1323,7 +1320,7 @@
 	 * @param component xml defined web beans component
 	 * @param annotationSet all annotation defined in XML
 	 */
-	private static <T> void configureScopeType(AbstractComponent<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList)
+	private  <T> void configureScopeType(AbstractComponent<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList)
 	{
 		Class<? extends Annotation> scopeType = XMLDefinitionUtil.defineXMLTypeMetaData(component, annotationSet, ScopeType.class ,createConfigurationFailedMessage() + "@ScopeType annotation is not configured correctly");
 		
@@ -1345,7 +1342,7 @@
 	 * @param component web beans xml component
 	 * @param anns annotations defined in the xml documents
 	 */
-	private static <T> void configureBindingType(XMLComponentImpl<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList)
+	private  <T> void configureBindingType(XMLComponentImpl<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList)
 	{
 		boolean isDefined = XMLDefinitionUtil.defineXMLBindingType(component, annotationSet, annotationElementList, createConfigurationFailedMessage());
 		
@@ -1362,7 +1359,7 @@
 	 * @param component web beans xml component
 	 * @param anns annotations defined in the xml documents
 	 */
-	private static <T> void configureInterceptorBindingType(XMLComponentImpl<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList)
+	private  <T> void configureInterceptorBindingType(XMLComponentImpl<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList)
 	{
 		XMLDefinitionUtil.defineXMLClassLevelInterceptorType(component, annotationSet, annotationElementList, createConfigurationFailedMessage());
 	}
@@ -1373,7 +1370,7 @@
 	 * @param component webbeans component
 	 * @param annotationSet type-level metadata annotation set
 	 */
-	private static <T> void configureStereoType(AbstractComponent<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList)
+	private  <T> void configureStereoType(AbstractComponent<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList)
 	{
 		XMLDefinitionUtil.defineXMLStereoType(component, annotationSet);
 	}
@@ -1385,7 +1382,7 @@
 	 * @param annotationSet type-level metadata annotation set
 	 * @param webBeanDecleration webbeans decleration element
 	 */
-	private static <T> void configureNamed(AbstractComponent<T> component, List<Class<? extends Annotation>> annotationSet, Element webBeanDecleration)
+	private  <T> void configureNamed(AbstractComponent<T> component, List<Class<? extends Annotation>> annotationSet, Element webBeanDecleration)
 	{
 		boolean isDefined = XMLDefinitionUtil.defineXMLName(component, annotationSet);
 		if(isDefined)
@@ -1414,7 +1411,7 @@
 	 * @param component webbeans component
 	 * @param annotationSet type-level metadata annotation set
 	 */
-	private static <T> void configureSpecializes(XMLComponentImpl<T> component, List<Class<? extends Annotation>> annotationSet)
+	private  <T> void configureSpecializes(XMLComponentImpl<T> component, List<Class<? extends Annotation>> annotationSet)
 	{
 		XMLDefinitionUtil.defineXMLSpecializes(component, annotationSet);
 	}
@@ -1425,7 +1422,7 @@
 	 * @param component webbeans component
 	 * @param annotationSet type-level metadata annotation set
 	 */
-	private static <T> void configureInterceptor(XMLComponentImpl<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList)
+	private  <T> void configureInterceptor(XMLComponentImpl<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList)
 	{
 		XMLDefinitionUtil.defineXMLInterceptors(component, annotationSet, annotationElementList, createConfigurationFailedMessage());
 
@@ -1437,7 +1434,7 @@
 	 * @param component webbeans component
 	 * @param annotationSet type-level metadata annotation set
 	 */
-	private static <T> void configureDecorator(XMLComponentImpl<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList, Element webBeanDecleration)
+	private  <T> void configureDecorator(XMLComponentImpl<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList, Element webBeanDecleration)
 	{
 		XMLDefinitionUtil.defineXMLDecorators(component, annotationSet, webBeanDecleration, createConfigurationFailedMessage());
 	}
@@ -1448,7 +1445,7 @@
 	 * @param ejbClass
 	 *            ejb class
 	 */
-	private static void configureEJBWebBean(Class<?> ejbClass)
+	private  void configureEJBWebBean(Class<?> ejbClass)
 	{
 		// TODO EJB Decleration
 	}
@@ -1459,7 +1456,7 @@
 	 * @param webBeanElement
 	 *            element
 	 */
-	private static void configureJMSEndpointComponent(Element webBeanElement)
+	private  void configureJMSEndpointComponent(Element webBeanElement)
 	{
 		// TODO JMS Endpoint
 	}
@@ -1472,7 +1469,7 @@
 	 * @param child child element that declares field
 	 * @param isValueElement is it applicable for value setting
 	 */
-	private static <T> void configureFieldValues(XMLComponentImpl<T> component, Field field, Element child, boolean isValueElement)
+	private  <T> void configureFieldValues(XMLComponentImpl<T> component, Field field, Element child, boolean isValueElement)
 	{
 		if (isValueElement)
 		{
@@ -1587,7 +1584,7 @@
 	 * @param child list field xml element
 	 * @param errorMessage error message
 	 */
-	private static void configureFieldListValue(XMLComponentImpl<?> component, Field field, Element child, String errorMessage)
+	private  void configureFieldListValue(XMLComponentImpl<?> component, Field field, Element child, String errorMessage)
 	{
 		boolean isString = false;
 		boolean isEnum = false;
@@ -1679,7 +1676,7 @@
 	 * @param child list field xml element
 	 * @param errorMessage error message
 	 */	
-	private static void configureFieldSetValue(XMLComponentImpl<?> component, Field field, Element child, String errorMessage)
+	private  void configureFieldSetValue(XMLComponentImpl<?> component, Field field, Element child, String errorMessage)
 	{
 		boolean isString = false;
 		boolean isEnum = false;
@@ -1768,7 +1765,7 @@
 	 * 
 	 * @return the error messages
 	 */
-	private static String createConfigurationFailedMessage()
+	private  String createConfigurationFailedMessage()
 	{
 		return "WebBeans XML configuration defined in " + CURRENT_SCAN_FILE_NAME + " is failed. Reason is : ";
 	}

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java?rev=728808&r1=728807&r2=728808&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java Mon Dec 22 14:13:21 2008
@@ -24,6 +24,7 @@
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CopyOnWriteArraySet;
 
+import org.apache.webbeans.config.WebBeansFinder;
 import org.apache.webbeans.deployment.StereoTypeManager;
 import org.apache.webbeans.deployment.XMLStereoTypeModel;
 import org.apache.webbeans.util.WebBeansUtil;
@@ -32,26 +33,20 @@
 
 public class XMLAnnotationTypeManager
 {
-	private static XMLAnnotationTypeManager manager = null;
-	
 	private Set<Class<? extends Annotation>> xmlBindingTypes = new CopyOnWriteArraySet<Class<? extends Annotation>>();
 	
 	private Map<Class<? extends Annotation>, Set<Annotation>> xmlInterceptorBindingTypes = new ConcurrentHashMap<Class<? extends Annotation>, Set<Annotation>>();
 	
 	private Set<Class<? extends Annotation>> xmlStereoTypes = new CopyOnWriteArraySet<Class<? extends Annotation>>();
 	
-	private XMLAnnotationTypeManager()
+	public XMLAnnotationTypeManager()
 	{
 		
 	}
 	
 	public static XMLAnnotationTypeManager getInstance()
 	{
-		if(manager == null)
-		{
-			manager = new XMLAnnotationTypeManager();
-		}
-		
+		XMLAnnotationTypeManager manager = (XMLAnnotationTypeManager)WebBeansFinder.getSingletonInstance(WebBeansFinder.SINGLETON_XML_ANNOTATION_TYPE_MANAGER);
 		return manager;
 	}
 	

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java?rev=728808&r1=728807&r2=728808&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java Mon Dec 22 14:13:21 2008
@@ -457,7 +457,7 @@
 	 * 
 	 * @see XMLProducerComponentImpl
 	 */
-	public static <T> XMLProducerComponentImpl<T> defineXMLProducerMethod(XMLComponentImpl<T> component, Method producesMethod, Element producerMethodElement, String errorMessage)
+	public static <T> XMLProducerComponentImpl<T> defineXMLProducerMethod(WebBeansXMLConfigurator configurator,XMLComponentImpl<T> component, Method producesMethod, Element producerMethodElement, String errorMessage)
 	{
 		boolean producesDefined = false;
 		List<Element> childElements = producerMethodElement.elements();
@@ -541,7 +541,7 @@
 		XMLProducerComponentImpl<T> producerComponentImpl = configureProduerMethod(component, producesMethod, injectedParameters, 
 				type, arrayElement, typeElement, errorMessage);
 		
-		configureProducerTypeLevelMetaData(producerComponentImpl, producesMethod, producerMethodElement, memberLevelMetaData, memberLevelElement, component, errorMessage);
+		configureProducerTypeLevelMetaData(configurator,producerComponentImpl, producesMethod, producerMethodElement, memberLevelMetaData, memberLevelElement, component, errorMessage);
 
 		
 		return producerComponentImpl;
@@ -614,7 +614,7 @@
 	 * 
 	 * @see XMLProducerComponentImpl
 	 */
-	private static <T> XMLProducerComponentImpl<T> configureProducerTypeLevelMetaData(XMLProducerComponentImpl<T> producerComponentImpl, Method producesMethod, Element producerMethodElement,List<Class<? extends Annotation>> memberLevelMetaData,List<Element> memberLevelElement ,XMLComponentImpl<T> component,String errorMessage)
+	private static <T> XMLProducerComponentImpl<T> configureProducerTypeLevelMetaData(WebBeansXMLConfigurator configurator,XMLProducerComponentImpl<T> producerComponentImpl, Method producesMethod, Element producerMethodElement,List<Class<? extends Annotation>> memberLevelMetaData,List<Element> memberLevelElement ,XMLComponentImpl<T> component,String errorMessage)
 	{
 		
 		for(Class<? extends Annotation> memberLevelMetaDataClass : memberLevelMetaData)
@@ -629,7 +629,7 @@
 			}
 		}
 		
-		WebBeansXMLConfigurator.configureProducerTypeLevelMetaData(producerComponentImpl, memberLevelMetaData, memberLevelElement, producerMethodElement);
+		configurator.configureProducerTypeLevelMetaData(producerComponentImpl, memberLevelMetaData, memberLevelElement, producerMethodElement);
 		
 		return producerComponentImpl;
 	}

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLSpecializesManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLSpecializesManager.java?rev=728808&r1=728807&r2=728808&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLSpecializesManager.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLSpecializesManager.java Mon Dec 22 14:13:21 2008
@@ -20,16 +20,14 @@
 import java.util.Set;
 import java.util.concurrent.CopyOnWriteArraySet;
 
+import org.apache.webbeans.config.WebBeansFinder;
 import org.apache.webbeans.util.Asserts;
 
 public class XMLSpecializesManager
 {
-
-	private static XMLSpecializesManager instance = null;
-	
 	private Set<Class<?>> specializeClasses = new CopyOnWriteArraySet<Class<?>>();
 	
-	private XMLSpecializesManager()
+	public XMLSpecializesManager()
 	{
 		
 	}
@@ -37,11 +35,7 @@
 	
 	public static XMLSpecializesManager getInstance()
 	{
-		if(instance == null)
-		{
-			instance = new XMLSpecializesManager();
-		}
-		
+		XMLSpecializesManager instance = (XMLSpecializesManager)WebBeansFinder.getSingletonInstance(WebBeansFinder.SINGLETON_XML_SPECIALIZES_MANAGER);
 		return instance;
 	}
 	



Mime
View raw message