You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Peter Danielsen (JIRA)" <ji...@apache.org> on 2007/06/01 04:36:15 UTC

[jira] Created: (AXIS2-2749) Improved codegen XSLTIncludeResolver support for

Improved codegen XSLTIncludeResolver support for <xsl:include>
--------------------------------------------------------------

                 Key: AXIS2-2749
                 URL: https://issues.apache.org/jira/browse/AXIS2-2749
             Project: Axis 2.0 (Axis2)
          Issue Type: Improvement
          Components: codegen
            Reporter: Peter Danielsen


I've been trying to create my own Axis2 codegen XSLT templates and would like to factor out some common templates to a separate file that can be included by others.  An example is a template that generates a method signature.  It would be included in a template that generates an interface and in one that generates an implementation class.

The current URI resolver used by the AxisServiceBasedMultiLanguageEmitter, XSLTIncludeResolver, requires the value of an <xsl:include>'s href attribute to be a property that's in its CodeGenConfiguration object. It looks like the only way to set the property is to write code. It would be preferable refer to it directly in a template by setting the href to a value that can be resolved by XSLTIncludeResolver using getResourceAsStream.  Such a change to XSLTIncludeResolver will enable easier maintenance of the existing templates, once refactored, and easier development of new templates since there won't be multiple copies of the same code to update when something changes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (AXIS2-2749) Improved codegen XSLTIncludeResolver support for

Posted by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-2749?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Amila Chinthaka Suriarachchi updated AXIS2-2749:
------------------------------------------------

    Attachment: newpatch.txt

> Improved codegen XSLTIncludeResolver support for <xsl:include>
> --------------------------------------------------------------
>
>                 Key: AXIS2-2749
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2749
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Improvement
>          Components: codegen
>            Reporter: Peter Danielsen
>            Assignee: Amila Chinthaka Suriarachchi
>         Attachments: newpatch.txt, XSLTIncludeResolver.java.svn.diff, XSLTIncludeResolver.patch.txt, XSLTIncludeResolverTest.java, XSLTIncludeResolverTestTemplate.xsl
>
>
> I've been trying to create my own Axis2 codegen XSLT templates and would like to factor out some common templates to a separate file that can be included by others.  An example is a template that generates a method signature.  It would be included in a template that generates an interface and in one that generates an implementation class.
> The current URI resolver used by the AxisServiceBasedMultiLanguageEmitter, XSLTIncludeResolver, requires the value of an <xsl:include>'s href attribute to be a property that's in its CodeGenConfiguration object. It looks like the only way to set the property is to write code. It would be preferable refer to it directly in a template by setting the href to a value that can be resolved by XSLTIncludeResolver using getResourceAsStream.  Such a change to XSLTIncludeResolver will enable easier maintenance of the existing templates, once refactored, and easier development of new templates since there won't be multiple copies of the same code to update when something changes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (AXIS2-2749) Improved codegen XSLTIncludeResolver support for

Posted by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-2749?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12506638 ] 

Amila Chinthaka Suriarachchi commented on AXIS2-2749:
-----------------------------------------------------

sorry for late reply.

Are you suggesting something like this. 
currently we have used the href parameter as follows.
<xsl:include href="databindsupporter"/>
and you want to use it in 
<xsl:include href="org.apache.axis2.schema.template.ADBDatabindingTemplate.xsl"/>
like this.

Here the problem is the template we want have to use is known only at runtime. it depends on the databinding use. 

On the other hand we can add that feature too if someone needs. 

if I appling your patch is it enogh to add only the XSLTIncludeResolver.patch.txt? does it make any problem to the existing template processing system? This template processing code was there from a long time and it worked properly. 






> Improved codegen XSLTIncludeResolver support for <xsl:include>
> --------------------------------------------------------------
>
>                 Key: AXIS2-2749
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2749
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Improvement
>          Components: codegen
>            Reporter: Peter Danielsen
>            Assignee: Amila Chinthaka Suriarachchi
>         Attachments: XSLTIncludeResolver.patch.txt, XSLTIncludeResolverTest.java, XSLTIncludeResolverTestTemplate.xsl
>
>
> I've been trying to create my own Axis2 codegen XSLT templates and would like to factor out some common templates to a separate file that can be included by others.  An example is a template that generates a method signature.  It would be included in a template that generates an interface and in one that generates an implementation class.
> The current URI resolver used by the AxisServiceBasedMultiLanguageEmitter, XSLTIncludeResolver, requires the value of an <xsl:include>'s href attribute to be a property that's in its CodeGenConfiguration object. It looks like the only way to set the property is to write code. It would be preferable refer to it directly in a template by setting the href to a value that can be resolved by XSLTIncludeResolver using getResourceAsStream.  Such a change to XSLTIncludeResolver will enable easier maintenance of the existing templates, once refactored, and easier development of new templates since there won't be multiple copies of the same code to update when something changes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Resolved: (AXIS2-2749) Improved codegen XSLTIncludeResolver support for

Posted by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-2749?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Amila Chinthaka Suriarachchi resolved AXIS2-2749.
-------------------------------------------------

    Resolution: Fixed

fixed the issue with revision 551799.
added the test cases. thanks perter submitting the patch

> Improved codegen XSLTIncludeResolver support for <xsl:include>
> --------------------------------------------------------------
>
>                 Key: AXIS2-2749
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2749
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Improvement
>          Components: codegen
>            Reporter: Peter Danielsen
>            Assignee: Amila Chinthaka Suriarachchi
>         Attachments: newpatch.txt, XSLTIncludeResolver.java.svn.diff, XSLTIncludeResolver.patch.txt, XSLTIncludeResolverTest.java, XSLTIncludeResolverTestTemplate.xsl
>
>
> I've been trying to create my own Axis2 codegen XSLT templates and would like to factor out some common templates to a separate file that can be included by others.  An example is a template that generates a method signature.  It would be included in a template that generates an interface and in one that generates an implementation class.
> The current URI resolver used by the AxisServiceBasedMultiLanguageEmitter, XSLTIncludeResolver, requires the value of an <xsl:include>'s href attribute to be a property that's in its CodeGenConfiguration object. It looks like the only way to set the property is to write code. It would be preferable refer to it directly in a template by setting the href to a value that can be resolved by XSLTIncludeResolver using getResourceAsStream.  Such a change to XSLTIncludeResolver will enable easier maintenance of the existing templates, once refactored, and easier development of new templates since there won't be multiple copies of the same code to update when something changes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (AXIS2-2749) Improved codegen XSLTIncludeResolver support for

Posted by "Peter Danielsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-2749?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Danielsen updated AXIS2-2749:
-----------------------------------

    Attachment: XSLTIncludeResolver.java.svn.diff

Attached is the patch as created with "svn diff".

> Improved codegen XSLTIncludeResolver support for <xsl:include>
> --------------------------------------------------------------
>
>                 Key: AXIS2-2749
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2749
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Improvement
>          Components: codegen
>            Reporter: Peter Danielsen
>            Assignee: Amila Chinthaka Suriarachchi
>         Attachments: XSLTIncludeResolver.java.svn.diff, XSLTIncludeResolver.patch.txt, XSLTIncludeResolverTest.java, XSLTIncludeResolverTestTemplate.xsl
>
>
> I've been trying to create my own Axis2 codegen XSLT templates and would like to factor out some common templates to a separate file that can be included by others.  An example is a template that generates a method signature.  It would be included in a template that generates an interface and in one that generates an implementation class.
> The current URI resolver used by the AxisServiceBasedMultiLanguageEmitter, XSLTIncludeResolver, requires the value of an <xsl:include>'s href attribute to be a property that's in its CodeGenConfiguration object. It looks like the only way to set the property is to write code. It would be preferable refer to it directly in a template by setting the href to a value that can be resolved by XSLTIncludeResolver using getResourceAsStream.  Such a change to XSLTIncludeResolver will enable easier maintenance of the existing templates, once refactored, and easier development of new templates since there won't be multiple copies of the same code to update when something changes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (AXIS2-2749) Improved codegen XSLTIncludeResolver support for

Posted by "Peter Danielsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-2749?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Danielsen updated AXIS2-2749:
-----------------------------------

    Attachment: XSLTIncludeResolverTestTemplate.xsl
                XSLTIncludeResolverTest.java
                XSLTIncludeResolver.patch.txt

There are three files attached:
1. XSLTIncludeResolver.patch.txt - a patch containing an implementation of a solution.
2. XSLTIncludeResolverTest.java - a JUnit test for XSLTIncludeResolver once the patch is applied.
3. XSLTIncludeResolverTestTemplate.xsl - a template to be used by XSLTIncludeResolverTest.  It should be placed in tests/org/apache/axis2/wsdl/util/resources (a new directory)

I've run the test successfully in my own ant environment.  I'm unfamiliar with maven, so I didn't modify the codegen maven files.  It looks like a change will be needed there so that the template will be found on the classpath at test run-time.

> Improved codegen XSLTIncludeResolver support for <xsl:include>
> --------------------------------------------------------------
>
>                 Key: AXIS2-2749
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2749
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Improvement
>          Components: codegen
>            Reporter: Peter Danielsen
>         Attachments: XSLTIncludeResolver.patch.txt, XSLTIncludeResolverTest.java, XSLTIncludeResolverTestTemplate.xsl
>
>
> I've been trying to create my own Axis2 codegen XSLT templates and would like to factor out some common templates to a separate file that can be included by others.  An example is a template that generates a method signature.  It would be included in a template that generates an interface and in one that generates an implementation class.
> The current URI resolver used by the AxisServiceBasedMultiLanguageEmitter, XSLTIncludeResolver, requires the value of an <xsl:include>'s href attribute to be a property that's in its CodeGenConfiguration object. It looks like the only way to set the property is to write code. It would be preferable refer to it directly in a template by setting the href to a value that can be resolved by XSLTIncludeResolver using getResourceAsStream.  Such a change to XSLTIncludeResolver will enable easier maintenance of the existing templates, once refactored, and easier development of new templates since there won't be multiple copies of the same code to update when something changes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Assigned: (AXIS2-2749) Improved codegen XSLTIncludeResolver support for

Posted by "Davanum Srinivas (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-2749?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Davanum Srinivas reassigned AXIS2-2749:
---------------------------------------

    Assignee: Amila Chinthaka Suriarachchi

> Improved codegen XSLTIncludeResolver support for <xsl:include>
> --------------------------------------------------------------
>
>                 Key: AXIS2-2749
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2749
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Improvement
>          Components: codegen
>            Reporter: Peter Danielsen
>            Assignee: Amila Chinthaka Suriarachchi
>         Attachments: XSLTIncludeResolver.patch.txt, XSLTIncludeResolverTest.java, XSLTIncludeResolverTestTemplate.xsl
>
>
> I've been trying to create my own Axis2 codegen XSLT templates and would like to factor out some common templates to a separate file that can be included by others.  An example is a template that generates a method signature.  It would be included in a template that generates an interface and in one that generates an implementation class.
> The current URI resolver used by the AxisServiceBasedMultiLanguageEmitter, XSLTIncludeResolver, requires the value of an <xsl:include>'s href attribute to be a property that's in its CodeGenConfiguration object. It looks like the only way to set the property is to write code. It would be preferable refer to it directly in a template by setting the href to a value that can be resolved by XSLTIncludeResolver using getResourceAsStream.  Such a change to XSLTIncludeResolver will enable easier maintenance of the existing templates, once refactored, and easier development of new templates since there won't be multiple copies of the same code to update when something changes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (AXIS2-2749) Improved codegen XSLTIncludeResolver support for

Posted by "Peter Danielsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-2749?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508996 ] 

Peter Danielsen commented on AXIS2-2749:
----------------------------------------

Amila,

The last change you proposed preserves the existing functionality and provides the functionality I requested.  Please commit it.

Thank you,

Peter


> Improved codegen XSLTIncludeResolver support for <xsl:include>
> --------------------------------------------------------------
>
>                 Key: AXIS2-2749
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2749
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Improvement
>          Components: codegen
>            Reporter: Peter Danielsen
>            Assignee: Amila Chinthaka Suriarachchi
>         Attachments: newpatch.txt, XSLTIncludeResolver.java.svn.diff, XSLTIncludeResolver.patch.txt, XSLTIncludeResolverTest.java, XSLTIncludeResolverTestTemplate.xsl
>
>
> I've been trying to create my own Axis2 codegen XSLT templates and would like to factor out some common templates to a separate file that can be included by others.  An example is a template that generates a method signature.  It would be included in a template that generates an interface and in one that generates an implementation class.
> The current URI resolver used by the AxisServiceBasedMultiLanguageEmitter, XSLTIncludeResolver, requires the value of an <xsl:include>'s href attribute to be a property that's in its CodeGenConfiguration object. It looks like the only way to set the property is to write code. It would be preferable refer to it directly in a template by setting the href to a value that can be resolved by XSLTIncludeResolver using getResourceAsStream.  Such a change to XSLTIncludeResolver will enable easier maintenance of the existing templates, once refactored, and easier development of new templates since there won't be multiple copies of the same code to update when something changes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (AXIS2-2749) Improved codegen XSLTIncludeResolver support for

Posted by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-2749?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508731 ] 

Amila Chinthaka Suriarachchi commented on AXIS2-2749:
-----------------------------------------------------

if I change it like this 
} else if ((href != null) && (!href.equals("externalTemplate"))){
            Source source = getSourceFromTemplateName(href);
            if ((source != null) && ((StreamSource)source).getInputStream() != null){
                return source;
            }
            return getEmptySource();
        }

All tests will pass.
the reason here is if there is an invalid href the patch you have send return the emptySource and the commited version returns null.

so I belive that sending a null is correct if user has given a wrong href name. But if you want to return a emptySource (this may sometimes cause debuging problems) I commit it in that way.

the externalTemplate variable is used to define an externalTemplate at runtime if needed. So  this is an existing thing and we have to treat it in a special way.

I'll commit the test cases as well. Sorry I have fogotten them since your patch has only the Class change. 

I am bit reluctant to commit the patch in the way you have send it since it hide exceptions and you have put a todo for that.

please replay soon since we are going to relase 1.3 soon.

> Improved codegen XSLTIncludeResolver support for <xsl:include>
> --------------------------------------------------------------
>
>                 Key: AXIS2-2749
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2749
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Improvement
>          Components: codegen
>            Reporter: Peter Danielsen
>            Assignee: Amila Chinthaka Suriarachchi
>         Attachments: newpatch.txt, XSLTIncludeResolver.java.svn.diff, XSLTIncludeResolver.patch.txt, XSLTIncludeResolverTest.java, XSLTIncludeResolverTestTemplate.xsl
>
>
> I've been trying to create my own Axis2 codegen XSLT templates and would like to factor out some common templates to a separate file that can be included by others.  An example is a template that generates a method signature.  It would be included in a template that generates an interface and in one that generates an implementation class.
> The current URI resolver used by the AxisServiceBasedMultiLanguageEmitter, XSLTIncludeResolver, requires the value of an <xsl:include>'s href attribute to be a property that's in its CodeGenConfiguration object. It looks like the only way to set the property is to write code. It would be preferable refer to it directly in a template by setting the href to a value that can be resolved by XSLTIncludeResolver using getResourceAsStream.  Such a change to XSLTIncludeResolver will enable easier maintenance of the existing templates, once refactored, and easier development of new templates since there won't be multiple copies of the same code to update when something changes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (AXIS2-2749) Improved codegen XSLTIncludeResolver support for

Posted by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-2749?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12506639 ] 

Amila Chinthaka Suriarachchi commented on AXIS2-2749:
-----------------------------------------------------

can you please create your patch with the normal svn diff. I am not in eclipse.

> Improved codegen XSLTIncludeResolver support for <xsl:include>
> --------------------------------------------------------------
>
>                 Key: AXIS2-2749
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2749
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Improvement
>          Components: codegen
>            Reporter: Peter Danielsen
>            Assignee: Amila Chinthaka Suriarachchi
>         Attachments: XSLTIncludeResolver.patch.txt, XSLTIncludeResolverTest.java, XSLTIncludeResolverTestTemplate.xsl
>
>
> I've been trying to create my own Axis2 codegen XSLT templates and would like to factor out some common templates to a separate file that can be included by others.  An example is a template that generates a method signature.  It would be included in a template that generates an interface and in one that generates an implementation class.
> The current URI resolver used by the AxisServiceBasedMultiLanguageEmitter, XSLTIncludeResolver, requires the value of an <xsl:include>'s href attribute to be a property that's in its CodeGenConfiguration object. It looks like the only way to set the property is to write code. It would be preferable refer to it directly in a template by setting the href to a value that can be resolved by XSLTIncludeResolver using getResourceAsStream.  Such a change to XSLTIncludeResolver will enable easier maintenance of the existing templates, once refactored, and easier development of new templates since there won't be multiple copies of the same code to update when something changes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (AXIS2-2749) Improved codegen XSLTIncludeResolver support for

Posted by "Peter Danielsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-2749?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508712 ] 

Peter Danielsen commented on AXIS2-2749:
----------------------------------------

Amila,

I ran the XSLIncludeResolverTest JUnit test that I submitted on the new version (551018) of XSLTIncludeResolver committed yesterday. Unfortunately, there were failures. I provided the test with this JIRA to verify that my patch didn't break any existing functionality.
 
The only test that failed on the original version of XSLTIncludeResolver was:
  testResolveTemplateName
I expected that since it tests the new functionality that was introduced in my patch. 

All tests passed when run on the version that I submitted. 

When I ran the unit test on the committed version, the following tests failed:
  testResolveUnknownDataBinding
  testResolveUnknownProperty
So, the committed version eliminated some existing functionality.  Was this your intent?

(To run the JUnit test on the committed version, I first restored the static final String called EMPTY_TEMPLATE in XSLTIncludeResolver.  It's used by the JUnit test to verify the results of some tests.)

I don't understand the 26/Jun/07 comment suggesting that "externalTemplate" be treated differently.  In the templates I've seen, that configuration property is not set and no errors occur, as far as I can tell.

One other question: Is it possible to commit the JUnit test class also?  It helps verify that the use cases it covers aren't inadvertently broken by future changes.

Thanks for looking into this issue.


Peter




> Improved codegen XSLTIncludeResolver support for <xsl:include>
> --------------------------------------------------------------
>
>                 Key: AXIS2-2749
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2749
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Improvement
>          Components: codegen
>            Reporter: Peter Danielsen
>            Assignee: Amila Chinthaka Suriarachchi
>         Attachments: newpatch.txt, XSLTIncludeResolver.java.svn.diff, XSLTIncludeResolver.patch.txt, XSLTIncludeResolverTest.java, XSLTIncludeResolverTestTemplate.xsl
>
>
> I've been trying to create my own Axis2 codegen XSLT templates and would like to factor out some common templates to a separate file that can be included by others.  An example is a template that generates a method signature.  It would be included in a template that generates an interface and in one that generates an implementation class.
> The current URI resolver used by the AxisServiceBasedMultiLanguageEmitter, XSLTIncludeResolver, requires the value of an <xsl:include>'s href attribute to be a property that's in its CodeGenConfiguration object. It looks like the only way to set the property is to write code. It would be preferable refer to it directly in a template by setting the href to a value that can be resolved by XSLTIncludeResolver using getResourceAsStream.  Such a change to XSLTIncludeResolver will enable easier maintenance of the existing templates, once refactored, and easier development of new templates since there won't be multiple copies of the same code to update when something changes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (AXIS2-2749) Improved codegen XSLTIncludeResolver support for

Posted by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-2749?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508393 ] 

Amila Chinthaka Suriarachchi commented on AXIS2-2749:
-----------------------------------------------------

the above exception is caused by the 'externalTemplate' variable used by some templates. Actually this variable sometimes may not be present. So hide an exception because of this is not a good approach.
I change the code to check this and acommadate your requriement. please see the patch and check it make your requirement. 

> Improved codegen XSLTIncludeResolver support for <xsl:include>
> --------------------------------------------------------------
>
>                 Key: AXIS2-2749
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2749
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Improvement
>          Components: codegen
>            Reporter: Peter Danielsen
>            Assignee: Amila Chinthaka Suriarachchi
>         Attachments: XSLTIncludeResolver.java.svn.diff, XSLTIncludeResolver.patch.txt, XSLTIncludeResolverTest.java, XSLTIncludeResolverTestTemplate.xsl
>
>
> I've been trying to create my own Axis2 codegen XSLT templates and would like to factor out some common templates to a separate file that can be included by others.  An example is a template that generates a method signature.  It would be included in a template that generates an interface and in one that generates an implementation class.
> The current URI resolver used by the AxisServiceBasedMultiLanguageEmitter, XSLTIncludeResolver, requires the value of an <xsl:include>'s href attribute to be a property that's in its CodeGenConfiguration object. It looks like the only way to set the property is to write code. It would be preferable refer to it directly in a template by setting the href to a value that can be resolved by XSLTIncludeResolver using getResourceAsStream.  Such a change to XSLTIncludeResolver will enable easier maintenance of the existing templates, once refactored, and easier development of new templates since there won't be multiple copies of the same code to update when something changes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (AXIS2-2749) Improved codegen XSLTIncludeResolver support for

Posted by "Peter Danielsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-2749?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12506745 ] 

Peter Danielsen commented on AXIS2-2749:
----------------------------------------

Amila,

I don't want to change how the databindsupporter works, but I would like to also be able to use <xsl:include> in the traditional way where the href just refers directly to a location that can be found with getResourceAsStream.  This issue is about making it easier to reuse code among template files.  

In the development of my templates, there were several places where I needed to do the same thing.  An example is generating a method signature.  It should be the same in the interface and in the implementation.  I could have copied and pasted that code.  Or, I could have created a named template and called it from each place, but I needed to use it in different template files.  To do that would have required me to copy the named template into each file, which would be time-consuming to fix if a bug was discovered. I'd rather just put that common template in a one file that could be included by the other files.  If a bug is found with that code, I only need to update one place.

In my case, I put the common template in a new file at     
  com/foo/axis2/wsdl/template/java/InterfaceMethodSignature.xsl

Without the patch, I'd have to write some Java code to modify the CodeGenConfiguration object to create a property and set its value as the path to the file, and then modify each template to add an <xsl:include> whose href attribute is that property name.

With the patch, I can just include that file with
  <xsl:include href="/com/foo/axis2/wsdl/template/java/InterfaceMethodSignature.xsl" /> 
and not have to write any Java code.

Regarding your question about affecting existing template processing system, I don't believe it will break it.  The only issue would be if a template is modified and an href is given an incorrect value.  When that occurs a TransformerException is thrown with the message id "resolver.templateNotFound". I saw that message appear in the console output in my test runs.  In the patch, I have a "TODO" in the "catch" of that exception because I didn't think there was anything further to do given that the message appeared in the console output.  What do you think should be done?

Once this patch is in place, there's an opportunity to take advantage of this feature to reduce the size of the existing templates by factoring out duplicate code to common files that they could include.


Peter


> Improved codegen XSLTIncludeResolver support for <xsl:include>
> --------------------------------------------------------------
>
>                 Key: AXIS2-2749
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2749
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Improvement
>          Components: codegen
>            Reporter: Peter Danielsen
>            Assignee: Amila Chinthaka Suriarachchi
>         Attachments: XSLTIncludeResolver.java.svn.diff, XSLTIncludeResolver.patch.txt, XSLTIncludeResolverTest.java, XSLTIncludeResolverTestTemplate.xsl
>
>
> I've been trying to create my own Axis2 codegen XSLT templates and would like to factor out some common templates to a separate file that can be included by others.  An example is a template that generates a method signature.  It would be included in a template that generates an interface and in one that generates an implementation class.
> The current URI resolver used by the AxisServiceBasedMultiLanguageEmitter, XSLTIncludeResolver, requires the value of an <xsl:include>'s href attribute to be a property that's in its CodeGenConfiguration object. It looks like the only way to set the property is to write code. It would be preferable refer to it directly in a template by setting the href to a value that can be resolved by XSLTIncludeResolver using getResourceAsStream.  Such a change to XSLTIncludeResolver will enable easier maintenance of the existing templates, once refactored, and easier development of new templates since there won't be multiple copies of the same code to update when something changes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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