org.apache.felix.scrplugin
Class JavaClassDescriptorManager

java.lang.Object
  extended by org.apache.felix.scrplugin.JavaClassDescriptorManager
Direct Known Subclasses:
AntJavaClassDescriptorManager, MavenJavaClassDescriptorManager

public abstract class JavaClassDescriptorManager
extends Object

The JavaClassDescriptorManager must be implemented to provide access to the java sources to be scanned for descriptor annotations and JavaDoc tags, the descriptors of components from the class path and the location of the generated class files to be able to add the bind and unbind methods.


Field Summary
protected  Log log
          The maven log.
 
Constructor Summary
JavaClassDescriptorManager(Log log, ClassLoader classLoader, String[] annotationTagProviders, boolean parseJavadocs, boolean processAnnotations)
          Construct a new manager.
 
Method Summary
 AnnotationTagProviderManager getAnnotationTagProviderManager()
           
 ClassLoader getClassLoader()
          Return the class laoder.
protected  Map<String,Component> getComponentDescriptors()
          Returns a map of component descriptors which may be extended by the java sources returned by the getSources() method.
protected  List<File> getDependencies()
          Returns a list of files denoting dependencies of the module for which descriptors are to be generated.
 JavaClassDescription getJavaClassDescription(String className)
          Get a java class description for the class.
 Log getLog()
          Return the log.
abstract  String getOutputDirectory()
          Returns the absolute filesystem path to the directory where the classes compiled from the java source files (see getSources()) have been placed.
 JavaClassDescription[] getSourceDescriptions()
          Return all source descriptions of this project.
protected  Iterator<File> getSourceFiles()
          Returns an iterator of paths to directories providing Java source files to be parsed.
protected  com.thoughtworks.qdox.model.JavaSource[] getSources()
          Returns the QDox JavaSource instances representing the source files for which the Declarative Services and Metatype descriptors have to be generated.
 boolean isParseJavadocs()
          Returns true if this class descriptor manager is parsing JavaDoc tags.
 boolean isProcessAnnotations()
          Returns true if this class descriptor manager is parsing Java 5 annotations.
protected  Components parseServiceComponentDescriptor(InputStream file)
          Parses the descriptors read from the given input stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final Log log
The maven log.

Constructor Detail

JavaClassDescriptorManager

public JavaClassDescriptorManager(Log log,
                                  ClassLoader classLoader,
                                  String[] annotationTagProviders,
                                  boolean parseJavadocs,
                                  boolean processAnnotations)
                           throws SCRDescriptorFailureException
Construct a new manager.

Throws:
SCRDescriptorFailureException
Method Detail

getSources

protected com.thoughtworks.qdox.model.JavaSource[] getSources()
                                                       throws SCRDescriptorException
Returns the QDox JavaSource instances representing the source files for which the Declarative Services and Metatype descriptors have to be generated.

Throws:
SCRDescriptorException - May be thrown if an error occurrs gathering the java sources.

getSourceFiles

protected Iterator<File> getSourceFiles()
Returns an iterator of paths to directories providing Java source files to be parsed.

This method is called by the default getSources() implementation to return the root directories for the Java files to be parsed. This default implementation returns an empty iterator. Implementations of this class not overwriting the getSources() method should overwrite this method by providing the concrete source locations.

Returns:
An iterator of Java source locations.

getComponentDescriptors

protected Map<String,Component> getComponentDescriptors()
                                                 throws SCRDescriptorException
Returns a map of component descriptors which may be extended by the java sources returned by the getSources() method.

This method calls the getDependencies() method and checks for any Service-Component descriptors in the returned files.

This method may be overwritten by extensions of this class.

Throws:
SCRDescriptorException - May be thrown if an error occurrs gethering the component descriptors.

getDependencies

protected List<File> getDependencies()
Returns a list of files denoting dependencies of the module for which descriptors are to be generated. The returned dependencies are expected to be bundles which may (or may not) contain Service Component descriptors (or internal descriptors in the case of abstract components not listed in the "official" descriptors).

This method is called by the getComponentDescriptors() method in this class to get the list of bundles from where base component descriptors are to be extracted.

Extensions of this class not overwriting the getComponentDescriptors() method should overwrite this method if they wish to provide such base component descriptors.

Returns:

getOutputDirectory

public abstract String getOutputDirectory()
Returns the absolute filesystem path to the directory where the classes compiled from the java source files (see getSources()) have been placed.

This method is called to find the class files to which bind and unbind methods are to be added.


getLog

public Log getLog()
Return the log.


getClassLoader

public ClassLoader getClassLoader()
Return the class laoder.


getAnnotationTagProviderManager

public AnnotationTagProviderManager getAnnotationTagProviderManager()
Returns:
Annotation tag provider manager

isParseJavadocs

public boolean isParseJavadocs()
Returns true if this class descriptor manager is parsing JavaDoc tags.


isProcessAnnotations

public boolean isProcessAnnotations()
Returns true if this class descriptor manager is parsing Java 5 annotations.


parseServiceComponentDescriptor

protected Components parseServiceComponentDescriptor(InputStream file)
                                              throws SCRDescriptorException
Parses the descriptors read from the given input stream. This method may be called by the getComponentDescriptors() method to parse the descriptors gathered in an implementation dependent way.

Throws:
SCRDescriptorException - If an error occurrs reading the descriptors from the stream.

getSourceDescriptions

public JavaClassDescription[] getSourceDescriptions()
                                             throws SCRDescriptorException
Return all source descriptions of this project.

Returns:
All contained java class descriptions.
Throws:
SCRDescriptorException

getJavaClassDescription

public JavaClassDescription getJavaClassDescription(String className)
                                             throws SCRDescriptorException
Get a java class description for the class.

Parameters:
className -
Returns:
The java class description.
Throws:
SCRDescriptorException


Copyright © 2011 Apache Software Foundation. All Rights Reserved.