You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by im...@apache.org on 2007/08/11 22:30:52 UTC
svn commit: r564969 - in /myfaces/orchestra/trunk:
core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/SpringConversationScope.java
core15/src/main/java/org/apache/myfaces/orchestra/conversation/annotations/ConversationRequire.java
Author: imario
Date: Sat Aug 11 13:30:51 2007
New Revision: 564969
URL: http://svn.apache.org/viewvc?view=rev&rev=564969
Log:
added a first try to build a framework to deal with annotations in the core15 module.
javadoc needs to be done and AnnotationsInitializer needs to be refactored - just committed for safety.
Added:
myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/conversation/annotations/ConversationRequire.java
Modified:
myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/SpringConversationScope.java
Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/SpringConversationScope.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/SpringConversationScope.java?view=diff&rev=564969&r1=564968&r2=564969
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/SpringConversationScope.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/SpringConversationScope.java Sat Aug 11 13:30:51 2007
@@ -71,7 +71,8 @@
* The beanName will also be the conversation name.
* </p>
*/
-public class SpringConversationScope implements Scope, BeanFactoryAware, ApplicationContextAware
+public class SpringConversationScope implements
+ Scope, BeanFactoryAware, ApplicationContextAware
{
private ConfigurableApplicationContext applicationContext;
private Advice[] advices;
@@ -217,7 +218,7 @@
{
// bad hack to get access to the real definition
// TODO: is there a better way to do this?
- beanDefinition = applicationContext.getBeanFactory().getBeanDefinition("scopedTarget." + beanName); // NON-NLS
+ beanDefinition = applicationContext.getBeanFactory().getBeanDefinition(_SpringUtils.getAlternateBeanName(beanName)); // NON-NLS
}
if (beanDefinition.hasAttribute(BeanDefinitionConversationNameAttrDecorator.CONVERSATION_NAME_ATTRIBUTE))
{
@@ -282,8 +283,7 @@
{
if (!(applicationContext instanceof ConfigurableApplicationContext))
{
- // TODO: log info
- return;
+ throw new IllegalArgumentException("a ConfigurableApplicationContext is required");
}
this.applicationContext = (ConfigurableApplicationContext) applicationContext;
Added: myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/conversation/annotations/ConversationRequire.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/conversation/annotations/ConversationRequire.java?view=auto&rev=564969
==============================================================================
--- myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/conversation/annotations/ConversationRequire.java (added)
+++ myfaces/orchestra/trunk/core15/src/main/java/org/apache/myfaces/orchestra/conversation/annotations/ConversationRequire.java Sat Aug 11 13:30:51 2007
@@ -0,0 +1,52 @@
+/*
+ * 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.myfaces.orchestra.conversation.annotations;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Defines a class as ViewController to receive ViewController events for
+ * the given viewId(s)
+ */
+@Target(value = {ElementType.TYPE})
+@Retention(value = RetentionPolicy.RUNTIME)
+public @interface ConversationRequire
+{
+ /**
+ * One or many conversation names the view require as prerequesite.
+ * If one of the configured conversations is not active a redirect or
+ * navigationAction will be issued.
+ */
+ String[] conversationNames() default {};
+
+ /**
+ * The servlet url to redirect to if one of the conversations is not running.
+ */
+ String redirect() default "";
+
+ /**
+ * The jsf action to issue if one of the conversations is not running.
+ * You have to configure the action as global navigation rule in your faces-config.xml
+ */
+ String navigationAction() default "";
+}
\ No newline at end of file