Pivot
  1. Pivot
  2. PIVOT-470

Rename org.apache.pivot.wtkx.WTKXSerializer to org.apache.pivot.beans.BXMLSerializer

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0
    • Component/s: core-beans
    • Labels:
      None

      Description

      WTKXSerializer does not currently have any dependencies on org.apache.pivot.wtk and can technically be used to deserialize any arbitrary bean hierarchy. Moving it to pivot-core will allow developers to take advantage of it on the server where it can be used to facilitate design patterns such as dependency injection and aspect-oriented programming.

      There is a question of what prefix to use for the internal processing namespace (currently "wtkx"). Should this continue to be "wtkx" for WTKX files, or should it be something more generic ("bxml", "bx", "jbx", etc.)? This prefix could also be used as a generic file extension for bean markup files when a more appropriate extension is not available.

      There is also the question of what to call the @WTKX annotation. This should probably also parallel the namespace prefix.

      It may be valid for WTKX files to retain the .wtkx extension, since it clearly articulates what type of bean XML the file contains. This notion is further reinforced by the fact that the default namespace for WTKX files refers to the WTK package, org.apache.pivot.wtk. However, using a dedicated extension for WTK markup may simply promote confusion.

      1. sample.wtkx
        0.3 kB
        Greg Brown

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        65d 2h 54m 1 Greg Brown 23/Jun/10 17:21
        Greg Brown made changes -
        Summary Rename org.apache.pivot.wtkx.WTKXSerializer to org.apache.pivot.beans.BeanSerializer Rename org.apache.pivot.wtkx.WTKXSerializer to org.apache.pivot.beans.BXMLSerializer
        Greg Brown made changes -
        Summary Move WTKXSerializer to org.apache.pivot.beans and rename to BXMLSerializer Rename org.apache.pivot.wtkx.WTKXSerializer to org.apache.pivot.beans.BeanSerializer
        Greg Brown made changes -
        Summary Move WTKXSerializer to org.apache.pivot.beans and rename to BeanSerializer Move WTKXSerializer to org.apache.pivot.beans and rename to BXMLSerializer
        Greg Brown made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Greg Brown [ gbrown ]
        Resolution Fixed [ 1 ]
        Hide
        Appddevvv added a comment -

        One use case is embedding the XML files inside other XML files for tooling but my use case is to allow them to potentially be embedded in spring containers. In the same spirit, I'm about to submit a small patch to the serializer that makes it possible to extend so that instance creation and the recursize serializer creation process can be customized. This allows full DI frameworks to be employed for instance initialization especially useful for pivot subclasses. I'll make more comments on that issue in the jira that's opened.

        Show
        Appddevvv added a comment - One use case is embedding the XML files inside other XML files for tooling but my use case is to allow them to potentially be embedded in spring containers. In the same spirit, I'm about to submit a small patch to the serializer that makes it possible to extend so that instance creation and the recursize serializer creation process can be customized. This allows full DI frameworks to be employed for instance initialization especially useful for pivot subclasses. I'll make more comments on that issue in the jira that's opened.
        Hide
        Greg Brown added a comment -

        The internal namespace prefix used by WTKXSerializer is currently "wtkx". In order to help ease the transition from WTKXSerializer to BeanSerializer, it may make sense to make this configurable such that a different prefix can be used, or it may not. Not sure yet.

        We discussed using @Resource a while back, but decided against it because the term "resource" is already too heavily overloaded. @Inject isn't bad, though, and it would avoid tying the annotation name to the file extension, which is nice.

        I'm not sure what use case you are trying to address by embedding WTKX in other XML files. Can you describe what you are envisioning in a little more detail?

        Show
        Greg Brown added a comment - The internal namespace prefix used by WTKXSerializer is currently "wtkx". In order to help ease the transition from WTKXSerializer to BeanSerializer, it may make sense to make this configurable such that a different prefix can be used, or it may not. Not sure yet. We discussed using @Resource a while back, but decided against it because the term "resource" is already too heavily overloaded. @Inject isn't bad, though, and it would avoid tying the annotation name to the file extension, which is nice. I'm not sure what use case you are trying to address by embedding WTKX in other XML files. Can you describe what you are envisioning in a little more detail?
        Hide
        Appddevvv added a comment -

        Just thinking through this, you may want to use another notation that is more standard java such as @Resource or @Inject.

        Show
        Appddevvv added a comment - Just thinking through this, you may want to use another notation that is more standard java such as @Resource or @Inject.
        Hide
        Appddevvv added a comment -

        Not sure what you mean by not allowing the processing namespace prefix to be configurable but I think a scenario that should be supported is embedding the wtkx XML inside other XML files.

        Show
        Appddevvv added a comment - Not sure what you mean by not allowing the processing namespace prefix to be configurable but I think a scenario that should be supported is embedding the wtkx XML inside other XML files.
        Greg Brown made changes -
        Fix Version/s 1.5 [ 12314034 ]
        Fix Version/s 2.0 [ 12313780 ]
        Hide
        Greg Brown added a comment -

        it is also possible that simply using .xml as a standard file extension would be best, since that covers all cases and doesn't require developers to map XML syntax highlighter templates to a multitude of custom extensions.

        Show
        Greg Brown added a comment - it is also possible that simply using .xml as a standard file extension would be best, since that covers all cases and doesn't require developers to map XML syntax highlighter templates to a multitude of custom extensions.
        Greg Brown made changes -
        Field Original Value New Value
        Attachment sample.wtkx [ 12442314 ]
        Hide
        Greg Brown added a comment -

        Having prototyped what this might look like in practice (see sample.wtkx), I think that the following approach will work best:

        • Move all classes in org.apache.pivot.wtkx to org.apache.pivot.beans
        • Rename WTKXSerializer to BeanSerializer
        • Rename @WTKX to @BXML
        • Do not allow the processing namespace prefix to be configurable; standardize on "bx" (which maps to the "http://pivot.apache.org/bxml" namespace URI) - this will replace the "wtkx" prefix
        • Continue to use .wtkx as a file extension for WTK markup, since this accurately reflects the default namespace declared by the file ("org.apache.pivot.wtk"); other extensions may be defined as needed, and .bxml can be used as a default extension when another extension is not appropriate
        Show
        Greg Brown added a comment - Having prototyped what this might look like in practice (see sample.wtkx), I think that the following approach will work best: Move all classes in org.apache.pivot.wtkx to org.apache.pivot.beans Rename WTKXSerializer to BeanSerializer Rename @WTKX to @BXML Do not allow the processing namespace prefix to be configurable; standardize on "bx" (which maps to the "http://pivot.apache.org/bxml" namespace URI) - this will replace the "wtkx" prefix Continue to use .wtkx as a file extension for WTK markup, since this accurately reflects the default namespace declared by the file ("org.apache.pivot.wtk"); other extensions may be defined as needed, and .bxml can be used as a default extension when another extension is not appropriate
        Hide
        Greg Brown added a comment -

        A better alternative might be to always allow a caller to define the prefix for the internal processing namespace (similar to how XML itself allows a developer to specify the prefix to be used for a namespace URI within a given XML file). This would allow existing applications to continue to use the .wtkx extension and "wtkx" prefix, but use BeanSerializer in code.

        Show
        Greg Brown added a comment - A better alternative might be to always allow a caller to define the prefix for the internal processing namespace (similar to how XML itself allows a developer to specify the prefix to be used for a namespace URI within a given XML file). This would allow existing applications to continue to use the .wtkx extension and "wtkx" prefix, but use BeanSerializer in code.
        Hide
        Greg Brown added a comment -

        For the short term, WTKXSerializer could simply extend BeanSerializer. BeanSerializer could accept a constructor argument that identifies the internal processing namespace (currently "wtkx"). In the next major release (2.0, not 1.x), we could drop WTKXSerializer and standardize on a new naming convention.

        Show
        Greg Brown added a comment - For the short term, WTKXSerializer could simply extend BeanSerializer. BeanSerializer could accept a constructor argument that identifies the internal processing namespace (currently "wtkx"). In the next major release (2.0, not 1.x), we could drop WTKXSerializer and standardize on a new naming convention.
        Greg Brown created issue -

          People

          • Assignee:
            Greg Brown
            Reporter:
            Greg Brown
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development