org.eclipse.jetty.osgi.annotations
Class AnnotationConfiguration

java.lang.Object
  extended by org.eclipse.jetty.webapp.AbstractConfiguration
      extended by org.eclipse.jetty.annotations.AnnotationConfiguration
          extended by org.eclipse.jetty.osgi.annotations.AnnotationConfiguration
All Implemented Interfaces:
Configuration

public class AnnotationConfiguration
extends AnnotationConfiguration

Extend the AnnotationConfiguration to support OSGi: Look for annotations inside WEB-INF/lib and also in the fragments and required bundles. Discover them using a scanner adapted to OSGi instead of the jarscanner.


Field Summary
 
Fields inherited from class org.eclipse.jetty.annotations.AnnotationConfiguration
CLASS_INHERITANCE_MAP
 
Constructor Summary
AnnotationConfiguration()
           
 
Method Summary
protected  AnnotationParser createAnnotationParser()
          This parser scans the bundles using the OSGi APIs instead of assuming a jar.
protected  ClassNameResolver createClassNameResolver(WebAppContext context)
          Returns the same classname resolver than for the webInfjar scanner
protected  ClassNameResolver createClassNameResolver(WebAppContext context, boolean excludeSysClass, boolean excludeServerClass, boolean excludeEverythingElse, boolean overrideIsParenLoaderIsPriority)
           
protected  void parseBundle(WebAppContext context, AnnotationParser parser, org.osgi.framework.Bundle webbundle, org.osgi.framework.Bundle bundle)
           
protected  void parseFragmentBundle(WebAppContext context, AnnotationParser parser, org.osgi.framework.Bundle webbundle, org.osgi.framework.Bundle fragmentBundle)
          Scan a fragment bundle for servlet annotations
protected  void parseRequiredBundle(WebAppContext context, AnnotationParser parser, org.osgi.framework.Bundle webbundle, org.osgi.framework.Bundle requiredBundle)
          Scan a bundle required by the webbundle for servlet annotations
protected  void parseWebBundle(WebAppContext context, AnnotationParser parser, org.osgi.framework.Bundle webbundle)
          Scan a bundle required by the webbundle for servlet annotations
 void parseWebInfLib(WebAppContext context, AnnotationParser parser)
          Here is the order in which jars and osgi artifacts are scanned for discoverable annotations.
 
Methods inherited from class org.eclipse.jetty.annotations.AnnotationConfiguration
clearAnnotationList, cloneConfigure, configure, gatherAnnotations, getFragmentFromJar, isFromExcludedJar, isMetaDataComplete, parseContainerPath, parseWebInfClasses, preConfigure, registerServletContainerInitializerAnnotationHandlers
 
Methods inherited from class org.eclipse.jetty.webapp.AbstractConfiguration
deconfigure, destroy, postConfigure
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationConfiguration

public AnnotationConfiguration()
Method Detail

createAnnotationParser

protected AnnotationParser createAnnotationParser()
This parser scans the bundles using the OSGi APIs instead of assuming a jar.

Overrides:
createAnnotationParser in class AnnotationConfiguration
Returns:
a new AnnotationParser. This method can be overridden to use a different impleemntation of the AnnotationParser. Note that this is considered internal API.

parseWebInfLib

public void parseWebInfLib(WebAppContext context,
                           AnnotationParser parser)
                    throws Exception
Here is the order in which jars and osgi artifacts are scanned for discoverable annotations.
  1. The container jars are scanned.
  2. The WEB-INF/classes are scanned
  3. The osgi fragment to the web bundle are parsed.
  4. The WEB-INF/lib are scanned
  5. The required bundles are parsed

Overrides:
parseWebInfLib in class AnnotationConfiguration
Throws:
Exception

parseFragmentBundle

protected void parseFragmentBundle(WebAppContext context,
                                   AnnotationParser parser,
                                   org.osgi.framework.Bundle webbundle,
                                   org.osgi.framework.Bundle fragmentBundle)
                            throws Exception
Scan a fragment bundle for servlet annotations

Parameters:
context - The webapp context
parser - The parser
webbundle - The current webbundle
fragmentBundle - The OSGi fragment bundle to scan
Throws:
Exception

parseWebBundle

protected void parseWebBundle(WebAppContext context,
                              AnnotationParser parser,
                              org.osgi.framework.Bundle webbundle)
                       throws Exception
Scan a bundle required by the webbundle for servlet annotations

Parameters:
context - The webapp context
parser - The parser
webbundle - The current webbundle
fragmentBundle - The OSGi required bundle to scan
Throws:
Exception

parseRequiredBundle

protected void parseRequiredBundle(WebAppContext context,
                                   AnnotationParser parser,
                                   org.osgi.framework.Bundle webbundle,
                                   org.osgi.framework.Bundle requiredBundle)
                            throws Exception
Scan a bundle required by the webbundle for servlet annotations

Parameters:
context - The webapp context
parser - The parser
webbundle - The current webbundle
fragmentBundle - The OSGi required bundle to scan
Throws:
Exception

parseBundle

protected void parseBundle(WebAppContext context,
                           AnnotationParser parser,
                           org.osgi.framework.Bundle webbundle,
                           org.osgi.framework.Bundle bundle)
                    throws Exception
Throws:
Exception

createClassNameResolver

protected ClassNameResolver createClassNameResolver(WebAppContext context)
Returns the same classname resolver than for the webInfjar scanner

Parameters:
context -
Returns:

createClassNameResolver

protected ClassNameResolver createClassNameResolver(WebAppContext context,
                                                    boolean excludeSysClass,
                                                    boolean excludeServerClass,
                                                    boolean excludeEverythingElse,
                                                    boolean overrideIsParenLoaderIsPriority)


Copyright © 1995-2011 Mort Bay Consulting. All Rights Reserved.