1 |
4104
|
daigle
|
/**
|
2 |
|
|
* '$RCSfile$'
|
3 |
|
|
* Copyright: 2004 Regents of the University of California and the
|
4 |
|
|
* National Center for Ecological Analysis and Synthesis
|
5 |
|
|
*
|
6 |
|
|
* '$Author$'
|
7 |
|
|
* '$Date$'
|
8 |
|
|
* '$Revision$'
|
9 |
|
|
*
|
10 |
|
|
* This program is free software; you can redistribute it and/or modify
|
11 |
|
|
* it under the terms of the GNU General Public License as published by
|
12 |
|
|
* the Free Software Foundation; either version 2 of the License, or
|
13 |
|
|
* (at your option) any later version.
|
14 |
|
|
*
|
15 |
|
|
* This program is distributed in the hope that it will be useful,
|
16 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
|
|
* GNU General Public License for more details.
|
19 |
|
|
*
|
20 |
|
|
* You should have received a copy of the GNU General Public License
|
21 |
|
|
* along with this program; if not, write to the Free Software
|
22 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
23 |
|
|
*/
|
24 |
|
|
|
25 |
|
|
/*
|
26 |
|
|
* Logging -- table to store metadata and data access log
|
27 |
|
|
*/
|
28 |
|
|
CREATE TABLE access_log (
|
29 |
|
|
entryid NUMBER(20), -- the identifier for the log event
|
30 |
|
|
ip_address VARCHAR2(512), -- the ip address inititiating the event
|
31 |
|
|
principal VARCHAR2(512), -- the user initiiating the event
|
32 |
|
|
docid VARCHAR2(250), -- the document id #
|
33 |
|
|
event VARCHAR2(512), -- the code symbolizing the event type
|
34 |
|
|
date_logged DATE, -- the datetime on which the event occurred
|
35 |
|
|
CONSTRAINT access_log_pk PRIMARY KEY (entryid)
|
36 |
|
|
);
|
37 |
|
|
|
38 |
|
|
CREATE SEQUENCE access_log_id_seq;
|
39 |
|
|
CREATE TRIGGER access_log_before_insert
|
40 |
|
|
BEFORE INSERT ON access_log FOR EACH ROW
|
41 |
|
|
BEGIN
|
42 |
|
|
SELECT access_log_id_seq.nextval
|
43 |
|
|
INTO :new.entryid
|
44 |
|
|
FROM dual;
|
45 |
|
|
END;
|
46 |
|
|
/
|
47 |
|
|
|
48 |
|
|
/*
|
49 |
|
|
* harvest_site_schedule -- table to store harvest sites and schedule info
|
50 |
|
|
*/
|
51 |
|
|
CREATE TABLE harvest_site_schedule (
|
52 |
|
|
site_schedule_id NUMBER, -- unique id
|
53 |
|
|
documentlisturl VARCHAR2(255), -- URL of the site harvest document list
|
54 |
|
|
ldapdn VARCHAR2(255), -- LDAP distinguished name for site account
|
55 |
|
|
datenextharvest DATE, -- scheduled date of next harvest
|
56 |
|
|
datelastharvest DATE, -- recorded date of last harvest
|
57 |
|
|
updatefrequency NUMBER, -- the harvest update frequency
|
58 |
|
|
unit VARCHAR2(50), -- update unit -- days weeks or months
|
59 |
|
|
contact_email VARCHAR2(50), -- email address of the site contact person
|
60 |
|
|
ldappwd VARCHAR2(20), -- LDAP password for site account
|
61 |
|
|
CONSTRAINT harvest_site_schedule_pk PRIMARY KEY (site_schedule_id)
|
62 |
|
|
);
|
63 |
|
|
|
64 |
|
|
/*
|
65 |
|
|
* harvest_log -- table to log entries for harvest operations
|
66 |
|
|
*/
|
67 |
|
|
CREATE TABLE harvest_log (
|
68 |
|
|
harvest_log_id NUMBER, -- unique id
|
69 |
|
|
harvest_date DATE, -- date of the current harvest
|
70 |
|
|
status NUMBER, -- non-zero indicates an error status
|
71 |
|
|
message VARCHAR2(1000), -- text message for this log entry
|
72 |
|
|
harvest_operation_code VARCHAR2(30), -- the type of harvest operation
|
73 |
|
|
site_schedule_id NUMBER, -- site schedule id, or 0 if no site
|
74 |
|
|
CONSTRAINT harvest_log_pk PRIMARY KEY (harvest_log_id)
|
75 |
|
|
);
|
76 |
|
|
|
77 |
|
|
/*
|
78 |
|
|
* harvest_detail_log -- table to log detailed info about documents that
|
79 |
|
|
* generated errors during the harvest
|
80 |
|
|
*/
|
81 |
|
|
CREATE TABLE harvest_detail_log (
|
82 |
|
|
detail_log_id NUMBER, -- unique id
|
83 |
|
|
harvest_log_id NUMBER, -- ponter to the related log entry
|
84 |
|
|
scope VARCHAR2(50), -- document scope
|
85 |
|
|
identifier NUMBER, -- document identifier
|
86 |
|
|
revision NUMBER, -- document revision
|
87 |
|
|
document_url VARCHAR2(255), -- document URL
|
88 |
|
|
error_message VARCHAR2(1000), -- text error message
|
89 |
|
|
document_type VARCHAR2(100), -- document type
|
90 |
|
|
CONSTRAINT harvest_detail_log_pk PRIMARY KEY (detail_log_id),
|
91 |
|
|
CONSTRAINT harvest_detail_log_fk
|
92 |
|
|
FOREIGN KEY (harvest_log_id) REFERENCES harvest_log
|
93 |
|
|
);
|
94 |
|
|
|
95 |
|
|
/*
|
96 |
|
|
* Modify the xml_index.path to the new larger size
|
97 |
|
|
*/
|
98 |
|
|
ALTER TABLE xml_index MODIFY (path VARCHAR2(1000));
|
99 |
|
|
|
100 |
|
|
/*
|
101 |
|
|
* Update the XML_CATALOG table with new entries, and change old ones
|
102 |
|
|
*/
|
103 |
|
|
INSERT INTO xml_catalog (entry_type, public_id, system_id)
|
104 |
|
|
VALUES ('Schema', '@eml2_0_1namespace@', '/schema/eml-2.0.1/eml.xsd');
|
105 |
|
|
UPDATE xml_catalog
|
106 |
|
|
SET system_id = '/schema/eml-2.0.0/eml.xsd'
|
107 |
|
|
WHERE public_id = '@eml2_0_0namespace@';
|
108 |
|
|
UPDATE xml_catalog
|
109 |
|
|
SET system_id = '/schema/eml-2.0.0/stmml.xsd'
|
110 |
|
|
WHERE public_id = '@stmmlnamespace@';
|