You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cs...@apache.org on 2007/02/27 18:39:44 UTC

svn commit: r512335 - in /beehive/trunk/samples: ./ controls-lifecycle/ controls-lifecycle/src/ controls-lifecycle/src/controls/ controls-lifecycle/src/service/ controls-lifecycle/web/

Author: cschoett
Date: Tue Feb 27 09:39:43 2007
New Revision: 512335

URL: http://svn.apache.org/viewvc?view=rev&rev=512335
Log:
Some cleanup of the controls-lifecycle sample.

Added:
    beehive/trunk/samples/controls-lifecycle/src/service/EventRecorderService.java   (contents, props changed)
      - copied, changed from r511973, beehive/trunk/samples/controls-lifecycle/src/service/LifecycleRecorder.java
    beehive/trunk/samples/controls-lifecycle/src/service/EventRecorderServiceProvider.java   (contents, props changed)
      - copied, changed from r511973, beehive/trunk/samples/controls-lifecycle/src/service/LifecycleEventRecorderService.java
Removed:
    beehive/trunk/samples/controls-lifecycle/src/service/LifecycleEventRecorderService.java
    beehive/trunk/samples/controls-lifecycle/src/service/LifecycleRecorder.java
Modified:
    beehive/trunk/samples/build.xml
    beehive/trunk/samples/controls-lifecycle/README.txt
    beehive/trunk/samples/controls-lifecycle/build.xml
    beehive/trunk/samples/controls-lifecycle/src/Controller.java
    beehive/trunk/samples/controls-lifecycle/src/controls/InnerControlImpl.java
    beehive/trunk/samples/controls-lifecycle/src/controls/OuterControlImpl.java
    beehive/trunk/samples/controls-lifecycle/web/index.jsp

Modified: beehive/trunk/samples/build.xml
URL: http://svn.apache.org/viewvc/beehive/trunk/samples/build.xml?view=diff&rev=512335&r1=512334&r2=512335
==============================================================================
--- beehive/trunk/samples/build.xml (original)
+++ beehive/trunk/samples/build.xml Tue Feb 27 09:39:43 2007
@@ -33,6 +33,7 @@
 
         <ant dir="controls-blank" antfile="build.xml" target="clean" inheritAll="false"/>
         <ant dir="controls-spring" antfile="build.xml" target="clean" inheritAll="false"/>
+        <ant dir="controls-lifecycle" antfile="build.xml" target="clean" inheritAll="false"/>
         <ant dir="system-controls-jdbc" antfile="build.xml" target="clean" inheritAll="false"/>
 
         <ant dir="petstoreWeb" antfile="build.xml" target="scrub" inheritAll="false"/>
@@ -53,6 +54,7 @@
 
         <ant dir="controls-blank" antfile="build.xml" target="build" inheritAll="false"/>
         <ant dir="controls-spring" antfile="build.xml" target="build" inheritAll="false"/>
+        <ant dir="controls-lifecycle" antfile="build.xml" target="build" inheritAll="false"/>
         <ant dir="system-controls-jdbc" antfile="build.xml" target="build" inheritAll="false"/>
 
         <ant dir="petstoreWeb" antfile="build.xml" target="build" inheritAll="false"/>

Modified: beehive/trunk/samples/controls-lifecycle/README.txt
URL: http://svn.apache.org/viewvc/beehive/trunk/samples/controls-lifecycle/README.txt?view=diff&rev=512335&r1=512334&r2=512335
==============================================================================
--- beehive/trunk/samples/controls-lifecycle/README.txt (original)
+++ beehive/trunk/samples/controls-lifecycle/README.txt Tue Feb 27 09:39:43 2007
@@ -1,9 +1,9 @@
-Beehive Controls - Controls Lifecycle Sample
+Beehive Controls - Controls Life Cycle Sample
 ============================================
 
 This sample directory contains examples of:
 
-  * Controls lifecycle events.
+  * Controls life cycle and resource events.
   * Registering and using a custom service provider from Beehive controls.
 
 
@@ -21,7 +21,8 @@
     /controls-lifecycle/index.jsp
 
 This page includes links that will invoked controls from the page flow and display
-the resulting lifecycle events.  Lifecycle events are captured by the 
-LifeCycleEventRecorderService, a custom service registered with the ControlContainerContext
-and accessible from all controls within that context by using the '@Context' reference.
+the resulting life cycle and resource events.  Life cycle and resource events are
+captured by the EventRecorderService, a custom service registered with the
+ControlContainerContext and accessible from all controls within that context by
+using the '@Context' reference.
 

Modified: beehive/trunk/samples/controls-lifecycle/build.xml
URL: http://svn.apache.org/viewvc/beehive/trunk/samples/controls-lifecycle/build.xml?view=diff&rev=512335&r1=512334&r2=512335
==============================================================================
--- beehive/trunk/samples/controls-lifecycle/build.xml (original)
+++ beehive/trunk/samples/controls-lifecycle/build.xml Tue Feb 27 09:39:43 2007
@@ -107,6 +107,7 @@
 
     <target name="clean" description="Clean the webapp">
         <delete dir="${build.dir}" includeEmptyDirs="true"/>
+        <delete file="${basedir}/${context.path}.war" failonerror="false"/>
     </target>
 
     <target name="war" description="Build a compressed WAR file that can be deployed to an application container">

Modified: beehive/trunk/samples/controls-lifecycle/src/Controller.java
URL: http://svn.apache.org/viewvc/beehive/trunk/samples/controls-lifecycle/src/Controller.java?view=diff&rev=512335&r1=512334&r2=512335
==============================================================================
--- beehive/trunk/samples/controls-lifecycle/src/Controller.java (original)
+++ beehive/trunk/samples/controls-lifecycle/src/Controller.java Tue Feb 27 09:39:43 2007
@@ -19,8 +19,6 @@
 
 import java.util.Iterator;
 
-import javax.servlet.http.HttpSession;
-
 import org.apache.beehive.controls.api.bean.Control;
 import org.apache.beehive.controls.api.context.ControlContainerContext;
 import org.apache.beehive.controls.api.context.ControlThreadContext;
@@ -30,18 +28,18 @@
 
 import controls.OuterControl;
 
-import service.LifecycleEventRecorderService;
-import service.LifecycleRecorder;
+import service.EventRecorderServiceProvider;
+import service.EventRecorderService;
 
 /**
- * Demonstrates controls lifecycle events and the use of a custom service
- * for Beehive controls.
+ * Demonstrates controls life cycle and resource events and the use of a
+ * custom service provider for Beehive controls.
  */
 @Jpf.Controller(forwards = {@Jpf.Forward(name="index", path="index.jsp")})
 public class Controller extends PageFlowController {
 	private static final long serialVersionUID = -125820123L;
 
-	private LifecycleEventRecorderService _lfService;
+	private EventRecorderServiceProvider _lfService;
 	
 	@Control
 	private OuterControl _ctrl;
@@ -53,8 +51,8 @@
 	@Override
 	protected void onCreate() {
 		ControlContainerContext ccc = ControlThreadContext.getContext();
-		_lfService = new LifecycleEventRecorderService();
-		ccc.addService(LifecycleRecorder.class, _lfService);
+		_lfService = new EventRecorderServiceProvider();
+		ccc.addService(EventRecorderService.class, _lfService);
 	}
 
 	@Jpf.Action
@@ -83,10 +81,10 @@
 	}
 
     /**
-     * Get an Iterator for all logged events from the lifecycle service.
+     * Get an Iterator for all logged events from the event recorder service.
      */
     public Iterator<String> getControlEvents() {
-		LifecycleRecorder lr = (LifecycleRecorder)_lfService.getService(null, null, LifecycleRecorder.class, null);
+		EventRecorderService lr = (EventRecorderService)_lfService.getService(null, null, EventRecorderService.class, null);
 		return lr.getEvents();
 	}
 }

Modified: beehive/trunk/samples/controls-lifecycle/src/controls/InnerControlImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/samples/controls-lifecycle/src/controls/InnerControlImpl.java?view=diff&rev=512335&r1=512334&r2=512335
==============================================================================
--- beehive/trunk/samples/controls-lifecycle/src/controls/InnerControlImpl.java (original)
+++ beehive/trunk/samples/controls-lifecycle/src/controls/InnerControlImpl.java Tue Feb 27 09:39:43 2007
@@ -26,7 +26,7 @@
 import org.apache.beehive.controls.api.context.ControlBeanContext;
 import org.apache.beehive.controls.api.context.ResourceContext;
 import org.apache.beehive.controls.api.events.EventHandler;
-import service.LifecycleRecorder;
+import service.EventRecorderService;
 
 import java.io.Serializable;
 
@@ -46,14 +46,14 @@
     private ResourceContext _rc;
 
     @Context
-    private LifecycleRecorder _lc;
+    private EventRecorderService _lc;
 
     /**
      * onCreate EventHandler.
      */
     @EventHandler(field = "_cbc", eventSet = ControlBeanContext.LifeCycle.class, eventName = "onCreate")
     public void onCreate() {
-        _lc.logEvent(this, LifecycleRecorder.EventType.ON_CREATE);
+        _lc.logEvent(this, EventRecorderService.EventType.ON_CREATE);
     }
 
     /**
@@ -61,7 +61,7 @@
      */
     @EventHandler(field = "_rc", eventSet = ResourceContext.ResourceEvents.class, eventName = "onAcquire")
     public void onAcquire() {
-        _lc.logEvent(this, LifecycleRecorder.EventType.ON_ACQUIRE);
+        _lc.logEvent(this, EventRecorderService.EventType.ON_ACQUIRE);
     }
 
     /**
@@ -69,7 +69,7 @@
      */
     @EventHandler(field = "_rc", eventSet = ResourceContext.ResourceEvents.class, eventName = "onRelease")
     public void onRelease() {
-        _lc.logEvent(this, LifecycleRecorder.EventType.ON_RELEASE);
+        _lc.logEvent(this, EventRecorderService.EventType.ON_RELEASE);
     }
 
     /**

Modified: beehive/trunk/samples/controls-lifecycle/src/controls/OuterControlImpl.java
URL: http://svn.apache.org/viewvc/beehive/trunk/samples/controls-lifecycle/src/controls/OuterControlImpl.java?view=diff&rev=512335&r1=512334&r2=512335
==============================================================================
--- beehive/trunk/samples/controls-lifecycle/src/controls/OuterControlImpl.java (original)
+++ beehive/trunk/samples/controls-lifecycle/src/controls/OuterControlImpl.java Tue Feb 27 09:39:43 2007
@@ -27,7 +27,7 @@
 import org.apache.beehive.controls.api.context.ControlBeanContext;
 import org.apache.beehive.controls.api.context.ResourceContext;
 import org.apache.beehive.controls.api.events.EventHandler;
-import service.LifecycleRecorder;
+import service.EventRecorderService;
 
 import java.io.Serializable;
 
@@ -48,14 +48,14 @@
     private ResourceContext _rc;
 
     @Context
-    private LifecycleRecorder _lc;
+    private EventRecorderService _lc;
 
     /**
      * onCreate EventHandler.
      */
     @EventHandler(field = "_cbc", eventSet = ControlBeanContext.LifeCycle.class, eventName = "onCreate")
     public void onCreate() {
-        _lc.logEvent(this, LifecycleRecorder.EventType.ON_CREATE);
+        _lc.logEvent(this, EventRecorderService.EventType.ON_CREATE);
     }
 
     /**
@@ -63,7 +63,7 @@
      */
     @EventHandler(field = "_rc", eventSet = ResourceContext.ResourceEvents.class, eventName = "onAcquire")
     public void onAcquire() {
-        _lc.logEvent(this, LifecycleRecorder.EventType.ON_ACQUIRE);
+        _lc.logEvent(this, EventRecorderService.EventType.ON_ACQUIRE);
     }
 
     /**
@@ -71,7 +71,7 @@
      */
     @EventHandler(field = "_rc", eventSet = ResourceContext.ResourceEvents.class, eventName = "onRelease")
     public void onRelease() {
-        _lc.logEvent(this, LifecycleRecorder.EventType.ON_RELEASE);
+        _lc.logEvent(this, EventRecorderService.EventType.ON_RELEASE);
     }
 
     /**

Copied: beehive/trunk/samples/controls-lifecycle/src/service/EventRecorderService.java (from r511973, beehive/trunk/samples/controls-lifecycle/src/service/LifecycleRecorder.java)
URL: http://svn.apache.org/viewvc/beehive/trunk/samples/controls-lifecycle/src/service/EventRecorderService.java?view=diff&rev=512335&p1=beehive/trunk/samples/controls-lifecycle/src/service/LifecycleRecorder.java&r1=511973&p2=beehive/trunk/samples/controls-lifecycle/src/service/EventRecorderService.java&r2=512335
==============================================================================
--- beehive/trunk/samples/controls-lifecycle/src/service/LifecycleRecorder.java (original)
+++ beehive/trunk/samples/controls-lifecycle/src/service/EventRecorderService.java Tue Feb 27 09:39:43 2007
@@ -25,10 +25,10 @@
 import java.util.LinkedList;
 
 /**
- * Implementation of service provided by the LifecycleEventRecorderService service provider.
- * This service provides a simple mechanism to log control lifecycle events.
+ * Implementation of service provided by the EventRecorderServiceProvider service provider.
+ * This service provides a simple mechanism to log control events.
  */
-public class LifecycleRecorder implements Serializable {
+public class EventRecorderService implements Serializable {
 
     private static final long serialVersionUID = 6527468764100208475L;
     private LinkedList<String> _events = new LinkedList<String>();

Propchange: beehive/trunk/samples/controls-lifecycle/src/service/EventRecorderService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: beehive/trunk/samples/controls-lifecycle/src/service/EventRecorderService.java
------------------------------------------------------------------------------
    svn:executable = *

Copied: beehive/trunk/samples/controls-lifecycle/src/service/EventRecorderServiceProvider.java (from r511973, beehive/trunk/samples/controls-lifecycle/src/service/LifecycleEventRecorderService.java)
URL: http://svn.apache.org/viewvc/beehive/trunk/samples/controls-lifecycle/src/service/EventRecorderServiceProvider.java?view=diff&rev=512335&p1=beehive/trunk/samples/controls-lifecycle/src/service/LifecycleEventRecorderService.java&r1=511973&p2=beehive/trunk/samples/controls-lifecycle/src/service/EventRecorderServiceProvider.java&r2=512335
==============================================================================
--- beehive/trunk/samples/controls-lifecycle/src/service/LifecycleEventRecorderService.java (original)
+++ beehive/trunk/samples/controls-lifecycle/src/service/EventRecorderServiceProvider.java Tue Feb 27 09:39:43 2007
@@ -25,16 +25,16 @@
 
 /**
  * Custom controls service provider.  Once registered with a ControlContainerContext (CCC), this
- * service provider produces LifecycleRecorder service instances for controls within the CCC.
+ * service provider produces EventRecorderService service instances for controls within the CCC.
  * <p/>
  * Controls may get a service instance using the <code>@org.apache.beehive.controls.api.context.Context</code>
  * annotation in their implementations.  See InnerControlImpl or OuterControlImpl for sample of usage.
  */
-public class LifecycleEventRecorderService implements
+public class EventRecorderServiceProvider implements
         BeanContextServiceProvider, Serializable {
 
     private static final long serialVersionUID = -2688547397733439091L;
-    private LifecycleRecorder _recorder;
+    private EventRecorderService _recorderService;
 
     /**
      * Service selectors are not used by this service provide.  Always returns null.
@@ -55,16 +55,16 @@
      *                        <code>BeanContextServiceProvider</code> to distinguish service
      *                        requests from multiple sources.
      * @param requestor       The object requesting the service
-     * @param serviceClass    For this service provider value should always be <code>LifecycleRecorder</code>
+     * @param serviceClass    For this service provider value should always be <code>EventRecorderService</code>
      * @param serviceSelector Not applicable for this service provider, should always be <code>null</code>
      * @return a reference to the requested service
      */
     public Object getService(BeanContextServices bcs, Object requestor, Class serviceClass, Object serviceSelector) {
-        if (LifecycleRecorder.class.equals(serviceClass)) {
-            if (_recorder == null) {
-                _recorder = new LifecycleRecorder();
+        if (EventRecorderService.class.equals(serviceClass)) {
+            if (_recorderService == null) {
+                _recorderService = new EventRecorderService();
             }
-            return _recorder;
+            return _recorderService;
         }
         return null;
     }

Propchange: beehive/trunk/samples/controls-lifecycle/src/service/EventRecorderServiceProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: beehive/trunk/samples/controls-lifecycle/src/service/EventRecorderServiceProvider.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: beehive/trunk/samples/controls-lifecycle/web/index.jsp
URL: http://svn.apache.org/viewvc/beehive/trunk/samples/controls-lifecycle/web/index.jsp?view=diff&rev=512335&r1=512334&r2=512335
==============================================================================
--- beehive/trunk/samples/controls-lifecycle/web/index.jsp (original)
+++ beehive/trunk/samples/controls-lifecycle/web/index.jsp Tue Feb 27 09:39:43 2007
@@ -25,11 +25,11 @@
 <netui:base />
 </head>
 <netui:body>
-    <h3>Controls Lifecycle Sample</h3>
-    <p>This sample provides a demonstration of when control lifecycle events are fired by
-        the controls framework.  Click on the 'Invoke' links below to display a list of
-        lifecycle events fired for each.  These links may be clicked on in any order or
-        multiple times.
+    <h3>Controls Life Cycle Sample</h3>
+    <p>This sample provides a demonstration of when control life cycle and resource events
+        are fired by the controls framework.  Click on the 'Invoke' links below to display
+        a list of life cycle and resource events fired for each.  These links may be clicked
+        on in any order or multiple times.
     </p>
     <p>Use the 'Reset' link to clear the event list and reset this page flow to its initial state.
     </p>