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/01/08 20:41:33 UTC

svn commit: r732803 [7/17] - in /incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: ./ annotation/ component/ component/ejb/ component/jms/ component/xml/ config/ container/ context/ context/type/ decorator/ decorator/xml/ de...

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=732803&r1=732802&r2=732803&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 Thu Jan  8 11:41:30 2009
@@ -1,18 +1,15 @@
 /*
- *  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.
+ * 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.event;
 
@@ -44,297 +41,286 @@
 @SuppressWarnings("unchecked")
 public final class NotificationManager implements Synchronization
 {
-	private static final WebBeansLogger logger = WebBeansLogger.getLogger(NotificationManager.class);
-	
-	private Map<Class<?>, Set<ObserverImpl<?>>> observers = new ConcurrentHashMap<Class<?>, Set<ObserverImpl<?>>>();
-		
-	private Set<TransactionalNotifier> transactionSet = new CopyOnWriteArraySet<TransactionalNotifier>();
-	
-	public NotificationManager()
-	{
-		
-	}
-	
-	@SuppressWarnings("unchecked")
-	public static NotificationManager getInstance()
-	{
-		NotificationManager instance = (NotificationManager)WebBeansFinder.getSingletonInstance(WebBeansFinder.SINGLETON_NOTIFICATION_MANAGER);
-		return instance;
-	}
-	
-	public <T> void  addObserver(Observer<T> observer, Class<T> eventType, Annotation...annotations)
-	{
-		addObserver(observer, false, TransactionalObserverType.NONE, eventType, annotations);
-	}
-	
-	public <T> void  addObserver(Observer<T> observer, boolean ifExist, TransactionalObserverType type, Class<T> eventType, Annotation...annotations)
-	{
-		EventUtil.checkEventType(eventType);
-		EventUtil.checkEventBindings(annotations);
-		
-		ObserverImpl<T> observerImpl = new ObserverImpl<T>(observer, ifExist, type, eventType, annotations);
-		
-		Set<ObserverImpl<?>> set = observers.get(eventType);
-		if(set == null)
-		{
-			set = new HashSet<ObserverImpl<?>>();
-			observers.put(eventType, set);
-		}
-			
-		set.add(observerImpl);
-	}
-	
-	
-	public <T>  void  addObserver(Observer<T> observer, TypeLiteral<T> eventType, Annotation...annotations)
-	{
-		EventUtil.checkEventType(eventType.getRawType());
-		EventUtil.checkEventBindings(annotations);
-		
-		ObserverImpl<T> observerImpl = new ObserverImpl<T>(observer, eventType.getRawType(), annotations);
-		
-		Set<ObserverImpl<?>> set = observers.get(eventType);
-		if(set == null)
-		{
-			set = new HashSet<ObserverImpl<?>>();
-			observers.put(eventType.getRawType(), set);
-		}
-			
-		
-		set.add(observerImpl);
-	}
-	
-
-	public <T> void removeObserver(Observer<T> observer, Class<T> eventType, Annotation...annotations)
-	{
-		EventUtil.checkEventType(eventType);
-		EventUtil.checkEventBindings(annotations);
-		
-		if(observers.containsKey(eventType))
-		{
-			Set<ObserverImpl<?>> set = observers.get(eventType);
-			Iterator<ObserverImpl<?>> it = set.iterator();
-			while(it.hasNext())
-			{
-				ObserverImpl<?> s = it.next();
-				Observer<T> ob = (Observer<T>)s.getObserver();
-				
-				if(ob.equals(observer))
-				{
-					set.remove(s);
-				}
-			}
-		}
-	}
-	
-	public <T> void removeObserver(Observer<T> observer, TypeLiteral<T> eventType, Annotation...annotations)
-	{
-		EventUtil.checkEventType(eventType.getRawType());
-		EventUtil.checkEventBindings(annotations);
-		
-		if(observers.containsKey(eventType))
-		{
-			Set<ObserverImpl<?>> set = observers.get(eventType.getRawType());
-			Iterator<ObserverImpl<?>> it = set.iterator();
-			while(it.hasNext())
-			{
-				ObserverImpl<?> s = it.next();
-				Observer<T> ob = (Observer<T>)s.getObserver();
-				
-				if(ob.equals(observer))
-				{
-					set.remove(s);
-				}
-			}
-		}
-	}
-	
-	public <T> Set<Observer<T>> resolveObservers(T event, Annotation... bindings)
-	{
-		
-		Set<ObserverImpl<?>> resolvedSet = new HashSet<ObserverImpl<?>>();
-		Set<Observer<T>> unres = new HashSet<Observer<T>>();
-		
-		@SuppressWarnings("unchecked")Class<T> eventType = (Class<T>)event.getClass();
-		
-		EventUtil.checkEventType(eventType);
-		EventUtil.checkEventBindings(bindings);
-		
-		Set<Class<?>> keySet = this.observers.keySet();
-		Iterator<Class<?>> itKeySet = keySet.iterator();
-		
-		while(itKeySet.hasNext())
-		{
-			Class<?> type = itKeySet.next();
-			if(type.isAssignableFrom(eventType))
-			{
-				resolvedSet.addAll(this.observers.get(type));
-			}
-		}
-		
-		
-		Iterator<ObserverImpl<?>> it = resolvedSet.iterator();
-		while(it.hasNext())
-		{
-			@SuppressWarnings("unchecked")
-			ObserverImpl<T> impl = (ObserverImpl<T>)it.next();
-			
-			if(impl.isObserverOfBindings(bindings))
-			{
-				unres.add(impl.getObserver());	
-			}
-		}
-		
-		return unres;		
-	}	
-	
-	public void fireEvent(Object event, Annotation... bindings)
-	{
-		Set<Observer<Object>> observers = resolveObservers(event, bindings);
-		Iterator<Observer<Object>> it = observers.iterator();
-		
-		TransactionalNotifier transNotifier = null;
-		while(it.hasNext())
-		{
-			Observer<Object> observer =  it.next();
-			try
-			{
-				if(observer instanceof BeanObserverImpl)
-				{
-					BeanObserverImpl<Object> beanObserver = (BeanObserverImpl<Object>)observer;
-					TransactionalObserverType type = beanObserver.getType();
-					if(!type.equals(TransactionalObserverType.NONE))
-					{
-						Transaction transaction = TransactionUtil.getCurrentTransactionManager().getTransaction();
-						if(transaction != null)
-						{
-							transaction.registerSynchronization(this);
-							if(transNotifier == null)
-							{
-								transNotifier = new TransactionalNotifier(event);
-								this.transactionSet.add(transNotifier);
-							}
-							
-							//Register for transaction
-							if(type.equals(TransactionalObserverType.AFTER_TRANSACTION_COMPLETION))
-							{
-								transNotifier.addAfterCompletionObserver(observer);
-							}
-							else if(type.equals(TransactionalObserverType.AFTER_TRANSACTION_SUCCESS))
-							{
-								transNotifier.addAfterCompletionSuccessObserver(observer);
-							}
-							else if(type.equals(TransactionalObserverType.AFTER_TRANSACTION_FAILURE))
-							{
-								transNotifier.addAfterCompletionFailureObserver(observer);
-							}
-							else if(type.equals(TransactionalObserverType.BEFORE_TRANSACTION_COMPLETION))
-							{
-								transNotifier.addBeforeCompletionObserver(observer);
-							}
-						}
-						else
-						{
-							observer.notify(event);
-						}
-					}
-					else
-					{
-						observer.notify(event);
-					}
-				}
-				else
-				{
-					observer.notify(event);
-				}
-				
-			}catch(Throwable e)
-			{
-				if(Exception.class.isAssignableFrom(e.getClass()))
-				{
-					throw new ObserverException("Exception is thrown while handling event object with type : " + event.getClass().getName(),e);
-				}
-			}
-		}		
-	}
-	
-	public <T> void addObservableComponentMethods(ObservesMethodsOwner<?> component)
-	{
-		Asserts.assertNotNull(component, "component parameter can not be null");
-		Set<Method> observableMethods = component.getObservableMethods();
-		Iterator<Method> itMethods = observableMethods.iterator();
-		
-		while(itMethods.hasNext())
-		{
-			Method observableMethod = itMethods.next();
-			Annotation[] bindingTypes = AnnotationUtil.getMethodFirstParameterBindingTypesWithGivenAnnotation(observableMethod, Observes.class);
-			
-			boolean ifExist = false;
-			
-			if(AnnotationUtil.isMethodParameterAnnotationExist(observableMethod, IfExists.class))
-			{
-				ifExist = true;
-			}
-			
-			TransactionalObserverType type = EventUtil.getObserverMethodTransactionType(observableMethod);
-			
-			BeanObserverImpl<T> observer = new BeanObserverImpl(component, observableMethod, ifExist, type);
-
-			Class<T> clazz = (Class<T>)AnnotationUtil.getMethodFirstParameterTypeClazzWithAnnotation(observableMethod, Observes.class);
-						
-			addObserver(observer, ifExist, type , clazz, bindingTypes);			
-		}
-		
-	}
-	
-
-	public void afterCompletion(int status)
-	{
-		try
-		{
-			Iterator<TransactionalNotifier> it = this.transactionSet.iterator();
-			
-			while(it.hasNext())
-			{
-				TransactionalNotifier notifier = it.next();				
-
-				notifier.notifyAfterCompletion();
-
-				if(status == Status.STATUS_COMMITTED)
-				{
-					notifier.notifyAfterCompletionSuccess();
-
-				}
-				else if(status == Status.STATUS_ROLLEDBACK)
-				{
-					notifier.notifyAfterCompletionFailure();
-				}
-					
-			}			
-				
-		}catch(Throwable e)
-		{
-			logger.error("Exception is occured in the transational observer ",e);
-		}finally
-		{
-			this.transactionSet.clear();
-		}
-	}
-	
-	public void beforeCompletion()
-	{
-		//Call @BeforeTransactionCompletion		
-		try
-		{
-			Iterator<TransactionalNotifier> it = this.transactionSet.iterator();
-			while(it.hasNext())
-			{
-				TransactionalNotifier notifier = it.next();
-				notifier.notifyBeforeCompletion();
-			}
-			
-		}catch(Throwable e)
-		{
-			logger.error("Exception is occured in the transational observer ",e);
-		}
-	}	 
+    private static final WebBeansLogger logger = WebBeansLogger.getLogger(NotificationManager.class);
+
+    private Map<Class<?>, Set<ObserverImpl<?>>> observers = new ConcurrentHashMap<Class<?>, Set<ObserverImpl<?>>>();
+
+    private Set<TransactionalNotifier> transactionSet = new CopyOnWriteArraySet<TransactionalNotifier>();
+
+    public NotificationManager()
+    {
+
+    }
+
+    @SuppressWarnings("unchecked")
+    public static NotificationManager getInstance()
+    {
+        NotificationManager instance = (NotificationManager) WebBeansFinder.getSingletonInstance(WebBeansFinder.SINGLETON_NOTIFICATION_MANAGER);
+        return instance;
+    }
+
+    public <T> void addObserver(Observer<T> observer, Class<T> eventType, Annotation... annotations)
+    {
+        addObserver(observer, false, TransactionalObserverType.NONE, eventType, annotations);
+    }
+
+    public <T> void addObserver(Observer<T> observer, boolean ifExist, TransactionalObserverType type, Class<T> eventType, Annotation... annotations)
+    {
+        EventUtil.checkEventType(eventType);
+        EventUtil.checkEventBindings(annotations);
+
+        ObserverImpl<T> observerImpl = new ObserverImpl<T>(observer, ifExist, type, eventType, annotations);
+
+        Set<ObserverImpl<?>> set = observers.get(eventType);
+        if (set == null)
+        {
+            set = new HashSet<ObserverImpl<?>>();
+            observers.put(eventType, set);
+        }
+
+        set.add(observerImpl);
+    }
+
+    public <T> void addObserver(Observer<T> observer, TypeLiteral<T> eventType, Annotation... annotations)
+    {
+        EventUtil.checkEventType(eventType.getRawType());
+        EventUtil.checkEventBindings(annotations);
+
+        ObserverImpl<T> observerImpl = new ObserverImpl<T>(observer, eventType.getRawType(), annotations);
+
+        Set<ObserverImpl<?>> set = observers.get(eventType);
+        if (set == null)
+        {
+            set = new HashSet<ObserverImpl<?>>();
+            observers.put(eventType.getRawType(), set);
+        }
+
+        set.add(observerImpl);
+    }
+
+    public <T> void removeObserver(Observer<T> observer, Class<T> eventType, Annotation... annotations)
+    {
+        EventUtil.checkEventType(eventType);
+        EventUtil.checkEventBindings(annotations);
+
+        if (observers.containsKey(eventType))
+        {
+            Set<ObserverImpl<?>> set = observers.get(eventType);
+            Iterator<ObserverImpl<?>> it = set.iterator();
+            while (it.hasNext())
+            {
+                ObserverImpl<?> s = it.next();
+                Observer<T> ob = (Observer<T>) s.getObserver();
+
+                if (ob.equals(observer))
+                {
+                    set.remove(s);
+                }
+            }
+        }
+    }
+
+    public <T> void removeObserver(Observer<T> observer, TypeLiteral<T> eventType, Annotation... annotations)
+    {
+        EventUtil.checkEventType(eventType.getRawType());
+        EventUtil.checkEventBindings(annotations);
+
+        if (observers.containsKey(eventType))
+        {
+            Set<ObserverImpl<?>> set = observers.get(eventType.getRawType());
+            Iterator<ObserverImpl<?>> it = set.iterator();
+            while (it.hasNext())
+            {
+                ObserverImpl<?> s = it.next();
+                Observer<T> ob = (Observer<T>) s.getObserver();
+
+                if (ob.equals(observer))
+                {
+                    set.remove(s);
+                }
+            }
+        }
+    }
+
+    public <T> Set<Observer<T>> resolveObservers(T event, Annotation... bindings)
+    {
+
+        Set<ObserverImpl<?>> resolvedSet = new HashSet<ObserverImpl<?>>();
+        Set<Observer<T>> unres = new HashSet<Observer<T>>();
+
+        @SuppressWarnings("unchecked")
+        Class<T> eventType = (Class<T>) event.getClass();
+
+        EventUtil.checkEventType(eventType);
+        EventUtil.checkEventBindings(bindings);
+
+        Set<Class<?>> keySet = this.observers.keySet();
+        Iterator<Class<?>> itKeySet = keySet.iterator();
+
+        while (itKeySet.hasNext())
+        {
+            Class<?> type = itKeySet.next();
+            if (type.isAssignableFrom(eventType))
+            {
+                resolvedSet.addAll(this.observers.get(type));
+            }
+        }
+
+        Iterator<ObserverImpl<?>> it = resolvedSet.iterator();
+        while (it.hasNext())
+        {
+            @SuppressWarnings("unchecked")
+            ObserverImpl<T> impl = (ObserverImpl<T>) it.next();
+
+            if (impl.isObserverOfBindings(bindings))
+            {
+                unres.add(impl.getObserver());
+            }
+        }
+
+        return unres;
+    }
+
+    public void fireEvent(Object event, Annotation... bindings)
+    {
+        Set<Observer<Object>> observers = resolveObservers(event, bindings);
+        Iterator<Observer<Object>> it = observers.iterator();
+
+        TransactionalNotifier transNotifier = null;
+        while (it.hasNext())
+        {
+            Observer<Object> observer = it.next();
+            try
+            {
+                if (observer instanceof BeanObserverImpl)
+                {
+                    BeanObserverImpl<Object> beanObserver = (BeanObserverImpl<Object>) observer;
+                    TransactionalObserverType type = beanObserver.getType();
+                    if (!type.equals(TransactionalObserverType.NONE))
+                    {
+                        Transaction transaction = TransactionUtil.getCurrentTransactionManager().getTransaction();
+                        if (transaction != null)
+                        {
+                            transaction.registerSynchronization(this);
+                            if (transNotifier == null)
+                            {
+                                transNotifier = new TransactionalNotifier(event);
+                                this.transactionSet.add(transNotifier);
+                            }
+
+                            // Register for transaction
+                            if (type.equals(TransactionalObserverType.AFTER_TRANSACTION_COMPLETION))
+                            {
+                                transNotifier.addAfterCompletionObserver(observer);
+                            } else if (type.equals(TransactionalObserverType.AFTER_TRANSACTION_SUCCESS))
+                            {
+                                transNotifier.addAfterCompletionSuccessObserver(observer);
+                            } else if (type.equals(TransactionalObserverType.AFTER_TRANSACTION_FAILURE))
+                            {
+                                transNotifier.addAfterCompletionFailureObserver(observer);
+                            } else if (type.equals(TransactionalObserverType.BEFORE_TRANSACTION_COMPLETION))
+                            {
+                                transNotifier.addBeforeCompletionObserver(observer);
+                            }
+                        } else
+                        {
+                            observer.notify(event);
+                        }
+                    } else
+                    {
+                        observer.notify(event);
+                    }
+                } else
+                {
+                    observer.notify(event);
+                }
+
+            } catch (Throwable e)
+            {
+                if (Exception.class.isAssignableFrom(e.getClass()))
+                {
+                    throw new ObserverException("Exception is thrown while handling event object with type : " + event.getClass().getName(), e);
+                }
+            }
+        }
+    }
+
+    public <T> void addObservableComponentMethods(ObservesMethodsOwner<?> component)
+    {
+        Asserts.assertNotNull(component, "component parameter can not be null");
+        Set<Method> observableMethods = component.getObservableMethods();
+        Iterator<Method> itMethods = observableMethods.iterator();
+
+        while (itMethods.hasNext())
+        {
+            Method observableMethod = itMethods.next();
+            Annotation[] bindingTypes = AnnotationUtil.getMethodFirstParameterBindingTypesWithGivenAnnotation(observableMethod, Observes.class);
+
+            boolean ifExist = false;
+
+            if (AnnotationUtil.isMethodParameterAnnotationExist(observableMethod, IfExists.class))
+            {
+                ifExist = true;
+            }
+
+            TransactionalObserverType type = EventUtil.getObserverMethodTransactionType(observableMethod);
+
+            BeanObserverImpl<T> observer = new BeanObserverImpl(component, observableMethod, ifExist, type);
+
+            Class<T> clazz = (Class<T>) AnnotationUtil.getMethodFirstParameterTypeClazzWithAnnotation(observableMethod, Observes.class);
+
+            addObserver(observer, ifExist, type, clazz, bindingTypes);
+        }
+
+    }
+
+    public void afterCompletion(int status)
+    {
+        try
+        {
+            Iterator<TransactionalNotifier> it = this.transactionSet.iterator();
+
+            while (it.hasNext())
+            {
+                TransactionalNotifier notifier = it.next();
+
+                notifier.notifyAfterCompletion();
+
+                if (status == Status.STATUS_COMMITTED)
+                {
+                    notifier.notifyAfterCompletionSuccess();
+
+                } else if (status == Status.STATUS_ROLLEDBACK)
+                {
+                    notifier.notifyAfterCompletionFailure();
+                }
+
+            }
+
+        } catch (Throwable e)
+        {
+            logger.error("Exception is occured in the transational observer ", e);
+        } finally
+        {
+            this.transactionSet.clear();
+        }
+    }
+
+    public void beforeCompletion()
+    {
+        // Call @BeforeTransactionCompletion
+        try
+        {
+            Iterator<TransactionalNotifier> it = this.transactionSet.iterator();
+            while (it.hasNext())
+            {
+                TransactionalNotifier notifier = it.next();
+                notifier.notifyBeforeCompletion();
+            }
+
+        } catch (Throwable e)
+        {
+            logger.error("Exception is occured in the transational observer ", e);
+        }
+    }
 }
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverImpl.java?rev=732803&r1=732802&r2=732803&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverImpl.java Thu Jan  8 11:41:30 2009
@@ -1,18 +1,15 @@
 /*
- *  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.
+ * 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.event;
 
@@ -30,131 +27,125 @@
  * 
  * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
  * @since 1.0
- * 
  * @param <T> generic event type
  */
 public class ObserverImpl<T>
 {
-	/**Event binding types apeearing on the parameter*/
-	private Set<Annotation> eventBindingTypes = new HashSet<Annotation>();
-	
-	/**Event object type*/
-	private Class<T> eventType;
-	
-	private Observer<T> observer;
-	
-	private boolean ifExist;
-	
-	private TransactionalObserverType transObserverType;
-	
-	/**
-	 * Constructs new observer instance.
-	 * 
-	 * @param component web beans component defines the observer method
-	 * @param observerMethod observer method
-	 * @param eventType event type
-	 */
-	public ObserverImpl(Observer<T> observer, Class<T> eventType,Annotation...annotations)
-	{
-		this(observer, false, TransactionalObserverType.NONE, eventType, annotations);
-	}
-	
-	public ObserverImpl(Observer<T> observer,  boolean ifExist, TransactionalObserverType type, Class<T> eventType,Annotation...annotations)
-	{
-		for(Annotation annotation : annotations)
-		{
-			this.eventBindingTypes.add(annotation);
-		}
-		
-		this.observer = observer;
-		this.eventType = eventType;
-		this.ifExist = ifExist;
-		this.transObserverType = type;
-	}
-	
-	
-	public boolean isObserverOfBindings(Annotation...annotations)
-	{
-		boolean ok = true;
-		for(Annotation annot : annotations)
-		{
-			if(!this.eventBindingTypes.contains(annot))
-			{
-				ok = false;
-				break;
-			}
-			else
-			{
-				if(!AnnotationUtil.isAnnotationMemberExist(annot.annotationType(), annot, getAnnotation(annot.annotationType())))
-				{
-					ok = false;
-					break;
-				}
-			}
-			
-		}
-		
-		return ok;
-		
-	}
-	
-	private Annotation getAnnotation(Class<? extends Annotation> type)
-	{
-		Iterator<Annotation> it = this.eventBindingTypes.iterator();
-		while(it.hasNext())
-		{
-			Annotation annot = it.next();
-			
-			if(annot.annotationType().equals(type))
-			{
-				return annot;
-			}
-		}
-		
-		return null;
-	}
-	
-	/**
-	 * Gets event binding types.
-	 */
-	public Set<Annotation> getEventBindingTypes()
-	{
-		return this.eventBindingTypes;
-	}
-
-	/**
-	 * Gets event type.
-	 */
-	public Class<T> getEventType()
-	{
-		return this.eventType;
-	}
-	
-	
-
-	/**
-	 * @return the observer
-	 */
-	public Observer<T> getObserver()
-	{
-		return observer;
-	}
-
-	/**
-	 * @return the ifExist
-	 */
-	public boolean isIfExist()
-	{
-		return ifExist;
-	}
-
-	/**
-	 * @return the transObserverType
-	 */
-	public TransactionalObserverType getTransObserverType()
-	{
-		return transObserverType;
-	}
-	
-	
+    /** Event binding types apeearing on the parameter */
+    private Set<Annotation> eventBindingTypes = new HashSet<Annotation>();
+
+    /** Event object type */
+    private Class<T> eventType;
+
+    private Observer<T> observer;
+
+    private boolean ifExist;
+
+    private TransactionalObserverType transObserverType;
+
+    /**
+     * Constructs new observer instance.
+     * 
+     * @param component web beans component defines the observer method
+     * @param observerMethod observer method
+     * @param eventType event type
+     */
+    public ObserverImpl(Observer<T> observer, Class<T> eventType, Annotation... annotations)
+    {
+        this(observer, false, TransactionalObserverType.NONE, eventType, annotations);
+    }
+
+    public ObserverImpl(Observer<T> observer, boolean ifExist, TransactionalObserverType type, Class<T> eventType, Annotation... annotations)
+    {
+        for (Annotation annotation : annotations)
+        {
+            this.eventBindingTypes.add(annotation);
+        }
+
+        this.observer = observer;
+        this.eventType = eventType;
+        this.ifExist = ifExist;
+        this.transObserverType = type;
+    }
+
+    public boolean isObserverOfBindings(Annotation... annotations)
+    {
+        boolean ok = true;
+        for (Annotation annot : annotations)
+        {
+            if (!this.eventBindingTypes.contains(annot))
+            {
+                ok = false;
+                break;
+            } else
+            {
+                if (!AnnotationUtil.isAnnotationMemberExist(annot.annotationType(), annot, getAnnotation(annot.annotationType())))
+                {
+                    ok = false;
+                    break;
+                }
+            }
+
+        }
+
+        return ok;
+
+    }
+
+    private Annotation getAnnotation(Class<? extends Annotation> type)
+    {
+        Iterator<Annotation> it = this.eventBindingTypes.iterator();
+        while (it.hasNext())
+        {
+            Annotation annot = it.next();
+
+            if (annot.annotationType().equals(type))
+            {
+                return annot;
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * Gets event binding types.
+     */
+    public Set<Annotation> getEventBindingTypes()
+    {
+        return this.eventBindingTypes;
+    }
+
+    /**
+     * Gets event type.
+     */
+    public Class<T> getEventType()
+    {
+        return this.eventType;
+    }
+
+    /**
+     * @return the observer
+     */
+    public Observer<T> getObserver()
+    {
+        return observer;
+    }
+
+    /**
+     * @return the ifExist
+     */
+    public boolean isIfExist()
+    {
+        return ifExist;
+    }
+
+    /**
+     * @return the transObserverType
+     */
+    public TransactionalObserverType getTransObserverType()
+    {
+        return transObserverType;
+    }
+
 }
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/TransactionalNotifier.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/TransactionalNotifier.java?rev=732803&r1=732802&r2=732803&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/TransactionalNotifier.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/TransactionalNotifier.java Thu Jan  8 11:41:30 2009
@@ -1,18 +1,15 @@
 /*
- *  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.
+ * 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.event;
 
@@ -26,125 +23,127 @@
 
 class TransactionalNotifier
 {
-	private Object event;
-	
-	private Set<Observer<Object>> afterCompletion = new HashSet<Observer<Object>>();
-	
-	private Set<Observer<Object>> afterCompletionSuccess = new HashSet<Observer<Object>>();
-	
-	private Set<Observer<Object>> afterCompletionFailure = new HashSet<Observer<Object>>();
-	
-	private Set<Observer<Object>> beforeCompletion = new HashSet<Observer<Object>>();
-	
-	
-	public TransactionalNotifier(Object event)
-	{
-		this.event = event;
-	}
-
-	public void addAfterCompletionObserver(Observer<Object> observer)
-	{
-		checkNull(observer);
-		
-		this.afterCompletion.add(observer);
-		
-	}
-	
-	public void addAfterCompletionSuccessObserver(Observer<Object> observer)
-	{
-		checkNull(observer);
-		
-		this.afterCompletionSuccess.add(observer);
-	}
-
-	public void addAfterCompletionFailureObserver(Observer<Object> observer)
-	{
-		checkNull(observer);
-		
-		this.afterCompletionFailure.add(observer);
-	}
-
-	public void addBeforeCompletionObserver(Observer<Object> observer)
-	{
-		checkNull(observer);
-		
-		this.beforeCompletion.add(observer);
-	}
-	
-	public void notifyAfterCompletion() throws Throwable
-	{
-		Iterator<Observer<Object>> it = this.afterCompletion.iterator();
-		handleEvent(it);
-	}
-	
-	public void notifyAfterCompletionSuccess() throws Throwable
-	{
-		Iterator<Observer<Object>> it = this.afterCompletionSuccess.iterator();
-		handleEvent(it);
-		
-	}
-	
-	public void notifyAfterCompletionFailure() throws Throwable
-	{
-		Iterator<Observer<Object>> it = this.afterCompletionFailure.iterator();
-		handleEvent(it);
-		
-	}
-	
-	public void notifyBeforeCompletion() throws Throwable
-	{
-		Iterator<Observer<Object>> it = this.beforeCompletion.iterator();
-		handleEvent(it);
-		
-	}
-	
-	
-	/* (non-Javadoc)
-	 * @see java.lang.Object#hashCode()
-	 */
-	@Override
-	public int hashCode()
-	{
-		final int prime = 31;
-		int result = 1;
-		result = prime * result + ((event.getClass() == null) ? 0 : event.getClass().hashCode());
-		return result;
-	}
-
-	/* (non-Javadoc)
-	 * @see java.lang.Object#equals(java.lang.Object)
-	 */
-	@Override
-	public boolean equals(Object obj)
-	{
-		if (this == obj)
-			return true;
-		if (obj == null)
-			return false;
-		if (getClass() != obj.getClass())
-			return false;
-		final TransactionalNotifier other = (TransactionalNotifier) obj;
-		if (event.getClass() == null)
-		{
-			if (other.event.getClass() != null)
-				return false;
-		} else if (!event.getClass().equals(other.event.getClass()))
-			return false;
-		return true;
-	}
-	
-	private void handleEvent(Iterator<Observer<Object>> it)
-	{
-		while(it.hasNext())
-		{
-			it.next().notify(this.event);
-		}		
-		
-	}
-
-	private void checkNull(Observer<Object> observer)
-	{
-		Asserts.assertNotNull(observer,"observer parameter can not be null");
-	}
+    private Object event;
+
+    private Set<Observer<Object>> afterCompletion = new HashSet<Observer<Object>>();
+
+    private Set<Observer<Object>> afterCompletionSuccess = new HashSet<Observer<Object>>();
+
+    private Set<Observer<Object>> afterCompletionFailure = new HashSet<Observer<Object>>();
+
+    private Set<Observer<Object>> beforeCompletion = new HashSet<Observer<Object>>();
+
+    public TransactionalNotifier(Object event)
+    {
+        this.event = event;
+    }
+
+    public void addAfterCompletionObserver(Observer<Object> observer)
+    {
+        checkNull(observer);
+
+        this.afterCompletion.add(observer);
+
+    }
+
+    public void addAfterCompletionSuccessObserver(Observer<Object> observer)
+    {
+        checkNull(observer);
+
+        this.afterCompletionSuccess.add(observer);
+    }
+
+    public void addAfterCompletionFailureObserver(Observer<Object> observer)
+    {
+        checkNull(observer);
+
+        this.afterCompletionFailure.add(observer);
+    }
+
+    public void addBeforeCompletionObserver(Observer<Object> observer)
+    {
+        checkNull(observer);
+
+        this.beforeCompletion.add(observer);
+    }
+
+    public void notifyAfterCompletion() throws Throwable
+    {
+        Iterator<Observer<Object>> it = this.afterCompletion.iterator();
+        handleEvent(it);
+    }
+
+    public void notifyAfterCompletionSuccess() throws Throwable
+    {
+        Iterator<Observer<Object>> it = this.afterCompletionSuccess.iterator();
+        handleEvent(it);
+
+    }
+
+    public void notifyAfterCompletionFailure() throws Throwable
+    {
+        Iterator<Observer<Object>> it = this.afterCompletionFailure.iterator();
+        handleEvent(it);
+
+    }
+
+    public void notifyBeforeCompletion() throws Throwable
+    {
+        Iterator<Observer<Object>> it = this.beforeCompletion.iterator();
+        handleEvent(it);
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode()
+    {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((event.getClass() == null) ? 0 : event.getClass().hashCode());
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(Object obj)
+    {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        final TransactionalNotifier other = (TransactionalNotifier) obj;
+        if (event.getClass() == null)
+        {
+            if (other.event.getClass() != null)
+                return false;
+        } else if (!event.getClass().equals(other.event.getClass()))
+            return false;
+        return true;
+    }
+
+    private void handleEvent(Iterator<Observer<Object>> it)
+    {
+        while (it.hasNext())
+        {
+            it.next().notify(this.event);
+        }
+
+    }
+
+    private void checkNull(Observer<Object> observer)
+    {
+        Asserts.assertNotNull(observer, "observer parameter can not be null");
+    }
 
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/TransactionalObserverType.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/TransactionalObserverType.java?rev=732803&r1=732802&r2=732803&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/TransactionalObserverType.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/TransactionalObserverType.java Thu Jan  8 11:41:30 2009
@@ -1,26 +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.
+ * 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.event;
 
 public enum TransactionalObserverType
 {
-	AFTER_TRANSACTION_COMPLETION,
-	AFTER_TRANSACTION_SUCCESS,
-	AFTER_TRANSACTION_FAILURE,
-	BEFORE_TRANSACTION_COMPLETION,
-	NONE
+    AFTER_TRANSACTION_COMPLETION, AFTER_TRANSACTION_SUCCESS, AFTER_TRANSACTION_FAILURE, BEFORE_TRANSACTION_COMPLETION, NONE
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/xml/BeanObserverXMLImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/xml/BeanObserverXMLImpl.java?rev=732803&r1=732802&r2=732803&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/xml/BeanObserverXMLImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/xml/BeanObserverXMLImpl.java Thu Jan  8 11:41:30 2009
@@ -1,18 +1,15 @@
 /*
- *  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.
+ * 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.event.xml;
 
@@ -33,35 +30,37 @@
 
 public class BeanObserverXMLImpl<T> extends BeanObserverImpl<T>
 {
-	private List<XMLInjectionPointModel> observersParameters = new ArrayList<XMLInjectionPointModel>();
-	
-	public BeanObserverXMLImpl(ObservesMethodsOwner<?> bean, Method observerMethod, boolean ifExist, TransactionalObserverType type)
-	{
-		super(bean, observerMethod, ifExist, type);
-	}
-
-	/* (non-Javadoc)
-	 * @see org.apache.webbeans.event.BeanObserverImpl#getMethodArguments(java.lang.Object)
-	 */
-	@Override
-	protected List<Object> getMethodArguments(Object event)
-	{
-		List<Object> params = new ArrayList<Object>();
-		Manager manager = ManagerImpl.getManager();
-		for(XMLInjectionPointModel model : observersParameters)
-		{
-			Set<Annotation> setBindingTypes = model.getBindingTypes();
-			Annotation[] anns = new Annotation[setBindingTypes.size()];
-			anns = setBindingTypes.toArray(anns);
-			params.add(manager.getInstance(InjectionResolver.getInstance().implResolveByType(model.getInjectionClassType(), model.getActualTypeArguments(), anns).iterator().next()));
-		}
-		
-		return params;
-	}
-	
-	public void addXMLInjectionObservesParameter(XMLInjectionPointModel model)
-	{
-		this.observersParameters.add(model);
-	}
+    private List<XMLInjectionPointModel> observersParameters = new ArrayList<XMLInjectionPointModel>();
+
+    public BeanObserverXMLImpl(ObservesMethodsOwner<?> bean, Method observerMethod, boolean ifExist, TransactionalObserverType type)
+    {
+        super(bean, observerMethod, ifExist, type);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.webbeans.event.BeanObserverImpl#getMethodArguments(java.lang.Object)
+     */
+    @Override
+    protected List<Object> getMethodArguments(Object event)
+    {
+        List<Object> params = new ArrayList<Object>();
+        Manager manager = ManagerImpl.getManager();
+        for (XMLInjectionPointModel model : observersParameters)
+        {
+            Set<Annotation> setBindingTypes = model.getBindingTypes();
+            Annotation[] anns = new Annotation[setBindingTypes.size()];
+            anns = setBindingTypes.toArray(anns);
+            params.add(manager.getInstance(InjectionResolver.getInstance().implResolveByType(model.getInjectionClassType(), model.getActualTypeArguments(), anns).iterator().next()));
+        }
+
+        return params;
+    }
+
+    public void addXMLInjectionObservesParameter(XMLInjectionPointModel model)
+    {
+        this.observersParameters.add(model);
+    }
 
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/ComponentNotFoundException.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/ComponentNotFoundException.java?rev=732803&r1=732802&r2=732803&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/ComponentNotFoundException.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/ComponentNotFoundException.java Thu Jan  8 11:41:30 2009
@@ -1,18 +1,15 @@
 /*
- *  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.
+ * 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.exception;
 
@@ -24,11 +21,11 @@
  */
 public class ComponentNotFoundException extends WebBeansException
 {
-	private static final long serialVersionUID = 532093075405474889L;
+    private static final long serialVersionUID = 532093075405474889L;
 
-	public ComponentNotFoundException(String message)
-	{
-		super(message);
-	}
+    public ComponentNotFoundException(String message)
+    {
+        super(message);
+    }
 
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/ContextRemoveException.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/ContextRemoveException.java?rev=732803&r1=732802&r2=732803&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/ContextRemoveException.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/ContextRemoveException.java Thu Jan  8 11:41:30 2009
@@ -1,35 +1,32 @@
 /*
- *  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.
+ * 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.exception;
 
 /**
- * Throws when the component is not found in the current context
- * while trrying to remove.
+ * Throws when the component is not found in the current context while trrying
+ * to remove.
  * 
  * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
  * @since 1.0
  */
 public class ContextRemoveException extends WebBeansException
 {
-	private static final long serialVersionUID = 532093075405474889L;
+    private static final long serialVersionUID = 532093075405474889L;
 
-	public ContextRemoveException(String message)
-	{
-		super(message);
-	}
+    public ContextRemoveException(String message)
+    {
+        super(message);
+    }
 
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/ResolutionByNameException.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/ResolutionByNameException.java?rev=732803&r1=732802&r2=732803&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/ResolutionByNameException.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/ResolutionByNameException.java Thu Jan  8 11:41:30 2009
@@ -1,35 +1,32 @@
 /*
- *  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.
+ * 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.exception;
 
 /**
- * Throws when exceptional situation occurs while resolving components
- * in the web beans container by name.
+ * Throws when exceptional situation occurs while resolving components in the
+ * web beans container by name.
  * 
  * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
  * @since 1.0
  */
 public class ResolutionByNameException extends WebBeansException
 {
-	private static final long serialVersionUID = 532093075405474889L;
+    private static final long serialVersionUID = 532093075405474889L;
 
-	public ResolutionByNameException(String message)
-	{
-		super(message);
-	}
+    public ResolutionByNameException(String message)
+    {
+        super(message);
+    }
 
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansConfigurationException.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansConfigurationException.java?rev=732803&r1=732802&r2=732803&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansConfigurationException.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansConfigurationException.java Thu Jan  8 11:41:30 2009
@@ -1,26 +1,23 @@
 /*
- *  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.
+ * 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.exception;
 
 import javax.webbeans.DefinitionException;
 
 /**
- * Exception that is thrown by the web beans container at the
- * intialization time.
+ * Exception that is thrown by the web beans container at the intialization
+ * time.
  * 
  * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
  * @since 1.0
@@ -28,28 +25,26 @@
 public class WebBeansConfigurationException extends DefinitionException
 {
 
-	private static final long serialVersionUID = 1863095663133791175L;
-	
-	
-	public WebBeansConfigurationException()
-	{
-		super();
-	}
-
-	public WebBeansConfigurationException(String message)
-	{
-		super(message);
-	}
-	
-	public WebBeansConfigurationException(Throwable e)
-	{
-		super(e);
-	}
-	
-	public WebBeansConfigurationException(String message,Throwable e)
-	{
-		super(message,e);
-	}
-	
-	
+    private static final long serialVersionUID = 1863095663133791175L;
+
+    public WebBeansConfigurationException()
+    {
+        super();
+    }
+
+    public WebBeansConfigurationException(String message)
+    {
+        super(message);
+    }
+
+    public WebBeansConfigurationException(Throwable e)
+    {
+        super(e);
+    }
+
+    public WebBeansConfigurationException(String message, Throwable e)
+    {
+        super(message, e);
+    }
+
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansCreationException.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansCreationException.java?rev=732803&r1=732802&r2=732803&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansCreationException.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansCreationException.java Thu Jan  8 11:41:30 2009
@@ -1,24 +1,20 @@
 /*
- *  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.
+ * 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.exception;
 
 /**
- * Exception that is thrown by the web beans container at the
- * deployment time.
+ * Exception that is thrown by the web beans container at the deployment time.
  * 
  * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
  * @since 1.0
@@ -26,15 +22,15 @@
 public class WebBeansCreationException extends WebBeansException
 {
 
-	private static final long serialVersionUID = 1863095663133791175L;
+    private static final long serialVersionUID = 1863095663133791175L;
+
+    public WebBeansCreationException(Throwable e)
+    {
+        super(e);
+    }
 
-	public WebBeansCreationException(Throwable e)
-	{
-		super(e);
-	}
-	
-	public WebBeansCreationException(String message)
-	{
-		super(message);
-	}
+    public WebBeansCreationException(String message)
+    {
+        super(message);
+    }
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansDeploymentException.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansDeploymentException.java?rev=732803&r1=732802&r2=732803&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansDeploymentException.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansDeploymentException.java Thu Jan  8 11:41:30 2009
@@ -1,24 +1,20 @@
 /*
- *  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.
+ * 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.exception;
 
 /**
- * Exception that is thrown by the web beans container at the
- * deployment time.
+ * Exception that is thrown by the web beans container at the deployment time.
  * 
  * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
  * @since 1.0
@@ -26,15 +22,15 @@
 public class WebBeansDeploymentException extends WebBeansException
 {
 
-	private static final long serialVersionUID = 1863095663133791175L;
+    private static final long serialVersionUID = 1863095663133791175L;
+
+    public WebBeansDeploymentException(Throwable e)
+    {
+        super(e);
+    }
 
-	public WebBeansDeploymentException(Throwable e)
-	{
-		super(e);
-	}
-	
-	public WebBeansDeploymentException(String message)
-	{
-		super(message);
-	}
+    public WebBeansDeploymentException(String message)
+    {
+        super(message);
+    }
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansException.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansException.java?rev=732803&r1=732802&r2=732803&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansException.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansException.java Thu Jan  8 11:41:30 2009
@@ -1,51 +1,47 @@
 /*
- *  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.
+ * 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.exception;
 
 /**
  * @author Administrator
- * 
  */
 public class WebBeansException extends RuntimeException
 {
 
-	private static final long serialVersionUID = -3721839220664165557L;
-	private Throwable cause;
+    private static final long serialVersionUID = -3721839220664165557L;
+    private Throwable cause;
 
-	public WebBeansException(String message)
-	{
-		super(message);
-	}
-
-	public WebBeansException(Throwable e)
-	{
-		super(e);
-		this.cause = e;
-	}
-
-	public WebBeansException(String message, Throwable e)
-	{
-		super(message, e);
-		this.cause = e;
-	}
-
-	public Throwable getCause()
-	{
-		return cause;
-	}
+    public WebBeansException(String message)
+    {
+        super(message);
+    }
+
+    public WebBeansException(Throwable e)
+    {
+        super(e);
+        this.cause = e;
+    }
+
+    public WebBeansException(String message, Throwable e)
+    {
+        super(message, e);
+        this.cause = e;
+    }
+
+    public Throwable getCause()
+    {
+        return cause;
+    }
 
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java?rev=732803&r1=732802&r2=732803&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java Thu Jan  8 11:41:30 2009
@@ -1,18 +1,15 @@
 /*
- *  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.
+ * 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.inject;
 
@@ -46,159 +43,155 @@
 @SuppressWarnings("unchecked")
 public abstract class AbstractInjectable implements Injectable
 {
-	/** Owner component */
-	private AbstractComponent<?> injectionOwnerComponent;
-	
-	protected AbstractInjectable(AbstractComponent<?> component)
-	{
-		this.injectionOwnerComponent = component;
-	}
-
-	/**
-	 * Gets the injected component instance in its scoped context.
-	 * 
-	 * @param type
-	 *            type of the injection point, maybe parametrized type
-	 * @param annotations
-	 *            binding annotations at the injection point
-	 * @return current component instance in the resolved component scope
-	 */
-	public <T> Object inject(Class<T> type, Type[] args, Annotation... annotations)
-	{
-		DependentContext context = (DependentContext)ManagerImpl.getManager().getContext(Dependent.class);
-		boolean isSetOnThis = false;
-		
-		try
-		{
-			if(!context.isActive())
-			{
-				context.setActive(true);
-				isSetOnThis = true;
-			}
-			
-			if (isNewBinding(annotations))
-			{
-				return injectForNew(type, annotations);
-			}
-			
-			if(isObservableBinding(annotations))
-			{
-				return injectForObservable(args, annotations);
-			}
-			
-			Set<Bean<T>> componentSet = InjectionResolver.getInstance().implResolveByType(type, args, annotations);
-			ResolutionUtil.checkResolvedBeans(componentSet, type);
-			
-			AbstractComponent<?> component = (AbstractComponent<?>)componentSet.iterator().next();
-			
-			/*Nullable check*/
-			WebBeansUtil.checkNullable(type, component);
-
-			if (component.getScopeType().equals(Dependent.class))
-			{
-				return injectForDependent(component);
-				
-			} else
-			{
-				return injectForComponent(component);
-			}
-			
-		}finally
-		{
-			if(isSetOnThis)
-			{
-				context.setActive(false);	
-			}
-		}
-		
-	}
-	
-	private boolean isNewBinding(Annotation...annotations)
-	{
-		if (annotations.length == 1)
-		{
-			if (annotations[0].annotationType().equals(New.class))
-			{
-				return true;
-			}
-		}
-		
-		return false;
-	}
-	
-	private boolean isObservableBinding(Annotation...annotations)
-	{
-		for(Annotation ann : annotations)
-		{
-			if(ann.annotationType().equals(Fires.class))
-			{
-				return true;
-			}
-		}
-		
-		return false;
-	}
-	
-
-	private Object injectForNew(Type type, Annotation... annotations)
-	{
-		Class<?> clazz = null;
-
-		if (type instanceof ParameterizedType)
-		{
-			clazz = (Class<?>) ((ParameterizedType) type).getRawType();
-		} else if (type instanceof Class)
-		{
-			clazz = (Class<?>) type;
-		}
-
-		return injectForDependent(WebBeansUtil.createNewComponent(clazz));
-	}
-	
-	
-	private <T> Object injectForObservable(Type[] args, Annotation... annotations)
-	{
-		Class<?> eventType = (Class<?>) args[0];
-		
-		return injectForDependent(WebBeansUtil.createObservableImplicitComponent(EventImpl.class, eventType, annotations));
-	}
-
-	private Object injectForDependent(AbstractComponent<?> component)
-	{
-		Object object = null;
-		object = this.injectionOwnerComponent.getDependent(component);
-
-		return object;
-	}
-
-	private Object injectForComponent(AbstractComponent<?> component)
-	{
-		WebBeansContext context = null;
-		Object object = null;
-		
-		context = (WebBeansContext) ManagerImpl.getManager().getContext(component.getScopeType());
-		object = context.get(component, true);
-
-			return object;
-
-	}
-	
-	protected void checkParametrizedTypeForInjectionPoint(ParameterizedType pType)
-	{
-		if(!ClassUtil.checkParametrizedType(pType))
-		{
-			throw new WebBeansConfigurationException("Injection point with parametrized type : " + pType + " can not define Type variable or Wildcard type");
-		}
-	}
-
-	/**
-	 * Gets the component.
-	 * 
-	 * @return the component
-	 */
-	public AbstractComponent<?> getInjectionOwnerComponent()
-	{
-		return injectionOwnerComponent;
-	}
+    /** Owner component */
+    private AbstractComponent<?> injectionOwnerComponent;
+
+    protected AbstractInjectable(AbstractComponent<?> component)
+    {
+        this.injectionOwnerComponent = component;
+    }
+
+    /**
+     * Gets the injected component instance in its scoped context.
+     * 
+     * @param type type of the injection point, maybe parametrized type
+     * @param annotations binding annotations at the injection point
+     * @return current component instance in the resolved component scope
+     */
+    public <T> Object inject(Class<T> type, Type[] args, Annotation... annotations)
+    {
+        DependentContext context = (DependentContext) ManagerImpl.getManager().getContext(Dependent.class);
+        boolean isSetOnThis = false;
+
+        try
+        {
+            if (!context.isActive())
+            {
+                context.setActive(true);
+                isSetOnThis = true;
+            }
+
+            if (isNewBinding(annotations))
+            {
+                return injectForNew(type, annotations);
+            }
+
+            if (isObservableBinding(annotations))
+            {
+                return injectForObservable(args, annotations);
+            }
+
+            Set<Bean<T>> componentSet = InjectionResolver.getInstance().implResolveByType(type, args, annotations);
+            ResolutionUtil.checkResolvedBeans(componentSet, type);
+
+            AbstractComponent<?> component = (AbstractComponent<?>) componentSet.iterator().next();
+
+            /* Nullable check */
+            WebBeansUtil.checkNullable(type, component);
+
+            if (component.getScopeType().equals(Dependent.class))
+            {
+                return injectForDependent(component);
+
+            } else
+            {
+                return injectForComponent(component);
+            }
+
+        } finally
+        {
+            if (isSetOnThis)
+            {
+                context.setActive(false);
+            }
+        }
+
+    }
+
+    private boolean isNewBinding(Annotation... annotations)
+    {
+        if (annotations.length == 1)
+        {
+            if (annotations[0].annotationType().equals(New.class))
+            {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    private boolean isObservableBinding(Annotation... annotations)
+    {
+        for (Annotation ann : annotations)
+        {
+            if (ann.annotationType().equals(Fires.class))
+            {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    private Object injectForNew(Type type, Annotation... annotations)
+    {
+        Class<?> clazz = null;
+
+        if (type instanceof ParameterizedType)
+        {
+            clazz = (Class<?>) ((ParameterizedType) type).getRawType();
+        } else if (type instanceof Class)
+        {
+            clazz = (Class<?>) type;
+        }
+
+        return injectForDependent(WebBeansUtil.createNewComponent(clazz));
+    }
+
+    private <T> Object injectForObservable(Type[] args, Annotation... annotations)
+    {
+        Class<?> eventType = (Class<?>) args[0];
+
+        return injectForDependent(WebBeansUtil.createObservableImplicitComponent(EventImpl.class, eventType, annotations));
+    }
+
+    private Object injectForDependent(AbstractComponent<?> component)
+    {
+        Object object = null;
+        object = this.injectionOwnerComponent.getDependent(component);
+
+        return object;
+    }
+
+    private Object injectForComponent(AbstractComponent<?> component)
+    {
+        WebBeansContext context = null;
+        Object object = null;
+
+        context = (WebBeansContext) ManagerImpl.getManager().getContext(component.getScopeType());
+        object = context.get(component, true);
+
+        return object;
+
+    }
+
+    protected void checkParametrizedTypeForInjectionPoint(ParameterizedType pType)
+    {
+        if (!ClassUtil.checkParametrizedType(pType))
+        {
+            throw new WebBeansConfigurationException("Injection point with parametrized type : " + pType + " can not define Type variable or Wildcard type");
+        }
+    }
+
+    /**
+     * Gets the component.
+     * 
+     * @return the component
+     */
+    public AbstractComponent<?> getInjectionOwnerComponent()
+    {
+        return injectionOwnerComponent;
+    }
 
 }
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/Injectable.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/Injectable.java?rev=732803&r1=732802&r2=732803&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/Injectable.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/Injectable.java Thu Jan  8 11:41:30 2009
@@ -1,29 +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.
+ * 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.inject;
 
-
 /**
- * Marker interface for all injectable elements of the web
- * beans components.
- * 
+ * Marker interface for all injectable elements of the web beans components.
  * <p>
  * There are several injectable elements in the web beans container;
- * 
  * <ul>
  * <li>Constructor,</li>
  * <li>Methods,</li>
@@ -33,7 +26,6 @@
  * 
  * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
  * @since 1.0
- * 
  * @see InjectableConstructor
  * @see InjectableField
  * @see InjectableMethods
@@ -41,18 +33,17 @@
  */
 public interface Injectable
 {
-	/**
-	 * Responsible for injecting the owner required injected
-	 * component instances. Maybe returning an component instance,
-	 * for example, {@link InjectableConstructor#doInjection()} returns
-	 * a new web bean component instance. 
-	 * 
-	 * <p>
-	 * Each injetable elements parameters, web beans component instances,  are resolved
-	 * using the resolution type algorithm.
-	 * </p>
-	 * 
-	 * @return if the return instance if available
-	 */
-	public Object doInjection();
+    /**
+     * Responsible for injecting the owner required injected component
+     * instances. Maybe returning an component instance, for example,
+     * {@link InjectableConstructor#doInjection()} returns a new web bean
+     * component instance.
+     * <p>
+     * Each injetable elements parameters, web beans component instances, are
+     * resolved using the resolution type algorithm.
+     * </p>
+     * 
+     * @return if the return instance if available
+     */
+    public Object doInjection();
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableConstructor.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableConstructor.java?rev=732803&r1=732802&r2=732803&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableConstructor.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableConstructor.java Thu Jan  8 11:41:30 2009
@@ -1,18 +1,15 @@
 /*
- *  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.
+ * 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.inject;
 
@@ -41,81 +38,80 @@
 @SuppressWarnings("unchecked")
 public class InjectableConstructor<T> extends AbstractInjectable
 {
-	/** Injectable constructor instance */
-	protected Constructor<T> con;
+    /** Injectable constructor instance */
+    protected Constructor<T> con;
 
-	/**
-	 * Sets the constructor.
-	 * 
-	 * @param cons
-	 *            injectable constructor
-	 */
-	public InjectableConstructor(Constructor<T> cons, AbstractComponent<?> owner)
-	{
-		super(owner);
-		this.con = cons;
-	}
-
-	/**
-	 * Creates the instance from the constructor. Each constructor parameter
-	 * instance is resolved using the resolution algorithm.
-	 */
-	public T doInjection()
-	{
-		T instance = null;
-
-		Type[] types = con.getGenericParameterTypes();
-		Annotation[][] annots = con.getParameterAnnotations();
-		List<Object> list = new ArrayList<Object>();
-		if (types.length > 0)
-		{
-			int i = 0;
-			for (Type type : types)
-			{
-				Annotation[] annot = annots[i];
-				if (annot.length == 0)
-				{
-					annot = new Annotation[1];
-					annot[0] = new CurrentLiteral();
-				}
-
-				Type[] args = new Type[0];
-				Class<?> clazz = null;
-				if (type instanceof ParameterizedType)
-				{
-					ParameterizedType pt = (ParameterizedType) type;
-					
-					checkParametrizedTypeForInjectionPoint(pt);
-					
-					args = new Type[1];
-					args = pt.getActualTypeArguments();
-
-					clazz = (Class<?>) pt.getRawType();
-				} else
-				{
-					clazz = (Class<?>) type;
-				}
-
-				list.add(inject(clazz, args, AnnotationUtil.getBindingAnnotations(annot)));
-
-				i++;
-
-			}
-
-		}
-
-		try
-		{
-			if (!EJBUtil.isEJBSessionClass(con.getDeclaringClass()))
-			{
-				instance = con.newInstance(list.toArray());
-			}
-
-		} catch (Exception e)
-		{
-			throw new WebBeansException(e);
-		}
+    /**
+     * Sets the constructor.
+     * 
+     * @param cons injectable constructor
+     */
+    public InjectableConstructor(Constructor<T> cons, AbstractComponent<?> owner)
+    {
+        super(owner);
+        this.con = cons;
+    }
+
+    /**
+     * Creates the instance from the constructor. Each constructor parameter
+     * instance is resolved using the resolution algorithm.
+     */
+    public T doInjection()
+    {
+        T instance = null;
+
+        Type[] types = con.getGenericParameterTypes();
+        Annotation[][] annots = con.getParameterAnnotations();
+        List<Object> list = new ArrayList<Object>();
+        if (types.length > 0)
+        {
+            int i = 0;
+            for (Type type : types)
+            {
+                Annotation[] annot = annots[i];
+                if (annot.length == 0)
+                {
+                    annot = new Annotation[1];
+                    annot[0] = new CurrentLiteral();
+                }
+
+                Type[] args = new Type[0];
+                Class<?> clazz = null;
+                if (type instanceof ParameterizedType)
+                {
+                    ParameterizedType pt = (ParameterizedType) type;
+
+                    checkParametrizedTypeForInjectionPoint(pt);
+
+                    args = new Type[1];
+                    args = pt.getActualTypeArguments();
+
+                    clazz = (Class<?>) pt.getRawType();
+                } else
+                {
+                    clazz = (Class<?>) type;
+                }
+
+                list.add(inject(clazz, args, AnnotationUtil.getBindingAnnotations(annot)));
+
+                i++;
+
+            }
+
+        }
+
+        try
+        {
+            if (!EJBUtil.isEJBSessionClass(con.getDeclaringClass()))
+            {
+                instance = con.newInstance(list.toArray());
+            }
+
+        } catch (Exception e)
+        {
+            throw new WebBeansException(e);
+        }
 
-		return instance;
-	}
+        return instance;
+    }
 }
\ No newline at end of file