You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2010/07/27 22:29:03 UTC
svn commit: r979855 -
/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultContextsService.java
Author: struberg
Date: Tue Jul 27 20:29:03 2010
New Revision: 979855
URL: http://svn.apache.org/viewvc?rev=979855&view=rev
Log:
OWB-425 remove rendundant checks
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultContextsService.java
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultContextsService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultContextsService.java?rev=979855&r1=979854&r2=979855&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultContextsService.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultContextsService.java Tue Jul 27 20:29:03 2010
@@ -106,74 +106,68 @@ public class DefaultContextsService exte
*/
@Override
public Context getCurrentContext(Class<? extends Annotation> scopeType)
- {
- if(supportsContext(scopeType))
+ {
+ if(scopeType.equals(RequestScoped.class))
+ {
+ return getCurrentRequestContext();
+ }
+ else if(scopeType.equals(SessionScoped.class))
+ {
+ return getCurrentSessionContext();
+ }
+ else if(scopeType.equals(ApplicationScoped.class))
+ {
+ return getCurrentApplicationContext();
+ }
+ else if(scopeType.equals(ConversationScoped.class))
+ {
+ return getCurrentConversationContext();
+ }
+ else if(scopeType.equals(Dependent.class))
+ {
+ return getCurrentDependentContext();
+ }
+ else if(scopeType.equals(Singleton.class))
+ {
+ return getCurrentSingletonContext();
+ }
+
+ return null;
+
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void startContext(Class<? extends Annotation> scopeType, Object startParameter) throws ContextException
+ {
+ try
{
if(scopeType.equals(RequestScoped.class))
{
- return getCurrentRequestContext();
+ startRequestContext(startParameter);
}
else if(scopeType.equals(SessionScoped.class))
{
- return getCurrentSessionContext();
+ startSessionContext(startParameter);
}
else if(scopeType.equals(ApplicationScoped.class))
{
- return getCurrentApplicationContext();
+ startApplicationContext(startParameter);
}
else if(scopeType.equals(ConversationScoped.class))
{
- return getCurrentConversationContext();
+ startConversationContext((ConversationContext)startParameter);
}
else if(scopeType.equals(Dependent.class))
{
- return getCurrentDependentContext();
+ //Do nothing
}
- else
- {
- return getCurrentSingletonContext();
- }
- }
-
- return null;
-
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void startContext(Class<? extends Annotation> scopeType, Object startParameter) throws ContextException
- {
- try
- {
- if(supportsContext(scopeType))
+ else if(scopeType.equals(Singleton.class))
{
- if(scopeType.equals(RequestScoped.class))
- {
- startRequestContext(startParameter);
- }
- else if(scopeType.equals(SessionScoped.class))
- {
- startSessionContext(startParameter);
- }
- else if(scopeType.equals(ApplicationScoped.class))
- {
- startApplicationContext(startParameter);
- }
- else if(scopeType.equals(ConversationScoped.class))
- {
- startConversationContext((ConversationContext)startParameter);
- }
- else if(scopeType.equals(Dependent.class))
- {
- //Do nothing
- }
- else
- {
- startSingletonContext(startParameter);
- }
+ startSingletonContext(startParameter);
}
}
catch(Exception e)
@@ -198,6 +192,7 @@ public class DefaultContextsService exte
if(scopeType.equals(RequestScoped.class) ||
scopeType.equals(SessionScoped.class) ||
scopeType.equals(ApplicationScoped.class) ||
+ scopeType.equals(ConversationScoped.class) ||
scopeType.equals(Dependent.class) ||
scopeType.equals(Singleton.class))
{