ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/util XMLFragment.java
Date Tue, 25 May 2004 06:23:17 GMT
bodewig     2004/05/24 23:23:17

  Modified:    src/main/org/apache/tools/ant IntrospectionHelper.java
               src/main/org/apache/tools/ant/util XMLFragment.java
  Log:
  temporary fix until Peter adds DynamicConfiguratorNS
  
  Revision  Changes    Path
  1.82      +46 -45    ant/src/main/org/apache/tools/ant/IntrospectionHelper.java
  
  Index: IntrospectionHelper.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/IntrospectionHelper.java,v
  retrieving revision 1.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- IntrospectionHelper.java	24 May 2004 15:09:54 -0000	1.81
  +++ IntrospectionHelper.java	25 May 2004 06:23:17 -0000	1.82
  @@ -489,20 +489,21 @@
               = (AttributeSetter) attributeSetters.get(
                   attributeName.toLowerCase(Locale.US));
           if (as == null) {
  -            if (element instanceof DynamicConfiguratorNS) {
  -                DynamicConfiguratorNS dc = (DynamicConfiguratorNS) element;
  -                String uriPlusPrefix =
  -                    ProjectHelper.extractUriFromComponentName(attributeName);
  -                String uri =
  -                    ProjectHelper.extractUriFromComponentName(uriPlusPrefix);
  -                String localName =
  -                    ProjectHelper.extractNameFromComponentName(attributeName);
  -                String qName = ("".equals(uri)
  -                                ? localName : (uri + ":" + localName));
  -
  -                dc.setDynamicAttribute(uri, localName, qName, value);
  -                return;
  -            } else if (element instanceof DynamicConfigurator) {
  +//            if (element instanceof DynamicConfiguratorNS) {
  +//                DynamicConfiguratorNS dc = (DynamicConfiguratorNS) element;
  +//                String uriPlusPrefix =
  +//                    ProjectHelper.extractUriFromComponentName(attributeName);
  +//                String uri =
  +//                    ProjectHelper.extractUriFromComponentName(uriPlusPrefix);
  +//                String localName =
  +//                    ProjectHelper.extractNameFromComponentName(attributeName);
  +//                String qName = ("".equals(uri)
  +//                                ? localName : (uri + ":" + localName));
  +//
  +//                dc.setDynamicAttribute(uri, localName, qName, value);
  +//                return;
  +//            } else 
  +            if (element instanceof DynamicConfigurator) {
                   DynamicConfigurator dc = (DynamicConfigurator) element;
                   dc.setDynamicAttribute(attributeName.toLowerCase(Locale.US), value);
                   return;
  @@ -611,35 +612,35 @@
           if (nc == null) {
               nc = createAddTypeCreator(project, parent, elementName);
           }
  -        if (nc == null && parent instanceof DynamicConfiguratorNS) {
  -            DynamicConfiguratorNS dc = (DynamicConfiguratorNS) parent;
  -            String qName = (child == null ? name : child.getQName());
  -            final Object nestedElement =
  -                dc.createDynamicElement(
  -                    (child == null ? "" : child.getNamespace()),
  -                    name, qName);
  -            if (nestedElement != null) {
  -                nc = new NestedCreator() {
  -                    public boolean isPolyMorphic() {
  -                        return false;
  -                    }
  -                    public Class getElementClass() {
  -                        return null;
  -                    }
  -
  -                    public Object getRealObject() {
  -                        return null;
  -                    }
  -
  -                    public Object create(
  -                        Project project, Object parent, Object ignore) {
  -                        return nestedElement;
  -                    }
  -                    public void store(Object parent, Object child) {
  -                    }
  -                };
  -            }
  -        }
  +//        if (nc == null && parent instanceof DynamicConfiguratorNS) {
  +//            DynamicConfiguratorNS dc = (DynamicConfiguratorNS) parent;
  +//            String qName = (child == null ? name : child.getQName());
  +//            final Object nestedElement =
  +//                dc.createDynamicElement(
  +//                    (child == null ? "" : child.getNamespace()),
  +//                    name, qName);
  +//            if (nestedElement != null) {
  +//                nc = new NestedCreator() {
  +//                    public boolean isPolyMorphic() {
  +//                        return false;
  +//                    }
  +//                    public Class getElementClass() {
  +//                        return null;
  +//                    }
  +//
  +//                    public Object getRealObject() {
  +//                        return null;
  +//                    }
  +//
  +//                    public Object create(
  +//                        Project project, Object parent, Object ignore) {
  +//                        return nestedElement;
  +//                    }
  +//                    public void store(Object parent, Object child) {
  +//                    }
  +//                };
  +//            }
  +//        }
           if (nc == null && parent instanceof DynamicConfigurator) {
               DynamicConfigurator dc = (DynamicConfigurator) parent;
               final Object nestedElement =
  @@ -750,7 +751,7 @@
       public boolean supportsNestedElement(String elementName) {
           return nestedCreators.containsKey(elementName.toLowerCase(Locale.US))
               || DynamicConfigurator.class.isAssignableFrom(bean)
  -            || DynamicConfiguratorNS.class.isAssignableFrom(bean)
  +            //            || DynamicConfiguratorNS.class.isAssignableFrom(bean)
               || addTypeMethods.size() != 0;
       }
   
  @@ -777,7 +778,7 @@
               nestedCreators.containsKey(name.toLowerCase(Locale.US))
               && (uri.equals(parentUri))) // || uri.equals("")))
               || DynamicConfigurator.class.isAssignableFrom(bean)
  -            || DynamicConfiguratorNS.class.isAssignableFrom(bean)
  +            //            || DynamicConfiguratorNS.class.isAssignableFrom(bean)
               || addTypeMethods.size() != 0;
       }
   
  
  
  
  1.7       +36 -20    ant/src/main/org/apache/tools/ant/util/XMLFragment.java
  
  Index: XMLFragment.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/util/XMLFragment.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XMLFragment.java	24 May 2004 15:09:57 -0000	1.6
  +++ XMLFragment.java	25 May 2004 06:23:17 -0000	1.7
  @@ -24,7 +24,8 @@
   import org.w3c.dom.Text;
   
   import org.apache.tools.ant.BuildException;
  -import org.apache.tools.ant.DynamicConfiguratorNS;
  +//import org.apache.tools.ant.DynamicConfiguratorNS;
  +import org.apache.tools.ant.DynamicConfigurator;
   import org.apache.tools.ant.ProjectHelper;
   
   /**
  @@ -38,7 +39,8 @@
    *
    * @since Ant 1.7
    */
  -public class XMLFragment implements DynamicConfiguratorNS {
  +//public class XMLFragment implements DynamicConfiguratorNS {
  +public class XMLFragment implements DynamicConfigurator {
   
       private Document doc;
       private DocumentFragment fragment;
  @@ -66,7 +68,8 @@
       /**
        * No attributes for the wrapping element.
        */
  -    public void setDynamicAttribute(String uri, String name, String qName, String value)
  +    //    public void setDynamicAttribute(String uri, String name, String qName, String
value)
  +    public void setDynamicAttribute(String name, String value)
           throws BuildException {
           throw new BuildException("Attribute " + name + " is not supported.");
       }
  @@ -74,8 +77,12 @@
       /**
        * Creates a nested element.
        */
  -    public Object createDynamicElement(String uri, String name, String qName) {
  -        Element e = doc.createElementNS(uri, qName);
  +//    public Object createDynamicElement(String uri, String name, String qName) {
  +//        Element e = doc.createElementNS(uri, qName);
  +    public Object createDynamicElement(String name) {
  +        Element e = doc
  +            .createElementNS(ProjectHelper.extractUriFromComponentName(name),
  +                             ProjectHelper.extractNameFromComponentName(name));
           fragment.appendChild(e);
           return new Child(e);
       }
  @@ -87,7 +94,8 @@
           }
       }
   
  -    public class Child implements DynamicConfiguratorNS {
  +    //    public class Child implements DynamicConfiguratorNS {
  +    public class Child implements DynamicConfigurator {
           private Element e;
   
           Child(Element e) {
  @@ -104,25 +112,33 @@
           /**
            * Sets the attribute
            */
  -        public void setDynamicAttribute(
  -            String uri, String name, String qName, String value) {
  -            if (uri.equals("")) {
  -                e.setAttribute(name, value);
  -            } else {
  -                e.setAttributeNS(uri, qName, value);
  -            }
  +//        public void setDynamicAttribute(
  +//            String uri, String name, String qName, String value) {
  +//            if (uri.equals("")) {
  +//                e.setAttribute(name, value);
  +//            } else {
  +//                e.setAttributeNS(uri, qName, value);
  +//            }
  +        public void setDynamicAttribute(String name, String value) {
  +            e.setAttribute(name, value);
           }
   
           /**
            * Creates a nested element.
            */
  -        public Object createDynamicElement(String uri, String name, String qName) {
  -            Element e2 = null;
  -            if (uri.equals("")) {
  -                e2 = doc.createElement(name);
  -            } else {
  -                e2 = doc.createElementNS(uri, qName);
  -            }
  +//        public Object createDynamicElement(String uri, String name, String qName) {
  +//            Element e2 = null;
  +//            if (uri.equals("")) {
  +//                e2 = doc.createElement(name);
  +//            } else {
  +//                e2 = doc.createElementNS(uri, qName);
  +//            }
  +        public Object createDynamicElement(String name) {
  +            Element e2 = doc
  +                .createElementNS(ProjectHelper
  +                                 .extractUriFromComponentName(name),
  +                                 ProjectHelper
  +                                 .extractNameFromComponentName(name));
               e.appendChild(e2);
               return new Child(e2);
           }
  
  
  

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


Mime
View raw message