You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Holger Haag (JIRA)" <ji...@apache.org> on 2006/05/23 11:01:33 UTC

[jira] Updated: (BETWIXT-50) Versioning of XML Output

     [ http://issues.apache.org/jira/browse/BETWIXT-50?page=all ]

Holger Haag updated BETWIXT-50:
-------------------------------

    Attachment: betwixt-versioning-patch
                src.zip

betwixt-versioning-patch: SVN Patch
src.zip: new files (e.g. test cases)

> Versioning of XML Output
> ------------------------
>
>          Key: BETWIXT-50
>          URL: http://issues.apache.org/jira/browse/BETWIXT-50
>      Project: Commons Betwixt
>         Type: Improvement

>     Reporter: Holger Haag
>  Attachments: betwixt-versioning-patch, src.zip
>
> Referring to the thread "Versioning of XML Output" (http://mail-archives.apache.org/mod_mbox/jakarta-commons-user/200605.mbox/%3c18841.1147350087@www031.gmx.net%3e) on the jakarta-commons-user  mailing list, I'll provide here a SVN patch for the described problem. 
> - Two new strategies: Attribute and Element suppression. Chose interfaces
> instead of abstract class so that one class (see test cases) can implement
> both.
> - After an element/attribute descriptor has been build completely (including
> the options), the suppression strategies are evaluated. If the
> element/attribute shall be suppressed, it is removed from the introspection
> results. 
> - Important: use <addDefaults add-properties="false" /> ! Otherwise the
> effects of element/attribute suppression will be ... none.
> - Test cases for illustration
> === Code snippets + explanation == :
> * Added new Interfaces 
>   
>   org.apache.commons.betwixt.strategy.AttributeSuppressionStrategy
>   
>   public boolean suppress(AttributeDescriptor descr);
>   
>   
>   org.apache.commons.betwixt.strategy.ElementSuppressionStrategy
>   
>   public boolean suppress(ElementDescriptor descr);
>   
>   
> * Added setter/getter methods for such strategies in
> org.apache.commons.betwixt.IntrospectionConfiguration
> * org.apache.commons.betwixt.digester.ElementRule: Remove element descriptor
> if suppressed:
>         ElementDescriptor descriptor = (ElementDescriptor)digester.pop();
>         
>         final Object peek = digester.peek();
>         
>         if(peek instanceof ElementDescriptor) {
>             ElementDescriptor parent = (ElementDescriptor)digester.peek();
>             // check for element suppression
>             if(
> getXMLIntrospector().getConfiguration().getElementSuppressionStrategy().suppress(descriptor))
> {
>                 parent.removeElementDescriptor(descriptor);
>             }
>         }
> * org.apache.commons.betwixt.digester.AttributeRule: Remove attribute
> descrptor if suppressed:
>         AttributeDescriptor descriptor =
> (AttributeDescriptor)digester.pop();
>         ElementDescriptor parent = (ElementDescriptor)digester.peek();
>         // check for attribute suppression
>         if(
> getXMLIntrospector().getConfiguration().getAttributeSuppressionStrategy().suppress(descriptor))
> {
>             parent.removeAttributeDescriptor(descriptor);
>         }
> * ElementDescriptor: new methods:
>     public void removeAttributeDescriptor(AttributeDescriptor descriptor) {
>         getAttributeList().remove(descriptor);
>     }
>     public void removeElementDescriptor(ElementDescriptor descriptor) {
>         getElementList().remove(descriptor);
>         getContentList().remove(descriptor);
>     }
>     
>         public AttributeDescriptor getAttributeDescriptor(final String name)
> {
> 	        for (int i = 0, size = attributeDescriptors.length; i < size; i++)
> {
> 	            AttributeDescriptor descr = attributeDescriptors[i];
> 	            if (descr.getQualifiedName().equals(name)) {
> 	                return descr;
> 	            }
> 	        }
> 	
> 	        return null;
> 	    }
> * Test cases: package org.apache.commons.betwixt.versioning
>   VersioningStrategy implements both an element and versioning strategy
>   VersioningTest well.. .test the versioning.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org