<%@page contentType="text/html" buffer="none" import="java.io.*" import= "wowg.*" import = "java.net.*" %> <%! File dir = new File(wowg.CachedURL.cvs,"2002/03owlt/editors-draft/draft/"); void save( String url, String fName, JspWriter jsp, Thread t ) throws IOException { URL u = new URL(url); jsp.println("

Saving "+ url + " to " + fName + "

"); jsp.flush(); t.resume(); InputStream in = u.openStream(); OutputStream out = new FileOutputStream( new File(dir, fName) ); byte buf[] = new byte[1024]; while ( true ) { int lgth = in.read(buf); if ( lgth <= 0 ) { in.close(); out.close(); t.suspend(); jsp.println("

Done

"); jsp.flush(); return; } out.write(buf,0,lgth); } } %> Update the Editors Draft <% if ( request.getMethod().equalsIgnoreCase("POST") ) { final JspWriter o2 = out; Thread t = new Thread() { public void run() { try { while ( true ) { Thread.sleep(5000); o2.print("
wait ...
"); o2.flush(); } } catch (Exception e) { } } }; t.start(); t.suspend(); try { String goal = request.getParameter("submit"); String url = new String(request.getRequestURL()); url = url.substring(0,url.lastIndexOf('/')) + "/main.jsp?editorsDraft=" + goal.startsWith("E") + "&size="; %>

Generating: <%=goal%> in <%= dir.getAbsolutePath() %>

<% out.flush(); if ( goal.indexOf("Z")!= -1 ) { t.resume(); response.flushBuffer(); Triples.usingZipMaker = true; new ZipMaker("APPROVED").saveAs( new File(dir, "approved.zip").getAbsolutePath() ); // new ZipMaker("PROPOSED").saveAs(new File(dir, "proposed.zip").getAbsolutePath() ); Triples.usingZipMaker = false; t.suspend(); %>

Done!

<% out.flush(); } if (goal.indexOf("E") != -1 || goal.indexOf("W") != -1 ) { String ur = url.substring(0,url.lastIndexOf('/')) + ( goal.indexOf("W") != -1 ? "/main.jsp?editorsDraft=false&size=": "/main.jsp?editorsDraft=true&size=" ); save( ur +"M", "M.html", out, t ); save( ur+"L", "L.html", out, t ); save( ur+"X", "XXL.html", out, t ); %>

Applying XSLT in <%= dir.getAbsolutePath() %>

<% t.resume(); File saxon = new File( dir.getParentFile(), "saxon.jar" ); File xslt = new File( dir.getParentFile(), "multipart.xsl" ); Process p = Runtime.getRuntime().exec(new String[]{"java","-jar",saxon.getAbsolutePath(), "XXL.html", xslt.getAbsolutePath()}, null, dir ); p.waitFor(); t.suspend(); %>

Generating Manifest.rdf in <%= dir.getAbsolutePath() %>

<% t.resume(); response.flushBuffer(); FileOutputStream fos = new FileOutputStream(new File(dir, "Manifest.rdf")); Manifest.model().write(fos,"RDF/XML-ABBREV", "never:never.never"); fos.close(); t.suspend(); } } catch (Exception e) { %> Exception: <%= e.getMessage() %>

<% } finally { t.resume(); t.interrupt(); } } %>

Update the Editors Draft

Generate: