1 8 import java.io.*; 9 import org.w3c.dom.*; 10 import javax.servlet.http.*; 11 12 import org.apache.cocoon.framework.*; 13 import org.apache.cocoon.parser.Parser; 14 import org.apache.cocoon.producer.Producer; 15 16 import org.ozoneDB.*; 17 import org.ozoneDB.xml.*; 18 import org.ozoneDB.xml.dom.*; 19 import org.ozoneDB.xml.util.*; 20 21 22 34 public class OzoneProducer extends AbstractActor implements Producer, Status { 35 private final static String hostname = "localhost"; 37 private final static int port = 3333; 38 private final static String username = "zvi"; 39 private final static String password = "111"; 40 41 private RemoteDatabase database = null; 42 43 44 48 public Document getDocument( HttpServletRequest request ) throws Exception { 49 if (database == null) { 50 database = new RemoteDatabase(); 51 database.open( hostname, port, username, password ); 52 database.reloadClasses(); 53 } 54 ; 55 56 final String documentName = request.getParameter( "document" ); 57 final String query = request.getParameter( "query" ); 58 final String stylesheet = request.getParameter( "stylesheet" ); 59 60 if (documentName == null) { 61 throw new Exception ( "document parameter is not defined" ); 62 } 63 ; 64 65 Document document = (Document)database.objectForName( documentName ); 66 67 if (query != null) { 68 throw new Exception ( "XPath query engine still not implemented" ); 70 } 71 ; 72 73 if (stylesheet != null) { 74 throw new Exception ( "XSLT processing still not implemented" ); 78 } 79 ; 80 81 return document; 82 } 83 84 85 91 public Reader getStream( HttpServletRequest request ) throws Exception { 92 return null; 93 } 94 95 96 101 public String getPath( HttpServletRequest request ) { 102 return ""; 103 } 104 105 106 111 public boolean hasChanged( Object request ) { 112 return true; 113 } 114 115 116 119 public String getStatus() { 120 return "Ozone PDOM Producer"; 121 } 122 } 123 | Popular Tags |