info.magnolia.objectfactory
Class ObservedComponentFactory<T>

java.lang.Object
  extended by info.magnolia.objectfactory.ObservedComponentFactory<T>
Type Parameters:
T - the type of component this factory instantiates.
All Implemented Interfaces:
ComponentFactory<T>, javax.jcr.observation.EventListener
Direct Known Subclasses:
IPSecurityManagerImpl.InstanceFactory, ServerConfiguration.InstanceFactory

public class ObservedComponentFactory<T>
extends Object
implements ComponentFactory<T>, javax.jcr.observation.EventListener

Generic observed singleton factory.

Version:
$Id: $
Author:
philipp

Constructor Summary
ObservedComponentFactory(String repository, String path, Class<T> type)
           
ObservedComponentFactory(String repository, String path, Class<T> type, ComponentProvider componentProvider)
           
 
Method Summary
protected  Class<T> getComponentType()
           
protected  Node2BeanTransformer getNode2BeanTransformer()
           
 T getObservedObject()
          Deprecated. since 4.3 - info.magnolia.objectfactory.DefaultComponentProvider#newInstance(Class) returns a proxy of the observed object instead of this factory, so this method shouldn't be needed publicly.
protected  void instantiateDefault()
           
protected  boolean isConcrete(Class<?> clazz)
          Deprecated. since 4.5, use Classes.isConcrete(Class)
protected  void load()
           
 T newInstance()
          Called by the ComponentProvider to create a component.
 void onEvent(javax.jcr.observation.EventIterator events)
           
protected  void onRegister(Content node)
          Deprecated. since 4.5, use #onRegister(Node) instead
protected  void reload()
           
protected  void startObservation(String handle)
           
 String toString()
           
protected  T transformNode(javax.jcr.Node node)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObservedComponentFactory

public ObservedComponentFactory(String repository,
                                String path,
                                Class<T> type)

ObservedComponentFactory

public ObservedComponentFactory(String repository,
                                String path,
                                Class<T> type,
                                ComponentProvider componentProvider)
Method Detail

newInstance

public T newInstance()
Description copied from interface: ComponentFactory
Called by the ComponentProvider to create a component. This will only be done once and hence instances created by component factories are effectively singletons.

Specified by:
newInstance in interface ComponentFactory<T>

startObservation

protected void startObservation(String handle)

onEvent

public void onEvent(javax.jcr.observation.EventIterator events)
Specified by:
onEvent in interface javax.jcr.observation.EventListener

reload

protected void reload()

load

protected void load()

instantiateDefault

protected void instantiateDefault()

isConcrete

@Deprecated
protected boolean isConcrete(Class<?> clazz)
Deprecated. since 4.5, use Classes.isConcrete(Class)


onRegister

@Deprecated
protected void onRegister(Content node)
Deprecated. since 4.5, use #onRegister(Node) instead


transformNode

protected T transformNode(javax.jcr.Node node)
                   throws Node2BeanException,
                          javax.jcr.RepositoryException
Throws:
Node2BeanException
javax.jcr.RepositoryException

getNode2BeanTransformer

protected Node2BeanTransformer getNode2BeanTransformer()

getComponentType

protected Class<T> getComponentType()

getObservedObject

@Deprecated
public T getObservedObject()
Deprecated. since 4.3 - info.magnolia.objectfactory.DefaultComponentProvider#newInstance(Class) returns a proxy of the observed object instead of this factory, so this method shouldn't be needed publicly.

Returns the latest converted object observed by this factory. Since 4.3, if you are using DefaultClassFactory, calling this shouldn't be needed, newInstance() returned a proxy, so you'll always see this object.


toString

public String toString()
Overrides:
toString in class Object


Copyright © 2003-2013 Magnolia International Ltd.. All Rights Reserved.