com.esri.adf.web.data
Interface WebLifecycle

All Known Implementing Classes:
AGSExtensionsResource, AGSGeocodeResource, AGSGeometryResource, AGSGPResource, AGSImageResource, AGSLocalExtensionsResource, AGSLocalGeocodeResource, AGSLocalGeometryResource, AGSLocalGPResource, AGSLocalImageResource, AGSLocalMapResource, AGSMapResource, AIMSMapResource, DefaultGraphicsResource, EditBean, GISResource, GraphicsResource, VEGeocodeResource, VEImageryResource, VEResource, WebContext, WMSMapResource

public interface WebLifecycle

The WebLifecycle interface is implemented by WebContext attributes, GISResources and GISFunctionalitys alike to activate and passivate themselves before and after performing user operations respectively.

The ADF typically calls WebContext.activate() when a user request is received and calls WebContext.passivate() after the request has been serviced. When these two methods are called on the WebContext the context in turn calls back the same methods on its attributes and resources. The resources further invoke these call backs on its functionalities.

This interface is typically implemented by GISFunctionalitys to give themselves an opportunity to setup before performing user operations and subsequently cleanup themselves after the operations have been performed. Some scenarios where activation and passivation is useful are connecting to and releasing connections, deserializing and serializing objects, etc.

The ArcGIS Server (AGS) resources and functionalities make most use of this interface. The AGS resource objects such as AGSLocalMapResource and AGSLocalGeocodeResource use the activate() method to connect to the GIS server and to create an IServerContext and they use the passivate() method to subsequently release the previously created IServerContext. Since the AGS resources release the server context on passivate(), the AGS (Local) functionalities cannot hold on to live server objects after the resource passivates. So they should use the passivate() method to serialize server objects such as IMapDescription and IImageDescription and deserialize them back to their object form in the activate() method:

 public class MyAGSLocalFunctionality implements GISFunctionality, WebLifecycle {
   IMapDescription mapDesc;
   String serializedMapDesc;
   ...
   public void passivate() {
     serializedMapDesc = serialize(mapDesc);
     mapDesc = null;
     ...
   }
   
   public void activate() {
     mapDesc = deserialize(serializedMapDesc);
     serializedMapDesc = null;
     ...
   }
   ... 
 }
 


Method Summary
 void activate()
           Objects (context attributes, resources and functionalities) should perform setup tasks to ready themselves up to do user operations in this method.
 void passivate()
           Objects (context attributes, resources and functionalities) should perform cleanup tasks after having performed user operations in this method.
 

Method Detail

activate

void activate()

Objects (context attributes, resources and functionalities) should perform setup tasks to ready themselves up to do user operations in this method.

Typical setup tasks including (re)connecting to GIS servers and (re)hydrating server objects. This method is called on context attributes and on resources by the WebContext when the context itself is activated. The resource subsequently calls this method on its functionalities.

This method is called on every request before the JSF lifecycle is executed.

See Also:
WebContext.activate()

passivate

void passivate()

Objects (context attributes, resources and functionalities) should perform cleanup tasks after having performed user operations in this method.

Typical cleanup tasks including closing connections to GIS servers and dehydrating server objects. This method is called on context attributes and on resources by the WebContext when the context itself is passivated. The resource subsequently calls this method on its functionalities.

This method is called on every request after the JSF lifecycle is executed.

See Also:
WebContext.passivate()