Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.directwebremoting.fluent
Class FluentConfigurator

    java.lang.Object
      org.directwebremoting.fluent.FluentConfigurator

All Implemented Interfaces:
  Configurator

    public abstract class FluentConfigurator

extends java.lang.Object
implements Configurator

A `Configurator` that used the FluentInterface style as described by Martin Fowler.

To wire up the configuration programatically rather than having to use `dwr.xml`. In order to use this style, you'll need to:

- Create a concrete implementation of `FluentConfigurator` which implements the `configure()` method.
- Add an init param '`customConfigurator`' to the DWR servlet in `web.xml` to point at your new class.

The implementation of `configure()` will look something like this:

     public void configure() {
        withConverterType("dog", "com.yourcompany.beans.Dog");
        withCreatorType("ejb", "com.yourcompany.dwr.creator.EJBCreator");
        withCreator("new", "ApartmentDAO")
            .addParam("scope", "session")
            .addParam("class", "com.yourcompany.dao.ApartmentDAO")
            .exclude("saveApartment")
            .withAuth("method", "role");
        withCreator("struts", "DogDAO")
            .addParam("clas", "com.yourcompany.dao.DogDAO")
            .include("getDog")
            .include("getColor");
        withConverter("dog", "*.Dog")
            .addParam("name", "value");
        withSignature()
            .addLine("import java.util.List;")
            .addLine("import com.example.Check;")
            .addLine("Check.setLotteryResults(List nos);");
     }

Author:
  Aaron Johnson [ajohnson at cephas dot net / http://cephas.net/blog], Joe Walker [joe at getahead dot ltd dot uk]

Constructor Summary
`FluentConfigurator()`

Method Summary
`FluentConfigurator` | `addFilter(java.lang.String newFilterClassName)` Add a filter to whatever is being configured.
`FluentConfigurator` | `addLine(java.lang.String line)` Add lines to a signature.
`FluentConfigurator` | `addParam(java.lang.String name, java.lang.String value)` Add a parameter to whatever is being configured.
`abstract void` | `configure()` This method is used to configure DWR using the fluent style.
`void` | `configure(Container container)` Do the Configuration actions
`FluentConfigurator` | `exclude(java.lang.String methodName)` Add an exclude rule to a `Creator` This should be used during a `withCreator(String, String)` call.
`FluentConfigurator` | `include(java.lang.String methodName)` Add an include rule to a `Creator`.
`FluentConfigurator` | `withAuth(java.lang.String methodName, java.lang.String role)` Add an authorization rule to a `Creator` This should be used during a `withCreator(String, String)` call.
`FluentConfigurator` | `withConverter(java.lang.String newConverter, java.lang.String newMatch)` Use a `Converter` to instansiate a class
`FluentConfigurator` | `withConverterType(java.lang.String id, java.lang.String converterClassName)` Add a new `Converter` definition.
`FluentConfigurator` | `withCreator(java.lang.String newTypeName, java.lang.String newScriptName)` Use a `Creator` to instansiate a class
`FluentConfigurator` | `withCreatorType(java.lang.String id, java.lang.String creatorClassName)` Add a new `Creator` definition.
`FluentConfigurator` | `withFilter(java.lang.String newFilterClassName)`
`FluentConfigurator` | `withSignature()` Add lines to a signature.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### FluentConfigurator

    public FluentConfigurator()

Method Detail

### configure

    public abstract void configure()

  This method is used to configure DWR using the fluent style.

### withConverterType

    public FluentConfigurator withConverterType(java.lang.String id,
                                                java.lang.String converterClassName)

  Add a new `Converter` definition.

  Parameters:
    `id` - The id referred to by the `withConverter(String, String)`
    `converterClassName` - The implementation of `Converter` to instansitate.
  Returns:
    `this` to continue the fluency

### withConverter

    public FluentConfigurator withConverter(java.lang.String newConverter,
                                            java.lang.String newMatch)

  Use a `Converter` to instansiate a class

  Parameters:
    `newConverter` - A predefined `Converter` or one defined by `withConverterType(String, String)`.
    `newMatch` - The javascript name of this component
  Returns:
    `this` to continue the fluency

### withCreatorType

    public FluentConfigurator withCreatorType(java.lang.String id,
                                              java.lang.String creatorClassName)

  Add a new `Creator` definition.

  Parameters:
    `id` - The id referred to by the `withCreator(String, String)`
    `creatorClassName` - The implementation of `Creator` to instansitate.
  Returns:
    `this` to continue the fluency

### withCreator

    public FluentConfigurator withCreator(java.lang.String newTypeName,
                                          java.lang.String newScriptName)

  Use a `Creator` to instansiate a class

  Parameters:
    `newTypeName` - A predefined `Creator` or one defined by `withCreatorType(String, String)`.
    `newScriptName` - The javascript name of this component
  Returns:
    `this` to continue the fluency

### withFilter

    public FluentConfigurator withFilter(java.lang.String newFilterClassName)

  Parameters:
    `newFilterClassName` - filter class name
  Returns:
    `this` to continue the fluency

### addParam

    public FluentConfigurator addParam(java.lang.String name,
                                       java.lang.String value)

  Add a parameter to whatever is being configured.

  Parameters:
    `name` - The name of the parameter
    `value` - The value of the parameter
  Returns:
    `this` to continue the fluency

### addFilter

    public FluentConfigurator addFilter(java.lang.String newFilterClassName)

  Add a filter to whatever is being configured.

  Parameters:
    `newFilterClassName` - The class to add as a filter
  Returns:
    `this` to continue the fluency

### include

    public FluentConfigurator include(java.lang.String methodName)

  Add an include rule to a `Creator`. This should be used during a `withCreator(String, String)` call.

  Parameters:
    `methodName` - The method name to be allowed
  Returns:
    `this` to continue the fluency

### exclude

    public FluentConfigurator exclude(java.lang.String methodName)

  Add an exclude rule to a `Creator` This should be used during a `withCreator(String, String)` call.

  Parameters:
    `methodName` - The method name to be dis-allowed
  Returns:
    `this` to continue the fluency

### withAuth

    public FluentConfigurator withAuth(java.lang.String methodName,
                                       java.lang.String role)

  Add an authorization rule to a `Creator` This should be used during a `withCreator(String, String)` call.

  Parameters:
    `methodName` - The method name to have a required role
    `role` - The required role for the given method
  Returns:
    `this` to continue the fluency

### withSignature

    public FluentConfigurator withSignature()

  Add lines to a signature.

  Returns:
    `this` to continue the fluency

### addLine

    public FluentConfigurator addLine(java.lang.String line)

  Add lines to a signature.

  Parameters:
    `line` - The line of text to add to the signature configuration
  Returns:
    `this` to continue the fluency

### configure

    public void configure(Container container)

  Description copied from interface: `Configurator`
  Do the Configuration actions

  Specified by:
    `configure` in interface `Configurator`
  Parameters:
    `container` - The object that contains the system objects to configure

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Copyright ¬ 2005
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD