org.apache.sling.featureflags.impl

## Class FeatureManager

- java.lang.Object
- - org.apache.sling.featureflags.impl.FeatureManager

All Implemented Interfaces:
  javax.servlet.Filter, javax.servlet.Servlet, Features

    public class FeatureManager
    extends Object
    implements Features, javax.servlet.Filter, javax.servlet.Servlet

This service implements the feature handling. It keeps track of all `Feature` services.

### Constructor Summary

Constructors
Constructor and Description
`FeatureManager()`

### Method Summary

Methods
`void` `destroy()`
`void` `doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)`
`Feature` `getFeature(String name)` Returns the feature with the given name.
`Feature[]` `getFeatures()` Get the list of all (known) features.
`javax.servlet.ServletConfig` `getServletConfig()`
`String` `getServletInfo()`
`void` `init(javax.servlet.FilterConfig filterConfig)`
`void` `init(javax.servlet.ServletConfig config)`
`boolean` `isEnabled(String featureName)` Returns `true` if a feature with the given name is known and enabled under the current `ExecutionContext`.
`void` `service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### FeatureManager

    public FeatureManager()

### Method Detail

#### getFeatures

    public Feature[] getFeatures()

Description copied from interface: `Features`
Get the list of all (known) features.

Features are known if they are registered as `Feature` services or are configured with OSGi configuration whose factory PID is `org.apache.sling.featureflags.Feature`.

Specified by:
  `getFeatures` in interface `Features`
Returns:
  The known features

#### getFeature

    public Feature getFeature(String name)

Description copied from interface: `Features`
Returns the feature with the given name.

Features are known if they are registered as `Feature` services or are configured with OSGi configuration whose factory PID is `org.apache.sling.featureflags.Feature`.

Specified by:
  `getFeature` in interface `Features`
Parameters:
  `name` - The name of the feature.
Returns:
  The feature or `null` if not known or the name is an empty string or `null`.

#### isEnabled

    public boolean isEnabled(String featureName)

Description copied from interface: `Features`
Returns `true` if a feature with the given name is known and enabled under the current `ExecutionContext`.

Features are known if they are registered as `Feature` services or are configured with OSGi configuration whose factory PID is `org.apache.sling.featureflags.Feature`.

Specified by:
  `isEnabled` in interface `Features`
Parameters:
  `featureName` - The name of the feature to check for enablement.
Returns:
  `true` if the named feature is known and enabled. Specifically `false` is also returned if the named feature is not known.

#### init

    public void init(javax.servlet.FilterConfig filterConfig)

Specified by:
  `init` in interface `javax.servlet.Filter`

#### doFilter

    public void doFilter(javax.servlet.ServletRequest request,
                javax.servlet.ServletResponse response,
                javax.servlet.FilterChain chain)
                  throws IOException,
                         javax.servlet.ServletException

Specified by:
  `doFilter` in interface `javax.servlet.Filter`
Throws:
  `IOException`
  `javax.servlet.ServletException`

#### destroy

    public void destroy()

Specified by:
  `destroy` in interface `javax.servlet.Filter`
Specified by:
  `destroy` in interface `javax.servlet.Servlet`

#### init

    public void init(javax.servlet.ServletConfig config)

Specified by:
  `init` in interface `javax.servlet.Servlet`

#### getServletConfig

    public javax.servlet.ServletConfig getServletConfig()

Specified by:
  `getServletConfig` in interface `javax.servlet.Servlet`

#### getServletInfo

    public String getServletInfo()

Specified by:
  `getServletInfo` in interface `javax.servlet.Servlet`

#### service

    public void service(javax.servlet.ServletRequest req,
               javax.servlet.ServletResponse res)
                 throws IOException

Specified by:
  `service` in interface `javax.servlet.Servlet`
Throws:
  `IOException`