DWR

Decouple DWR from Java reflection

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Normal Normal
  • Resolution: Fixed
  • Affects Version/s: 1.0, 1.1, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 2.0.rc1, 2.0.rc2, 2.0.rc3, 2.0.rc4, 2.0.rc5, 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 3.0.M1, 3.0.RC1
  • Fix Version/s: 3.0.RC2
  • Component/s: Converters, Core, Creators
  • Documentation Required:
    Yes
  • Description:
    Some integrations are hard to do with DWR as the DWR Core and Creator infrastructure is tightly based on discovering remoted methods through Java reflection.
    To ease future integrations like OSGI, and similar, this needs to be opened up.

Activity

Hide
Mike Wilson added a comment - 14/Oct/10 4:58 AM

I've checked in an initial stab at this issue with updates that decouple DWR's core so it doesn't require remoted objects to be made of reflectable concrete Java classes accessible through DWR's classloader, but instead get a logical representation that may be customized by integration code.

This has been done by adding these classes:

Module and ModuleManager interfaces,
that provide a more generic integration point in DWR's conversion pipeline, compared to Creators that are hard-coded to reflection.

MethodDeclaration class,
that is the representation of a logical method, not necessarily backed by reflection.

and these new injection points in the DWR conversion pipeline (in defaults.properties):

moduleManager,
a MasterModuleManager that delegates to customModuleManager and fallbackModuleManager in that order

customModuleManager,
empty by default and may be configured by applications to activate custom integrations

fallbackModuleManager,
a CreatorModuleManager that interfaces against the standard Creator infrastructure (including some required internal DWR services)

Changes to existing code:

There are small changes to many files, but the major part of the code changes are in the following modified interfaces:
AccessControl
and core classes:
Call
DefaultRemoter

The new interfaces may be considered experimental, and this work should be continued in follow-up activities after 3.0.

Show
Mike Wilson added a comment - 14/Oct/10 4:58 AM I've checked in an initial stab at this issue with updates that decouple DWR's core so it doesn't require remoted objects to be made of reflectable concrete Java classes accessible through DWR's classloader, but instead get a logical representation that may be customized by integration code. This has been done by adding these classes: Module and ModuleManager interfaces, that provide a more generic integration point in DWR's conversion pipeline, compared to Creators that are hard-coded to reflection. MethodDeclaration class, that is the representation of a logical method, not necessarily backed by reflection. and these new injection points in the DWR conversion pipeline (in defaults.properties): moduleManager, a MasterModuleManager that delegates to customModuleManager and fallbackModuleManager in that order customModuleManager, empty by default and may be configured by applications to activate custom integrations fallbackModuleManager, a CreatorModuleManager that interfaces against the standard Creator infrastructure (including some required internal DWR services) Changes to existing code: There are small changes to many files, but the major part of the code changes are in the following modified interfaces: AccessControl and core classes: Call DefaultRemoter The new interfaces may be considered experimental, and this work should be continued in follow-up activities after 3.0.
Hide
Mike Wilson added a comment - 12/Nov/10 3:31 PM

Checked in some more improvements that allows registering conversion of classes from other classloaders than the one that loaded DWR. This is done through ConverterManager.addConverter(Class, Converter) where the Class may come from another classloader. These Classes are then referred to by Modules' MethodDeclarations.

Show
Mike Wilson added a comment - 12/Nov/10 3:31 PM Checked in some more improvements that allows registering conversion of classes from other classloaders than the one that loaded DWR. This is done through ConverterManager.addConverter(Class, Converter) where the Class may come from another classloader. These Classes are then referred to by Modules' MethodDeclarations.

People

Dates

  • Created:
    14/Oct/10 4:44 AM
    Updated:
    12/Nov/10 3:31 PM
    Resolved:
    14/Oct/10 4:58 AM