|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.felix.ipojo.IPojoFactory
org.apache.felix.ipojo.ComponentFactory
public class ComponentFactory
The component factory manages component instance objects. This management consists to create and manage component instances build with the current component factory. This class could export Factory and ManagedServiceFactory services.
IPojoFactory
,
TrackerCustomizer
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.felix.ipojo.IPojoFactory |
---|
IPojoFactory.RequiredHandler |
Field Summary | |
---|---|
protected Tracker |
m_tracker
The tracker used to track required handler factories. |
Fields inherited from class org.apache.felix.ipojo.IPojoFactory |
---|
INSTANCE_NAME, m_componentDesc, m_componentInstances, m_componentMetadata, m_context, m_factoryName, m_isPublic, m_listeners, m_logger, m_requiredHandlers, m_sr, m_state |
Fields inherited from interface org.apache.felix.ipojo.Factory |
---|
INVALID, VALID |
Constructor Summary | |
---|---|
ComponentFactory(BundleContext context,
byte[] clazz,
Element element)
Creates a instance manager factory. |
|
ComponentFactory(BundleContext context,
Element element)
Creates a instance manager factory. |
Method Summary | |
---|---|
void |
addedService(ServiceReference reference)
This method is called when a matching service has been added to the tracker, we can no compute the factory state. |
boolean |
addingService(ServiceReference reference)
This method is called when a new handler factory is detected. |
void |
check(Element element)
Allows a factory to check if the given element is well-formed. |
ComponentInstance |
createInstance(Dictionary config,
IPojoContext context,
HandlerManager[] handlers)
Creates a primitive instance. |
Class |
defineClass(String name,
byte[] clazz,
ProtectionDomain domain)
Defines a class. |
String |
getClassName()
Gets the class name. |
ComponentTypeDescription |
getComponentTypeDescription()
Gets the component type description of the current factory. |
String |
getFactoryName()
Computes the factory name. |
PojoMetadata |
getPojoMetadata()
Returns manipulation metadata of this component type. |
List |
getRequiredHandlerList()
Computes required handlers. |
URL |
getResource(String resName)
Returns the URL of a resource. |
Class |
loadClass(String className)
Loads a class. |
void |
modifiedService(ServiceReference reference,
Object service)
This method is called when a used handler factory is modified. |
void |
removedService(ServiceReference reference,
Object service)
This method is called when a used handler factory disappears. |
void |
starting()
Starts the factory. |
void |
stopping()
Stops all the instance managers. |
Methods inherited from class org.apache.felix.ipojo.IPojoFactory |
---|
addFactoryStateListener, checkAcceptability, computeDescription, computeFactoryState, createComponentInstance, createComponentInstance, deleted, disposed, generateName, getBundleContext, getComponentDescription, getDescription, getHandler, getLogger, getMissingHandlers, getName, getRequiredHandlers, getState, isAcceptable, match, reconfigure, removeFactoryStateListener, start, stop, updated |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Tracker m_tracker
Constructor Detail |
---|
public ComponentFactory(BundleContext context, byte[] clazz, Element element) throws ConfigurationException
context
- the bundle contextclazz
- the component classelement
- the metadata of the component
ConfigurationException
- if the element describing the factory is malformed.public ComponentFactory(BundleContext context, Element element) throws ConfigurationException
context
- the bundle contextelement
- the metadata of the component to create
ConfigurationException
- if element describing the factory is malformed.Method Detail |
---|
public ComponentTypeDescription getComponentTypeDescription()
getComponentTypeDescription
in class IPojoFactory
IPojoFactory.getComponentTypeDescription()
public void check(Element element) throws ConfigurationException
element
- the metadata describing the component
ConfigurationException
- if the element describing the factory is malformed.public String getClassName()
getClassName
in interface Factory
getClassName
in class IPojoFactory
IPojoFactory.getClassName()
public ComponentInstance createInstance(Dictionary config, IPojoContext context, HandlerManager[] handlers) throws ConfigurationException
createInstance
in class IPojoFactory
config
- the instance configurationcontext
- the service context (null if the instance has to be created in the global space).handlers
- the handlers to attach to the instance
ConfigurationException
- if the configuration process failed.IPojoFactory.createInstance(java.util.Dictionary, org.apache.felix.ipojo.IPojoContext, org.apache.felix.ipojo.HandlerManager[])
public Class defineClass(String name, byte[] clazz, ProtectionDomain domain)
define
method invocation to the
factory classloader.
name
- the qualified name of the classclazz
- the byte array of the classdomain
- the protection domain of the class
public URL getResource(String resName)
Bundle#getResource(String)
method.
resName
- the resource name
public Class loadClass(String className) throws ClassNotFoundException
Bundle#loadClass(String)
is called.
className
- the name of the class to load
ClassNotFoundException
- if the class is not foundpublic void starting()
starting
in class IPojoFactory
public void stopping()
stopping
in class IPojoFactory
public String getFactoryName()
getFactoryName
in class IPojoFactory
public List getRequiredHandlerList()
getRequiredHandlerList
in class IPojoFactory
public boolean addingService(ServiceReference reference)
addingService
in interface TrackerCustomizer
reference
- the new service reference.
true
if the given factory reference matches with a required handler.TrackerCustomizer.addingService(org.osgi.framework.ServiceReference)
public void addedService(ServiceReference reference)
addedService
in interface TrackerCustomizer
reference
- the added service reference.TrackerCustomizer.addedService(org.osgi.framework.ServiceReference)
public void removedService(ServiceReference reference, Object service)
removedService
in interface TrackerCustomizer
reference
- the leaving service reference.service
- the handler factory object.TrackerCustomizer.removedService(org.osgi.framework.ServiceReference, java.lang.Object)
public void modifiedService(ServiceReference reference, Object service)
modifiedService
in interface TrackerCustomizer
reference
- the service referenceservice
- the Factory object (if already get)TrackerCustomizer.modifiedService(org.osgi.framework.ServiceReference, java.lang.Object)
public PojoMetadata getPojoMetadata()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |