[jira] Created: (OFBIZ-370) Allow splitting of controller.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (OFBIZ-370) Allow splitting of controller.xml

Nicolas Malin (Jira)
Allow splitting of controller.xml
---------------------------------

                 Key: OFBIZ-370
                 URL: http://issues.apache.org/jira/browse/OFBIZ-370
             Project: OFBiz (The Open for Business Project)
          Issue Type: Improvement
          Components: framework
    Affects Versions: SVN trunk
         Environment: Linux, java-sun-1.5
            Reporter: Peter Goron
            Priority: Minor
         Attachments: site-conf-include.patch

Controller.xml files become bigger and bigger and are complex to read. That made a long time I was looking for a way to split these files and I finally digged into ofbiz code to see how it can be implemented.

What a surprise to see that this feature is already present in Ofbiz but is not activated !

You can test to insert <include file="another-controller.xml"/> in an existing controller.xml. You should see a validation error because include element is not declared in xsd but it does not prevent inclusion mechanism to run.

However there is good chance you also obtain an exception report because it doesn't find the file you try to include. To be consistent with other places in ofbiz, I've slightly modified inclusion mechanism to use FlexibleResolver (see attached patch, ex: <include location="component://component/webapp/component/WEB-INF/another-controller.xml"/>)

I hope you will be as enthousiast as me about this feature. I think it opens nice perspectives :
- the possibility to share common request-map & view-map (login, logout, setLocale, Lookups, etc)
- the possibility to split a big controller.xml by functional subdomain (like for servicedef)

Peter

PS: I'm not sure if it's related to OFBIZ-77 issue

--
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

       
Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (OFBIZ-370) Allow splitting of controller.xml

Nicolas Malin (Jira)
     [ http://issues.apache.org/jira/browse/OFBIZ-370?page=all ]

Peter Goron updated OFBIZ-370:
------------------------------

    Attachment: site-conf-include.patch

> Allow splitting of controller.xml
> ---------------------------------
>
>                 Key: OFBIZ-370
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-370
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: SVN trunk
>         Environment: Linux, java-sun-1.5
>            Reporter: Peter Goron
>            Priority: Minor
>         Attachments: site-conf-include.patch
>
>
> Controller.xml files become bigger and bigger and are complex to read. That made a long time I was looking for a way to split these files and I finally digged into ofbiz code to see how it can be implemented.
> What a surprise to see that this feature is already present in Ofbiz but is not activated !
> You can test to insert <include file="another-controller.xml"/> in an existing controller.xml. You should see a validation error because include element is not declared in xsd but it does not prevent inclusion mechanism to run.
> However there is good chance you also obtain an exception report because it doesn't find the file you try to include. To be consistent with other places in ofbiz, I've slightly modified inclusion mechanism to use FlexibleResolver (see attached patch, ex: <include location="component://component/webapp/component/WEB-INF/another-controller.xml"/>)
> I hope you will be as enthousiast as me about this feature. I think it opens nice perspectives :
> - the possibility to share common request-map & view-map (login, logout, setLocale, Lookups, etc)
> - the possibility to split a big controller.xml by functional subdomain (like for servicedef)
> Peter
> PS: I'm not sure if it's related to OFBIZ-77 issue

--
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

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-370) Allow splitting of controller.xml

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-370?page=comments#action_12440964 ]
           
Chris Howe commented on OFBIZ-370:
----------------------------------

We had discussed this a while back and at the time (and I think the point is still very valid) this approach makes troubleshooting more dificult.  When you get an error on a page, the way most troubleshoot it is to:

1) look at the uri
2) go to the controller.xml and find the uri
3) take it from there

if you use inserts or include file, it will become very dificult to track down where the uri is and thus more dificult to troubleshoot.  Compound this with the fact that name xml elements overwrite previous elements with the same name and you'll find it near impossible to find your uri to begin troubleshooting.

OFBIZ-77 attempts to take a merge approach so that the custom developer can easily keep track of his/her customizations when built in reference to an established app.  Not for use within the project, but rather for custom applications.

> Allow splitting of controller.xml
> ---------------------------------
>
>                 Key: OFBIZ-370
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-370
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: SVN trunk
>         Environment: Linux, java-sun-1.5
>            Reporter: Peter Goron
>            Priority: Minor
>         Attachments: site-conf-include.patch
>
>
> Controller.xml files become bigger and bigger and are complex to read. That made a long time I was looking for a way to split these files and I finally digged into ofbiz code to see how it can be implemented.
> What a surprise to see that this feature is already present in Ofbiz but is not activated !
> You can test to insert <include file="another-controller.xml"/> in an existing controller.xml. You should see a validation error because include element is not declared in xsd but it does not prevent inclusion mechanism to run.
> However there is good chance you also obtain an exception report because it doesn't find the file you try to include. To be consistent with other places in ofbiz, I've slightly modified inclusion mechanism to use FlexibleResolver (see attached patch, ex: <include location="component://component/webapp/component/WEB-INF/another-controller.xml"/>)
> I hope you will be as enthousiast as me about this feature. I think it opens nice perspectives :
> - the possibility to share common request-map & view-map (login, logout, setLocale, Lookups, etc)
> - the possibility to split a big controller.xml by functional subdomain (like for servicedef)
> Peter
> PS: I'm not sure if it's related to OFBIZ-77 issue

--
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

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-370) Allow splitting of controller.xml

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-370?page=comments#action_12440968 ]
           
Peter Goron commented on OFBIZ-370:
-----------------------------------

Hi Chris,

I think the problem you describe is the same for service definitions that can be hidden by other definitions with the same name. But nobody complains about it because it's not the aim of this feature.

This feature is not intended to override existing request-map or view-map but to help to organize them by  functional domain (like everyone seems to do for service definitions, ex: application/order/servicedef).


Peter


> Allow splitting of controller.xml
> ---------------------------------
>
>                 Key: OFBIZ-370
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-370
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: SVN trunk
>         Environment: Linux, java-sun-1.5
>            Reporter: Peter Goron
>            Priority: Minor
>         Attachments: site-conf-include.patch
>
>
> Controller.xml files become bigger and bigger and are complex to read. That made a long time I was looking for a way to split these files and I finally digged into ofbiz code to see how it can be implemented.
> What a surprise to see that this feature is already present in Ofbiz but is not activated !
> You can test to insert <include file="another-controller.xml"/> in an existing controller.xml. You should see a validation error because include element is not declared in xsd but it does not prevent inclusion mechanism to run.
> However there is good chance you also obtain an exception report because it doesn't find the file you try to include. To be consistent with other places in ofbiz, I've slightly modified inclusion mechanism to use FlexibleResolver (see attached patch, ex: <include location="component://component/webapp/component/WEB-INF/another-controller.xml"/>)
> I hope you will be as enthousiast as me about this feature. I think it opens nice perspectives :
> - the possibility to share common request-map & view-map (login, logout, setLocale, Lookups, etc)
> - the possibility to split a big controller.xml by functional subdomain (like for servicedef)
> Peter
> PS: I'm not sure if it's related to OFBIZ-77 issue

--
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

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-370) Allow splitting of controller.xml

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-370?page=comments#action_12440971 ]
           
Chris Howe commented on OFBIZ-370:
----------------------------------

The difference with servicedefs is that they are globally unique and therefore their name within the community project is unique.  Controller request and view maps are only webapp unique and therefore not unique within the community project.

> Allow splitting of controller.xml
> ---------------------------------
>
>                 Key: OFBIZ-370
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-370
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: SVN trunk
>         Environment: Linux, java-sun-1.5
>            Reporter: Peter Goron
>            Priority: Minor
>         Attachments: site-conf-include.patch
>
>
> Controller.xml files become bigger and bigger and are complex to read. That made a long time I was looking for a way to split these files and I finally digged into ofbiz code to see how it can be implemented.
> What a surprise to see that this feature is already present in Ofbiz but is not activated !
> You can test to insert <include file="another-controller.xml"/> in an existing controller.xml. You should see a validation error because include element is not declared in xsd but it does not prevent inclusion mechanism to run.
> However there is good chance you also obtain an exception report because it doesn't find the file you try to include. To be consistent with other places in ofbiz, I've slightly modified inclusion mechanism to use FlexibleResolver (see attached patch, ex: <include location="component://component/webapp/component/WEB-INF/another-controller.xml"/>)
> I hope you will be as enthousiast as me about this feature. I think it opens nice perspectives :
> - the possibility to share common request-map & view-map (login, logout, setLocale, Lookups, etc)
> - the possibility to split a big controller.xml by functional subdomain (like for servicedef)
> Peter
> PS: I'm not sure if it's related to OFBIZ-77 issue

--
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

       
Reply | Threaded
Open this post in threaded view
|

[jira] Assigned: (OFBIZ-370) Allow splitting of controller.xml

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
     [ http://issues.apache.org/jira/browse/OFBIZ-370?page=all ]

Si Chen reassigned OFBIZ-370:
-----------------------------

    Assignee: Si Chen

> Allow splitting of controller.xml
> ---------------------------------
>
>                 Key: OFBIZ-370
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-370
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: SVN trunk
>         Environment: Linux, java-sun-1.5
>            Reporter: Peter Goron
>         Assigned To: Si Chen
>            Priority: Minor
>         Attachments: site-conf-include.patch
>
>
> Controller.xml files become bigger and bigger and are complex to read. That made a long time I was looking for a way to split these files and I finally digged into ofbiz code to see how it can be implemented.
> What a surprise to see that this feature is already present in Ofbiz but is not activated !
> You can test to insert <include file="another-controller.xml"/> in an existing controller.xml. You should see a validation error because include element is not declared in xsd but it does not prevent inclusion mechanism to run.
> However there is good chance you also obtain an exception report because it doesn't find the file you try to include. To be consistent with other places in ofbiz, I've slightly modified inclusion mechanism to use FlexibleResolver (see attached patch, ex: <include location="component://component/webapp/component/WEB-INF/another-controller.xml"/>)
> I hope you will be as enthousiast as me about this feature. I think it opens nice perspectives :
> - the possibility to share common request-map & view-map (login, logout, setLocale, Lookups, etc)
> - the possibility to split a big controller.xml by functional subdomain (like for servicedef)
> Peter
> PS: I'm not sure if it's related to OFBIZ-77 issue

--
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

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-370) Allow splitting of controller.xml

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-370?page=comments#action_12450806 ]
           
Si Chen commented on OFBIZ-370:
-------------------------------

This is actually a good idea, and I will take a look at Peter's code and give you my feedback.

Peter--do you have some samples of usage or syntax?

> Allow splitting of controller.xml
> ---------------------------------
>
>                 Key: OFBIZ-370
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-370
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: SVN trunk
>         Environment: Linux, java-sun-1.5
>            Reporter: Peter Goron
>         Assigned To: Si Chen
>            Priority: Minor
>         Attachments: site-conf-include.patch
>
>
> Controller.xml files become bigger and bigger and are complex to read. That made a long time I was looking for a way to split these files and I finally digged into ofbiz code to see how it can be implemented.
> What a surprise to see that this feature is already present in Ofbiz but is not activated !
> You can test to insert <include file="another-controller.xml"/> in an existing controller.xml. You should see a validation error because include element is not declared in xsd but it does not prevent inclusion mechanism to run.
> However there is good chance you also obtain an exception report because it doesn't find the file you try to include. To be consistent with other places in ofbiz, I've slightly modified inclusion mechanism to use FlexibleResolver (see attached patch, ex: <include location="component://component/webapp/component/WEB-INF/another-controller.xml"/>)
> I hope you will be as enthousiast as me about this feature. I think it opens nice perspectives :
> - the possibility to share common request-map & view-map (login, logout, setLocale, Lookups, etc)
> - the possibility to split a big controller.xml by functional subdomain (like for servicedef)
> Peter
> PS: I'm not sure if it's related to OFBIZ-77 issue

--
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

       
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-370) Allow splitting of controller.xml

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
    [ http://issues.apache.org/jira/browse/OFBIZ-370?page=comments#action_12451035 ]
           
Peter Goron commented on OFBIZ-370:
-----------------------------------

Hi Si

Thanks to take a look to this issue.

After having applied patch, you can include another file in a controller.xml file using this syntax:
    <include location="component://component/webapp/webappname/WEB-INF/another-controller.xml"/>

This tag must be inserted after handler declarations in controller.xml

Peter

> Allow splitting of controller.xml
> ---------------------------------
>
>                 Key: OFBIZ-370
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-370
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: SVN trunk
>         Environment: Linux, java-sun-1.5
>            Reporter: Peter Goron
>         Assigned To: Si Chen
>            Priority: Minor
>         Attachments: site-conf-include.patch
>
>
> Controller.xml files become bigger and bigger and are complex to read. That made a long time I was looking for a way to split these files and I finally digged into ofbiz code to see how it can be implemented.
> What a surprise to see that this feature is already present in Ofbiz but is not activated !
> You can test to insert <include file="another-controller.xml"/> in an existing controller.xml. You should see a validation error because include element is not declared in xsd but it does not prevent inclusion mechanism to run.
> However there is good chance you also obtain an exception report because it doesn't find the file you try to include. To be consistent with other places in ofbiz, I've slightly modified inclusion mechanism to use FlexibleResolver (see attached patch, ex: <include location="component://component/webapp/component/WEB-INF/another-controller.xml"/>)
> I hope you will be as enthousiast as me about this feature. I think it opens nice perspectives :
> - the possibility to share common request-map & view-map (login, logout, setLocale, Lookups, etc)
> - the possibility to split a big controller.xml by functional subdomain (like for servicedef)
> Peter
> PS: I'm not sure if it's related to OFBIZ-77 issue

--
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

       
Reply | Threaded
Open this post in threaded view
|

[jira] Assigned: (OFBIZ-370) Allow splitting of controller.xml

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
     [ http://issues.apache.org/jira/browse/OFBIZ-370?page=all ]

David E. Jones reassigned OFBIZ-370:
------------------------------------

    Assignee: David E. Jones  (was: Si Chen)

> Allow splitting of controller.xml
> ---------------------------------
>
>                 Key: OFBIZ-370
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-370
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: SVN trunk
>         Environment: Linux, java-sun-1.5
>            Reporter: Peter Goron
>         Assigned To: David E. Jones
>            Priority: Minor
>         Attachments: site-conf-include.patch
>
>
> Controller.xml files become bigger and bigger and are complex to read. That made a long time I was looking for a way to split these files and I finally digged into ofbiz code to see how it can be implemented.
> What a surprise to see that this feature is already present in Ofbiz but is not activated !
> You can test to insert <include file="another-controller.xml"/> in an existing controller.xml. You should see a validation error because include element is not declared in xsd but it does not prevent inclusion mechanism to run.
> However there is good chance you also obtain an exception report because it doesn't find the file you try to include. To be consistent with other places in ofbiz, I've slightly modified inclusion mechanism to use FlexibleResolver (see attached patch, ex: <include location="component://component/webapp/component/WEB-INF/another-controller.xml"/>)
> I hope you will be as enthousiast as me about this feature. I think it opens nice perspectives :
> - the possibility to share common request-map & view-map (login, logout, setLocale, Lookups, etc)
> - the possibility to split a big controller.xml by functional subdomain (like for servicedef)
> Peter
> PS: I'm not sure if it's related to OFBIZ-77 issue

--
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

       
Reply | Threaded
Open this post in threaded view
|

[jira] Closed: (OFBIZ-370) Allow splitting of controller.xml

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)
     [ http://issues.apache.org/jira/browse/OFBIZ-370?page=all ]

David E. Jones closed OFBIZ-370.
--------------------------------

    Fix Version/s: SVN trunk
       Resolution: Fixed

Thanks Peter, your changes are in SVN rev 476610.

This was a little aggressive on the cleanups, but I'm fine with that as all of those things really needed to be cleaned up.

I made one small change so that the include element is the first in the file instead of further down.

After reviewing this I noticed that only the request-map and view-map elements are included and it would be nice to include everything. So, now everything is included from the other file, but everything can also be overridden in the current file, including the event list blocks though those will override the entire event list from the other file, which is good because it is the only real way to "remove" an event from one of the lists. These changes are in SVN rev 476624.

BTW, I also changed the exception handler catch blocks to use the Debug.logError method instead of the printStackTrace method directly on the exception.

> Allow splitting of controller.xml
> ---------------------------------
>
>                 Key: OFBIZ-370
>                 URL: http://issues.apache.org/jira/browse/OFBIZ-370
>             Project: OFBiz (The Open for Business Project)
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: SVN trunk
>         Environment: Linux, java-sun-1.5
>            Reporter: Peter Goron
>         Assigned To: David E. Jones
>            Priority: Minor
>             Fix For: SVN trunk
>
>         Attachments: site-conf-include.patch
>
>
> Controller.xml files become bigger and bigger and are complex to read. That made a long time I was looking for a way to split these files and I finally digged into ofbiz code to see how it can be implemented.
> What a surprise to see that this feature is already present in Ofbiz but is not activated !
> You can test to insert <include file="another-controller.xml"/> in an existing controller.xml. You should see a validation error because include element is not declared in xsd but it does not prevent inclusion mechanism to run.
> However there is good chance you also obtain an exception report because it doesn't find the file you try to include. To be consistent with other places in ofbiz, I've slightly modified inclusion mechanism to use FlexibleResolver (see attached patch, ex: <include location="component://component/webapp/component/WEB-INF/another-controller.xml"/>)
> I hope you will be as enthousiast as me about this feature. I think it opens nice perspectives :
> - the possibility to share common request-map & view-map (login, logout, setLocale, Lookups, etc)
> - the possibility to split a big controller.xml by functional subdomain (like for servicedef)
> Peter
> PS: I'm not sure if it's related to OFBIZ-77 issue

--
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