1 /* 2 * $Id: LifecycleStateInjectorProcessor.java 20321 2010-11-24 15:21:24Z dfeist $ 3 * -------------------------------------------------------------------------------------- 4 * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com 5 * 6 * The software in this package is published under the terms of the CPAL v1.0 7 * license, a copy of which has been included with this distribution in the 8 * LICENSE.txt file. 9 */ 10 package org.mule.registry; 11 12 import org.mule.api.lifecycle.LifecycleState; 13 import org.mule.api.lifecycle.LifecycleStateAware; 14 import org.mule.api.registry.InjectProcessor; 15 16 /** 17 * Injects the MuleContext object for objects stored in the {@link org.mule.registry.TransientRegistry} where the object registered 18 * implements {@link org.mule.api.context.MuleContextAware}. 19 */ 20 public class LifecycleStateInjectorProcessor implements InjectProcessor 21 { 22 private LifecycleState state; 23 24 public LifecycleStateInjectorProcessor(LifecycleState state) 25 { 26 this.state = state; 27 } 28 29 public Object process(Object object) 30 { 31 if (object instanceof LifecycleStateAware) 32 { 33 ((LifecycleStateAware)object).setLifecycleState(state); 34 } 35 return object; 36 } 37 }