Project

General

Profile

« Previous | Next » 

Revision 598

Added by bojilova over 23 years ago

DBEntityResolver:
- added new parameter dtd for upload on Metacat file system; optional; Reader
- new routines to upload dtd if provided
- systemID of metadata document is used to exctract the filename of new dtd;
- the new dtd is uploaded on Metacat file system as specified by dtdPath property;
- dtdURL property value is return after upload to the parser as a new systemID for metadata doc;
- the doctype of metadata document is used for registering of the new dtd;
- <doctype, dtdURL> is registered in db xml_catalog
AccessControlList:
- changes to use DBEntityResolver as a EntityResolver
DocumentImpl, MetaCatServlet:
- changes related to DTD upload - new servlet parameter dtdtext(optional) for the text of the new DTD;
- dtdtext parameter is expected on INSERT or UPDATE actions

View differences:

MetaCatServlet.java
72 72
 * qformat=html -- display resultset from query in HTML<br>
73 73
 * docid=34 -- display the document with the document ID number 34<br>
74 74
 * doctext -- XML text of the document to load into the database<br>
75
 * acl - xml access file for a document to load into the database<br>
75
 * acltext -- XML access text for a document to load into the database<br>
76
 * dtdtext -- XML DTD text for a new DTD to load into Metacat XML Catalog<br>
76 77
 * query -- actual query text (to go with 'action=query' or 'action=squery')<br>
77 78
 * valtext -- XML text to be validated<br>
78 79
 * action=getdatadoc -- retreive a stored datadocument<br>
......
124 125
      executescript = util.getOption("executescript"); 
125 126
      servletpath = util.getOption("servletpath");
126 127
      htmlpath = util.getOption("htmlpath");
127
/*
128
      try {
129
        // Open a pool of db connections
130
        connectionPool = util.getConnectionPool();
131
      } catch (Exception e) {
132
        System.err.println("Error creating pool of database connections");
133
        System.err.println(e.getMessage());
134
      }
135
*/
128

  
129
//      try {
130
//        // Open a pool of db connections
131
//        connectionPool = util.getConnectionPool();
132
//      } catch (Exception e) {
133
//        System.err.println("Error creating pool of database connections");
134
//        System.err.println(e.getMessage());
135
//      }
136 136
    } catch ( ServletException ex ) {
137 137
      throw ex;
138 138
    }
......
175 175
    if ( util == null ) {
176 176
        util = new MetaCatUtil(); 
177 177
    }
178
    if ( connectionPool == null ) {
178
    if ( connectionPool.isEmpty() ) {
179 179
      try {
180 180
        // Open a pool of db connections
181 181
        connectionPool = util.getConnectionPool();
......
884 884
               HttpServletResponse response) 
885 885
               throws ClassNotFoundException, IOException, SQLException 
886 886
  {
887
//    out.println(((String[])params.get("docid"))[0]);
887
    //out.println(((String[])params.get("docid"))[0]);
888 888
    try {
889 889
      //MetacatURL murl = new MetacatURL(((String[])params.get("docid"))[0]);
890 890
      URL murl = new URL(((String[])params.get("docid"))[0]);
......
963 963
    try {
964 964
      // Get the document indicated
965 965
      String[] doctext = (String[])params.get("doctext");
966
      String[] acltext = null;
967 966

  
968 967
      StringReader acl = null;
969
      if(params.contains("acl"))
968
      if(params.contains("acltext"))
970 969
      {
971
        acltext = (String[])params.get("acl");
970
        String[] acltext = (String[])params.get("acltext");
972 971
        try {
973 972
          acl = new StringReader(acltext[0]);
974 973
        } catch (NullPointerException npe) {}
975 974
      }
975
      StringReader dtd = null;
976
      if(params.contains("dtdtext"))
977
      {
978
        String[] dtdtext = (String[])params.get("dtdtext");
979
        try {
980
          dtd = new StringReader(dtdtext[0]);
981
        } catch (NullPointerException npe) {}
982
      }
976 983
      
977 984
      StringReader xml = null;
978 985
      try {
......
999 1006
                if (accNumber.equals("")) {
1000 1007
                    accNumber = null;
1001 1008
                }
1002
                newdocid = DocumentImpl.write(conn, xml, acl, doAction,
1009
                newdocid = DocumentImpl.write(conn, xml, acl, dtd, doAction,
1003 1010
                                              accNumber, user, group);
1004 1011
                
1005 1012
            } catch (NullPointerException npe) {
1006
              newdocid = DocumentImpl.write(conn, xml, acl, doAction,
1013
              newdocid = DocumentImpl.write(conn, xml, acl, dtd, doAction,
1007 1014
                                            null, user, group);
1008 1015
            }
1009 1016
//        } catch (Exception e) {

Also available in: Unified diff