2 Replies Latest reply on Jul 29, 2009 9:22 AM by jesper.pedersen

    idea about JCA and 303 integration

    jeff.zhang

      We have 4 test case of BeanValidation include standard303, user303 and negative standard and user.

      So we can do validation in sjc. Here is my idea:
      1. Create a class list contain all need validated beans (follow 322 spec)
      2. find the testcase rar (get File reference from sjc)
      3. list all files()classes) in rar
      4. load classes (by classloader from sjc) and judge this class should be validated (step 1)
      5. if need, create a bean instance and merge the metadata infomation (ConnectorMetadata and JBossRAMetadata by sjc)
      6. do validation using hibernate validation v4
      7. return the result.

        • 1. Re: idea about JCA and 303 integration
          jesper.pedersen

          Its even more simple than that :)

          The deployer has already created the objects and injected the property values.

          So you need to

          1) Create the ValidatorFactory
          2) Get the Validator interface
          3) Validate the object passed in as an argument against the Default group (for now)
          4) If an empty set is returned - do nothing
          5) If the set contains ConstraintViolation's create an exception with the violations embedded

          The rest is handled by Hibernate Validator - which does its own annotation scanning. And you can assume that the correct classloader is already set.

          • 2. Re: idea about JCA and 303 integration
            jesper.pedersen

            For 5) use

            ConstraintViolationException(java.util.Set<ConstraintViolation<?>> constraintViolations)