Keel 2.1RC2

org.apache.avalon.fortress.impl.factory
Class AbstractObjectFactory

java.lang.Object
  extended byorg.apache.avalon.fortress.impl.factory.AbstractObjectFactory
All Implemented Interfaces:
Instrumentable, ObjectFactory
Direct Known Subclasses:
NoopObjectFactory, ProxyObjectFactory, WrapperObjectFactory

public abstract class AbstractObjectFactory
extends java.lang.Object
implements ObjectFactory, Instrumentable

AbstractObjectFactory does XYZ

Version:
CVS $ Revision: 1.1 $
Author:

Field Summary
private static java.lang.Class[] INVALID_INTERFACES
          The list interfaces that will not be proxied.
protected  ObjectFactory m_delegateFactory
          The ObjectFactory proper we delegate all calls to.
 
Fields inherited from interface org.apache.excalibur.mpool.ObjectFactory
ROLE
 
Fields inherited from interface org.apache.excalibur.instrument.Instrumentable
EMPTY_INSTRUMENT_ARRAY, EMPTY_INSTRUMENTABLE_ARRAY
 
Constructor Summary
AbstractObjectFactory(ObjectFactory objectFactory)
           
 
Method Summary
private static void addInterfaces(java.lang.Class[] interfaces, java.util.Set workInterfaces)
          Get a list of interfaces to proxy by scanning through all interfaces a class implements.
abstract  void dispose(java.lang.Object object)
          Performs any deconstruction that is necessary for the object.
 Instrumentable[] getChildInstrumentables()
          Any Object which implements Instrumentable can also make use of other Instrumentable child objects.
 java.lang.Class getCreatedClass()
          Get the class of the object you are creating.
 java.lang.String getInstrumentableName()
          Gets the name of the Instrumentable.
 Instrument[] getInstruments()
          Obtain a reference to all the Instruments that the Instrumentable object wishes to expose.
protected static java.lang.Class[] guessWorkInterfaces(java.lang.Class clazz)
          Get a list of interfaces to proxy by scanning through all interfaces a class implements and skipping invalid interfaces (as defined in INVALID_INTERFACES).
private static void guessWorkInterfaces(java.lang.Class clazz, java.util.Set workInterfaces)
          Get a list of interfaces to proxy by scanning through all interfaces a class implements.
abstract  java.lang.Object newInstance()
          Create a new instance of the object being pooled.
 void setInstrumentableName(java.lang.String name)
          Sets the name for the Instrumentable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INVALID_INTERFACES

private static final java.lang.Class[] INVALID_INTERFACES
The list interfaces that will not be proxied.


m_delegateFactory

protected final ObjectFactory m_delegateFactory
The ObjectFactory proper we delegate all calls to.

Constructor Detail

AbstractObjectFactory

public AbstractObjectFactory(ObjectFactory objectFactory)
Method Detail

newInstance

public abstract java.lang.Object newInstance()
                                      throws java.lang.Exception
Description copied from interface: ObjectFactory
Create a new instance of the object being pooled.

Specified by:
newInstance in interface ObjectFactory
Returns:
the pooled Object instance
Throws:
java.lang.Exception - if the object cannot be instantiated
See Also:
ObjectFactory.newInstance()

getCreatedClass

public final java.lang.Class getCreatedClass()
Description copied from interface: ObjectFactory
Get the class of the object you are creating.

Specified by:
getCreatedClass in interface ObjectFactory
Returns:
Class object of the factory's class
See Also:
ObjectFactory.getCreatedClass()

dispose

public abstract void dispose(java.lang.Object object)
                      throws java.lang.Exception
Description copied from interface: ObjectFactory
Performs any deconstruction that is necessary for the object.

Specified by:
dispose in interface ObjectFactory
Parameters:
object - to destroy
Throws:
java.lang.Exception - if there is any other reason that the factory has problems disposing of the object.
See Also:
ObjectFactory.dispose(Object)

setInstrumentableName

public final void setInstrumentableName(java.lang.String name)
Description copied from interface: Instrumentable
Sets the name for the Instrumentable. The Instrumentable Name is used to uniquely identify the Instrumentable during the configuration of the InstrumentManager and to gain access to an InstrumentableDescriptor through the InstrumentManager. The value should be a string which does not contain spaces or periods.

This value may be set by a parent Instrumentable, or by the InstrumentManager using the value of the 'instrumentable' attribute in the configuration of the component.

Specified by:
setInstrumentableName in interface Instrumentable
Parameters:
name - The name used to identify a Instrumentable.

getInstrumentableName

public final java.lang.String getInstrumentableName()
Description copied from interface: Instrumentable
Gets the name of the Instrumentable.

Specified by:
getInstrumentableName in interface Instrumentable
Returns:
The name used to identify a Instrumentable.

getInstruments

public final Instrument[] getInstruments()
Description copied from interface: Instrumentable
Obtain a reference to all the Instruments that the Instrumentable object wishes to expose. All sampling is done directly through the Instruments as opposed to the Instrumentable interface.

Specified by:
getInstruments in interface Instrumentable
Returns:
An array of the Instruments available for profiling. Should never be null. If there are no Instruments, then EMPTY_INSTRUMENT_ARRAY can be returned. This should never be the case though unless there are child Instrumentables with Instruments.

getChildInstrumentables

public final Instrumentable[] getChildInstrumentables()
Description copied from interface: Instrumentable
Any Object which implements Instrumentable can also make use of other Instrumentable child objects. This method is used to tell the InstrumentManager about them.

Specified by:
getChildInstrumentables in interface Instrumentable
Returns:
An array of child Instrumentables. This method should never return null. If there are no child Instrumentables, then EMPTY_INSTRUMENTABLE_ARRAY can be returned.

guessWorkInterfaces

protected static java.lang.Class[] guessWorkInterfaces(java.lang.Class clazz)
Get a list of interfaces to proxy by scanning through all interfaces a class implements and skipping invalid interfaces (as defined in INVALID_INTERFACES).

Parameters:
clazz - the class
Returns:
the list of interfaces to proxy

guessWorkInterfaces

private static void guessWorkInterfaces(java.lang.Class clazz,
                                        java.util.Set workInterfaces)
Get a list of interfaces to proxy by scanning through all interfaces a class implements.

Parameters:
clazz - the class
workInterfaces - the set of current work interfaces

addInterfaces

private static void addInterfaces(java.lang.Class[] interfaces,
                                  java.util.Set workInterfaces)
Get a list of interfaces to proxy by scanning through all interfaces a class implements.

Parameters:
interfaces - the array of interfaces
workInterfaces - the set of current work interfaces

Keel 2.1RC2

Please see keelframework.org for information about new Keel releases.