mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 15:03:18 +00:00
Merge branch 'DS-2701-service-api' of github.com:mwoodiupui/DSpace into DS-2701-oai-main
This commit is contained in:
@@ -56,7 +56,7 @@ default.language = en_US
|
||||
# Uncomment the appropriate block below for your database.
|
||||
# postgres
|
||||
db.driver=org.postgresql.Driver
|
||||
db.dialect=org.dspace.storage.rdbms.hibernate.postgres.DSpacePostgreSQL9Dialect
|
||||
db.dialect=org.dspace.storage.rdbms.hibernate.postgres.DSpacePostgreSQL82Dialect
|
||||
db.url=jdbc:postgresql://localhost:5432/dspace
|
||||
db.username=dspace
|
||||
db.password=dspace
|
||||
|
@@ -55,9 +55,11 @@ public class ResourcePolicy{
|
||||
private Group epersonGroup;
|
||||
|
||||
@Column(name="start_date")
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date startDate;
|
||||
|
||||
@Column(name="end_date")
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date endDate;
|
||||
|
||||
@Column(name="rpname", length = 30)
|
||||
|
@@ -18,6 +18,7 @@ import org.dspace.event.Dispatcher;
|
||||
import org.dspace.event.Event;
|
||||
import org.dspace.event.factory.EventServiceFactory;
|
||||
import org.dspace.event.service.EventService;
|
||||
import org.dspace.storage.rdbms.DatabaseConfigVO;
|
||||
import org.dspace.utils.DSpace;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
@@ -153,6 +154,12 @@ public class Context
|
||||
return dbConnection;
|
||||
}
|
||||
|
||||
|
||||
public DatabaseConfigVO getDBConfig() throws SQLException
|
||||
{
|
||||
return dbConnection.getDatabaseConfig();
|
||||
}
|
||||
|
||||
public String getDbType(){
|
||||
return dbConnection.getType();
|
||||
}
|
||||
|
@@ -7,6 +7,9 @@
|
||||
*/
|
||||
package org.dspace.core;
|
||||
|
||||
import org.dspace.storage.rdbms.DatabaseConfigVO;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
@@ -31,4 +34,8 @@ public interface DBConnection<T> {
|
||||
public void shutdown();
|
||||
|
||||
public String getType();
|
||||
|
||||
public DataSource getDataSource();
|
||||
|
||||
public DatabaseConfigVO getDatabaseConfig() throws SQLException;
|
||||
}
|
@@ -7,13 +7,18 @@
|
||||
*/
|
||||
package org.dspace.core;
|
||||
|
||||
import org.dspace.storage.rdbms.DatabaseConfigVO;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.orm.hibernate4.SessionFactoryUtils;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
@@ -83,4 +88,23 @@ public class HibernateDBConnection implements DBConnection<Session> {
|
||||
return ((SessionFactoryImplementor) sessionFactory).getDialect().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSource getDataSource() {
|
||||
return SessionFactoryUtils.getDataSource(sessionFactory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatabaseConfigVO getDatabaseConfig() throws SQLException {
|
||||
DatabaseConfigVO databaseConfigVO = new DatabaseConfigVO();
|
||||
|
||||
try (Connection connection = getDataSource().getConnection()) {
|
||||
DatabaseMetaData metaData = connection.getMetaData();
|
||||
databaseConfigVO.setDatabaseDriver(metaData.getDriverName());
|
||||
databaseConfigVO.setDatabaseUrl(metaData.getURL());
|
||||
databaseConfigVO.setSchema(metaData.getSchemaTerm());
|
||||
databaseConfigVO.setMaxConnections(metaData.getMaxConnections());
|
||||
databaseConfigVO.setUserName(metaData.getUserName());
|
||||
}
|
||||
return databaseConfigVO;
|
||||
}
|
||||
}
|
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.storage.rdbms;
|
||||
|
||||
/**
|
||||
* Value object for the Database configuration, can be used to get the database configuration parameters.
|
||||
* The config parameters are retrieved by the implementation of the org.dspace.core.DBConnection object.
|
||||
* This class should never be used to store configuration, it is just used to export & can be used for display purposes
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public class DatabaseConfigVO {
|
||||
|
||||
private String databaseUrl;
|
||||
|
||||
private String databaseDriver;
|
||||
|
||||
private String userName;
|
||||
|
||||
private String schema;
|
||||
|
||||
private int maxConnections;
|
||||
|
||||
public DatabaseConfigVO()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public String getDatabaseUrl() {
|
||||
return databaseUrl;
|
||||
}
|
||||
|
||||
public void setDatabaseUrl(String databaseUrl) {
|
||||
this.databaseUrl = databaseUrl;
|
||||
}
|
||||
|
||||
public String getDatabaseDriver() {
|
||||
return databaseDriver;
|
||||
}
|
||||
|
||||
public void setDatabaseDriver(String databaseDriver) {
|
||||
this.databaseDriver = databaseDriver;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getSchema() {
|
||||
return schema;
|
||||
}
|
||||
|
||||
public void setSchema(String schema) {
|
||||
this.schema = schema;
|
||||
}
|
||||
|
||||
public int getMaxConnections() {
|
||||
return maxConnections;
|
||||
}
|
||||
|
||||
public void setMaxConnections(int maxConnections) {
|
||||
this.maxConnections = maxConnections;
|
||||
}
|
||||
}
|
@@ -87,46 +87,24 @@ public class DatabaseUtils
|
||||
// Call initDataSource to JUST initialize the dataSource WITHOUT fully
|
||||
// initializing the DatabaseManager itself. This ensures we do NOT
|
||||
// immediately run our Flyway DB migrations on this database
|
||||
//TODO: HIBERNATE FIX FLYWAY
|
||||
DataSource dataSource = null; //DatabaseManager.initDataSource();
|
||||
DBConnection dbConnection = new DSpace().getSingletonService(DBConnection.class);
|
||||
DataSource dataSource = dbConnection.getDataSource();
|
||||
DatabaseConfigVO databaseConfig = dbConnection.getDatabaseConfig();
|
||||
|
||||
// Get configured DB URL for reporting below
|
||||
String url = ConfigurationManager.getProperty("db.url");
|
||||
String url = databaseConfig.getDatabaseUrl();
|
||||
|
||||
|
||||
|
||||
// Point Flyway API to our database
|
||||
Flyway flyway = setupFlyway(dataSource);
|
||||
|
||||
// "test" = Test Database Connection
|
||||
if(argv[0].equalsIgnoreCase("test"))
|
||||
if(argv[0].equalsIgnoreCase("migrate"))
|
||||
{
|
||||
// Try to connect to the database
|
||||
System.out.println("\nAttempting to connect to database using these configurations: ");
|
||||
System.out.println(" - URL: " + url);
|
||||
System.out.println(" - Driver: " + ConfigurationManager.getProperty("db.driver"));
|
||||
System.out.println(" - Username: " + ConfigurationManager.getProperty("db.username"));
|
||||
System.out.println(" - Password: [hidden]");
|
||||
System.out.println(" - Schema: " + ConfigurationManager.getProperty("db.schema"));
|
||||
System.out.println("\nTesting connection...");
|
||||
try
|
||||
{
|
||||
// Just do a high level test by getting our configured DataSource and attempting to connect to it
|
||||
// NOTE: We specifically do NOT call DatabaseManager.getConnection() because that will attempt
|
||||
// a full initialization of DatabaseManager & also cause database migrations/upgrades to occur
|
||||
Connection connection = dataSource.getConnection();
|
||||
connection.close();
|
||||
try (Connection connection = dataSource.getConnection()) {
|
||||
}
|
||||
catch (SQLException sqle)
|
||||
{
|
||||
System.err.println("\nError: ");
|
||||
System.err.println(" - " + sqle);
|
||||
System.err.println("\nPlease see the DSpace documentation for assistance.\n");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
System.out.println("Connected successfully!\n");
|
||||
}
|
||||
// "info" = Basic Database Information
|
||||
else if(argv[0].equalsIgnoreCase("info"))
|
||||
}else
|
||||
if(argv[0].equalsIgnoreCase("info"))
|
||||
{
|
||||
// Get basic Database info
|
||||
Connection connection = dataSource.getConnection();
|
||||
@@ -156,51 +134,6 @@ public class DatabaseUtils
|
||||
}
|
||||
connection.close();
|
||||
}
|
||||
// "migrate" = Manually run any outstanding Database migrations (if any)
|
||||
else if(argv[0].equalsIgnoreCase("migrate"))
|
||||
{
|
||||
System.out.println("\nDatabase URL: " + url);
|
||||
|
||||
// "migrate" allows for an OPTIONAL second argument:
|
||||
// - "ignored" = Also run any previously "ignored" migrations during the migration
|
||||
// - [version] = ONLY run migrations up to a specific DSpace version (ONLY FOR TESTING)
|
||||
if(argv.length==2)
|
||||
{
|
||||
if(argv[1].equalsIgnoreCase("ignored"))
|
||||
{
|
||||
System.out.println("Migrating database to latest version AND running previously \"Ignored\" migrations... (Check logs for details)");
|
||||
Connection connection = dataSource.getConnection();
|
||||
// Update the database to latest version, but set "outOfOrder=true"
|
||||
// This will ensure any old migrations in the "ignored" state are now run
|
||||
updateDatabase(dataSource, connection, null, true);
|
||||
connection.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise, we assume "argv[1]" is a valid migration version number
|
||||
// This is only for testing! Never specify for Production!
|
||||
System.out.println("Migrating database ONLY to version " + argv[1] + " ... (Check logs for details)");
|
||||
System.out.println("\nWARNING: It is highly likely you will see errors in your logs when the Metadata");
|
||||
System.out.println("or Bitstream Format Registry auto-update. This is because you are attempting to");
|
||||
System.out.println("use an OLD version " + argv[1] + " Database with a newer DSpace API. NEVER do this in a");
|
||||
System.out.println("PRODUCTION scenario. The resulting old DB is only useful for migration testing.\n");
|
||||
Connection connection = dataSource.getConnection();
|
||||
// Update the database, to the version specified.
|
||||
updateDatabase(dataSource, connection, argv[1], false);
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("Migrating database to latest version... (Check logs for details)");
|
||||
// NOTE: This looks odd, but all we really need to do is ensure the
|
||||
// DatabaseManager auto-initializes. It'll take care of the migration itself.
|
||||
// Asking for our DB Name will ensure DatabaseManager.initialize() is called.
|
||||
//TODO: HIBERNATE FIX FLYWAY
|
||||
// DatabaseManager.getDbName();
|
||||
}
|
||||
System.out.println("Done.");
|
||||
}
|
||||
// "repair" = Run Flyway repair script
|
||||
else if(argv[0].equalsIgnoreCase("repair"))
|
||||
{
|
||||
@@ -232,10 +165,8 @@ public class DatabaseUtils
|
||||
{
|
||||
System.out.println("\nUsage: database [action]");
|
||||
System.out.println("Valid actions: 'test', 'info', 'migrate', 'repair' or 'clean'");
|
||||
System.out.println(" - test = Test database connection is OK");
|
||||
System.out.println(" - info = Describe basic info about database, including migrations run");
|
||||
System.out.println(" - migrate = Migrate the Database to the latest version");
|
||||
System.out.println(" Optionally, specify \"ignored\" to also run \"Ignored\" migrations");
|
||||
System.out.println(" - repair = Attempt to repair any previously failed database migrations");
|
||||
System.out.println(" - clean = DESTROY all data and tables in Database (WARNING there is no going back!)");
|
||||
System.out.println("");
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
package org.dspace.storage.rdbms.hibernate.postgres;
|
||||
|
||||
import org.hibernate.dialect.PostgreSQL9Dialect;
|
||||
import org.hibernate.dialect.PostgreSQL82Dialect;
|
||||
import org.hibernate.metamodel.spi.TypeContributions;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.type.PostgresUUIDType;
|
||||
@@ -18,7 +18,7 @@ import org.hibernate.type.PostgresUUIDType;
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public class DSpacePostgreSQL9Dialect extends PostgreSQL9Dialect
|
||||
public class DSpacePostgreSQL82Dialect extends PostgreSQL82Dialect
|
||||
{
|
||||
@Override
|
||||
public void contributeTypes(final TypeContributions typeContributions, final ServiceRegistry serviceRegistry) {
|
||||
@@ -26,6 +26,11 @@ public class DSpacePostgreSQL9Dialect extends PostgreSQL9Dialect
|
||||
typeContributions.contributeType(new InternalPostgresUUIDType());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerHibernateType(int code, String name) {
|
||||
super.registerHibernateType(code, name);
|
||||
}
|
||||
|
||||
protected static class InternalPostgresUUIDType extends PostgresUUIDType {
|
||||
|
||||
@Override
|
@@ -59,7 +59,7 @@ CREATE TABLE BitstreamFormatRegistry
|
||||
description VARCHAR2(2000),
|
||||
support_level INTEGER,
|
||||
-- Identifies internal types
|
||||
internal NUMBER(1)
|
||||
internal BOOLEAN
|
||||
);
|
||||
|
||||
-------------------------------------------------------
|
||||
@@ -80,14 +80,14 @@ CREATE TABLE Bitstream
|
||||
bitstream_id INTEGER PRIMARY KEY,
|
||||
bitstream_format_id INTEGER REFERENCES BitstreamFormatRegistry(bitstream_format_id),
|
||||
name VARCHAR2(256),
|
||||
size_bytes INTEGER,
|
||||
size_bytes BIGINT,
|
||||
checksum VARCHAR2(64),
|
||||
checksum_algorithm VARCHAR2(32),
|
||||
description VARCHAR2(2000),
|
||||
user_format_description VARCHAR2(2000),
|
||||
source VARCHAR2(256),
|
||||
internal_id VARCHAR2(256),
|
||||
deleted NUMBER(1),
|
||||
deleted BOOLEAN,
|
||||
store_number INTEGER,
|
||||
sequence_id INTEGER
|
||||
);
|
||||
@@ -102,9 +102,9 @@ CREATE TABLE EPerson
|
||||
password VARCHAR2(64),
|
||||
firstname VARCHAR2(64),
|
||||
lastname VARCHAR2(64),
|
||||
can_log_in NUMBER(1),
|
||||
require_certificate NUMBER(1),
|
||||
self_registered NUMBER(1),
|
||||
can_log_in BOOLEAN,
|
||||
require_certificate BOOLEAN,
|
||||
self_registered BOOLEAN,
|
||||
last_active TIMESTAMP,
|
||||
sub_frequency INTEGER,
|
||||
phone VARCHAR2(32)
|
||||
@@ -129,8 +129,8 @@ CREATE TABLE Item
|
||||
(
|
||||
item_id INTEGER PRIMARY KEY,
|
||||
submitter_id INTEGER REFERENCES EPerson(eperson_id),
|
||||
in_archive NUMBER(1),
|
||||
withdrawn NUMBER(1),
|
||||
in_archive BOOLEAN,
|
||||
withdrawn BOOLEAN,
|
||||
last_modified TIMESTAMP,
|
||||
owning_collection INTEGER
|
||||
);
|
||||
@@ -326,9 +326,9 @@ CREATE TABLE WorkspaceItem
|
||||
item_id INTEGER REFERENCES Item(item_id),
|
||||
collection_id INTEGER REFERENCES Collection(collection_id),
|
||||
-- Answers to questions on first page of submit UI
|
||||
multiple_titles NUMBER(1), -- boolean
|
||||
published_before NUMBER(1),
|
||||
multiple_files NUMBER(1),
|
||||
multiple_titles BOOLEAN, -- boolean
|
||||
published_before BOOLEAN,
|
||||
multiple_files BOOLEAN,
|
||||
-- How for the user has got in the submit process
|
||||
stage_reached INTEGER
|
||||
);
|
||||
@@ -345,9 +345,9 @@ CREATE TABLE WorkflowItem
|
||||
owner INTEGER REFERENCES EPerson(eperson_id),
|
||||
|
||||
-- Answers to questions on first page of submit UI
|
||||
multiple_titles NUMBER(1),
|
||||
published_before NUMBER(1),
|
||||
multiple_files NUMBER(1)
|
||||
multiple_titles BOOLEAN,
|
||||
published_before BOOLEAN,
|
||||
multiple_files BOOLEAN
|
||||
-- Note: stage reached not applicable here - people involved in workflow
|
||||
-- can always jump around submission UI
|
||||
|
||||
|
@@ -136,13 +136,13 @@ CREATE TABLE checksum_results
|
||||
CREATE TABLE most_recent_checksum
|
||||
(
|
||||
bitstream_id INTEGER PRIMARY KEY,
|
||||
to_be_processed NUMBER(1) NOT NULL,
|
||||
to_be_processed BOOLEAN NOT NULL,
|
||||
expected_checksum VARCHAR(64) NOT NULL,
|
||||
current_checksum VARCHAR(64) NOT NULL,
|
||||
last_process_start_date TIMESTAMP NOT NULL,
|
||||
last_process_end_date TIMESTAMP NOT NULL,
|
||||
checksum_algorithm VARCHAR(64) NOT NULL,
|
||||
matched_prev_checksum NUMBER(1) NOT NULL,
|
||||
matched_prev_checksum BOOLEAN NOT NULL,
|
||||
result VARCHAR(64) REFERENCES checksum_results(result_code)
|
||||
);
|
||||
|
||||
@@ -150,11 +150,11 @@ CREATE TABLE most_recent_checksum
|
||||
-- A row will be inserted into this table every
|
||||
-- time a checksum is re-calculated.
|
||||
|
||||
CREATE SEQUENCE checksum_history_seq;
|
||||
CREATE SEQUENCE checksum_history_check_id_seq;
|
||||
|
||||
CREATE TABLE checksum_history
|
||||
(
|
||||
check_id INTEGER PRIMARY KEY,
|
||||
check_id BIGINT PRIMARY KEY,
|
||||
bitstream_id INTEGER,
|
||||
process_start_date TIMESTAMP,
|
||||
process_end_date TIMESTAMP,
|
||||
|
@@ -15,8 +15,8 @@
|
||||
-- ===============================================================
|
||||
|
||||
-- Remove NOT NULL restrictions from the checksum columns of most_recent_checksum
|
||||
ALTER TABLE most_recent_checksum MODIFY expected_checksum null;
|
||||
ALTER TABLE most_recent_checksum MODIFY current_checksum null;
|
||||
ALTER TABLE most_recent_checksum ALTER COLUMN expected_checksum SET NOT NULL;
|
||||
ALTER TABLE most_recent_checksum ALTER COLUMN current_checksum SET NOT NULL;
|
||||
|
||||
------------------------------------------------------
|
||||
-- New Column language language in EPerson
|
||||
|
@@ -19,7 +19,7 @@ ALTER TABLE resourcepolicy ADD COLUMN rptype VARCHAR2(30);
|
||||
ALTER TABLE resourcepolicy ADD COLUMN rpdescription VARCHAR2(100);
|
||||
|
||||
|
||||
ALTER TABLE item ADD COLUMN discoverable NUMBER(1);
|
||||
ALTER TABLE item ADD COLUMN discoverable BOOLEAN;
|
||||
|
||||
CREATE TABLE versionhistory
|
||||
(
|
||||
|
@@ -47,7 +47,7 @@ CREATE TABLE Webapp
|
||||
AppName VARCHAR2(32),
|
||||
URL VARCHAR2(1000),
|
||||
Started TIMESTAMP,
|
||||
isUI NUMBER(1)
|
||||
isUI INTEGER
|
||||
);
|
||||
|
||||
CREATE SEQUENCE webapp_seq;
|
||||
@@ -62,11 +62,11 @@ CREATE TABLE requestitem
|
||||
token varchar(48),
|
||||
item_id INTEGER,
|
||||
bitstream_id INTEGER,
|
||||
allfiles NUMBER(1),
|
||||
allfiles BOOLEAN,
|
||||
request_email VARCHAR2(64),
|
||||
request_name VARCHAR2(64),
|
||||
request_date TIMESTAMP,
|
||||
accept_request NUMBER(1),
|
||||
accept_request BOOLEAN,
|
||||
decision_date TIMESTAMP,
|
||||
expires TIMESTAMP,
|
||||
CONSTRAINT requestitem_pkey PRIMARY KEY (requestitem_id),
|
||||
|
@@ -384,3 +384,19 @@ ALTER TABLE most_recent_checksum ADD COLUMN bitstream_id UUID;
|
||||
ALTER TABLE most_recent_checksum ADD CONSTRAINT most_recent_checksum_bitstream_id_fk FOREIGN KEY (bitstream_id) REFERENCES Bitstream;
|
||||
UPDATE most_recent_checksum SET bitstream_id = (SELECT Bitstream.uuid FROM Bitstream WHERE most_recent_checksum.bitstream_legacy_id = Bitstream.bitstream_id);
|
||||
ALTER TABLE most_recent_checksum DROP COLUMN bitstream_legacy_id;
|
||||
|
||||
ALTER TABLE checksum_history ALTER COLUMN bitstream_id rename to bitstream_legacy_id;
|
||||
ALTER TABLE checksum_history ADD COLUMN bitstream_id UUID;
|
||||
ALTER TABLE checksum_history ADD CONSTRAINT checksum_history_id_fk FOREIGN KEY (bitstream_id) REFERENCES Bitstream;
|
||||
UPDATE checksum_history SET bitstream_id = (SELECT Bitstream.uuid FROM Bitstream WHERE checksum_history.bitstream_legacy_id = Bitstream.bitstream_id);
|
||||
ALTER TABLE checksum_history DROP COLUMN bitstream_legacy_id;
|
||||
|
||||
--Alter table doi
|
||||
ALTER TABLE doi ADD COLUMN dspace_object UUID;
|
||||
ALTER TABLE doi ADD CONSTRAINT doi_dspace_object_fk FOREIGN KEY (dspace_object) REFERENCES dspaceobject;
|
||||
UPDATE doi SET dspace_object = (SELECT community.uuid FROM community WHERE doi.resource_id = community.community_id AND doi.resource_type_id = 4) WHERE doi.resource_type_id = 4;
|
||||
UPDATE doi SET dspace_object = (SELECT collection.uuid FROM collection WHERE doi.resource_id = collection.collection_id AND doi.resource_type_id = 3) WHERE doi.resource_type_id = 3;
|
||||
UPDATE doi SET dspace_object = (SELECT item.uuid FROM item WHERE doi.resource_id = item.item_id AND doi.resource_type_id = 2) WHERE doi.resource_type_id = 2;
|
||||
UPDATE doi SET dspace_object = (SELECT bundle.uuid FROM bundle WHERE doi.resource_id = bundle.bundle_id AND doi.resource_type_id = 1) WHERE doi.resource_type_id = 1;
|
||||
UPDATE doi SET dspace_object = (SELECT bitstream.uuid FROM bitstream WHERE doi.resource_id = bitstream.bitstream_id AND doi.resource_type_id = 0) WHERE doi.resource_type_id = 0;
|
||||
|
||||
|
@@ -361,4 +361,18 @@ ALTER TABLE epersongroup2workspaceitem add primary key (workspace_item_id,eperso
|
||||
ALTER TABLE most_recent_checksum RENAME COLUMN bitstream_id to bitstream_legacy_id;
|
||||
ALTER TABLE most_recent_checksum ADD COLUMN bitstream_id UUID REFERENCES Bitstream(uuid);
|
||||
UPDATE most_recent_checksum SET bitstream_id = (SELECT Bitstream.uuid FROM Bitstream WHERE most_recent_checksum.bitstream_legacy_id = Bitstream.bitstream_id);
|
||||
ALTER TABLE most_recent_checksum DROP COLUMN bitstream_legacy_id;
|
||||
ALTER TABLE most_recent_checksum DROP COLUMN bitstream_legacy_id;
|
||||
|
||||
ALTER TABLE checksum_history RENAME COLUMN bitstream_id to bitstream_legacy_id;
|
||||
ALTER TABLE checksum_history ADD COLUMN bitstream_id UUID REFERENCES Bitstream(uuid);
|
||||
UPDATE checksum_history SET bitstream_id = (SELECT Bitstream.uuid FROM Bitstream WHERE checksum_history.bitstream_legacy_id = Bitstream.bitstream_id);
|
||||
ALTER TABLE checksum_history DROP COLUMN bitstream_legacy_id;
|
||||
|
||||
--Alter table doi
|
||||
ALTER TABLE doi ADD COLUMN dspace_object UUID REFERENCES dspaceobject(uuid);
|
||||
UPDATE doi SET dspace_object = (SELECT community.uuid FROM community WHERE doi.resource_id = community.community_id AND doi.resource_type_id = 4) WHERE doi.resource_type_id = 4;
|
||||
UPDATE doi SET dspace_object = (SELECT collection.uuid FROM collection WHERE doi.resource_id = collection.collection_id AND doi.resource_type_id = 3) WHERE doi.resource_type_id = 3;
|
||||
UPDATE doi SET dspace_object = (SELECT item.uuid FROM item WHERE doi.resource_id = item.item_id AND doi.resource_type_id = 2) WHERE doi.resource_type_id = 2;
|
||||
UPDATE doi SET dspace_object = (SELECT bundle.uuid FROM bundle WHERE doi.resource_id = bundle.bundle_id AND doi.resource_type_id = 1) WHERE doi.resource_type_id = 1;
|
||||
UPDATE doi SET dspace_object = (SELECT bitstream.uuid FROM bitstream WHERE doi.resource_id = bitstream.bitstream_id AND doi.resource_type_id = 0) WHERE doi.resource_type_id = 0;
|
||||
|
||||
|
@@ -3,11 +3,6 @@
|
||||
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
|
||||
<hibernate-configuration>
|
||||
<session-factory>
|
||||
<!--<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>-->
|
||||
<!--<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQL9Dialect</property>-->
|
||||
<!--<property name="hibernate.connection.url">jdbc:postgresql://localhost:5433/dspace-kevin-unit-test</property>-->
|
||||
<!--<property name="hibernate.connection.username">dspace</property>-->
|
||||
<!--<property name="hibernate.connection.password">dspace</property>-->
|
||||
|
||||
|
||||
<property name="hibernate.connection.driver_class">org.h2.Driver</property>
|
||||
|
@@ -27,7 +27,7 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
<version>3.2.0.RELEASE</version>
|
||||
<version>${spring.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@@ -50,6 +50,7 @@ import org.dspace.harvest.HarvestScheduler;
|
||||
import org.dspace.harvest.factory.HarvestServiceFactory;
|
||||
import org.dspace.harvest.service.HarvestSchedulingService;
|
||||
import org.dspace.harvest.service.HarvestedCollectionService;
|
||||
import org.dspace.storage.rdbms.DatabaseConfigVO;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
@@ -102,8 +103,6 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
private static final Message T_DB_URL = message("xmlui.administrative.ControlPanel.db_url");
|
||||
private static final Message T_DB_DRIVER = message("xmlui.administrative.ControlPanel.db_driver");
|
||||
private static final Message T_DB_MAX_CONN = message("xmlui.administrative.ControlPanel.db_maxconnections");
|
||||
private static final Message T_DB_MAX_WAIT = message("xmlui.administrative.ControlPanel.db_maxwait");
|
||||
private static final Message T_DB_MAX_IDLE = message("xmlui.administrative.ControlPanel.db_maxidle");
|
||||
private static final Message T_MAIL_SERVER = message("xmlui.administrative.ControlPanel.mail_server");
|
||||
private static final Message T_MAIL_FROM_ADDRESS = message("xmlui.administrative.ControlPanel.mail_from_address");
|
||||
private static final Message T_FEEDBACK_RECIPIENT = message("xmlui.administrative.ControlPanel.mail_feedback_recipient");
|
||||
@@ -496,8 +495,7 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
/**
|
||||
* List important DSpace configuration parameters.
|
||||
*/
|
||||
private void addDSpaceConfiguration(Division div) throws WingException
|
||||
{
|
||||
private void addDSpaceConfiguration(Division div) throws WingException, SQLException {
|
||||
|
||||
// LIST: DSpace
|
||||
List dspace = div.addList("dspace");
|
||||
@@ -521,20 +519,15 @@ public class ControlPanel extends AbstractDSpaceTransformer implements Serviceab
|
||||
dspace.addLabel(T_DB_NAME);
|
||||
dspace.addItem(notempty(context.getDbType()));
|
||||
|
||||
DatabaseConfigVO dbConfig = context.getDBConfig();
|
||||
dspace.addLabel(T_DB_URL);
|
||||
dspace.addItem(notempty(ConfigurationManager.getProperty("db.url")));
|
||||
dspace.addItem(notempty(dbConfig.getDatabaseUrl()));
|
||||
|
||||
dspace.addLabel(T_DB_DRIVER);
|
||||
dspace.addItem(notempty(ConfigurationManager.getProperty("db.driver")));
|
||||
dspace.addItem(notempty(dbConfig.getDatabaseDriver()));
|
||||
|
||||
dspace.addLabel(T_DB_MAX_CONN);
|
||||
dspace.addItem(notempty(ConfigurationManager.getProperty("db.maxconnections")));
|
||||
|
||||
dspace.addLabel(T_DB_MAX_WAIT);
|
||||
dspace.addItem(notempty(ConfigurationManager.getProperty("db.maxwait")));
|
||||
|
||||
dspace.addLabel(T_DB_MAX_IDLE);
|
||||
dspace.addItem(notempty(ConfigurationManager.getProperty("db.maxidle")));
|
||||
dspace.addItem(notempty(String.valueOf(dbConfig.getMaxConnections())));
|
||||
|
||||
dspace.addLabel(T_MAIL_SERVER);
|
||||
dspace.addItem(notempty(ConfigurationManager.getProperty("mail.server")));
|
||||
|
@@ -18,7 +18,7 @@
|
||||
<property name="hibernate.default_schema">${db.schema}</property>
|
||||
<property name="hibernate.connection.username">${db.username}</property>
|
||||
<property name="hibernate.connection.password">${db.password}</property>
|
||||
<property name="hibernate.hbm2ddl.auto">update</property>
|
||||
<property name="hibernate.hbm2ddl.auto">validate</property>
|
||||
<property name="hibernate.hbm2ddl.import_files_sql_extractor">org.hibernate.tool.hbm2ddl.SingleLineSqlCommandExtractor</property>
|
||||
<property name="hibernate.connection.autocommit">false</property>
|
||||
<property name="hibernate.current_session_context_class">org.hibernate.context.internal.ThreadLocalSessionContext</property>
|
||||
|
@@ -145,7 +145,7 @@ Common usage:
|
||||
<echo message="fresh_install --> Perform a fresh installation of the software. " />
|
||||
<echo message="" />
|
||||
<echo message="clean_backups --> Remove .bak directories under install directory" />
|
||||
<echo message="test_database --> Attempt to connect to the DSpace database in order to verify that configuration is correct" />
|
||||
<echo message="migrate_database --> Migrate the DSpace database to the latest version." />
|
||||
<echo message="" />
|
||||
<echo message="" />
|
||||
<echo message="Available parameters are:" />
|
||||
@@ -186,7 +186,7 @@ Common usage:
|
||||
<!-- Update an installation -->
|
||||
<!-- ============================================================= -->
|
||||
|
||||
<target name="update" depends="update_configs,update_code,update_webapps,update_solr_indexes" description="Update installed code and web applications (without clobbering data/config)">
|
||||
<target name="update" depends="update_configs,update_code,migrate_database,update_webapps,update_solr_indexes" description="Update installed code and web applications (without clobbering data/config)">
|
||||
</target>
|
||||
|
||||
<!-- ============================================================= -->
|
||||
@@ -789,12 +789,13 @@ Common usage:
|
||||
<!-- ============================================================= -->
|
||||
|
||||
<!-- Test the connection to the database -->
|
||||
<target name="test_database">
|
||||
<java classname="org.dspace.storage.rdbms.DatabaseUtils" classpathref="class.path" fork="yes" failonerror="yes">
|
||||
<target name="migrate_database">
|
||||
<java classname="org.dspace.app.launcher.ScriptLauncher" classpathref="class.path" fork="yes" failonerror="yes">
|
||||
<sysproperty key="log4j.configuration" value="file:config/log4j-console.properties" />
|
||||
<sysproperty key="dspace.log.init.disable" value="true" />
|
||||
<sysproperty key="dspace.configuration" value="${config}" />
|
||||
<arg value="test" />
|
||||
<arg value="database" />
|
||||
<arg value="migrate" />
|
||||
</java>
|
||||
</target>
|
||||
|
||||
@@ -854,7 +855,7 @@ Common usage:
|
||||
<!-- ============================================================= -->
|
||||
|
||||
<target name="fresh_install"
|
||||
depends="init_installation,init_configs,test_database,install_code"
|
||||
depends="init_installation,init_configs,migrate_database,install_code"
|
||||
description="Do a fresh install of the system, overwriting any data">
|
||||
|
||||
<delete failonerror="no">
|
||||
|
26
pom.xml
26
pom.xml
@@ -35,7 +35,12 @@
|
||||
<solr.version>4.10.2</solr.version>
|
||||
<jena.version>2.12.0</jena.version>
|
||||
<slf4j.version>1.6.1</slf4j.version>
|
||||
<hibernate.version>4.3.10.Final</hibernate.version>
|
||||
<!--
|
||||
Hibernate version pinned to 4.2, 4.3 does not work with the spring version we are currently using
|
||||
Upgrading the spring version will make the XMLUI crash
|
||||
-->
|
||||
<hibernate.version>4.2.19.Final</hibernate.version>
|
||||
<spring.version>3.2.14.RELEASE</spring.version>
|
||||
<!-- 'root.basedir' is the path to the root [dspace-src] dir. It must be redefined by each child POM,
|
||||
as it is used to reference the LICENSE_HEADER and *.properties file(s) in that directory. -->
|
||||
<root.basedir>${basedir}</root.basedir>
|
||||
@@ -848,8 +853,7 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-orm</artifactId>
|
||||
<!--<version>4.1.4.RELEASE</version>-->
|
||||
<version>3.2.0.RELEASE</version>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.swordapp</groupId>
|
||||
@@ -860,49 +864,49 @@
|
||||
<dependency>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<groupId>org.springframework</groupId>
|
||||
<version>3.2.0.RELEASE</version>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
<groupId>org.springframework</groupId>
|
||||
<version>3.2.0.RELEASE</version>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
<groupId>org.springframework</groupId>
|
||||
<version>3.2.0.RELEASE</version>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<groupId>org.springframework</groupId>
|
||||
<version>3.2.0.RELEASE</version>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
<groupId>org.springframework</groupId>
|
||||
<version>3.2.0.RELEASE</version>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>spring-jdbc</artifactId>
|
||||
<groupId>org.springframework</groupId>
|
||||
<version>3.2.0.RELEASE</version>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<groupId>org.springframework</groupId>
|
||||
<version>3.2.0.RELEASE</version>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<groupId>org.springframework</groupId>
|
||||
<version>3.2.0.RELEASE</version>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
Reference in New Issue
Block a user