Issue Details (XML | Word | Printable)

Key: WF-397
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Hani Suleiman
Reporter: Sébastien Launay
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
OSWorkflow

Visibility of the inner class com.opensymphony.workflow.loader.XMLWorkflowFactory.WorkflowConfig

Created: 31/May/05 04:26 AM   Updated: 20/Jun/05 04:59 AM
Return to search
Component/s: None
Affects Version/s: 2.8
Fix Version/s: 2.8

File Attachments: 1. Text File XMLWorkflowFactory.java.patch (4 kB)



 Description  « Hide
I want to load workflow description file from the original XmlWorkflowFactory. And, i want these files to be in the local file system. But, when i use the "file" type like this :
<workflows>
  <workflow name="document" type="file" location="document-workflow.xml"/>
</workflows>
the search is done in $HOME/workflow.xml (because of File file = new File(location);) but i want to search for example in /path/to/WEB-INF/config/.
So, the simple solution for me will be to change url and location of the Map workflows after the call of initDone() in an inherited class of XmlWorkflowFactory.
But, i did not have acess to the inner class WorkflowConfig nested in XmlWorkflowFactory because the class visibility is package.

Thereforce, if the visibility was public, i could change url to point to my directory by changing location of each entry of the map.

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Hani Suleiman added a comment - 11/Jun/05 12:31 PM
Your solution would be a bit of a hack I'm afraid. The correct fix would be to add a 'basedir' attribute to the <workflows> element, and that'd be prepended to every file specified.

I'll try and implement this soon. Alternatively if you do it then please do submit a patch and I'll commit it. Thanks!

Sébastien Launay added a comment - 13/Jun/05 08:39 AM
I agree it will be a bit of a hack and this enhancement with a 'basedir' attribute will be best.
But, it does not resolve my problem, because the directory path name is dynamic and i know it only at execution via servletContext.getRealPath("WEB-INF/config/workflows.xml");.

So, i create a protected method for getting the base dir which i could redefine in the inherited class for setting my base dir.
Beside this, i respect your idea, and now a basedir attribute could be used for file type.
If the location is absolute, the base dir will not be used.
If the locaction is relative, it will be appended to the base dir.
And finally, if the base dir is not absolute, it will be appended to the current working directory.
The behavior is the same if no basedir attribute is defined.

By the way, i also extract the search of the workflows.xml in a protected method in order to be more flexible, like in DefaultConfiguration.

Sébastien Launay added a comment - 13/Jun/05 08:40 AM
The diff from the cvs.

Hani Suleiman added a comment - 20/Jun/05 04:59 AM
Thanks for the patch and sorry for the delay!