ro.isdc.wro.manager.callback
Class LifecycleCallbackRegistry

java.lang.Object
  extended by ro.isdc.wro.manager.callback.LifecycleCallbackRegistry
All Implemented Interfaces:
LifecycleCallback

public class LifecycleCallbackRegistry
extends Object
implements LifecycleCallback

Register all available callbacks. The registry acts as a LifecycleCallback itself whose implementation delegate the call to registered callbacks. The registry will handle any runtime exceptions thrown by callbacks, in order to allow successful lifecycle execution.

Since:
1.4.3
Author:
Alex Objelean

Constructor Summary
LifecycleCallbackRegistry()
           
 
Method Summary
protected  List<LifecycleCallback> initCallbacks()
           
 void onAfterMerge()
          Called after all resources are merged and the preProcessing is completed.
 void onAfterModelCreated()
          Invoked after the model is created.
 void onAfterPostProcess()
          Called after a resource is post processed.
 void onAfterPreProcess()
          Called after a resource is pre processed.
 void onBeforeMerge()
          Called before resources are merged and before any processing is applied.
 void onBeforeModelCreated()
          Invoked before starting model creation.
 void onBeforePostProcess()
          Called before a resource is post processed.
 void onBeforePreProcess()
          Called before each resource is processed.
protected  void onException(Exception e)
          Invoked when a callback fails.
 void onProcessingComplete()
          Called after all postProcessors are applied and overall processing is complete.
 void registerCallback(LifecycleCallback callback)
          Deprecated. use registerCallback(ObjectFactory) instead to ensure thread-safety.
 void registerCallback(ObjectFactory<LifecycleCallback> callbackFactory)
          Register a callback using a factory responsible for callback instantiation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LifecycleCallbackRegistry

public LifecycleCallbackRegistry()
Method Detail

registerCallback

@Deprecated
public void registerCallback(LifecycleCallback callback)
Deprecated. use registerCallback(ObjectFactory) instead to ensure thread-safety.

Parameters:
callback - to register.

registerCallback

public void registerCallback(ObjectFactory<LifecycleCallback> callbackFactory)
Register a callback using a factory responsible for callback instantiation.

Parameters:
callbackFactory - the factory used to instantiate callbacks.

initCallbacks

protected List<LifecycleCallback> initCallbacks()

onBeforeModelCreated

public void onBeforeModelCreated()
Invoked before starting model creation.

Specified by:
onBeforeModelCreated in interface LifecycleCallback

onAfterModelCreated

public void onAfterModelCreated()
Invoked after the model is created.

Specified by:
onAfterModelCreated in interface LifecycleCallback

onBeforePreProcess

public void onBeforePreProcess()
Called before each resource is processed.

Specified by:
onBeforePreProcess in interface LifecycleCallback

onAfterPreProcess

public void onAfterPreProcess()
Called after a resource is pre processed.

Specified by:
onAfterPreProcess in interface LifecycleCallback

onBeforePostProcess

public void onBeforePostProcess()
Called before a resource is post processed.

Specified by:
onBeforePostProcess in interface LifecycleCallback

onAfterPostProcess

public void onAfterPostProcess()
Called after a resource is post processed.

Specified by:
onAfterPostProcess in interface LifecycleCallback

onBeforeMerge

public void onBeforeMerge()
Called before resources are merged and before any processing is applied.

Specified by:
onBeforeMerge in interface LifecycleCallback

onAfterMerge

public void onAfterMerge()
Description copied from interface: LifecycleCallback
Called after all resources are merged and the preProcessing is completed.

Specified by:
onAfterMerge in interface LifecycleCallback

onProcessingComplete

public void onProcessingComplete()
Called after all postProcessors are applied and overall processing is complete.

Specified by:
onProcessingComplete in interface LifecycleCallback

onException

protected void onException(Exception e)
Invoked when a callback fails. By default exception is ignored.

Parameters:
e - Exception thrown by the fallback.


Copyright © 2008-2013. All Rights Reserved.