Re: Workflow in Database
Hani Suleiman <[email protected]>
| Newsgroups | gmane.comp.java.open-symphony.devel |
|---|---|
| Message-ID | <[email protected]> |
I've added the load(InputStream) method, it's in CVS now.
For the other issue, I don't think it's a good idea to add that. The
reason is that the way it is set up currently, the save method is free
to choose any way of saving. It doesn't need to store it as an xml file
either. It could persist the workflow descriptor to a set of database
tables which model its structure, or to a swing JTree model.
The WorkflowLoader is a convenience class, and so I don't think it's
such a big deal to duplicate the small amount of code it is to write
out the xml file. You could always have your jdbc factory subclass
XMLWorkflowFactory, and use its writing method. Okok, so this wasn't
possible before, but I just fixed it in XMLWorkflowFactory.
You can subclass it (JDBCXMLWorkflowFactory) and override the
saveWorkflow method, then use the writeXML method to write out your
workflow to whatever Writer you want.
Let me know if you have any problems with your implementation!
Hani
On Thursday, May 1, 2003, at 10:03 AM, Philipp Hug wrote:
> I wrote a class to put workflow definitions in a JDBC database,
> but I need some patches in osWorkflow to prevent code duplication:
>
> 1. WorkflowLoader.java
> --> add an additional load method that takes an InputStream instead of
> an
> URL
> /**
> * Load a workflow descriptor from a URL
> */
> public static WorkflowDescriptor load(final URL url) throws
> SAXException, IOException {
> return load(url.openStream());
> }
>
> /**
> * Load a workflow descriptor from an InputStream
> */
> public static WorkflowDescriptor load(final InputStream is) throws
> SAXException, IOException {
> ----
>
> 2. Move save() code from XMLWorkflowFactory into a new class similar to
> WorkflowLoader, otherwise the code
> would need to be duplicated. It's just a small part of code but anyway:
>
> the code could look like that:
> public static save(OutputStream os) {
> Writer out = new OutputStreamWriter(os);
>
> PrintWriter writer = new PrintWriter(new BufferedWriter(out));
> writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
>
> writer.println("<!DOCTYPE workflow PUBLIC \"-//OpenSymphony
> Group//DTD OSWorkflow 2.5//EN\"
> \"http://www.opensymphony.com/osworkflow/workflow.dtd\">");
> descriptor.writeXML(writer, 0);
> writer.flush();
> writer.close();
> }
>
> What do you think? Should I submit a feature request/bug in JIRA?
>
> philipp
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Opensymphony-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-developers
>
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf