-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://scm.dspace.org/svn/repo/trunk@2884 9c30dcfa-912a-0410-8fc2-9e0234be79fd
- Loading branch information
Showing
64 changed files
with
10,180 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Copyright (c) 2007, Aberystwyth University | ||
|
||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
|
||
- Redistributions of source code must retain the above | ||
copyright notice, this list of conditions and the | ||
following disclaimer. | ||
|
||
- Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in | ||
the documentation and/or other materials provided with the | ||
distribution. | ||
|
||
- Neither the name of the Centre for Advanced Software and | ||
Intelligent Systems (CASIS) nor the names of its | ||
contributors may be used to endorse or promote products derived | ||
from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF | ||
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
DSpace SWORD README | ||
=================== | ||
|
||
Author: Richard Jones | ||
Last Updated: 07-02-2007 | ||
|
||
This document describes the DSpace implementation of the SWORD deposit | ||
standard. This is an extension to the ATOM Publishing Protocol (APP), | ||
which provides a framework to discover deposit targets, and to deposit packaged | ||
content into remote repositories. | ||
|
||
For more information see: | ||
|
||
http://www.ukoln.ac.uk/repositories/digirep/index/SWORD | ||
|
||
Testing | ||
------- | ||
|
||
Supplied along with the source code is a package which can be used for testing. | ||
This consists of a mets.xml file, which is a METS document containing a Dublin | ||
Core XML section of descriptive metadata which conforms to the SWAP standard. | ||
There are additionally 3 example PDF files. | ||
|
||
These files are provided additionally inside a zip file which should form the | ||
content of a deposit request (example.zip). | ||
|
||
These files are all available in the directory: [dspace-sword]/example | ||
|
||
Testing can be performed using the separately available SWORD Client | ||
|
||
Implementation Notes | ||
-------------------- | ||
|
||
- DSpace has no equivalent concept for the SWORD term "treatment". This is | ||
therefore always null in the Service Document | ||
|
||
- The logic of onBehalfOf is as follows: The list of collections which is | ||
supplied during a request which is done onBehalfOf another user is the | ||
intersection of the lists of collections that the authenticated user can | ||
submit to and the list that the onBehalfOf user can submit to. | ||
|
||
- This implementation only supports the default PasswordAuthentication | ||
mechanism for DSpace. Modifications are required to tie it in to alternative | ||
authentication mechanisms. | ||
|
||
- When items are deposited and pass into the DSpace workflow system, they | ||
cannot be assigned external identifiers immediately. Therefore the returned | ||
id on "Accepted" items will be the front page of the repository on which the | ||
deposit happened. Alternatives to this mechanism are being sought, but may | ||
require core DSpace modifications. | ||
|
||
- If a request is made with an onBehalfOf user supplied, the authentication | ||
process requires that the username/password pair successfully authenticate a | ||
user, and that the onBehalfOf user simply exists in the user database. If | ||
any of these conditions fail, authentication fails. | ||
|
||
- The DSpace package ingester does not permit for a copy of the orignal package | ||
to be retained. To modify this requires changes to the core DSpace which | ||
could be considered. In the mean time, it is not possible to return a link | ||
to the original package in the <atom:link> element. | ||
|
||
- The ingest stylesheet used by default is available in the file: | ||
[dspace-source]/config/crosswalks/sword-swap-ingest.xsl but does not cover | ||
the complete SWAP profile yet. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.dspace</groupId> | ||
<artifactId>dspace-sword-api</artifactId> | ||
<packaging>jar</packaging> | ||
<name>DSpace SWORD :: API and Implementation</name> | ||
<description> | ||
DSpace SWORD Deposit Service Provider Web Application | ||
</description> | ||
<url>http://www.ukoln.ac.uk/repositories/digirep/index/SWORD</url> | ||
|
||
<!-- | ||
A Parent POM that Maven inherits DSpace Default | ||
POM atrributes from. | ||
--> | ||
<parent> | ||
<groupId>org.dspace</groupId> | ||
<artifactId>dspace-sword</artifactId> | ||
<version>1.5.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<repositories> | ||
<repository> | ||
<id>maven.dspace.org/snapshot</id> | ||
<name>DSpace Maven Snapshot Repository</name> | ||
<url>http://maven.dspace.org/snapshot</url> | ||
<releases> | ||
<enabled>false</enabled> | ||
<checksumPolicy>fail</checksumPolicy> | ||
</releases> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
<updatePolicy>never</updatePolicy> | ||
<checksumPolicy>fail</checksumPolicy> | ||
</snapshots> | ||
</repository> | ||
</repositories> | ||
|
||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>maven.dspace.org/snapshot</id> | ||
<name>DSpace Maven Repository</name> | ||
<url>http://maven.dspace.org/snapshot</url> | ||
<releases> | ||
<enabled>false</enabled> | ||
<checksumPolicy>fail</checksumPolicy> | ||
</releases> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
<updatePolicy>never</updatePolicy> | ||
<checksumPolicy>fail</checksumPolicy> | ||
</snapshots> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
|
||
<!-- | ||
The Subversion repository location is used by Continuum to update against | ||
when changes have occured, this spawns a new build cycle and releases snapshots | ||
into the snapshot repository below. | ||
--> | ||
<scm> | ||
<connection>scm:svn:http://dspace.svn.sourceforge.net/svnroot/dspace/branches/dspace-1_5_x/dspace-sword/dspace-sword-api</connection> | ||
<developerConnection>scm:svn:https://dspace.svn.sourceforge.net/svnroot/dspace/branches/dspace-1_5_x/dspace-sword/dspace-sword-api</developerConnection> | ||
<url>http://dspace.svn.sourceforge.net/viewvc/dspace/branches/dspace-1_5_x/dspace-sword/dspace-sword-api</url> | ||
</scm> | ||
|
||
<dependencies> | ||
|
||
<!-- Leave this out for the moment, as the source is in the tree --> | ||
<!-- | ||
<dependency> | ||
<groupId>org.dspace</groupId> | ||
<artifactId>sword-common</artifactId> | ||
<version>1.0.0</version> | ||
</dependency>--> | ||
|
||
<dependency> | ||
<groupId>org.dspace</groupId> | ||
<artifactId>dspace-api</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.dspace</groupId> | ||
<artifactId>dspace-api-lang</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>xom</groupId> | ||
<artifactId>xom</artifactId> | ||
<version>1.1</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>jaxen</groupId> | ||
<artifactId>jaxen</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>javax.servlet</groupId> | ||
<artifactId>servlet-api</artifactId> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
</project> |
168 changes: 168 additions & 0 deletions
168
dspace-sword/dspace-sword-api/src/main/java/org/dspace/sword/CollectionLocation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
/* CollectionLocation.java | ||
* | ||
* Copyright (c) 2007, Aberystwyth University | ||
* | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* | ||
* - Redistributions of source code must retain the above | ||
* copyright notice, this list of conditions and the | ||
* following disclaimer. | ||
* | ||
* - Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in | ||
* the documentation and/or other materials provided with the | ||
* distribution. | ||
* | ||
* - Neither the name of the Centre for Advanced Software and | ||
* Intelligent Systems (CASIS) nor the names of its | ||
* contributors may be used to endorse or promote products derived | ||
* from this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF | ||
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
* SUCH DAMAGE. | ||
*/ | ||
|
||
package org.dspace.sword; | ||
|
||
import java.net.MalformedURLException; | ||
import java.net.URL; | ||
import java.sql.SQLException; | ||
|
||
import org.apache.log4j.Logger; | ||
|
||
import org.dspace.content.Collection; | ||
import org.dspace.content.DSpaceObject; | ||
import org.dspace.core.ConfigurationManager; | ||
import org.dspace.core.Context; | ||
import org.dspace.handle.HandleManager; | ||
|
||
/** | ||
* This class provides a single point of contact for | ||
* resolving Collections from SWORD Deposit URLs and for | ||
* generating SWORD Deposit URLs from Collections | ||
* | ||
* @author Richard Jones | ||
* | ||
*/ | ||
public class CollectionLocation | ||
{ | ||
/** Log4j logger */ | ||
public static Logger log = Logger.getLogger(CollectionLocation.class); | ||
|
||
/** | ||
* Obtain the deposit URL for the given collection. These URLs | ||
* should not be considered persistent, but will remain consistent | ||
* unless configuration changes are made to DSpace | ||
* | ||
* @param collection | ||
* @return The Deposit URL | ||
* @throws DSpaceSWORDException | ||
*/ | ||
public String getLocation(Collection collection) | ||
throws DSpaceSWORDException | ||
{ | ||
return this.getBaseUrl() + "/" + collection.getHandle(); | ||
} | ||
|
||
/** | ||
* Obtain the collection which is represented by the given | ||
* URL | ||
* | ||
* @param context the DSpace context | ||
* @param location the URL to resolve to a collection | ||
* @return The collection to which the url resolves | ||
* @throws DSpaceSWORDException | ||
*/ | ||
public Collection getCollection(Context context, String location) | ||
throws DSpaceSWORDException | ||
{ | ||
try | ||
{ | ||
String baseUrl = this.getBaseUrl(); | ||
if (baseUrl.length() == location.length()) | ||
{ | ||
throw new DSpaceSWORDException("The deposit URL is incomplete"); | ||
} | ||
String handle = location.substring(baseUrl.length()); | ||
if (handle.startsWith("/")) | ||
{ | ||
handle = handle.substring(1); | ||
} | ||
if ("".equals(handle)) | ||
{ | ||
throw new DSpaceSWORDException("The deposit URL is incomplete"); | ||
} | ||
|
||
DSpaceObject dso = HandleManager.resolveToObject(context, handle); | ||
|
||
if (!(dso instanceof Collection)) | ||
{ | ||
throw new DSpaceSWORDException("The deposit URL does not resolve to a valid collection"); | ||
} | ||
|
||
return (Collection) dso; | ||
} | ||
catch (SQLException e) | ||
{ | ||
log.error("Caught exception:", e); | ||
throw new DSpaceSWORDException("There was a problem resolving the collection", e); | ||
} | ||
} | ||
|
||
/** | ||
* Get the base deposit URL for the DSpace SWORD implementation. This | ||
* is effectively the URL of the servlet which deals with deposit | ||
* requests, and is used as the basis for the individual Collection | ||
* URLs | ||
* | ||
* If the configuration sword.deposit.url is set, this will be returned, | ||
* but if not, it will construct the url as follows: | ||
* | ||
* [dspace.url]/dspace-sword/deposit | ||
* | ||
* where dspace.url is also in the configuration file. | ||
* | ||
* @return the base URL for sword deposit | ||
* @throws DSpaceSWORDException | ||
*/ | ||
private String getBaseUrl() | ||
throws DSpaceSWORDException | ||
{ | ||
String depositUrl = ConfigurationManager.getProperty("sword.deposit.url"); | ||
if (depositUrl == null || "".equals(depositUrl)) | ||
{ | ||
String dspaceUrl = ConfigurationManager.getProperty("dspace.url"); | ||
if (dspaceUrl == null || "".equals(dspaceUrl)) | ||
{ | ||
throw new DSpaceSWORDException("Unable to construct deposit urls, due to missing/invalid config in sword.deposit.url and/or dspace.url"); | ||
} | ||
|
||
try | ||
{ | ||
URL url = new URL(dspaceUrl); | ||
depositUrl = new URL(url.getProtocol(), url.getHost(), url.getPort(), "/sword/deposit").toString(); | ||
} | ||
catch (MalformedURLException e) | ||
{ | ||
throw new DSpaceSWORDException("Unable to construct deposit urls, due to invalid dspace.url " + e.getMessage(),e); | ||
} | ||
|
||
|
||
} | ||
return depositUrl; | ||
} | ||
} |
Oops, something went wrong.