Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,36 @@
.idea/
resourcesync.iml
*.bak
## Ignore the MVN compiled output directories from version tracking
target/

## Ignore project files created by Eclipse
.settings/
/bin/
.project
.classpath

## Ignore project files created by IntelliJ IDEA
*.iml
*.ipr
*.iws
.idea/
overlays/

## Ignore project files created by NetBeans
nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml
META-INF/

## Ignore all *.properties file in root folder, EXCEPT build.properties (the default)
/*.properties
!/build.properties

##Mac noise
.DS_Store
rebel.xml
.externalToolBuilders/
local.cfg
13 changes: 13 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright (c) 2002-2018, DuraSpace.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. 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.

3. Neither the name of the copyright holder 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 HOLDER 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.

See https://opensource.org/licenses/BSD-3-Clause
3 changes: 3 additions & 0 deletions LICENSE_HEADER
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
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
6 changes: 6 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

Licensing Notice

The project is based on code initially developed by Richard Jones at CottageLabs.
In May 2018 the copyright was waived in favour of the DuraSpace Foundation to
allow wide contribution and simplify the adoption by the DSpace community.
62 changes: 60 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.openarchives</groupId>
<groupId>org.dspace</groupId>
<artifactId>resourcesync</artifactId>
<version>0.9-SNAPSHOT</version>
<version>1.1-SNAPSHOT</version>

<properties>
<root.basedir>${basedir}</root.basedir>
</properties>

<build>
<plugins>
<plugin>
Expand All @@ -19,6 +23,60 @@
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<configuration>
<!-- License header file (can be a URL, but that's less stable if external site is down on occasion) -->
<header>${root.basedir}/LICENSE_HEADER</header>
<!--Just check headers of everything in the /src directory -->
<includes>
<include>src/**</include>
</includes>
<!--Use all default exclusions for IDE files & Maven files, see:
http://code.google.com/p/maven-license-plugin/wiki/Configuration#Default_excludes -->
<useDefaultExcludes>true</useDefaultExcludes>
<!-- Add some default DSpace exclusions not covered by <useDefaultExcludes>
Individual Maven projects may choose to override these defaults. -->
<excludes>
<exclude>**/src/test/resources/**</exclude>
<exclude>**/src/test/data/**</exclude>
<exclude>**/src/main/license/**</exclude>
<exclude>**/testEnvironment.properties</exclude>
<exclude>**/META-INF/**</exclude>
<exclude>**/robots.txt</exclude>
<exclude>**/*.LICENSE</exclude>
<exclude>**/LICENSE*</exclude>
<exclude>**/README*</exclude>
<exclude>**/readme*</exclude>
<exclude>**/.gitignore</exclude>
<exclude>**/build.properties*</exclude>
<exclude>**/rebel.xml</exclude>
</excludes>
<mapping>
<!-- Custom DSpace file extensions which are not recognized by maven-release-plugin:
*.xmap, *.xslt, *.wsdd, *.wsdl, *.ttl, *.LICENSE -->
<xmap>XML_STYLE</xmap>
<xslt>XML_STYLE</xslt>
<wsdd>XML_STYLE</wsdd>
<wsdl>XML_STYLE</wsdl>
<ttl>SCRIPT_STYLE</ttl>
<LICENSE>TEXT</LICENSE>
</mapping>
<encoding>UTF-8</encoding>
<!-- maven-license-plugin recommends a strict check (e.g. check spaces/tabs too) -->
<strictCheck>true</strictCheck>
</configuration>
<executions>
<execution>
<id>check-headers</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
/**
* 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
*/
package org.openarchives.resourcesync;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
* @author Richard Jones
*/
public class CapabilityList extends UrlSet
{
private List<String> allowedCapabilities = new ArrayList<String>();
Expand Down
46 changes: 46 additions & 0 deletions src/main/java/org/openarchives/resourcesync/ChangeDump.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* 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
*/
package org.openarchives.resourcesync;

import java.util.Date;

/**
* @author Richard Jones
*/
public class ChangeDump extends UrlSet
{

public ChangeDump(Date from, String resourceSync)
{
super(ResourceSync.CAPABILITY_CHANGEDUMP);
this.setFrom(from);
if (resourceSync != null)
{
this.addLn(ResourceSync.CAPABILITY_RESOURCESYNC, resourceSync);
}
}

public ChangeDump()
{
this(new Date(), null);
}

public void addResourceZip(URL zip)
{
this.addUrl(zip);
}

public URL addResourceZip(String zipUrl, Date lastMod, String type, long length)
{
URL url = new URL();
url.setLoc(zipUrl);
url.setLastModified(lastMod);
url.setType(type);
url.setLength(length);
this.addResourceZip(url);
return url;
}
}
13 changes: 11 additions & 2 deletions src/main/java/org/openarchives/resourcesync/ChangeList.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
/**
* 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
*/
package org.openarchives.resourcesync;

import java.util.Date;

/**
* @author Richard Jones
*/
public class ChangeList extends UrlSet
{


public ChangeList()
{
this(null, null, null, null);
Expand Down Expand Up @@ -31,7 +40,7 @@ public ChangeList(Date from, Date until, String capabilityList, String changeLis

if (capabilityList != null)
{
this.addLn(ResourceSync.REL_RESOURCESYNC, capabilityList);
this.addLn(ResourceSync.REL_UP, capabilityList);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
/**
* 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
*/
package org.openarchives.resourcesync;

import java.io.InputStream;
import java.util.Date;

/**
* @author Richard Jones
*/
public class ChangeListArchive extends SitemapIndex
{
public ChangeListArchive()
Expand Down Expand Up @@ -44,7 +51,7 @@ public ChangeListArchive(Date from, Date until, String capabilityList)

if (capabilityList != null)
{
this.addLn(ResourceSync.REL_RESOURCESYNC, capabilityList);
this.addLn(ResourceSync.REL_UP, capabilityList);
}
}

Expand Down
21 changes: 18 additions & 3 deletions src/main/java/org/openarchives/resourcesync/ResourceDump.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
/**
* 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
*/
package org.openarchives.resourcesync;

import com.sun.org.apache.xpath.internal.functions.FuncStringLength;

import java.util.Date;

/**
* @author Richard Jones
*/
public class ResourceDump extends UrlSet
{

Expand All @@ -13,7 +19,7 @@ public ResourceDump(Date from, String resourceSync)
this.setFrom(from);
if (resourceSync != null)
{
this.addLn(ResourceSync.CAPABILITY_RESOURCESYNC, resourceSync);
this.addLn(ResourceSync.REL_UP, resourceSync);
}
}

Expand All @@ -37,4 +43,13 @@ public URL addResourceZip(String zipUrl, Date lastMod, String type, long length)
this.addResourceZip(url);
return url;
}
public URL addResourceZip(String zipUrl, Date lastMod, String type)
{
URL url = new URL();
url.setLoc(zipUrl);
url.setLastModified(lastMod);
url.setType(type);
this.addResourceZip(url);
return url;
}
}
28 changes: 26 additions & 2 deletions src/main/java/org/openarchives/resourcesync/ResourceList.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
/**
* 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
*/
package org.openarchives.resourcesync;

import java.util.Date;

/**
* @author Richard Jones
*/
public class ResourceList extends UrlSet
{
public ResourceList()
Expand Down Expand Up @@ -54,10 +61,27 @@ public ResourceList(Date lastMod, String capabilityList, boolean dump)

if (capabilityList != null)
{
this.addLn(ResourceSync.REL_RESOURCESYNC, capabilityList);
this.addLn(ResourceSync.REL_UP, capabilityList);
}
}
public ResourceList(Date lastMod, String capabilityList, boolean dump,boolean changeDump)
{
super(changeDump ? ResourceSync.CAPABILITY_CHANGEDUMP_MANIFEST : ResourceSync.CAPABILITY_RESOURCELIST);

if (lastMod == null)
{
this.setFrom(new Date());
}
else
{
this.setFrom(lastMod);
}

if (capabilityList != null)
{
this.addLn(ResourceSync.REL_UP, capabilityList);
}
}
public void addResource(URL resource)
{
this.addEntry(resource);
Expand Down
13 changes: 10 additions & 3 deletions src/main/java/org/openarchives/resourcesync/ResourceSync.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
/**
* 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
*/
package org.openarchives.resourcesync;

import org.jdom2.Namespace;

import java.text.SimpleDateFormat;

/**
* @author Richard Jones
*/
public class ResourceSync
{
// namespaces
Expand All @@ -30,11 +37,11 @@ public class ResourceSync
public static String REL_PROFILE = "profile";

// capabilities
public static String CAPABILITY_RESOURCESYNC = "resourcesync";
public static String CAPABILITY_RESOURCESYNC = "description";
public static String CAPABILITY_RESOURCELIST = "resourcelist";
public static String CAPABILITY_RESOURCELIST_ARCHIVE = "resourcelist-archive";
public static String CAPABILITY_CHANGELIST = "changelist";
public static String CAPABILITY_CHANGELIST_ARCHIVE = "changelist-archive";
public static String CAPABILITY_CHANGELIST_ARCHIVE = "changelistindex";
public static String CAPABILITY_RESOURCEDUMP = "resourcedump";
public static String CAPABILITY_RESOURCEDUMP_ARCHIVE = "resourcedump-archive";
public static String CAPABILITY_CHANGEDUMP = "changedump";
Expand Down
Loading