Commit 0d5b8663 authored by Stefan Funk's avatar Stefan Funk 🐧
Browse files

Merge branch 'release/10.3.0.32-DH' into main

parents ceef66df 267e072b
......@@ -5,7 +5,7 @@
<parent>
<groupId>info.textgrid.middleware</groupId>
<artifactId>crud</artifactId>
<version>10.3.0.30-DH</version>
<version>10.3.0.32-DH</version>
</parent>
<artifactId>crud-base</artifactId>
<name>DARIAHDE :: CrudService :: Base</name>
......
......@@ -39,6 +39,8 @@ import java.util.Properties;
**
* CHANGELOG
*
* 2021-04-14 - Funk - Add DOI API URL.
*
* 2020-09-21 - Funk - Add badge text.
*
* 2020-09-16 - Funk - Add menu header color.
......@@ -107,8 +109,8 @@ public class CrudServiceConfigurator extends Properties {
public static synchronized CrudServiceConfigurator getInstance(String theConfigFileLocation)
throws IOException {
// Reload the configuration, if the file name or the config file's
// modification timestamp has changed.
// Reload the configuration, if the file name or the config file's modification timestamp has
// changed.
String oldFile = filename;
filename = theConfigFileLocation;
long oldDate = configfileDate;
......@@ -1259,6 +1261,27 @@ public class CrudServiceConfigurator extends Properties {
return result;
}
/**
* <p>
* The DOI API URL.
* </p>
*
* @return The DOI API URL.
* @throws IoFault
*/
public URL getDOIaPIlOCATION() throws IoFault {
URL result = null;
try {
result = getURLValueMandatory("DOI_API_LOCATION");
} catch (MalformedURLException e) {
throw new IoFault("Please check the DOI API LOCATION URL", e);
}
return result;
}
/**
* <p>
* The OAI-PMH host.
......
/*******************************************************************************
* This software is copyright (c) 2015 by
/**
* This software is copyright (c) 2021 by
*
* - TextGrid Consortium (http://www.textgrid.de)
* - DAASI International GmbH (http://www.daasi.de)
* TextGrid Consortium (https://textgrid.de)
*
* DAASI International GmbH (https://daasi.de)
*
* This is free software. You can redistribute it and/or modify it under the
* terms described in the GNU Lesser General Public License v3 of which you
* should have received a copy. Otherwise you can download it from
* This is free software. You can redistribute it and/or modify it under the terms described in the
* GNU Lesser General Public License v3 of which you should have received a copy. Otherwise you can
* download it from
*
* http://www.gnu.org/licenses/lgpl-3.0.txt
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* @copyright TextGrid Consortium (http://www.textgrid.de)
* @copyright DAASI International GmbH (http://www.daasi.de)
* @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU Lesser General Public
* License v3
* @copyright TextGrid Consortium (https://textgrid.de)
* @copyright DAASI International GmbH (https://daasi.de)
* @license GNU Lesser General Public (http://www.gnu.org/licenses/lgpl-3.0.txt) License v3
* @author Stefan E. Funk (stefan.e.funk@daasi.de)
******************************************************************************/
*/
package info.textgrid.namespaces.middleware.tgcrud.services.tgcrudservice;
import java.net.URI;
import java.util.HashMap;
import java.util.List;
import info.textgrid.namespaces.metadata.core._2010.ObjectType;
/*******************************************************************************
/**
* TODOLOG
*
*******************************************************************************
**
* CHANGELOG
*
* 2015-02-10 Funk Added update method.
* 2014-12-22 Funk Added setKeyValuePairs() method.
* 2013-12-11 Funk Removed public's for they are not needed anymore in
* interface method declarations.
* 2012-02-06 Funk Added user to lock and unlock parameters.
* 2010-09-03 Funk Adapted to the new metadata schema. Added getUri()
* method.
* 2010-06-28 Funk Added method getUris().
* 2010-06-24 Funk First version.
* 2021-04-016 - Funk - Add new method getHandleMetadata().
*
* 2015-02-10 - Funk - Add update method.
*
* 2014-12-22 - Funk - Add setKeyValuePairs() method.
*
* 2013-12-11 - Funk - Remove public's for they are not needed anymore in interface method
* declarations.
*
* 2012-02-06 - Funk - Add user to lock and unlock parameters.
*
* 2010-09-03 - Funk - Adapt to the new metadata schema. Added getUri() method.
*
* 2010-06-28 - Funk - Add method getUris().
*
******************************************************************************/
* 2010-06-24 - Funk - First version.
*/
/*******************************************************************************
/**
* <p>
* This Identifier interface provides access to TextGrid IDs, e.g. TextGrid
* URIs. The implementations must provide thread-safety itself!
* This Identifier interface provides access to TextGrid and DARIAH-DE IDs, such as TextGrid URIs or
* Handle PIDs. The implementations must provide thread-safety itself!
* </p>
*
* @author Stefan E. Funk, DAASI International GmbH
* @version 2014-12-22
* @version 2021-04-08
* @since 2010-06-24
******************************************************************************/
*/
public interface CrudServiceIdentifier {
// **
// STATIC FINAL VARIABLES
// **
static final String UNIT_NAME = "identifier";
static final String REVISION_SEPARATION_CHAR = ".";
static final int INITIAL_REVISION = 0;
static final ObjectType NO_METADATA = null;
/**
* <p>
* Creates a bunch of URIs, metadata parameter is needed.
* </p>
*
* @param theAmount
* @return A list of URIs.
* @throws IoFault
*/
List<URI> getUris(int theAmount) throws IoFault;
/**
* <p>
* Updates identifier's metadata using the key/value pair map.
* </p>
*
* @param theUri
* @throws IoFault
*/
void updatePidMetadata(URI theUri) throws IoFault;
/**
* <p>
* Checks if a URI already is registered.
* </p>
*
* @param theUri
* @return TRUE if the URI does exist, FALSE if not.
* @throws IoFault
*/
boolean uriExists(URI theUri) throws IoFault;
/**
* <p>
* Locks the URI for e.g. #UPDATE, #UPDATEMETADATA, and #DELETE calls.
* </p>
*
* @param theUri
* @param theUser
* @return TRUE if the given URI could be locked, FALSE otherwise.
* @throws IoFault
*/
boolean lock(URI theUri, String theUser) throws IoFault;
/**
* <p>
* Only checks if the given URI is locked by the user (and if the automagic
* unlocking time has exceeded already).
* </p>
*
* @param theUri
* @return A string by whom the object is locked.
* @throws IoFault
*/
String isLockedBy(URI theUri) throws IoFault;
/**
* <p>
* Unlocks the URI again.
* </p>
*
* @param theUri
* @param theUser
* @return TRUE if the given URI could be unlocked, FALSE otherwise.
* @throws IoFault
*/
boolean unlock(URI theUri, String theUser) throws IoFault;
/**
* <p>
* Locks the URI for e.g. #UPDATE, #UPDATEMETADATA, and #DELETE calls.
* Internal locking only, no user is involved.
* </p>
*
* @param theUri
* @return TRUE if the given URI could be locked, FALSE otherwise.
* @throws IoFault
*/
boolean lockInternal(URI theUri) throws IoFault;
/**
* <p>
* Unlocks the internal URI again.
* </p>
*
* @param theUri
* @return TRUE if the given URI could be unlocked, FALSE otherwise.
* @throws IoFault
*/
boolean unlockInternal(URI theUri) throws IoFault;
// **
// GETTERS AND SETTERS
// **
/**
* <p>
* Set the key/value pairs to bind to the identifier. Please use *before*
* creating the Identifier!
* </p>
*
* @param theKeyValueMap
* @throws IoFault
*/
void setKeyValuePairs(HashMap<String, String> theKeyValueMap)
throws IoFault;
/**
* @param theConfiguration
*/
void setConfiguration(CrudServiceConfigurator theConfiguration);
/**
* @return The service configurator.
*/
CrudServiceConfigurator getConfiguration();
// **
// STATIC FINAL VARIABLES
// **
static final String UNIT_NAME = "identifier";
static final String REVISION_SEPARATION_CHAR = ".";
static final int INITIAL_REVISION = 0;
static final ObjectType NO_METADATA = null;
/**
* <p>
* Creates a bunch of URIs, metadata parameter is needed.
* </p>
*
* @param theAmount
* @return A list of URIs.
* @throws IoFault
*/
List<URI> getUris(int theAmount) throws IoFault;
/**
* <p>
* Updates identifier's metadata using the key/value pair map.
* </p>
*
* @param theUri
* @throws IoFault
*/
void updatePidMetadata(URI theUri) throws IoFault;
/**
* <p>
* Checks if a URI already is registered.
* </p>
*
* @param theUri
* @return TRUE if the URI does exist, FALSE if not.
* @throws IoFault
*/
boolean uriExists(URI theUri) throws IoFault;
/**
* <p>
* Locks the URI for e.g. #UPDATE, #UPDATEMETADATA, and #DELETE calls.
* </p>
*
* @param theUri
* @param theUser
* @return TRUE if the given URI could be locked, FALSE otherwise.
* @throws IoFault
*/
boolean lock(URI theUri, String theUser) throws IoFault;
/**
* <p>
* Only checks if the given URI is locked by the user (and if the automagic unlocking time has
* exceeded already).
* </p>
*
* @param theUri
* @return A string by whom the object is locked.
* @throws IoFault
*/
String isLockedBy(URI theUri) throws IoFault;
/**
* <p>
* Unlocks the URI again.
* </p>
*
* @param theUri
* @param theUser
* @return TRUE if the given URI could be unlocked, FALSE otherwise.
* @throws IoFault
*/
boolean unlock(URI theUri, String theUser) throws IoFault;
/**
* <p>
* Locks the URI for e.g. #UPDATE, #UPDATEMETADATA, and #DELETE calls. Internal locking only, no
* user is involved.
* </p>
*
* @param theUri
* @return TRUE if the given URI could be locked, FALSE otherwise.
* @throws IoFault
*/
boolean lockInternal(URI theUri) throws IoFault;
/**
* <p>
* Unlocks the internal URI again.
* </p>
*
* @param theUri
* @return TRUE if the given URI could be unlocked, FALSE otherwise.
* @throws IoFault
*/
boolean unlockInternal(URI theUri) throws IoFault;
/**
* @param theUri
* @param theType
* @return
* @throws IoFault
* @throws MetadataParseFault
*/
abstract String getHandleMetadata(final URI theUri, final String theType)
throws IoFault, MetadataParseFault;
// **
// GETTERS AND SETTERS
// **
/**
* <p>
* Set the key/value pairs to bind to the identifier. Please use *before* creating the Identifier!
* </p>
*
* @param theKeyValueMap
* @throws IoFault
*/
void setKeyValuePairs(HashMap<String, String> theKeyValueMap)
throws IoFault;
/**
* @param theConfiguration
*/
void setConfiguration(CrudServiceConfigurator theConfiguration);
/**
* @return The service configurator.
*/
CrudServiceConfigurator getConfiguration();
}
/*******************************************************************************
* This software is copyright (c) 2015 by
/**
* This software is copyright (c) 2021 by
*
* - TextGrid Consortium (http://www.textgrid.de)
* - DAASI International GmbH (http://www.daasi.de)
* TextGrid Consortium (https://textgrid.de)
*
* DAASI International GmbH (https://daasi.de)
*
* This is free software. You can redistribute it and/or modify it under the
* terms described in the GNU Lesser General Public License v3 of which you
* should have received a copy. Otherwise you can download it from
* This is free software. You can redistribute it and/or modify it under the terms described in the
* GNU Lesser General Public License v3 of which you should have received a copy. Otherwise you can
* download it from
*
* http://www.gnu.org/licenses/lgpl-3.0.txt
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* @copyright TextGrid Consortium (http://www.textgrid.de)
* @copyright DAASI International GmbH (http://www.daasi.de)
* @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU Lesser General Public
* License v3
* @copyright TextGrid Consortium (https://textgrid.de)
* @copyright DAASI International GmbH (https://daasi.de)
* @license GNU Lesser General Public License v3 (http://www.gnu.org/licenses/lgpl-3.0.txt)
* @author Stefan E. Funk (stefan.e.funk@daasi.de)
******************************************************************************/
*/
package info.textgrid.namespaces.middleware.tgcrud.services.tgcrudservice;
import java.util.HashMap;
/*******************************************************************************
/**
* TODOLOG
*
*******************************************************************************
*
**
* CHANGELOG
*
* 2014-12-22 Funk Added setKeyValuePairs() method.
* 2010-09-04 Funk Adapted to the new metadata schema.
* 2010-06-28 Funk Added missing interface methods.
* 2010-06-24 Funk First version.
* 2014-12-22 - Funk - Added setKeyValuePairs() method.
*
* 2010-09-04 - Funk - Adapted to the new metadata schema.
*
* 2010-06-28 - Funk - Added missing interface methods.
*
******************************************************************************/
* 2010-06-24 - Funk - First version.
*/
/*******************************************************************************
/**
* <p>
* Abstract class for the TG-crud Identifier implementation.
* Abstract class for the CRUD services Identifier implementation.
* </p>
*
* <p>
* <b>NOTE</b> If you really want to use this implementation, please <b>DO
* REMOVE ANY SPECIAL CHARACTERS</b> first!
* <b>NOTE</b> If you really want to use this implementation, please <b>DO REMOVE ANY SPECIAL
* CHARACTERS</b> first!
* </p>
*
* @author Stefan E. Funk, DAASI International GmbH
* @version 2014-12-22
* @version 2021-04-08
* @since 2010-06-24
******************************************************************************/
*/
public abstract class CrudServiceIdentifierAbs implements
CrudServiceIdentifier {
public abstract class CrudServiceIdentifierAbs implements CrudServiceIdentifier {
// **
// STATIC FINALS
// **
// **
// STATIC FINALS
// **
protected static final String NOT_IMPLEMENTED = "Not implemented";
protected static final String NOT_IMPLEMENTED = "Not implemented";
// **
// INSTANCE VARIABLES
// **
// **
// INSTANCE VARIABLES
// **
protected CrudServiceConfigurator conf = null;
protected HashMap<String, String> keyValueMap = new HashMap<String, String>();
protected CrudServiceConfigurator conf = null;
protected HashMap<String, String> keyValueMap = new HashMap<String, String>();
// **
// ** GETTERS AND SETTERS
// **
// **
// ** GETTERS AND SETTERS
// **
/*
* (non-Javadoc)
*
* @see info.textgrid.namespaces.middleware.tgcrud.services.tgcrudservice.
* TGCrudServiceIdentifier#setKeyValuePairs(java.util.HashMap)
*/
public void setKeyValuePairs(HashMap<String, String> theKeyValueMap)
throws IoFault {
this.keyValueMap = theKeyValueMap;
}
/*
* (non-Javadoc)
*
* @see info.textgrid.namespaces.middleware.tgcrud.services.tgcrudservice.
* TGCrudServiceIdentifier#setKeyValuePairs(java.util.HashMap)
*/
public void setKeyValuePairs(HashMap<String, String> theKeyValueMap) throws IoFault {
this.keyValueMap = theKeyValueMap;
}
/*
* (non-Javadoc)
*
* @see info.textgrid.namespaces.middleware.tgcrud.services.tgcrudservice.
* TGCrudServiceIdentifier#getConfiguration()
*/
@Override
public CrudServiceConfigurator getConfiguration() {
return this.conf;
}
/*
* (non-Javadoc)
*
* @see info.textgrid.namespaces.middleware.tgcrud.services.tgcrudservice.
* TGCrudServiceIdentifier#getConfiguration()
*/
@Override