Project

General

Profile

« Previous | Next » 

Revision 887

Added by berkley over 22 years ago

made it so we can now use multiple accessfilestypes and packagdfiletypes in the metacat.properties file. Also fixed a bug introduced when the 'http://' was removed from behind the server name in the loaddtd.sql script and the knb.xml file

View differences:

lib/metacat.properties
19 19
saxparser=org.apache.xerces.parsers.SAXParser
20 20
servletpath=@servlet-path@
21 21
htmlpath=@html-path@
22
packagedoctype=-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN
23
accessdoctype=-//ecoinformatics.org//eml-access-2.0.0beta6//EN
22
packagedoctype=-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN, -//ecoinformatics.org//eml-dataset-2.0.0beta4//EN
23
accessdoctype=-//ecoinformatics.org//eml-access-2.0.0beta6//EN, -//ecoinformatics.org//eml-access-2.0.0beta4//EN
24 24
server=@serverhost@
25 25
authclass=edu.ucsb.nceas.metacat.AuthLdap
26 26
ldapurl=ldap://ldap.ecoinformatics.org:389/
lib/knb.xml
2 2
<style-set name="knb">
3 3
  <default-style>@server@@style-path@/ascii-treeview.xsl</default-style>
4 4
  <doctype publicid="-//NCEAS//resultset//EN">
5
    <target publicid="-//W3C//HTML//EN">@server@@style-path@/resultset.xsl</target>
5
    <target publicid="-//W3C//HTML//EN">http://@server@@style-path@/resultset.xsl</target>
6 6
  </doctype>
7 7
  <doctype publicid="-//NCEAS//login//EN">
8
    <target publicid="-//W3C//HTML//EN">@server@@style-path@/login.xsl</target>
8
    <target publicid="-//W3C//HTML//EN">http://@server@@style-path@/login.xsl</target>
9 9
  </doctype>
10 10
  <doctype publicid="-//NCEAS//eml-dataset-2.0//EN">
11
    <target publicid="-//W3C//HTML//EN">@server@@style-path@/eml-dataset-display.xsl</target>
11
    <target publicid="-//W3C//HTML//EN">http://@server@@style-path@/eml-dataset-display.xsl</target>
12 12
  </doctype>
13 13
  <doctype publicid="-//NCEAS//eml-dataset//EN">
14
    <target publicid="-//W3C//HTML//EN">@server@@style-path@/eml-dataset-display.xsl</target>
14
    <target publicid="-//W3C//HTML//EN">http://@server@@style-path@/eml-dataset-display.xsl</target>
15 15
  </doctype>
16 16
  <doctype publicid="-//NCEAS//eml-resource//EN">
17
    <target publicid="-//W3C//HTML//EN">@server@@style-path@/eml-dataset-display.xsl</target>
17
    <target publicid="-//W3C//HTML//EN">http://@server@@style-path@/eml-dataset-display.xsl</target>
18 18
  </doctype>
19 19
  <doctype publicid="-//ecoinformatics.org//eml-dataset-2.0.0beta4//EN">
20
    <target publicid="-//W3C//HTML//EN">@server@@style-path@/eml-dataset-display.xsl</target>
20
    <target publicid="-//W3C//HTML//EN">http://@server@@style-path@/eml-dataset-display.xsl</target>
21 21
  </doctype>
22 22
  <doctype publicid="-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN">
23
    <target publicid="-//W3C//HTML//EN">@server@@style-path@/eml-dataset-display.xsl</target>
23
    <target publicid="-//W3C//HTML//EN">http://@server@@style-path@/eml-dataset-display.xsl</target>
24 24
  </doctype>
25 25
</style-set>
src/loaddtd.sql
3 3
        AND public_id LIKE '%@eml-version@%';
4 4
INSERT INTO xml_catalog (entry_type, public_id, system_id)
5 5
  VALUES ('DTD', '-//ecoinformatics.org//eml-access-@eml-version@//EN',
6
          '@server@@html-path@/dtd/eml-access-@eml-version@.dtd');
6
          'http://@server@@html-path@/dtd/eml-access-@eml-version@.dtd');
7 7
INSERT INTO xml_catalog (entry_type, public_id, system_id)
8 8
  VALUES ('DTD', '-//ecoinformatics.org//eml-attribute-@eml-version@//EN',
9
          '@server@@html-path@/dtd/eml-attribute-@eml-version@.dtd');
9
          'http://@server@@html-path@/dtd/eml-attribute-@eml-version@.dtd');
10 10
INSERT INTO xml_catalog (entry_type, public_id, system_id)
11 11
  VALUES ('DTD', '-//ecoinformatics.org//eml-constraint-@eml-version@//EN',
12
          '@server@@html-path@/dtd/eml-constraint-@eml-version@.dtd');
12
          'http://@server@@html-path@/dtd/eml-constraint-@eml-version@.dtd');
13 13
INSERT INTO xml_catalog (entry_type, public_id, system_id)
14 14
  VALUES ('DTD', '-//ecoinformatics.org//eml-coverage-@eml-version@//EN',
15
          '@server@@html-path@/dtd/eml-coverage-@eml-version@.dtd');
15
          'http://@server@@html-path@/dtd/eml-coverage-@eml-version@.dtd');
16 16
INSERT INTO xml_catalog (entry_type, public_id, system_id)
17 17
  VALUES ('DTD', '-//ecoinformatics.org//eml-dataset-@eml-version@//EN',
18
          '@server@@html-path@/dtd/eml-dataset-@eml-version@.dtd');
18
          'http://@server@@html-path@/dtd/eml-dataset-@eml-version@.dtd');
19 19
INSERT INTO xml_catalog (entry_type, public_id, system_id)
20 20
  VALUES ('DTD', '-//ecoinformatics.org//eml-entity-@eml-version@//EN',
21
          '@server@@html-path@/dtd/eml-entity-@eml-version@.dtd');
21
          'http://@server@@html-path@/dtd/eml-entity-@eml-version@.dtd');
22 22
INSERT INTO xml_catalog (entry_type, public_id, system_id)
23 23
  VALUES ('DTD', '-//ecoinformatics.org//eml-literature-@eml-version@//EN',
24
          '@server@@html-path@/dtd/eml-literature-@eml-version@.dtd');
24
          'http://@server@@html-path@/dtd/eml-literature-@eml-version@.dtd');
25 25
INSERT INTO xml_catalog (entry_type, public_id, system_id)
26 26
  VALUES ('DTD', '-//ecoinformatics.org//eml-physical-@eml-version@//EN',
27
          '@server@@html-path@/dtd/eml-physical-@eml-version@.dtd');
27
          'http://@server@@html-path@/dtd/eml-physical-@eml-version@.dtd');
28 28
INSERT INTO xml_catalog (entry_type, public_id, system_id)
29 29
  VALUES ('DTD', '-//ecoinformatics.org//eml-project-@eml-version@//EN',
30
          '@server@@html-path@/dtd/eml-project-@eml-version@.dtd');
30
          'http://@server@@html-path@/dtd/eml-project-@eml-version@.dtd');
31 31
INSERT INTO xml_catalog (entry_type, public_id, system_id)
32 32
  VALUES ('DTD', '-//ecoinformatics.org//eml-protocol-@eml-version@//EN',
33
          '@server@@html-path@/dtd/eml-protocol-@eml-version@.dtd');
33
          'http://@server@@html-path@/dtd/eml-protocol-@eml-version@.dtd');
34 34
INSERT INTO xml_catalog (entry_type, public_id, system_id)
35 35
  VALUES ('DTD', '-//ecoinformatics.org//eml-software-@eml-version@//EN',
36
          '@server@@html-path@/dtd/eml-software-@eml-version@.dtd');
36
          'http://@server@@html-path@/dtd/eml-software-@eml-version@.dtd');
src/edu/ucsb/nceas/metacat/MetacatReplication.java
594 594
        String recordDoctype = rs.getString(3);
595 595
        if(!recordDoctype.equals("BIN"))
596 596
        { //don't replicate data files
597
          if(!recordDoctype.equals(util.getOption("packagedoctype")))
597
          Vector packagedoctypes = MetaCatUtil.getOptionList(
598
                                     MetaCatUtil.getOption("packagedoctype"));
599
          if(!packagedoctypes.contains(recordDoctype))
598 600
          { //if this is a package file, put it at the end
599 601
            //because if a package file is read before all of the files it
600 602
            //refers to are loaded then there is an error
src/edu/ucsb/nceas/metacat/MetaCatUtil.java
36 36
import java.util.PropertyResourceBundle;
37 37
import java.util.Hashtable;
38 38
import java.util.Enumeration;
39
import java.util.Vector;
39 40

  
40 41
import edu.ucsb.nceas.dbadapter.AbstractDatabase;
41 42

  
......
381 382
      System.err.println(msg);
382 383
    }
383 384
  }
385
  
386
  public static Vector getOptionList(String optiontext)
387
  {
388
    Vector options = new Vector();
389
    if(optiontext.indexOf(",") == -1)
390
    {
391
      options.addElement(optiontext);
392
      return options;
393
    }
394
    
395
    while(optiontext.indexOf(",") != -1)
396
    {
397
      String s = optiontext.substring(0, optiontext.indexOf(","));
398
      options.addElement(s.trim());
399
      optiontext = optiontext.substring(optiontext.indexOf(",") + 1, 
400
                                        optiontext.length());
401
      if(optiontext.indexOf(",") == -1)
402
      { //catch the last list entry
403
        options.addElement(optiontext.trim());
404
      }
405
    }
406
    return options;
407
  }
384 408
}
src/edu/ucsb/nceas/metacat/DBSAXHandler.java
262 262
      dbconn.commit();
263 263
         
264 264
      //if this is a package file
265
      if ( doctype.equals(util.getOption("packagedoctype")) )
265
      String packagedoctype = util.getOption("packagedoctype");
266
      Vector packagedoctypes = new Vector();
267
      
268
      packagedoctypes = MetaCatUtil.getOptionList(packagedoctype);
269
      
270
      if ( packagedoctypes.contains(doctype) )
266 271
      {
267 272
        // write the package info to xml_relation table
268 273
        RelationHandler rth = new RelationHandler(docid, dbconn);
......
274 279
        }
275 280
      }
276 281
      // if it is an access file
277
      else if ( doctype.equals(util.getOption("accessdoctype")) )
282
      else if ( MetaCatUtil.getOptionList(
283
                            util.getOption("accessdoctype")).contains(doctype) )
278 284
      {
279 285
        // write ACL for the package
280 286
        runAccessControlList(dbconn, docid);
src/edu/ucsb/nceas/metacat/RelationHandler.java
147 147
  public String getAccessFileID(String docid) throws SQLException
148 148
  {
149 149
    String aclid = null;
150
    
151
    StringBuffer sql = new StringBuffer();
152
    sql.append("SELECT docid FROM xml_documents WHERE docid in (SELECT subject ");
153
    sql.append("FROM xml_relation WHERE docid='").append(docid);
154
    sql.append("' AND (");
155
    Vector accessdoctypes = MetaCatUtil.getOptionList(
156
                              MetaCatUtil.getOption("accessdoctype"));
157
    for(int i=0; i<accessdoctypes.size(); i++)
158
    {
159
      String atype = (String)accessdoctypes.elementAt(i);
160
      sql.append("doctype='").append(atype).append("'");
161
      if(i < accessdoctypes.size()-1)
162
      {
163
        sql.append(" OR ");
164
      }
165
    }
166
    sql.append("))");
167
    //System.out.println("new sql script: " + sql.toString());
168
    
169
    /*
150 170
    PreparedStatement pstmt = 
151 171
      conn.prepareStatement("SELECT docid FROM xml_documents " +
152 172
                            "WHERE docid in " +
......
155 175
                            "AND doctype = ?");
156 176
    pstmt.setString(1, docid);
157 177
    pstmt.setString(2, MetaCatUtil.getOption("accessdoctype"));
178
    */
179
    PreparedStatement pstmt = conn.prepareStatement(sql.toString());
158 180
    pstmt.execute();
159 181
    ResultSet rs = pstmt.getResultSet();
160 182
    boolean hasRow = rs.next();
src/edu/ucsb/nceas/metacat/AccessControlList.java
844 844
    try {
845 845
      
846 846
      isOwned = isOwned(docid, user);
847
      systemID = getSystemID(accDoctype);
847
      systemID = getSystemID((String)MetaCatUtil.getOptionList(accDoctype).elementAt(0));
848 848
      publicAcc = getPublicAccess(docid);
849 849
        
850 850
      output.append("<?xml version=\"1.0\"?>\n");
build.xml
33 33
   <target name="init">
34 34
      <property name="jdbc-connect" 
35 35
                value="jdbc:oracle:thin:@dev.nceas.ucsb.edu:1521:exp"/>
36
      <property name="installdir" value="/opt/tomcat/webapps/berkley" />
36 37
      <property name="dbDriver" value="oracle.jdbc.driver.OracleDriver"/>
37
      <property name="installdir" value="/opt/tomcat/webapps/jones" />
38 38
      <property name="name" value="metacat"/>
39 39
      <property name="Name" value="MetaCat"/>
40 40
      <property name="release" value="1.0.1"/>
41 41
      <property name="web-base-url" 
42 42
                value="http://knb.ecoinformatics.org"/>
43
      <property name="replication-path" value="/jones/servlet/replication"/>
44
      <property name="servlet-path" value="/jones/servlet/metacat"/>
45
      <property name="html-path" value="/jones"/>
46
      <property name="image-path" value="/img/jones" />
47
      <property name="style-path" value="/jones/style"/>
48
      <property name="serverhost" value="dev.nceas.ucsb.edu"/>
49
      <property name="server" value="http://${serverhost}"/>
43

  
44
      <property name="replication-path" value="/servlet/replication"/>
45
      <property name="servlet-path" value="/berkley/servlet/metacat"/>
46
      <property name="html-path" value="/berkley"/>
47
      <property name="image-path" value="/img/berkley" />
48
      <property name="style-path" value="/berkley/style"/>
49
      <property name="server" value="dev.nceas.ucsb.edu:8090"/>
50 50
      <property name="replication-log" value="/tmp/metacatreplication.log"/>
51
      <property name="user" value="jones"/>
52
      <property name="password" value="your-pw-goes-here"/>
51
      <property name="user" value="berkley"/>
52
      <property name="password" value="UnSinn123"/>
53 53
      <property name="config-dir" value="${installdir}" />
54 54
      <property name="default-style" value="knb" />
55 55
      <property name="eml-module" value="mdstandards/eml" />
56 56
      <property name="eml-version" value="2.0.0beta6" />
57 57
      <property name="eml-tag" value="RELEASE_EML_2_0_0_BETA_6" />
58 58
      <property name="cvsroot" 
59
                value=":ext:jones@cvs.nceas.ucsb.edu:/cvs/pbi" />
59
                value=":ext:berkley@cvs.nceas.ucsb.edu:/cvs/pbi" />
60 60

  
61 61

  
62 62
      <filter token="docrooturl" value="./" />
......
88 88
      <property name="build.tests" value="${build.dir}/tests"/>
89 89
      <property name="build.data" value="${build.dir}/data"/>
90 90
      <property name="build.javadocs" value="${build.dir}/docs/api"/>
91
      <property name="build.img" value="/opt/httpd/html${image-path}"/>
91
      <property name="build.img" value="${installdir}/${image-path}"/>
92 92

  
93 93
      <property name="dist.dir" value="dist"/>
94 94
      <property name="ver.dir" value="${dist.dir}/${name}-${release}"/>

Also available in: Unified diff