Workflow in Database

"Philipp Hug" <[email protected]>
Newsgroups gmane.comp.java.open-symphony.devel
Message-ID <002601c30fea$70644810$522210ac@chimera>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.