Class AbstractServiceReferenceConfig

java.lang.Object
org.apache.sling.engine.servlets.AbstractServiceReferenceConfig

@Deprecated @ConsumerType public abstract class AbstractServiceReferenceConfig extends Object
Deprecated.
The AbstractServiceReferenceConfig may be used as a base class to define ServletConfig and FilterConfig instances from OSGi ServiceReference objects. The properties of this service reference are used as the initialization parameters of the configuration object.

The name of the servlet or filter may be retrieved from the service reference by calling the static getName(ServiceReference) method. This method looks for the following service reference properties, assuming the first non-null value found:

  1. sling.core.servletName - A service registration property which may be set to define an independent servlet name.
  2. component.name - The name of the Declarative Services component if the OSGi service is registered using Declarative Services.
  3. service.pid - The Service PID of the service.
  4. service.id - The ID of the service as set by the OSGi framework service registry. This property is guaranteed to always be set by the OSGi specification.
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractServiceReferenceConfig(javax.servlet.ServletContext servletContext, org.osgi.framework.ServiceReference reference, String name)
    Deprecated.
    Sets up this base configuration object.
  • Method Summary

    Modifier and Type
    Method
    Description
    Deprecated.
    Returns the value of the named initialization parameter, or null if the parameter does not exist.
    Deprecated.
    Returns the property keys of the underlying OSGi ServiceReference as an Enumeration of String objects, or an empty Enumeration if there are no properties.
    protected String
    Deprecated.
    Returns the name of this configuration object.
    static String
    getName(org.osgi.framework.ServiceReference reference)
    Deprecated.
    Looks for a name value in the service reference properties.
    javax.servlet.ServletContext
    Deprecated.
    Returns a reference to the ServletContext in which the caller is executing.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AbstractServiceReferenceConfig

      public AbstractServiceReferenceConfig(javax.servlet.ServletContext servletContext, org.osgi.framework.ServiceReference reference, String name)
      Deprecated.
      Sets up this base configuration object.
      Parameters:
      servletContext - The ServletContext attached to this configuration.
      reference - The service reference providing the initialization parameter values.
      name - The name of this configuration.
      See Also:
  • Method Details

    • getInitParameter

      public String getInitParameter(String name)
      Deprecated.
      Returns the value of the named initialization parameter, or null if the parameter does not exist.
      Parameters:
      name - The name of the initialization parameter.
      Returns:
      The value of the parameter or null.
    • getInitParameterNames

      public Enumeration<?> getInitParameterNames()
      Deprecated.
      Returns the property keys of the underlying OSGi ServiceReference as an Enumeration of String objects, or an empty Enumeration if there are no properties.
      Returns:
      An Enumeration of parameter names.
    • getServletContext

      public javax.servlet.ServletContext getServletContext()
      Deprecated.
      Returns a reference to the ServletContext in which the caller is executing.
      Returns:
      The ServletContext object.
    • getName

      protected String getName()
      Deprecated.
      Returns the name of this configuration object. Implementations may use this value to implement the ServletConfig.getServletName() or FilterConfig.getFilterName() methods.
      Returns:
      The name
    • getName

      public static String getName(org.osgi.framework.ServiceReference reference)
      Deprecated.
      Looks for a name value in the service reference properties. See the class comment at the top for the list of properties checked by this method.
      Parameters:
      reference - The service reference
      Returns:
      The name