You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by ws...@apache.org on 2006/05/22 06:10:44 UTC
svn commit: r408564 [1/2] - in /struts/shale/trunk/tiger/src:
java/org/apache/shale/tiger/view/ java/org/apache/shale/tiger/view/faces/
test/org/apache/shale/tiger/view/faces/
Author: wsmoak
Date: Sun May 21 21:10:43 2006
New Revision: 408564
URL: http://svn.apache.org/viewvc?rev=408564&view=rev
Log:
Added svn properties keywords and eol-style. Fixed line endings, no other changes.
Modified:
struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Activate.java (contents, props changed)
struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Application.java (contents, props changed)
struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Passivate.java (contents, props changed)
struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Request.java (contents, props changed)
struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Session.java (contents, props changed)
struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/faces/LifecycleListener2.java (contents, props changed)
struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/faces/ViewControllerCallbacks2.java (contents, props changed)
struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/ApplicationBean1.java (contents, props changed)
struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/ApplicationBean2.java (contents, props changed)
struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/CallbacksFactoryTestCase.java (contents, props changed)
struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/LifecycleListener2TestCase.java (contents, props changed)
struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/RequestBean1.java (contents, props changed)
struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/RequestBean2.java (contents, props changed)
struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/SessionBean1.java (contents, props changed)
struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/SessionBean2.java (contents, props changed)
struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/TestViewController.java (contents, props changed)
struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/ViewControllerCallbacks2TestCase.java (contents, props changed)
Modified: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Activate.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Activate.java?rev=408564&r1=408563&r2=408564&view=diff
==============================================================================
--- struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Activate.java (original)
+++ struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Activate.java Sun May 21 21:10:43 2006
@@ -1,41 +1,41 @@
-/*
- * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed 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.shale.tiger.view;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * <p>Method-level annotation indicating that the decorated method should
- * have the semantics of
- * <code>org.apache.shale.view.AbstractSessionBean.activate()</code>,
- * even if it is named differently.</p>
- *
- * <p><strong>ASSERTION</strong> - the annotated method is public, has
- * a return type of <code>void</code>, and takes no parameters.</p>
- *
- * <p><strong>ASSERTION</strong> - the annotated method is part of a class
- * that is annotated with the {@link Session} annotation.</p>
- *
- * @since 1.0.3
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-public @interface Activate {
-}
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.shale.tiger.view;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <p>Method-level annotation indicating that the decorated method should
+ * have the semantics of
+ * <code>org.apache.shale.view.AbstractSessionBean.activate()</code>,
+ * even if it is named differently.</p>
+ *
+ * <p><strong>ASSERTION</strong> - the annotated method is public, has
+ * a return type of <code>void</code>, and takes no parameters.</p>
+ *
+ * <p><strong>ASSERTION</strong> - the annotated method is part of a class
+ * that is annotated with the {@link Session} annotation.</p>
+ *
+ * @since 1.0.3
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface Activate {
+}
Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Activate.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Activate.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Application.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Application.java?rev=408564&r1=408563&r2=408564&view=diff
==============================================================================
--- struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Application.java (original)
+++ struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Application.java Sun May 21 21:10:43 2006
@@ -1,38 +1,38 @@
-/*
- * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed 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.shale.tiger.view;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * <p>Class-level annotation indicating that the decorated class should be
- * treated semantically as if it extended
- * <code>org.apache.shale.view.AbstractApplicationBean</code>, even if it does not.</p>
- *
- * <p><strong>WARNING</strong> - it may turn out that this annotation is
- * unnecessary, because an annotation processor can simply look for a class
- * that has method(s) implementing the method level annotations.</p>
- *
- * @since 1.0.3
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface Application {
-}
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.shale.tiger.view;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <p>Class-level annotation indicating that the decorated class should be
+ * treated semantically as if it extended
+ * <code>org.apache.shale.view.AbstractApplicationBean</code>, even if it does not.</p>
+ *
+ * <p><strong>WARNING</strong> - it may turn out that this annotation is
+ * unnecessary, because an annotation processor can simply look for a class
+ * that has method(s) implementing the method level annotations.</p>
+ *
+ * @since 1.0.3
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface Application {
+}
Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Application.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Application.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Passivate.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Passivate.java?rev=408564&r1=408563&r2=408564&view=diff
==============================================================================
--- struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Passivate.java (original)
+++ struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Passivate.java Sun May 21 21:10:43 2006
@@ -1,41 +1,41 @@
-/*
- * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed 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.shale.tiger.view;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * <p>Method-level annotation indicating that the decorated method should
- * have the semantics of
- * <code>org.apache.shale.view.AbstractSessionBean.passivate()</code>,
- * even if it is named differently.</p>
- *
- * <p><strong>ASSERTION</strong> - the annotated method is public, has
- * a return type of <code>void</code>, and takes no parameters.</p>
- *
- * <p><strong>ASSERTION</strong> - the annotated method is part of a class
- * that is annotated with the {@link Session} annotation.</p>
- *
- * @since 1.0.3
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-public @interface Passivate {
-}
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.shale.tiger.view;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <p>Method-level annotation indicating that the decorated method should
+ * have the semantics of
+ * <code>org.apache.shale.view.AbstractSessionBean.passivate()</code>,
+ * even if it is named differently.</p>
+ *
+ * <p><strong>ASSERTION</strong> - the annotated method is public, has
+ * a return type of <code>void</code>, and takes no parameters.</p>
+ *
+ * <p><strong>ASSERTION</strong> - the annotated method is part of a class
+ * that is annotated with the {@link Session} annotation.</p>
+ *
+ * @since 1.0.3
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface Passivate {
+}
Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Passivate.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Passivate.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Request.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Request.java?rev=408564&r1=408563&r2=408564&view=diff
==============================================================================
--- struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Request.java (original)
+++ struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Request.java Sun May 21 21:10:43 2006
@@ -1,38 +1,38 @@
-/*
- * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed 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.shale.tiger.view;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * <p>Class-level annotation indicating that the decorated class should be
- * treated semantically as if it extended
- * <code>org.apache.shale.view.AbstractRequestBean</code>, even if it does not.</p>
- *
- * <p><strong>WARNING</strong> - it may turn out that this annotation is
- * unnecessary, because an annotation processor can simply look for a class
- * that has method(s) implementing the method level annotations.</p>
- *
- * @since 1.0.3
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface Request {
-}
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.shale.tiger.view;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <p>Class-level annotation indicating that the decorated class should be
+ * treated semantically as if it extended
+ * <code>org.apache.shale.view.AbstractRequestBean</code>, even if it does not.</p>
+ *
+ * <p><strong>WARNING</strong> - it may turn out that this annotation is
+ * unnecessary, because an annotation processor can simply look for a class
+ * that has method(s) implementing the method level annotations.</p>
+ *
+ * @since 1.0.3
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface Request {
+}
Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Request.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Request.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Session.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Session.java?rev=408564&r1=408563&r2=408564&view=diff
==============================================================================
--- struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Session.java (original)
+++ struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Session.java Sun May 21 21:10:43 2006
@@ -1,38 +1,38 @@
-/*
- * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed 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.shale.tiger.view;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * <p>Class-level annotation indicating that the decorated class should be
- * treated semantically as if it extended
- * <code>org.apache.shale.view.AbstractSessionBean</code>, even if it does not.</p>
- *
- * <p><strong>WARNING</strong> - it may turn out that this annotation is
- * unnecessary, because an annotation processor can simply look for a class
- * that has method(s) implementing the method level annotations.</p>
- *
- * @since 1.0.3
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface Session {
-}
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.shale.tiger.view;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * <p>Class-level annotation indicating that the decorated class should be
+ * treated semantically as if it extended
+ * <code>org.apache.shale.view.AbstractSessionBean</code>, even if it does not.</p>
+ *
+ * <p><strong>WARNING</strong> - it may turn out that this annotation is
+ * unnecessary, because an annotation processor can simply look for a class
+ * that has method(s) implementing the method level annotations.</p>
+ *
+ * @since 1.0.3
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface Session {
+}
Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Session.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/Session.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/faces/LifecycleListener2.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/faces/LifecycleListener2.java?rev=408564&r1=408563&r2=408564&view=diff
==============================================================================
--- struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/faces/LifecycleListener2.java (original)
+++ struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/faces/LifecycleListener2.java Sun May 21 21:10:43 2006
@@ -1,598 +1,598 @@
-/*
- * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed 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.shale.tiger.view.faces;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-import javax.servlet.ServletContextAttributeEvent;
-import javax.servlet.ServletRequestAttributeEvent;
-import javax.servlet.http.HttpSessionBindingEvent;
-import javax.servlet.http.HttpSessionEvent;
-import org.apache.shale.tiger.view.Activate;
-import org.apache.shale.tiger.view.Application;
-import org.apache.shale.tiger.view.Destroy;
-import org.apache.shale.tiger.view.Init;
-import org.apache.shale.tiger.view.Passivate;
-import org.apache.shale.tiger.view.Preprocess;
-import org.apache.shale.tiger.view.Prerender;
-import org.apache.shale.tiger.view.Request;
-import org.apache.shale.tiger.view.Session;
-import org.apache.shale.tiger.view.View;
-import org.apache.shale.view.AbstractApplicationBean;
-import org.apache.shale.view.AbstractRequestBean;
-import org.apache.shale.view.AbstractSessionBean;
-import org.apache.shale.view.faces.LifecycleListener;
-
-/**
- * <p>Specialized version of
- * <code>org.apache.shale.view.faces.LifecycleListener</code>
- * that implements callbacks to methods tagged by appropriate annotations,
- * rather than requiring the containing classes to implement a particular
- * interface or extend a particular subclass.</p>
- *
- * $Id$
- *
- * @since 1.0.3
- */
-public class LifecycleListener2 extends LifecycleListener {
-
-
- // ------------------------------------------------------------- Constructor
-
-
- /**
- * <p>Create a new lifecycle listener.</p>
- */
- public LifecycleListener2() {
- }
-
-
- // ------------------------------------------------------ Instance Variables
-
-
- /**
- * <p>Parameter values array that passes no parameters.</p>
- */
- private static final Object PARAMETERS[] = new Object[0];
-
-
- // --------------------------------- ServletContextAttributeListener Methods
-
-
- /**
- * <p>Respond to an application scope attribute being added. If the
- * value is an {@link AbstractApplicationBean}, call its
- * <code>init()</code> method.</p>
- *
- * @param event Event to be processed
- */
- public void attributeAdded(ServletContextAttributeEvent event) {
-
- Object value = event.getValue();
- if (value != null) {
- fireApplicationInit(value);
- }
-
- }
-
-
- /**
- * <p>Respond to an application scope attribute being replaced.
- * If the old value was an {@link AbstractApplicationBean}, call
- * its <code>destroy()</code> method. If the new value is an
- * {@link AbstractApplicationBean}, call its <code>init()</code>
- * method.</p>
- *
- * @param event Event to be processed
- */
- public void attributeReplaced(ServletContextAttributeEvent event) {
-
- Object value = event.getValue();
- if (value != null) {
- fireApplicationDestroy(value);
- }
-
- value = event.getServletContext().getAttribute(event.getName());
- if (value != null) {
- fireApplicationInit(value);
- }
-
- }
-
-
- /**
- * <p>Respond to an application scope attribute being removed.
- * If the old value was an {@link AbstractApplicationBean}, call
- * its <code>destroy()</code> method.</p>
- *
- * @param event Event to be processed
- */
- public void attributeRemoved(ServletContextAttributeEvent event) {
-
- Object value = event.getValue();
- if (value != null) {
- fireApplicationDestroy(value);
- }
-
- }
-
-
- // ----------------------------------- HttpSessionActivationListener Methods
-
-
- /**
- * <p>Respond to a "session will passivate" event. Notify all session
- * scope attributes that are {@link AbstractSessionBean}s.</p>
- *
- * @param event Event to be processed
- */
- public void sessionWillPassivate(HttpSessionEvent event) {
-
- Enumeration names = event.getSession().getAttributeNames();
- while (names.hasMoreElements()) {
- String name = (String) names.nextElement();
- Object value = event.getSession().getAttribute(name);
- if (value != null) {
- fireSessionPassivate(value);
- }
- }
-
- }
-
-
- /**
- * <p>Respond to a "session did activate" event. Notify all session
- * scope attributes that are {@link AbstractSessionBean}s.</p>
- *
- * @param event Event to be processed
- */
- public void sessionDidActivate(HttpSessionEvent event) {
-
- Enumeration names = event.getSession().getAttributeNames();
- while (names.hasMoreElements()) {
- String name = (String) names.nextElement();
- Object value = event.getSession().getAttribute(name);
- if (value != null) {
- fireSessionActivate(value);
- }
- }
-
- }
-
-
- // ------------------------------------ HttpSessionAttributeListener Methods
-
-
- /**
- * <p>Respond to a session scope attribute being added. If the
- * value is an {@link AbstractSessionBean}, call its
- * <code>init()</code> method.</p>
- *
- * @param event Event to be processed
- */
- public void attributeAdded(HttpSessionBindingEvent event) {
-
- Object value = event.getValue();
- if (value != null) {
- fireSessionInit(value);
- }
-
- }
-
-
- /**
- * <p>Respond to a session scope attribute being replaced.
- * If the old value was an {@link AbstractSessionBean}, call
- * its <code>destroy()</code> method. If the new value is an
- * {@link AbstractSessionBean}, call its <code>init()</code>
- * method.</p>
- *
- * @param event Event to be processed
- */
- public void attributeReplaced(HttpSessionBindingEvent event) {
-
- Object value = event.getValue();
- if (value != null) {
- fireSessionDestroy(value);
- }
-
- value = event.getSession().getAttribute(event.getName());
- if (value != null) {
- fireSessionInit(value);
- }
-
- }
-
-
- /**
- * <p>Respond to a session scope attribute being removed.
- * If the old value was an {@link AbstractSessionBean}, call
- * its <code>destroy()</code> method.</p>
- *
- * @param event Event to be processed
- */
- public void attributeRemoved(HttpSessionBindingEvent event) {
-
- Object value = event.getValue();
- if (value != null) {
- fireSessionDestroy(value);
- }
-
- }
-
-
- // --------------------------------- ServletRequestAttributeListener Methods
-
-
- /**
- * <p>Respond to a request scope attribute being added. If the
- * value is an {@link AbstractRequestBean}, call its <code>init()</code> method.
- * </p>
- *
- * @param event Event to be processed
- */
- public void attributeAdded(ServletRequestAttributeEvent event) {
-
- Object value = event.getValue();
- if (value != null) {
- fireRequestInit(value);
- }
-
- }
-
-
- /**
- * <p>Respond to a request scope attribute being replaced.
- * If the old value was an {@link AbstractRequestBean},
- * call its <code>destroy()</code> method. If the new value is an
- * {@link AbstractRequestBean}, call its <code>init()</code> method.</p>
- *
- * @param event Event to be processed
- */
- public void attributeReplaced(ServletRequestAttributeEvent event) {
-
- Object value = event.getValue();
- if (value != null) {
- fireRequestDestroy(value);
- }
-
- value = event.getServletRequest().getAttribute(event.getName());
- if (value != null) {
- fireRequestInit(value);
- }
-
- }
-
-
- /**
- * <p>Respond to a request scope attribute being removed.
- * If the old value was an {@link AbstractRequestBean},
- * call its <code>destroy()</code> method.</p>
- *
- * @param event Event to be processed
- */
- public void attributeRemoved(ServletRequestAttributeEvent event) {
-
- Object value = event.getValue();
- if (value != null) {
- fireRequestDestroy(value);
- }
-
- }
-
-
- // ------------------------------------------------------- Protected Methods
-
-
- /**
- * <p>Fire a destroy event on an @{link AbstractApplicationBean}.</p>
- *
- * @param bean {@link AbstractApplicationBean} to fire event on
- */
- protected void fireApplicationDestroy(Object bean) {
-
- if (bean instanceof AbstractApplicationBean) {
- super.fireApplicationDestroy(bean);
- return;
- }
-
- try {
- Method method = method(bean, Destroy.class);
- if (method != null) {
- method.invoke(bean, PARAMETERS);
- }
- } catch (InvocationTargetException e) {
- cacheException((Exception) e.getCause());
- } catch (Exception e) {
- cacheException(e);
- }
-
- }
-
-
- /**
- * <p>Fire an init event on an {@link AbstractApplicationBean}.</p>
- *
- * @param bean {@link AbstractApplicationBean} to fire event on
- */
- protected void fireApplicationInit(Object bean) {
-
- if (bean instanceof AbstractApplicationBean) {
- super.fireApplicationInit(bean);
- return;
- }
-
- try {
- Method method = method(bean, Init.class);
- if (method != null) {
- method.invoke(bean, PARAMETERS);
- }
- } catch (InvocationTargetException e) {
- cacheException((Exception) e.getCause());
- } catch (Exception e) {
- cacheException(e);
- }
-
- }
-
-
- /**
- * <p>Fire a destroy event on an @{link AbstractRequestBean}.</p>
- *
- * @param bean {@link AbstractRequestBean} to fire event on
- */
- protected void fireRequestDestroy(Object bean) {
-
- if (bean instanceof AbstractRequestBean) {
- super.fireRequestDestroy(bean);
- return;
- }
-
- try {
- Method method = method(bean, Destroy.class);
- if (method != null) {
- method.invoke(bean, PARAMETERS);
- }
- } catch (InvocationTargetException e) {
- cacheException((Exception) e.getCause());
- } catch (Exception e) {
- cacheException(e);
- }
-
- }
-
-
- /**
- * <p>Fire an init event on an {@link AbstractRequestBean}.</p>
- *
- * @param bean {@link AbstractRequestBean} to fire event on
- */
- protected void fireRequestInit(Object bean) {
-
- if (bean instanceof AbstractRequestBean) {
- super.fireRequestInit(bean);
- return;
- }
-
- try {
- Method method = method(bean, Init.class);
- if (method != null) {
- method.invoke(bean, PARAMETERS);
- }
- } catch (InvocationTargetException e) {
- cacheException((Exception) e.getCause());
- } catch (Exception e) {
- cacheException(e);
- }
-
- }
-
-
- /**
- * <p>Fire an activate event on an @{link AbstractSessionBean}.</p>
- *
- * @param bean {@link AbstractSessionBean} to fire event on
- */
- protected void fireSessionActivate(Object bean) {
-
- if (bean instanceof AbstractSessionBean) {
- super.fireSessionActivate(bean);
- return;
- }
-
- try {
- Method method = method(bean, Activate.class);
- if (method != null) {
- method.invoke(bean, PARAMETERS);
- }
- } catch (InvocationTargetException e) {
- cacheException((Exception) e.getCause());
- } catch (Exception e) {
- cacheException(e);
- }
-
- }
-
-
- /**
- * <p>Fire a destroy event on an @{link AbstractSessionBean}.</p>
- *
- * @param bean {@link AbstractSessionBean} to fire event on
- */
- protected void fireSessionDestroy(Object bean) {
-
- if (bean instanceof AbstractSessionBean) {
- super.fireSessionDestroy(bean);
- return;
- }
-
- try {
- Method method = method(bean, Destroy.class);
- if (method != null) {
- method.invoke(bean, PARAMETERS);
- }
- } catch (InvocationTargetException e) {
- cacheException((Exception) e.getCause());
- } catch (Exception e) {
- cacheException(e);
- }
-
- }
-
-
- /**
- * <p>Fire an init event on an {@link AbstractSessionBean}.</p>
- *
- * @param bean {@link AbstractSessionBean} to fire event on
- */
- protected void fireSessionInit(Object bean) {
-
- if (bean instanceof AbstractSessionBean) {
- super.fireSessionInit(bean);
- return;
- }
-
- try {
- Method method = method(bean, Init.class);
- if (method != null) {
- method.invoke(bean, PARAMETERS);
- }
- } catch (InvocationTargetException e) {
- cacheException((Exception) e.getCause());
- } catch (Exception e) {
- cacheException(e);
- }
-
- }
-
-
- /**
- * <p>Fire an passivate event on an @{link AbstractSessionBean}.</p>
- *
- * @param bean {@link AbstractSessionBean} to fire event on
- */
- protected void fireSessionPassivate(Object bean) {
-
- if (bean instanceof AbstractSessionBean) {
- super.fireSessionPassivate(bean);
- return;
- }
-
- try {
- Method method = method(bean, Passivate.class);
- if (method != null) {
- method.invoke(bean, PARAMETERS);
- }
- } catch (InvocationTargetException e) {
- cacheException((Exception) e.getCause());
- } catch (Exception e) {
- cacheException(e);
- }
-
- }
-
-
- // --------------------------------------------------------- Private Methods
-
-
- /**
- * <p>The set of method annotations for callbacks of interest.</p>
- */
- private static final Class annotations[] =
- { Init.class, Preprocess.class, Prerender.class, Destroy.class,
- Activate.class, Passivate.class };
-
-
-
- /**
- * <p>The set of class annotations for classes of interest.</p>
- */
- private static final Class markers[] =
- { View.class, Request.class, Session.class, Application.class };
-
-
- /**
- * <p>Data structure to maintain information about annotated
- * methods. In this map, the key is the Class being analyzed,
- * and the value is an inner map. In the inner map, the key
- * is an Annotation class, and the value is the corresponding
- * Method instance.</p>
- */
- private transient Map<Class,Map<Class,Method>> maps =
- new HashMap<Class,Map<Class,Method>>();
-
-
- /**
- * <p>Return the <code>Method</code> to be called for the specified
- * annotation on the specified instance, if any. If there is no such
- * method, return <code>null</code>.</p>
- *
- * @param instance Instance on which callbacks will be performed
- * @param annotation Annotation for which to return a method
- */
- private Method method(Object instance, Class annotation) {
-
-
- // Does the underlying class implement a relevant class annotation?
- // If not, exit early
- Class clazz = instance.getClass();
- boolean found = false;
- for (Class marker : markers) {
- if (clazz.getAnnotation(marker) != null) {
- found = true;
- break;
- }
- }
- if (!found) {
- return null;
- }
-
- synchronized (maps) {
-
- // If we have seen this Class already, simply return the
- // previously located Method (if any)
- Map<Class,Method> map = maps.get(clazz);
- if (map != null) {
- return map.get(annotation);
- }
-
- // Construct and cache a new Map identifying the
- // methods of interest for these callbacks
- map = new HashMap<Class,Method>();
- Method methods[] = clazz.getMethods();
- for (Method method : methods) {
- if (method.getParameterTypes().length > 0) {
- continue;
- }
- for (Class anno : annotations) {
- if (method.getAnnotation(anno) != null) {
- map.put(anno, method);
- }
- }
- }
- maps.put(clazz, map);
- return map.get(annotation);
-
- }
-
- }
-
-
-}
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.shale.tiger.view.faces;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import javax.servlet.ServletContextAttributeEvent;
+import javax.servlet.ServletRequestAttributeEvent;
+import javax.servlet.http.HttpSessionBindingEvent;
+import javax.servlet.http.HttpSessionEvent;
+import org.apache.shale.tiger.view.Activate;
+import org.apache.shale.tiger.view.Application;
+import org.apache.shale.tiger.view.Destroy;
+import org.apache.shale.tiger.view.Init;
+import org.apache.shale.tiger.view.Passivate;
+import org.apache.shale.tiger.view.Preprocess;
+import org.apache.shale.tiger.view.Prerender;
+import org.apache.shale.tiger.view.Request;
+import org.apache.shale.tiger.view.Session;
+import org.apache.shale.tiger.view.View;
+import org.apache.shale.view.AbstractApplicationBean;
+import org.apache.shale.view.AbstractRequestBean;
+import org.apache.shale.view.AbstractSessionBean;
+import org.apache.shale.view.faces.LifecycleListener;
+
+/**
+ * <p>Specialized version of
+ * <code>org.apache.shale.view.faces.LifecycleListener</code>
+ * that implements callbacks to methods tagged by appropriate annotations,
+ * rather than requiring the containing classes to implement a particular
+ * interface or extend a particular subclass.</p>
+ *
+ * $Id$
+ *
+ * @since 1.0.3
+ */
+public class LifecycleListener2 extends LifecycleListener {
+
+
+ // ------------------------------------------------------------- Constructor
+
+
+ /**
+ * <p>Create a new lifecycle listener.</p>
+ */
+ public LifecycleListener2() {
+ }
+
+
+ // ------------------------------------------------------ Instance Variables
+
+
+ /**
+ * <p>Parameter values array that passes no parameters.</p>
+ */
+ private static final Object PARAMETERS[] = new Object[0];
+
+
+ // --------------------------------- ServletContextAttributeListener Methods
+
+
+ /**
+ * <p>Respond to an application scope attribute being added. If the
+ * value is an {@link AbstractApplicationBean}, call its
+ * <code>init()</code> method.</p>
+ *
+ * @param event Event to be processed
+ */
+ public void attributeAdded(ServletContextAttributeEvent event) {
+
+ Object value = event.getValue();
+ if (value != null) {
+ fireApplicationInit(value);
+ }
+
+ }
+
+
+ /**
+ * <p>Respond to an application scope attribute being replaced.
+ * If the old value was an {@link AbstractApplicationBean}, call
+ * its <code>destroy()</code> method. If the new value is an
+ * {@link AbstractApplicationBean}, call its <code>init()</code>
+ * method.</p>
+ *
+ * @param event Event to be processed
+ */
+ public void attributeReplaced(ServletContextAttributeEvent event) {
+
+ Object value = event.getValue();
+ if (value != null) {
+ fireApplicationDestroy(value);
+ }
+
+ value = event.getServletContext().getAttribute(event.getName());
+ if (value != null) {
+ fireApplicationInit(value);
+ }
+
+ }
+
+
+ /**
+ * <p>Respond to an application scope attribute being removed.
+ * If the old value was an {@link AbstractApplicationBean}, call
+ * its <code>destroy()</code> method.</p>
+ *
+ * @param event Event to be processed
+ */
+ public void attributeRemoved(ServletContextAttributeEvent event) {
+
+ Object value = event.getValue();
+ if (value != null) {
+ fireApplicationDestroy(value);
+ }
+
+ }
+
+
+ // ----------------------------------- HttpSessionActivationListener Methods
+
+
+ /**
+ * <p>Respond to a "session will passivate" event. Notify all session
+ * scope attributes that are {@link AbstractSessionBean}s.</p>
+ *
+ * @param event Event to be processed
+ */
+ public void sessionWillPassivate(HttpSessionEvent event) {
+
+ Enumeration names = event.getSession().getAttributeNames();
+ while (names.hasMoreElements()) {
+ String name = (String) names.nextElement();
+ Object value = event.getSession().getAttribute(name);
+ if (value != null) {
+ fireSessionPassivate(value);
+ }
+ }
+
+ }
+
+
+ /**
+ * <p>Respond to a "session did activate" event. Notify all session
+ * scope attributes that are {@link AbstractSessionBean}s.</p>
+ *
+ * @param event Event to be processed
+ */
+ public void sessionDidActivate(HttpSessionEvent event) {
+
+ Enumeration names = event.getSession().getAttributeNames();
+ while (names.hasMoreElements()) {
+ String name = (String) names.nextElement();
+ Object value = event.getSession().getAttribute(name);
+ if (value != null) {
+ fireSessionActivate(value);
+ }
+ }
+
+ }
+
+
+ // ------------------------------------ HttpSessionAttributeListener Methods
+
+
+ /**
+ * <p>Respond to a session scope attribute being added. If the
+ * value is an {@link AbstractSessionBean}, call its
+ * <code>init()</code> method.</p>
+ *
+ * @param event Event to be processed
+ */
+ public void attributeAdded(HttpSessionBindingEvent event) {
+
+ Object value = event.getValue();
+ if (value != null) {
+ fireSessionInit(value);
+ }
+
+ }
+
+
+ /**
+ * <p>Respond to a session scope attribute being replaced.
+ * If the old value was an {@link AbstractSessionBean}, call
+ * its <code>destroy()</code> method. If the new value is an
+ * {@link AbstractSessionBean}, call its <code>init()</code>
+ * method.</p>
+ *
+ * @param event Event to be processed
+ */
+ public void attributeReplaced(HttpSessionBindingEvent event) {
+
+ Object value = event.getValue();
+ if (value != null) {
+ fireSessionDestroy(value);
+ }
+
+ value = event.getSession().getAttribute(event.getName());
+ if (value != null) {
+ fireSessionInit(value);
+ }
+
+ }
+
+
+ /**
+ * <p>Respond to a session scope attribute being removed.
+ * If the old value was an {@link AbstractSessionBean}, call
+ * its <code>destroy()</code> method.</p>
+ *
+ * @param event Event to be processed
+ */
+ public void attributeRemoved(HttpSessionBindingEvent event) {
+
+ Object value = event.getValue();
+ if (value != null) {
+ fireSessionDestroy(value);
+ }
+
+ }
+
+
+ // --------------------------------- ServletRequestAttributeListener Methods
+
+
+ /**
+ * <p>Respond to a request scope attribute being added. If the
+ * value is an {@link AbstractRequestBean}, call its <code>init()</code> method.
+ * </p>
+ *
+ * @param event Event to be processed
+ */
+ public void attributeAdded(ServletRequestAttributeEvent event) {
+
+ Object value = event.getValue();
+ if (value != null) {
+ fireRequestInit(value);
+ }
+
+ }
+
+
+ /**
+ * <p>Respond to a request scope attribute being replaced.
+ * If the old value was an {@link AbstractRequestBean},
+ * call its <code>destroy()</code> method. If the new value is an
+ * {@link AbstractRequestBean}, call its <code>init()</code> method.</p>
+ *
+ * @param event Event to be processed
+ */
+ public void attributeReplaced(ServletRequestAttributeEvent event) {
+
+ Object value = event.getValue();
+ if (value != null) {
+ fireRequestDestroy(value);
+ }
+
+ value = event.getServletRequest().getAttribute(event.getName());
+ if (value != null) {
+ fireRequestInit(value);
+ }
+
+ }
+
+
+ /**
+ * <p>Respond to a request scope attribute being removed.
+ * If the old value was an {@link AbstractRequestBean},
+ * call its <code>destroy()</code> method.</p>
+ *
+ * @param event Event to be processed
+ */
+ public void attributeRemoved(ServletRequestAttributeEvent event) {
+
+ Object value = event.getValue();
+ if (value != null) {
+ fireRequestDestroy(value);
+ }
+
+ }
+
+
+ // ------------------------------------------------------- Protected Methods
+
+
+ /**
+ * <p>Fire a destroy event on an @{link AbstractApplicationBean}.</p>
+ *
+ * @param bean {@link AbstractApplicationBean} to fire event on
+ */
+ protected void fireApplicationDestroy(Object bean) {
+
+ if (bean instanceof AbstractApplicationBean) {
+ super.fireApplicationDestroy(bean);
+ return;
+ }
+
+ try {
+ Method method = method(bean, Destroy.class);
+ if (method != null) {
+ method.invoke(bean, PARAMETERS);
+ }
+ } catch (InvocationTargetException e) {
+ cacheException((Exception) e.getCause());
+ } catch (Exception e) {
+ cacheException(e);
+ }
+
+ }
+
+
+ /**
+ * <p>Fire an init event on an {@link AbstractApplicationBean}.</p>
+ *
+ * @param bean {@link AbstractApplicationBean} to fire event on
+ */
+ protected void fireApplicationInit(Object bean) {
+
+ if (bean instanceof AbstractApplicationBean) {
+ super.fireApplicationInit(bean);
+ return;
+ }
+
+ try {
+ Method method = method(bean, Init.class);
+ if (method != null) {
+ method.invoke(bean, PARAMETERS);
+ }
+ } catch (InvocationTargetException e) {
+ cacheException((Exception) e.getCause());
+ } catch (Exception e) {
+ cacheException(e);
+ }
+
+ }
+
+
+ /**
+ * <p>Fire a destroy event on an @{link AbstractRequestBean}.</p>
+ *
+ * @param bean {@link AbstractRequestBean} to fire event on
+ */
+ protected void fireRequestDestroy(Object bean) {
+
+ if (bean instanceof AbstractRequestBean) {
+ super.fireRequestDestroy(bean);
+ return;
+ }
+
+ try {
+ Method method = method(bean, Destroy.class);
+ if (method != null) {
+ method.invoke(bean, PARAMETERS);
+ }
+ } catch (InvocationTargetException e) {
+ cacheException((Exception) e.getCause());
+ } catch (Exception e) {
+ cacheException(e);
+ }
+
+ }
+
+
+ /**
+ * <p>Fire an init event on an {@link AbstractRequestBean}.</p>
+ *
+ * @param bean {@link AbstractRequestBean} to fire event on
+ */
+ protected void fireRequestInit(Object bean) {
+
+ if (bean instanceof AbstractRequestBean) {
+ super.fireRequestInit(bean);
+ return;
+ }
+
+ try {
+ Method method = method(bean, Init.class);
+ if (method != null) {
+ method.invoke(bean, PARAMETERS);
+ }
+ } catch (InvocationTargetException e) {
+ cacheException((Exception) e.getCause());
+ } catch (Exception e) {
+ cacheException(e);
+ }
+
+ }
+
+
+ /**
+ * <p>Fire an activate event on an @{link AbstractSessionBean}.</p>
+ *
+ * @param bean {@link AbstractSessionBean} to fire event on
+ */
+ protected void fireSessionActivate(Object bean) {
+
+ if (bean instanceof AbstractSessionBean) {
+ super.fireSessionActivate(bean);
+ return;
+ }
+
+ try {
+ Method method = method(bean, Activate.class);
+ if (method != null) {
+ method.invoke(bean, PARAMETERS);
+ }
+ } catch (InvocationTargetException e) {
+ cacheException((Exception) e.getCause());
+ } catch (Exception e) {
+ cacheException(e);
+ }
+
+ }
+
+
+ /**
+ * <p>Fire a destroy event on an @{link AbstractSessionBean}.</p>
+ *
+ * @param bean {@link AbstractSessionBean} to fire event on
+ */
+ protected void fireSessionDestroy(Object bean) {
+
+ if (bean instanceof AbstractSessionBean) {
+ super.fireSessionDestroy(bean);
+ return;
+ }
+
+ try {
+ Method method = method(bean, Destroy.class);
+ if (method != null) {
+ method.invoke(bean, PARAMETERS);
+ }
+ } catch (InvocationTargetException e) {
+ cacheException((Exception) e.getCause());
+ } catch (Exception e) {
+ cacheException(e);
+ }
+
+ }
+
+
+ /**
+ * <p>Fire an init event on an {@link AbstractSessionBean}.</p>
+ *
+ * @param bean {@link AbstractSessionBean} to fire event on
+ */
+ protected void fireSessionInit(Object bean) {
+
+ if (bean instanceof AbstractSessionBean) {
+ super.fireSessionInit(bean);
+ return;
+ }
+
+ try {
+ Method method = method(bean, Init.class);
+ if (method != null) {
+ method.invoke(bean, PARAMETERS);
+ }
+ } catch (InvocationTargetException e) {
+ cacheException((Exception) e.getCause());
+ } catch (Exception e) {
+ cacheException(e);
+ }
+
+ }
+
+
+ /**
+ * <p>Fire an passivate event on an @{link AbstractSessionBean}.</p>
+ *
+ * @param bean {@link AbstractSessionBean} to fire event on
+ */
+ protected void fireSessionPassivate(Object bean) {
+
+ if (bean instanceof AbstractSessionBean) {
+ super.fireSessionPassivate(bean);
+ return;
+ }
+
+ try {
+ Method method = method(bean, Passivate.class);
+ if (method != null) {
+ method.invoke(bean, PARAMETERS);
+ }
+ } catch (InvocationTargetException e) {
+ cacheException((Exception) e.getCause());
+ } catch (Exception e) {
+ cacheException(e);
+ }
+
+ }
+
+
+ // --------------------------------------------------------- Private Methods
+
+
+ /**
+ * <p>The set of method annotations for callbacks of interest.</p>
+ */
+ private static final Class annotations[] =
+ { Init.class, Preprocess.class, Prerender.class, Destroy.class,
+ Activate.class, Passivate.class };
+
+
+
+ /**
+ * <p>The set of class annotations for classes of interest.</p>
+ */
+ private static final Class markers[] =
+ { View.class, Request.class, Session.class, Application.class };
+
+
+ /**
+ * <p>Data structure to maintain information about annotated
+ * methods. In this map, the key is the Class being analyzed,
+ * and the value is an inner map. In the inner map, the key
+ * is an Annotation class, and the value is the corresponding
+ * Method instance.</p>
+ */
+ private transient Map<Class,Map<Class,Method>> maps =
+ new HashMap<Class,Map<Class,Method>>();
+
+
+ /**
+ * <p>Return the <code>Method</code> to be called for the specified
+ * annotation on the specified instance, if any. If there is no such
+ * method, return <code>null</code>.</p>
+ *
+ * @param instance Instance on which callbacks will be performed
+ * @param annotation Annotation for which to return a method
+ */
+ private Method method(Object instance, Class annotation) {
+
+
+ // Does the underlying class implement a relevant class annotation?
+ // If not, exit early
+ Class clazz = instance.getClass();
+ boolean found = false;
+ for (Class marker : markers) {
+ if (clazz.getAnnotation(marker) != null) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ return null;
+ }
+
+ synchronized (maps) {
+
+ // If we have seen this Class already, simply return the
+ // previously located Method (if any)
+ Map<Class,Method> map = maps.get(clazz);
+ if (map != null) {
+ return map.get(annotation);
+ }
+
+ // Construct and cache a new Map identifying the
+ // methods of interest for these callbacks
+ map = new HashMap<Class,Method>();
+ Method methods[] = clazz.getMethods();
+ for (Method method : methods) {
+ if (method.getParameterTypes().length > 0) {
+ continue;
+ }
+ for (Class anno : annotations) {
+ if (method.getAnnotation(anno) != null) {
+ map.put(anno, method);
+ }
+ }
+ }
+ maps.put(clazz, map);
+ return map.get(annotation);
+
+ }
+
+ }
+
+
+}
Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/faces/LifecycleListener2.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/faces/LifecycleListener2.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/faces/ViewControllerCallbacks2.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/faces/ViewControllerCallbacks2.java?rev=408564&r1=408563&r2=408564&view=diff
==============================================================================
--- struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/faces/ViewControllerCallbacks2.java (original)
+++ struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/faces/ViewControllerCallbacks2.java Sun May 21 21:10:43 2006
@@ -1,237 +1,237 @@
-/*
- * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed 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.shale.tiger.view.faces;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-import javax.faces.FacesException;
-import org.apache.shale.tiger.view.Destroy;
-import org.apache.shale.tiger.view.Init;
-import org.apache.shale.tiger.view.Preprocess;
-import org.apache.shale.tiger.view.Prerender;
-import org.apache.shale.tiger.view.View;
-import org.apache.shale.view.ViewController;
-import org.apache.shale.view.faces.ViewControllerCallbacks;
-
-/**
- * <p>Utility class to perform the event callbacks specified by the
- * {@link ViewController} interface. This version will call through
- * to ViewController methods if the bean class actually implements this
- * interface, or ituses annotations to identify the relevant methods.</p>
- *
- * <p><strong>NOTE</strong> - The annotated callback methods must be
- * public, and take no arguments. They may exist on the class of the
- * instance being passed in, or be inherited from a superclass.</p>
- *
- * $Id: ViewPhaseListener.java 367148 2006-01-09 01:01:56Z craigmcc $
- *
- * @since 1.0.1
- */
-public class ViewControllerCallbacks2 extends ViewControllerCallbacks {
-
-
- // ------------------------------------------------------------ Constructors
-
-
- // ------------------------------------------------------ Instance Variables
-
-
- // ---------------------------------------------------------- Public Methods
-
-
- /**
- * <p>Perform the <code>init</code> callback on the specified
- * instance.</p>
- *
- * @param instance Bean instance on which to perform this callback
- */
- public void init(Object instance) {
-
- if (instance instanceof ViewController) {
- ((ViewController) instance).init();
- return;
- }
-
- Method method = method(instance, Init.class);
- if (method != null) {
- try {
- method.invoke(instance, new Object[0]);
- } catch (IllegalAccessException e) {
- throw new FacesException(e);
- } catch (InvocationTargetException e) {
- throw new FacesException(e.getCause());
- }
- }
-
- }
-
-
- /**
- * <p>Perform the <code>preprocess</code> callback on the specified
- * instance.</p>
- *
- * @param instance Bean instance on which to perform this callback
- */
- public void preprocess(Object instance) {
-
- if (instance instanceof ViewController) {
- ((ViewController) instance).preprocess();
- return;
- }
-
- Method method = method(instance, Preprocess.class);
- if (method != null) {
- try {
- method.invoke(instance, new Object[0]);
- } catch (IllegalAccessException e) {
- throw new FacesException(e);
- } catch (InvocationTargetException e) {
- throw new FacesException(e.getCause());
- }
- }
-
- }
-
-
- /**
- * <p>Perform the <code>prerender</code> callback on the specified
- * instance.</p>
- *
- * @param instance Bean instance on which to perform this callback
- */
- public void prerender(Object instance) {
-
- if (instance instanceof ViewController) {
- ((ViewController) instance).prerender();
- return;
- }
-
- Method method = method(instance, Prerender.class);
- if (method != null) {
- try {
- method.invoke(instance, new Object[0]);
- } catch (IllegalAccessException e) {
- throw new FacesException(e);
- } catch (InvocationTargetException e) {
- throw new FacesException(e.getCause());
- }
- }
-
- }
-
-
- /**
- * <p>Perform the <code>destroy</code> callback on the specified
- * instance.</p>
- *
- * @param instance Bean instance on which to perform this callback
- */
- public void destroy(Object instance) {
-
- if (instance instanceof ViewController) {
- ((ViewController) instance).destroy();
- return;
- }
-
- Method method = method(instance, Destroy.class);
- if (method != null) {
- try {
- method.invoke(instance, new Object[0]);
- } catch (IllegalAccessException e) {
- throw new FacesException(e);
- } catch (InvocationTargetException e) {
- throw new FacesException(e.getCause());
- }
- }
-
- }
-
-
- // --------------------------------------------------------- Private Methods
-
-
- /**
- * <p>The set of method annotations for callbacks of interest.</p>
- */
- private static final Class annotations[] =
- { Init.class, Preprocess.class, Prerender.class, Destroy.class };
-
-
-
- /**
- * <p>Data structure to maintain information about annotated
- * methods. In this map, the key is the Class being analyzed,
- * and the value is an inner map. In the inner map, the key
- * is an Annotation class, and the value is the corresponding
- * Method instance.</p>
- */
- private transient Map<Class,Map<Class,Method>> maps =
- new HashMap<Class,Map<Class,Method>>();
-
-
- /**
- * <p>Return the <code>Method</code> to be called for the specified
- * annotation on the specified instance, if any. If there is no such
- * method, return <code>null</code>.</p>
- *
- * @param instance Instance on which callbacks will be performed
- * @param annotation Annotation for which to return a method
- */
- private Method method(Object instance, Class annotation) {
-
- // Does the underlying class implement the View annotation?
- // If not, exit early
- Class clazz = instance.getClass();
- if (clazz.getAnnotation(View.class) == null) {
- return null;
- }
-
- synchronized (maps) {
-
- // If we have seen this Class already, simply return the
- // previously located Method (if any)
- Map<Class,Method> map = maps.get(clazz);
- if (map != null) {
- return map.get(annotation);
- }
-
- // Construct and cache a new Map identifying the
- // methods of interest for these callbacks
- map = new HashMap<Class,Method>();
- Method methods[] = clazz.getMethods();
- for (int i = 0; i < methods.length; i++) {
- if (methods[i].getParameterTypes().length > 0) {
- continue;
- }
- for (int j = 0; j < annotations.length; j++) {
- if (methods[i].getAnnotation(annotations[j]) != null) {
- map.put(annotations[j], methods[i]);
- }
- }
- }
- maps.put(clazz, map);
- return map.get(annotation);
-
- }
-
- }
-
-
-}
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.shale.tiger.view.faces;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+import javax.faces.FacesException;
+import org.apache.shale.tiger.view.Destroy;
+import org.apache.shale.tiger.view.Init;
+import org.apache.shale.tiger.view.Preprocess;
+import org.apache.shale.tiger.view.Prerender;
+import org.apache.shale.tiger.view.View;
+import org.apache.shale.view.ViewController;
+import org.apache.shale.view.faces.ViewControllerCallbacks;
+
+/**
+ * <p>Utility class to perform the event callbacks specified by the
+ * {@link ViewController} interface. This version will call through
+ * to ViewController methods if the bean class actually implements this
+ * interface, or ituses annotations to identify the relevant methods.</p>
+ *
+ * <p><strong>NOTE</strong> - The annotated callback methods must be
+ * public, and take no arguments. They may exist on the class of the
+ * instance being passed in, or be inherited from a superclass.</p>
+ *
+ * $Id$
+ *
+ * @since 1.0.1
+ */
+public class ViewControllerCallbacks2 extends ViewControllerCallbacks {
+
+
+ // ------------------------------------------------------------ Constructors
+
+
+ // ------------------------------------------------------ Instance Variables
+
+
+ // ---------------------------------------------------------- Public Methods
+
+
+ /**
+ * <p>Perform the <code>init</code> callback on the specified
+ * instance.</p>
+ *
+ * @param instance Bean instance on which to perform this callback
+ */
+ public void init(Object instance) {
+
+ if (instance instanceof ViewController) {
+ ((ViewController) instance).init();
+ return;
+ }
+
+ Method method = method(instance, Init.class);
+ if (method != null) {
+ try {
+ method.invoke(instance, new Object[0]);
+ } catch (IllegalAccessException e) {
+ throw new FacesException(e);
+ } catch (InvocationTargetException e) {
+ throw new FacesException(e.getCause());
+ }
+ }
+
+ }
+
+
+ /**
+ * <p>Perform the <code>preprocess</code> callback on the specified
+ * instance.</p>
+ *
+ * @param instance Bean instance on which to perform this callback
+ */
+ public void preprocess(Object instance) {
+
+ if (instance instanceof ViewController) {
+ ((ViewController) instance).preprocess();
+ return;
+ }
+
+ Method method = method(instance, Preprocess.class);
+ if (method != null) {
+ try {
+ method.invoke(instance, new Object[0]);
+ } catch (IllegalAccessException e) {
+ throw new FacesException(e);
+ } catch (InvocationTargetException e) {
+ throw new FacesException(e.getCause());
+ }
+ }
+
+ }
+
+
+ /**
+ * <p>Perform the <code>prerender</code> callback on the specified
+ * instance.</p>
+ *
+ * @param instance Bean instance on which to perform this callback
+ */
+ public void prerender(Object instance) {
+
+ if (instance instanceof ViewController) {
+ ((ViewController) instance).prerender();
+ return;
+ }
+
+ Method method = method(instance, Prerender.class);
+ if (method != null) {
+ try {
+ method.invoke(instance, new Object[0]);
+ } catch (IllegalAccessException e) {
+ throw new FacesException(e);
+ } catch (InvocationTargetException e) {
+ throw new FacesException(e.getCause());
+ }
+ }
+
+ }
+
+
+ /**
+ * <p>Perform the <code>destroy</code> callback on the specified
+ * instance.</p>
+ *
+ * @param instance Bean instance on which to perform this callback
+ */
+ public void destroy(Object instance) {
+
+ if (instance instanceof ViewController) {
+ ((ViewController) instance).destroy();
+ return;
+ }
+
+ Method method = method(instance, Destroy.class);
+ if (method != null) {
+ try {
+ method.invoke(instance, new Object[0]);
+ } catch (IllegalAccessException e) {
+ throw new FacesException(e);
+ } catch (InvocationTargetException e) {
+ throw new FacesException(e.getCause());
+ }
+ }
+
+ }
+
+
+ // --------------------------------------------------------- Private Methods
+
+
+ /**
+ * <p>The set of method annotations for callbacks of interest.</p>
+ */
+ private static final Class annotations[] =
+ { Init.class, Preprocess.class, Prerender.class, Destroy.class };
+
+
+
+ /**
+ * <p>Data structure to maintain information about annotated
+ * methods. In this map, the key is the Class being analyzed,
+ * and the value is an inner map. In the inner map, the key
+ * is an Annotation class, and the value is the corresponding
+ * Method instance.</p>
+ */
+ private transient Map<Class,Map<Class,Method>> maps =
+ new HashMap<Class,Map<Class,Method>>();
+
+
+ /**
+ * <p>Return the <code>Method</code> to be called for the specified
+ * annotation on the specified instance, if any. If there is no such
+ * method, return <code>null</code>.</p>
+ *
+ * @param instance Instance on which callbacks will be performed
+ * @param annotation Annotation for which to return a method
+ */
+ private Method method(Object instance, Class annotation) {
+
+ // Does the underlying class implement the View annotation?
+ // If not, exit early
+ Class clazz = instance.getClass();
+ if (clazz.getAnnotation(View.class) == null) {
+ return null;
+ }
+
+ synchronized (maps) {
+
+ // If we have seen this Class already, simply return the
+ // previously located Method (if any)
+ Map<Class,Method> map = maps.get(clazz);
+ if (map != null) {
+ return map.get(annotation);
+ }
+
+ // Construct and cache a new Map identifying the
+ // methods of interest for these callbacks
+ map = new HashMap<Class,Method>();
+ Method methods[] = clazz.getMethods();
+ for (int i = 0; i < methods.length; i++) {
+ if (methods[i].getParameterTypes().length > 0) {
+ continue;
+ }
+ for (int j = 0; j < annotations.length; j++) {
+ if (methods[i].getAnnotation(annotations[j]) != null) {
+ map.put(annotations[j], methods[i]);
+ }
+ }
+ }
+ maps.put(clazz, map);
+ return map.get(annotation);
+
+ }
+
+ }
+
+
+}
Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/faces/ViewControllerCallbacks2.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/view/faces/ViewControllerCallbacks2.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/ApplicationBean1.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/ApplicationBean1.java?rev=408564&r1=408563&r2=408564&view=diff
==============================================================================
--- struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/ApplicationBean1.java (original)
+++ struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/ApplicationBean1.java Sun May 21 21:10:43 2006
@@ -1,52 +1,52 @@
-/*
- * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed 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.shale.tiger.view.faces;
-
-import org.apache.shale.view.AbstractApplicationBean;
-
-/**
- * <p>Test bean that subclasses <code>AbstractApplicationBean</code> so we can
- * test pass-through calls to "regular" bean instances.</p>
- */
-public class ApplicationBean1 extends AbstractApplicationBean {
-
-
- private StringBuffer sb = new StringBuffer();
-
-
- // -------------------------------------------------------- Callback Methods
-
-
- public void init() {
- sb.append("init/");
- }
-
-
- public void destroy() {
- sb.append("destroy/");
- }
-
-
- // ---------------------------------------------------------- Public Methods
-
-
- public String log() {
- return sb.toString();
- }
-
-
-}
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.shale.tiger.view.faces;
+
+import org.apache.shale.view.AbstractApplicationBean;
+
+/**
+ * <p>Test bean that subclasses <code>AbstractApplicationBean</code> so we can
+ * test pass-through calls to "regular" bean instances.</p>
+ */
+public class ApplicationBean1 extends AbstractApplicationBean {
+
+
+ private StringBuffer sb = new StringBuffer();
+
+
+ // -------------------------------------------------------- Callback Methods
+
+
+ public void init() {
+ sb.append("init/");
+ }
+
+
+ public void destroy() {
+ sb.append("destroy/");
+ }
+
+
+ // ---------------------------------------------------------- Public Methods
+
+
+ public String log() {
+ return sb.toString();
+ }
+
+
+}
Propchange: struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/ApplicationBean1.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/ApplicationBean1.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/ApplicationBean2.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/ApplicationBean2.java?rev=408564&r1=408563&r2=408564&view=diff
==============================================================================
--- struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/ApplicationBean2.java (original)
+++ struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/ApplicationBean2.java Sun May 21 21:10:43 2006
@@ -1,58 +1,58 @@
-/*
- * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed 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.shale.tiger.view.faces;
-
-import org.apache.shale.tiger.view.Application;
-import org.apache.shale.tiger.view.Destroy;
-import org.apache.shale.tiger.view.Init;
-import org.apache.shale.view.AbstractApplicationBean;
-
-/**
- * <p>Test bean that does not subclass <code>AbstractApplicationBean</code>,
- * but uses corresponding annotations, so that we can test callback events.</p>
- */
-@Application
-public class ApplicationBean2 {
-
-
- private StringBuffer sb = new StringBuffer();
-
-
- // -------------------------------------------------------- Callback Methods
-
-
- @Init
- public void doInit() {
- sb.append("init/");
- }
-
-
- @Destroy
- public void doDestroy() {
- sb.append("destroy/");
- }
-
-
- // ---------------------------------------------------------- Public Methods
-
-
- public String log() {
- return sb.toString();
- }
-
-
-}
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.shale.tiger.view.faces;
+
+import org.apache.shale.tiger.view.Application;
+import org.apache.shale.tiger.view.Destroy;
+import org.apache.shale.tiger.view.Init;
+import org.apache.shale.view.AbstractApplicationBean;
+
+/**
+ * <p>Test bean that does not subclass <code>AbstractApplicationBean</code>,
+ * but uses corresponding annotations, so that we can test callback events.</p>
+ */
+@Application
+public class ApplicationBean2 {
+
+
+ private StringBuffer sb = new StringBuffer();
+
+
+ // -------------------------------------------------------- Callback Methods
+
+
+ @Init
+ public void doInit() {
+ sb.append("init/");
+ }
+
+
+ @Destroy
+ public void doDestroy() {
+ sb.append("destroy/");
+ }
+
+
+ // ---------------------------------------------------------- Public Methods
+
+
+ public String log() {
+ return sb.toString();
+ }
+
+
+}
Propchange: struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/ApplicationBean2.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/ApplicationBean2.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/CallbacksFactoryTestCase.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/CallbacksFactoryTestCase.java?rev=408564&r1=408563&r2=408564&view=diff
==============================================================================
--- struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/CallbacksFactoryTestCase.java (original)
+++ struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/CallbacksFactoryTestCase.java Sun May 21 21:10:43 2006
@@ -1,99 +1,99 @@
-/*
- * Copyright 2006 The Apache Software Foundation.
- *
- * Licensed 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.shale.tiger.view.faces;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import org.apache.shale.view.faces.CallbacksFactory;
-import org.apache.shale.view.faces.ViewControllerCallbacks;
-
-/**
- * <p>Test case for <code>org.apache.shale.view.faces.CallbacksFactory</code>
- * when the Shale Tiger extensions are available.</p>
- */
-public class CallbacksFactoryTestCase extends TestCase {
-
-
- // ------------------------------------------------------------ Constructors
-
-
- // Construct a new instance of this test case.
- public CallbacksFactoryTestCase(String name) {
- super(name);
- }
-
-
- // ---------------------------------------------------- Overall Test Methods
-
-
- // Set up instance variables required by this test case.
- public void setUp() {
-
- factory = CallbacksFactory.getInstance();
-
- }
-
-
- // Return the tests included in this test case.
- public static Test suite() {
-
- return (new TestSuite(CallbacksFactoryTestCase.class));
-
- }
-
-
- // Tear down instance variables required by this test case.
- public void tearDown() {
-
- factory = null;
-
- }
-
-
- // ------------------------------------------------------ Instance Variables
-
-
- private CallbacksFactory factory = null;
-
-
- // ------------------------------------------------------------ Test Methods
-
-
-
- // Test a prisine instance
- public void testPristine() {
-
- ;
-
- }
-
-
- // Test returning a ViewControllerCallbacks instance
- public void testViewControllerCallbacks() {
-
- ViewControllerCallbacks vcc = factory.getViewControllerCallbacks();
- assertNotNull(vcc);
- assertEquals("org.apache.shale.tiger.view.faces.ViewControllerCallbacks2",
- vcc.getClass().getName());
-
- }
-
-
-
-
-}
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.shale.tiger.view.faces;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.shale.view.faces.CallbacksFactory;
+import org.apache.shale.view.faces.ViewControllerCallbacks;
+
+/**
+ * <p>Test case for <code>org.apache.shale.view.faces.CallbacksFactory</code>
+ * when the Shale Tiger extensions are available.</p>
+ */
+public class CallbacksFactoryTestCase extends TestCase {
+
+
+ // ------------------------------------------------------------ Constructors
+
+
+ // Construct a new instance of this test case.
+ public CallbacksFactoryTestCase(String name) {
+ super(name);
+ }
+
+
+ // ---------------------------------------------------- Overall Test Methods
+
+
+ // Set up instance variables required by this test case.
+ public void setUp() {
+
+ factory = CallbacksFactory.getInstance();
+
+ }
+
+
+ // Return the tests included in this test case.
+ public static Test suite() {
+
+ return (new TestSuite(CallbacksFactoryTestCase.class));
+
+ }
+
+
+ // Tear down instance variables required by this test case.
+ public void tearDown() {
+
+ factory = null;
+
+ }
+
+
+ // ------------------------------------------------------ Instance Variables
+
+
+ private CallbacksFactory factory = null;
+
+
+ // ------------------------------------------------------------ Test Methods
+
+
+
+ // Test a prisine instance
+ public void testPristine() {
+
+ ;
+
+ }
+
+
+ // Test returning a ViewControllerCallbacks instance
+ public void testViewControllerCallbacks() {
+
+ ViewControllerCallbacks vcc = factory.getViewControllerCallbacks();
+ assertNotNull(vcc);
+ assertEquals("org.apache.shale.tiger.view.faces.ViewControllerCallbacks2",
+ vcc.getClass().getName());
+
+ }
+
+
+
+
+}
Propchange: struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/CallbacksFactoryTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/shale/trunk/tiger/src/test/org/apache/shale/tiger/view/faces/CallbacksFactoryTestCase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL