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.gems;
011
012 import org.picocontainer.gems.adapters.ThreadLocalizing;
013 import org.picocontainer.gems.behaviors.AsmImplementationHiding;
014 import org.picocontainer.gems.behaviors.HotSwapping;
015 import org.picocontainer.gems.behaviors.Pooling;
016 import org.picocontainer.gems.jmx.JMXExposing;
017 import org.picocontainer.gems.monitors.CommonsLoggingComponentMonitor;
018 import org.picocontainer.gems.monitors.Log4JComponentMonitor;
019 import org.picocontainer.gems.monitors.Slf4jComponentMonitor;
020 import org.picocontainer.ComponentMonitor;
021 import org.picocontainer.BehaviorFactory;
022
023
024 /**
025 * Provides a series of factory methods to allow an "index" of the capabilities that you may find in
026 * PicoContainer-Gems.
027 * @author Paul Hammant
028 */
029 public class PicoGemsBuilder {
030
031 /**
032 * Creates an {@link org.picocontainer.gems.behaviors.AsmImplementationHiding AsmImplementationHiding} behavior factory.
033 * @return a new AsmImplementationHiding() instance.
034 * @deprecated renamed to ASM_IMPL_HIDING() to better differentiate between JDK Proxy implementation hiding
035 * and ASM-based implementation hiding.
036 */
037 @Deprecated
038 public static BehaviorFactory IMPL_HIDING() {
039 return new AsmImplementationHiding();
040 }
041
042 /**
043 * Creates an {@link org.picocontainer.gems.behaviors.AsmImplementationHiding AsmImplementationHiding} behavior factory.
044 * @return a new AsmImplementationHiding() instance.
045 * @since PicoContainer-Gems 2.4
046 */
047 public static BehaviorFactory ASM_IMPL_HIDING() {
048 return new AsmImplementationHiding();
049 }
050
051 /**
052 * Creates a {@link org.picocontainer.gems.behaviors.HotSwapping HotSwapping} behavior factory.
053 * @return
054 */
055 public static BehaviorFactory HOT_SWAPPING() {
056 return new HotSwapping();
057 }
058
059 /**
060 * Only uses the system default mbean server. See {@link org.picocontainer.gems.jmx.JMXExposing JMXExposing} for other
061 * constructors that give you more flexibility in exposing your objects.
062 * @return JMX Exposing behavior factory.
063 */
064 public static BehaviorFactory JMX() {
065 return new JMXExposing();
066 }
067
068 /**
069 * Creates a thread localizing adapter factory.
070 * @return
071 */
072 public static BehaviorFactory THREAD_LOCAL() {
073 return new ThreadLocalizing();
074 }
075
076 /**
077 * Creates an instance pooling adapter factory.
078 * @return
079 */
080 public static BehaviorFactory POOLING() {
081 return new Pooling();
082 }
083
084 /**
085 * Creates a log4j component monitor instance. You will need Log4j in your classpath for this method to work.
086 * @return Log4j-based component monitor.
087 */
088 public static ComponentMonitor LOG4J() {
089 return new Log4JComponentMonitor();
090 }
091
092 /**
093 * Creates a slf4j component monitor instance. You will need SLF4j in your classpath for this method to work
094 * properly.
095 * @return SLF4j-based component monitor.
096 */
097 public static ComponentMonitor SLF4J() {
098 return new Slf4jComponentMonitor();
099 }
100
101 /**
102 * Creates a Commons-Logging based component monitor instance. You will need Apache Commons-Logging in your classpath
103 * for this method to work properly.
104 * @return Commons-Logging based component monitor.
105 */
106 public static ComponentMonitor COMMONS_LOGGING() {
107 return new CommonsLoggingComponentMonitor();
108 }
109
110
111
112
113 }