castor
  1. castor
  2. CASTOR-2381 Create JDODescriptorSourceFactory
  3. CASTOR-2390

Refactor JDOClassDescriptorFactory to work with new ClassInfo instances (using natures).

    Details

    • Number of attachments :
      8

      Description

      Subject says all ....

      1. JDOClassDescriptorFactory.java
        31 kB
        Filip Hianik
      2. patch.c2381.20080701.txt
        70 kB
        Filip Hianik
      3. patch.c2390.20080709.txt
        95 kB
        Filip Hianik
      4. patch.c2390.20080714.txt
        85 kB
        Filip Hianik
      5. patch.c2390.20080715.txt
        113 kB
        Filip Hianik
      6. patch.c2390.20080715second.txt
        114 kB
        Filip Hianik
      7. patch.c2390.20080720.txt
        81 kB
        Filip Hianik
      8. patch.c2390.20080721.txt
        9 kB
        Filip Hianik

        Issue Links

          Activity

          Hide
          Filip Hianik added a comment -

          Patch contains the JDOClassDescriptorFactory that supports usage of Natures.
          At this time is the factory capable to create JDODescriptors for Entity classes. Tests are also included.
          There is no need of applying any other patches.

          Show
          Filip Hianik added a comment - Patch contains the JDOClassDescriptorFactory that supports usage of Natures. At this time is the factory capable to create JDODescriptors for Entity classes. Tests are also included. There is no need of applying any other patches.
          Hide
          Werner Guttmann added a comment -

          Just a few random observations:

          a) you are using Java 5.0 code in at least one place (top of my head).
          b) Your usage of natures is in some sense incorrect as you are not checking for the expected nature before actually looking at the *Info element(s).

          Before trying to fix this, let me post an updated patch of your code which you can use to make the required changes. In addition, I have used Eclipse to make the code to comply with the CheckStyle rules of the project. As such, I would suggest to use my patch against a clean checkout.

          Show
          Werner Guttmann added a comment - Just a few random observations: a) you are using Java 5.0 code in at least one place (top of my head). b) Your usage of natures is in some sense incorrect as you are not checking for the expected nature before actually looking at the *Info element(s). Before trying to fix this, let me post an updated patch of your code which you can use to make the required changes. In addition, I have used Eclipse to make the code to comply with the CheckStyle rules of the project. As such, I would suggest to use my patch against a clean checkout.
          Hide
          Sebastian Gabmeyer added a comment -

          I noted that the JDOClassDescriptorFactory prints DescriptorInstantiationException(..) to the generated JDODescriptors which is nowhere to be found. But the way this exception is initialized made me thinking if we really need it as it only "encapsulates" the message of another exception (e.g. a NoSuchMethodException) (which is - by the way - not a good idea). So we could either dump that exception all together or add the "true" exception by calling initCause(..) on the DescriptorInstantiationException before throwing it. What do you think?

          Show
          Sebastian Gabmeyer added a comment - I noted that the JDOClassDescriptorFactory prints DescriptorInstantiationException(..) to the generated JDODescriptors which is nowhere to be found. But the way this exception is initialized made me thinking if we really need it as it only "encapsulates" the message of another exception (e.g. a NoSuchMethodException) (which is - by the way - not a good idea). So we could either dump that exception all together or add the "true" exception by calling initCause(..) on the DescriptorInstantiationException before throwing it. What do you think?
          Hide
          Werner Guttmann added a comment -

          I will commit a trimmed down version of the classes contained in this patch in a few minutes. Basically, here's what I am doing:

          a) Commit the complete JDODescriptorJClass.
          b) Commit parts of JDODescriptorClassFactory, without any code that creates the field descriptors.
          c) Dropped all test cases.

          Please SVN update and attach a patch that makes the remainder of the code available. Please do look into the issues mentioend above, especially Java 1.4 compliance and usage of natures.

          Show
          Werner Guttmann added a comment - I will commit a trimmed down version of the classes contained in this patch in a few minutes. Basically, here's what I am doing: a) Commit the complete JDODescriptorJClass . b) Commit parts of JDODescriptorClassFactory , without any code that creates the field descriptors. c) Dropped all test cases. Please SVN update and attach a patch that makes the remainder of the code available. Please do look into the issues mentioend above, especially Java 1.4 compliance and usage of natures.
          Hide
          Filip Hianik added a comment -

          JDOClassDescriptorFactory massive refactored.
          ClassNatureCheck & FieldNatureCheck methods added.
          Hope there is no java 1.5 code inside at the moment. If so, pls tell me where.
          No other patches are needed to apply this patch, castor needs to be up to date.

          Show
          Filip Hianik added a comment - JDOClassDescriptorFactory massive refactored. ClassNatureCheck & FieldNatureCheck methods added. Hope there is no java 1.5 code inside at the moment. If so, pls tell me where. No other patches are needed to apply this patch, castor needs to be up to date.
          Hide
          Filip Hianik added a comment -

          Generating of the source for Descriptors with oneToOne relation added.
          Unit test also included.
          No additional patches needed to aply this one, but be sure you have the actual castor SVN checkout.
          Generating oneToMany descriptors will be added later today.

          Show
          Filip Hianik added a comment - Generating of the source for Descriptors with oneToOne relation added. Unit test also included. No additional patches needed to aply this one, but be sure you have the actual castor SVN checkout. Generating oneToMany descriptors will be added later today.
          Hide
          Filip Hianik added a comment -

          This version of JDOClassDescrptorFactory supports also generating of 1:N Descriptors.
          Unit tests included.
          Apply the patch on the actual castor checkout.

          Show
          Filip Hianik added a comment - This version of JDOClassDescrptorFactory supports also generating of 1:N Descriptors. Unit tests included. Apply the patch on the actual castor checkout.
          Hide
          Filip Hianik added a comment -

          I forgot, to apply this patch you need the CASTOR-2470

          Show
          Filip Hianik added a comment - I forgot, to apply this patch you need the CASTOR-2470
          Hide
          Filip Hianik added a comment -

          checkFieldInfoNatures method improved to check also JDOOneToOneNature and JDOOneToManyNature.

          Show
          Filip Hianik added a comment - checkFieldInfoNatures method improved to check also JDOOneToOneNature and JDOOneToManyNature.
          Hide
          Filip Hianik added a comment -

          I attach the JDOClassDescriptorFactory.java in jira because of the problems by applying the latest patch to the ctual version of Cator.

          Show
          Filip Hianik added a comment - I attach the JDOClassDescriptorFactory.java in jira because of the problems by applying the latest patch to the ctual version of Cator.
          Hide
          Werner Guttmann added a comment -

          What problems are you having, if I may ask ? And does the latest patch already include 1:M relations ?

          Show
          Werner Guttmann added a comment - What problems are you having, if I may ask ? And does the latest patch already include 1:M relations ?
          Hide
          Filip Hianik added a comment -

          @previous problem with the patch: Doesnt matter at this moment, but when I tried to apply it to the latest castor(not the from today) there were some inconsistencies with the JDOClassDescriptorFactory.java. Lukas had the same problem, therefore the attachement of the whole class.

          @this patch:
          it implements the 1:N relations (also the previous one did)
          The values for dirty and readOnly properties are now read from JDOOneToOneMany / JDOOneToManyNature.
          Apply the patch patch.c2412.20080720.txt from CASTOR-2412 first.

          Show
          Filip Hianik added a comment - @previous problem with the patch: Doesnt matter at this moment, but when I tried to apply it to the latest castor(not the from today) there were some inconsistencies with the JDOClassDescriptorFactory.java. Lukas had the same problem, therefore the attachement of the whole class. @this patch: it implements the 1:N relations (also the previous one did) The values for dirty and readOnly properties are now read from JDOOneToOneMany / JDOOneToManyNature. Apply the patch patch.c2412.20080720.txt from CASTOR-2412 first.
          Hide
          Filip Hianik added a comment -

          JDOClassDescriptorFactory improved to create correct 1:N descriptors.
          JDOClassDescriptorFactoryTest fixed.

          Show
          Filip Hianik added a comment - JDOClassDescriptorFactory improved to create correct 1:N descriptors. JDOClassDescriptorFactoryTest fixed.

            People

            • Assignee:
              Werner Guttmann
              Reporter:
              Werner Guttmann
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 30 minutes
                30m