Skip to content

Commit 40012cf

Browse files
Merge pull request #1 from 4Science/D4CRIS-506
Update the library for ResourceSync 1.1
2 parents da6f2a9 + e23a27c commit 40012cf

29 files changed

+470
-31
lines changed

.gitignore

+34-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,36 @@
1-
.idea/
2-
resourcesync.iml
1+
*.bak
2+
## Ignore the MVN compiled output directories from version tracking
33
target/
44

5+
## Ignore project files created by Eclipse
6+
.settings/
7+
/bin/
8+
.project
9+
.classpath
10+
11+
## Ignore project files created by IntelliJ IDEA
12+
*.iml
13+
*.ipr
14+
*.iws
15+
.idea/
16+
overlays/
17+
18+
## Ignore project files created by NetBeans
19+
nbproject/private/
20+
build/
21+
nbbuild/
22+
dist/
23+
nbdist/
24+
nbactions.xml
25+
nb-configuration.xml
26+
META-INF/
27+
28+
## Ignore all *.properties file in root folder, EXCEPT build.properties (the default)
29+
/*.properties
30+
!/build.properties
31+
32+
##Mac noise
33+
.DS_Store
34+
rebel.xml
35+
.externalToolBuilders/
36+
local.cfg

LICENSE

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright (c) 2002-2018, DuraSpace.
2+
3+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4+
5+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6+
7+
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.
8+
9+
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.
10+
11+
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.
12+
13+
See https://opensource.org/licenses/BSD-3-Clause

LICENSE_HEADER

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
The contents of this file are subject to the license and copyright
2+
detailed in the LICENSE and NOTICE files at the root of the source
3+
tree

NOTICE

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
Licensing Notice
3+
4+
The project is based on code initially developed by Richard Jones at CottageLabs.
5+
In May 2018 the copyright was waived in favour of the DuraSpace Foundation to
6+
allow wide contribution and simplify the adoption by the DSpace community.

pom.xml

+60-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

7-
<groupId>org.openarchives</groupId>
7+
<groupId>org.dspace</groupId>
88
<artifactId>resourcesync</artifactId>
9-
<version>0.9-SNAPSHOT</version>
9+
<version>1.1-SNAPSHOT</version>
1010

11+
<properties>
12+
<root.basedir>${basedir}</root.basedir>
13+
</properties>
14+
1115
<build>
1216
<plugins>
1317
<plugin>
@@ -19,6 +23,60 @@
1923
<target>1.6</target>
2024
</configuration>
2125
</plugin>
26+
<plugin>
27+
<groupId>com.mycila</groupId>
28+
<artifactId>license-maven-plugin</artifactId>
29+
<configuration>
30+
<!-- License header file (can be a URL, but that's less stable if external site is down on occasion) -->
31+
<header>${root.basedir}/LICENSE_HEADER</header>
32+
<!--Just check headers of everything in the /src directory -->
33+
<includes>
34+
<include>src/**</include>
35+
</includes>
36+
<!--Use all default exclusions for IDE files & Maven files, see:
37+
http://code.google.com/p/maven-license-plugin/wiki/Configuration#Default_excludes -->
38+
<useDefaultExcludes>true</useDefaultExcludes>
39+
<!-- Add some default DSpace exclusions not covered by <useDefaultExcludes>
40+
Individual Maven projects may choose to override these defaults. -->
41+
<excludes>
42+
<exclude>**/src/test/resources/**</exclude>
43+
<exclude>**/src/test/data/**</exclude>
44+
<exclude>**/src/main/license/**</exclude>
45+
<exclude>**/testEnvironment.properties</exclude>
46+
<exclude>**/META-INF/**</exclude>
47+
<exclude>**/robots.txt</exclude>
48+
<exclude>**/*.LICENSE</exclude>
49+
<exclude>**/LICENSE*</exclude>
50+
<exclude>**/README*</exclude>
51+
<exclude>**/readme*</exclude>
52+
<exclude>**/.gitignore</exclude>
53+
<exclude>**/build.properties*</exclude>
54+
<exclude>**/rebel.xml</exclude>
55+
</excludes>
56+
<mapping>
57+
<!-- Custom DSpace file extensions which are not recognized by maven-release-plugin:
58+
*.xmap, *.xslt, *.wsdd, *.wsdl, *.ttl, *.LICENSE -->
59+
<xmap>XML_STYLE</xmap>
60+
<xslt>XML_STYLE</xslt>
61+
<wsdd>XML_STYLE</wsdd>
62+
<wsdl>XML_STYLE</wsdl>
63+
<ttl>SCRIPT_STYLE</ttl>
64+
<LICENSE>TEXT</LICENSE>
65+
</mapping>
66+
<encoding>UTF-8</encoding>
67+
<!-- maven-license-plugin recommends a strict check (e.g. check spaces/tabs too) -->
68+
<strictCheck>true</strictCheck>
69+
</configuration>
70+
<executions>
71+
<execution>
72+
<id>check-headers</id>
73+
<phase>verify</phase>
74+
<goals>
75+
<goal>check</goal>
76+
</goals>
77+
</execution>
78+
</executions>
79+
</plugin>
2280
</plugins>
2381
</build>
2482

src/main/java/org/openarchives/resourcesync/CapabilityList.java

+8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
/**
2+
* The contents of this file are subject to the license and copyright
3+
* detailed in the LICENSE and NOTICE files at the root of the source
4+
* tree
5+
*/
16
package org.openarchives.resourcesync;
27

38
import java.util.ArrayList;
49
import java.util.Date;
510
import java.util.List;
611

12+
/**
13+
* @author Richard Jones
14+
*/
715
public class CapabilityList extends UrlSet
816
{
917
private List<String> allowedCapabilities = new ArrayList<String>();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/**
2+
* The contents of this file are subject to the license and copyright
3+
* detailed in the LICENSE and NOTICE files at the root of the source
4+
* tree
5+
*/
6+
package org.openarchives.resourcesync;
7+
8+
import java.util.Date;
9+
10+
/**
11+
* @author Richard Jones
12+
*/
13+
public class ChangeDump extends UrlSet
14+
{
15+
16+
public ChangeDump(Date from, String resourceSync)
17+
{
18+
super(ResourceSync.CAPABILITY_CHANGEDUMP);
19+
this.setFrom(from);
20+
if (resourceSync != null)
21+
{
22+
this.addLn(ResourceSync.CAPABILITY_RESOURCESYNC, resourceSync);
23+
}
24+
}
25+
26+
public ChangeDump()
27+
{
28+
this(new Date(), null);
29+
}
30+
31+
public void addResourceZip(URL zip)
32+
{
33+
this.addUrl(zip);
34+
}
35+
36+
public URL addResourceZip(String zipUrl, Date lastMod, String type, long length)
37+
{
38+
URL url = new URL();
39+
url.setLoc(zipUrl);
40+
url.setLastModified(lastMod);
41+
url.setType(type);
42+
url.setLength(length);
43+
this.addResourceZip(url);
44+
return url;
45+
}
46+
}

src/main/java/org/openarchives/resourcesync/ChangeList.java

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1+
/**
2+
* The contents of this file are subject to the license and copyright
3+
* detailed in the LICENSE and NOTICE files at the root of the source
4+
* tree
5+
*/
16
package org.openarchives.resourcesync;
27

38
import java.util.Date;
4-
9+
/**
10+
* @author Richard Jones
11+
*/
512
public class ChangeList extends UrlSet
613
{
14+
15+
716
public ChangeList()
817
{
918
this(null, null, null, null);
@@ -31,7 +40,7 @@ public ChangeList(Date from, Date until, String capabilityList, String changeLis
3140

3241
if (capabilityList != null)
3342
{
34-
this.addLn(ResourceSync.REL_RESOURCESYNC, capabilityList);
43+
this.addLn(ResourceSync.REL_UP, capabilityList);
3544
}
3645
}
3746

src/main/java/org/openarchives/resourcesync/ChangeListArchive.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1+
/**
2+
* The contents of this file are subject to the license and copyright
3+
* detailed in the LICENSE and NOTICE files at the root of the source
4+
* tree
5+
*/
16
package org.openarchives.resourcesync;
27

38
import java.io.InputStream;
49
import java.util.Date;
5-
10+
/**
11+
* @author Richard Jones
12+
*/
613
public class ChangeListArchive extends SitemapIndex
714
{
815
public ChangeListArchive()
@@ -44,7 +51,7 @@ public ChangeListArchive(Date from, Date until, String capabilityList)
4451

4552
if (capabilityList != null)
4653
{
47-
this.addLn(ResourceSync.REL_RESOURCESYNC, capabilityList);
54+
this.addLn(ResourceSync.REL_UP, capabilityList);
4855
}
4956
}
5057

src/main/java/org/openarchives/resourcesync/ResourceDump.java

+18-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
/**
2+
* The contents of this file are subject to the license and copyright
3+
* detailed in the LICENSE and NOTICE files at the root of the source
4+
* tree
5+
*/
16
package org.openarchives.resourcesync;
27

3-
import com.sun.org.apache.xpath.internal.functions.FuncStringLength;
48

59
import java.util.Date;
6-
10+
/**
11+
* @author Richard Jones
12+
*/
713
public class ResourceDump extends UrlSet
814
{
915

@@ -13,7 +19,7 @@ public ResourceDump(Date from, String resourceSync)
1319
this.setFrom(from);
1420
if (resourceSync != null)
1521
{
16-
this.addLn(ResourceSync.CAPABILITY_RESOURCESYNC, resourceSync);
22+
this.addLn(ResourceSync.REL_UP, resourceSync);
1723
}
1824
}
1925

@@ -37,4 +43,13 @@ public URL addResourceZip(String zipUrl, Date lastMod, String type, long length)
3743
this.addResourceZip(url);
3844
return url;
3945
}
46+
public URL addResourceZip(String zipUrl, Date lastMod, String type)
47+
{
48+
URL url = new URL();
49+
url.setLoc(zipUrl);
50+
url.setLastModified(lastMod);
51+
url.setType(type);
52+
this.addResourceZip(url);
53+
return url;
54+
}
4055
}

src/main/java/org/openarchives/resourcesync/ResourceList.java

+26-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1+
/**
2+
* The contents of this file are subject to the license and copyright
3+
* detailed in the LICENSE and NOTICE files at the root of the source
4+
* tree
5+
*/
16
package org.openarchives.resourcesync;
27

38
import java.util.Date;
4-
9+
/**
10+
* @author Richard Jones
11+
*/
512
public class ResourceList extends UrlSet
613
{
714
public ResourceList()
@@ -54,10 +61,27 @@ public ResourceList(Date lastMod, String capabilityList, boolean dump)
5461

5562
if (capabilityList != null)
5663
{
57-
this.addLn(ResourceSync.REL_RESOURCESYNC, capabilityList);
64+
this.addLn(ResourceSync.REL_UP, capabilityList);
5865
}
5966
}
67+
public ResourceList(Date lastMod, String capabilityList, boolean dump,boolean changeDump)
68+
{
69+
super(changeDump ? ResourceSync.CAPABILITY_CHANGEDUMP_MANIFEST : ResourceSync.CAPABILITY_RESOURCELIST);
6070

71+
if (lastMod == null)
72+
{
73+
this.setFrom(new Date());
74+
}
75+
else
76+
{
77+
this.setFrom(lastMod);
78+
}
79+
80+
if (capabilityList != null)
81+
{
82+
this.addLn(ResourceSync.REL_UP, capabilityList);
83+
}
84+
}
6185
public void addResource(URL resource)
6286
{
6387
this.addEntry(resource);

src/main/java/org/openarchives/resourcesync/ResourceSync.java

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1+
/**
2+
* The contents of this file are subject to the license and copyright
3+
* detailed in the LICENSE and NOTICE files at the root of the source
4+
* tree
5+
*/
16
package org.openarchives.resourcesync;
27

38
import org.jdom2.Namespace;
49

510
import java.text.SimpleDateFormat;
6-
11+
/**
12+
* @author Richard Jones
13+
*/
714
public class ResourceSync
815
{
916
// namespaces
@@ -30,11 +37,11 @@ public class ResourceSync
3037
public static String REL_PROFILE = "profile";
3138

3239
// capabilities
33-
public static String CAPABILITY_RESOURCESYNC = "resourcesync";
40+
public static String CAPABILITY_RESOURCESYNC = "description";
3441
public static String CAPABILITY_RESOURCELIST = "resourcelist";
3542
public static String CAPABILITY_RESOURCELIST_ARCHIVE = "resourcelist-archive";
3643
public static String CAPABILITY_CHANGELIST = "changelist";
37-
public static String CAPABILITY_CHANGELIST_ARCHIVE = "changelist-archive";
44+
public static String CAPABILITY_CHANGELIST_ARCHIVE = "changelistindex";
3845
public static String CAPABILITY_RESOURCEDUMP = "resourcedump";
3946
public static String CAPABILITY_RESOURCEDUMP_ARCHIVE = "resourcedump-archive";
4047
public static String CAPABILITY_CHANGEDUMP = "changedump";

0 commit comments

Comments
 (0)