Skip to content

Commit 55cb9a1

Browse files
committed
build enhancements and object api improvements
1 parent 788d511 commit 55cb9a1

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@
88
<artifactId>resourcesync</artifactId>
99
<version>0.5-SNAPSHOT</version>
1010

11+
<build>
12+
<plugins>
13+
<plugin>
14+
<groupId>org.apache.maven.plugins</groupId>
15+
<artifactId>maven-compiler-plugin</artifactId>
16+
<version>3.1</version>
17+
<configuration>
18+
<source>1.6</source>
19+
<target>1.6</target>
20+
</configuration>
21+
</plugin>
22+
</plugins>
23+
</build>
24+
1125
<dependencies>
1226
<dependency>
1327
<groupId>org.jdom</groupId>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ public ResourceList(Date lastMod, String capabilityList)
3434
}
3535
}
3636

37+
public ResourceList(String capabilityList)
38+
{
39+
this(null, capabilityList);
40+
}
41+
3742
public void addResource(URL resource)
3843
{
3944
this.addEntry(resource);

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import org.jdom2.Element;
55
import org.jdom2.output.XMLOutputter;
66

7+
import java.io.IOException;
8+
import java.io.OutputStream;
79
import java.util.ArrayList;
810
import java.util.Date;
911
import java.util.HashMap;
@@ -121,4 +123,13 @@ public String serialise()
121123
XMLOutputter out = new XMLOutputter();
122124
return out.outputString(doc);
123125
}
126+
127+
public void serialise(OutputStream out)
128+
throws IOException
129+
{
130+
Element element = this.getElement();
131+
Document doc = new Document(element);
132+
XMLOutputter xmlOutputter = new XMLOutputter();
133+
xmlOutputter.output(doc, out);
134+
}
124135
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public abstract class ResourceSyncEntry
2020
protected String capability = null;
2121
protected String change = null;
2222
protected Map<String, String> hashes = new HashMap<String, String>();
23-
protected int length = -1;
23+
protected long length = -1;
2424
protected String path = null;
2525
protected String type = null;
2626

@@ -63,7 +63,7 @@ public void setChange(String change)
6363
this.change = change;
6464
}
6565

66-
public void setLength(int length)
66+
public void setLength(long length)
6767
{
6868
this.length = length;
6969
}
@@ -132,7 +132,7 @@ public Map<String, String> getHashes()
132132
return hashes;
133133
}
134134

135-
public int getLength()
135+
public long getLength()
136136
{
137137
return length;
138138
}
@@ -198,7 +198,7 @@ public Element getElement()
198198
}
199199
if (this.length > -1)
200200
{
201-
md.setAttribute("length", Integer.toString(this.length), ResourceSync.NS_ATOM);
201+
md.setAttribute("length", Long.toString(this.length), ResourceSync.NS_ATOM);
202202
trip = true;
203203
}
204204
if (this.path != null)

0 commit comments

Comments
 (0)