001 /*****************************************************************************
002 * Copyright (C) PicoContainer Organization. All rights reserved. *
003 * ------------------------------------------------------------------------- *
004 * The software in this package is published under the terms of the BSD *
005 * style license a copy of which has been included with this distribution in *
006 * the LICENSE.txt file. *
007 * *
008 * Original code by *
009 *****************************************************************************/
010 package org.picocontainer.behaviors;
011
012 import org.picocontainer.ComponentAdapter;
013 import org.picocontainer.Parameter;
014 import org.picocontainer.ComponentMonitor;
015 import org.picocontainer.LifecycleStrategy;
016 import org.picocontainer.Characteristics;
017 import org.picocontainer.behaviors.AbstractBehaviorFactory;
018
019 import java.util.Properties;
020
021 /**
022 * @author Aslak Hellesøy
023 */
024 public class Synchronizing extends AbstractBehaviorFactory {
025
026 public ComponentAdapter createComponentAdapter(ComponentMonitor componentMonitor, LifecycleStrategy lifecycleStrategy, Properties componentProperties, Object componentKey, Class componentImplementation, Parameter... parameters) {
027 removePropertiesIfPresent(componentProperties, Characteristics.SYNCHRONIZE);
028 return new Synchronized(super.createComponentAdapter(
029 componentMonitor,
030 lifecycleStrategy,
031 componentProperties,
032 componentKey,
033 componentImplementation,
034 parameters));
035 }
036
037 public ComponentAdapter addComponentAdapter(ComponentMonitor componentMonitor,
038 LifecycleStrategy lifecycleStrategy,
039 Properties componentProperties,
040 ComponentAdapter adapter) {
041 removePropertiesIfPresent(componentProperties, Characteristics.SYNCHRONIZE);
042 return new Synchronized(super.addComponentAdapter(componentMonitor,
043 lifecycleStrategy,
044 componentProperties,
045 adapter));
046 }
047 }