-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
299 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
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
26 changes: 26 additions & 0 deletions
26
src/main/java/com/github/sardine/impl/methods/HttpCheckin.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,26 @@ | ||
package com.github.sardine.impl.methods; | ||
|
||
import org.apache.http.client.methods.HttpRequestBase; | ||
|
||
import java.net.URI; | ||
|
||
/** | ||
* Simple class for making WebDAV <code>CHECKIN</code> requests. | ||
*/ | ||
public class HttpCheckin extends HttpRequestBase { | ||
|
||
public static final String METHOD_NAME = "CHECKIN"; | ||
|
||
public HttpCheckin(String uri) { | ||
this(URI.create(uri)); | ||
} | ||
|
||
public HttpCheckin(URI uri) { | ||
this.setURI(uri); | ||
} | ||
|
||
@Override | ||
public String getMethod() { | ||
return METHOD_NAME; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/github/sardine/impl/methods/HttpCheckout.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,26 @@ | ||
package com.github.sardine.impl.methods; | ||
|
||
import org.apache.http.client.methods.HttpRequestBase; | ||
|
||
import java.net.URI; | ||
|
||
/** | ||
* Simple class for making WebDAV <code>CHECKOUT</code> requests. | ||
*/ | ||
public class HttpCheckout extends HttpRequestBase { | ||
|
||
public static final String METHOD_NAME = "CHECKOUT"; | ||
|
||
public HttpCheckout(String uri) { | ||
this(URI.create(uri)); | ||
} | ||
|
||
public HttpCheckout(URI uri) { | ||
this.setURI(uri); | ||
} | ||
|
||
@Override | ||
public String getMethod() { | ||
return METHOD_NAME; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/github/sardine/impl/methods/HttpVersionControl.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,26 @@ | ||
package com.github.sardine.impl.methods; | ||
|
||
import org.apache.http.client.methods.HttpRequestBase; | ||
|
||
import java.net.URI; | ||
|
||
/** | ||
* Simple class for making WebDAV <code>VERSION-CONTROL</code> requests. | ||
*/ | ||
public class HttpVersionControl extends HttpRequestBase { | ||
|
||
public static final String METHOD_NAME = "VERSION-CONTROL"; | ||
|
||
public HttpVersionControl(String uri) { | ||
this(URI.create(uri)); | ||
} | ||
|
||
public HttpVersionControl(URI uri) { | ||
this.setURI(uri); | ||
} | ||
|
||
@Override | ||
public String getMethod() { | ||
return METHOD_NAME; | ||
} | ||
} |
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
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,38 @@ | ||
package com.github.sardine.model; | ||
|
||
import javax.xml.bind.annotation.*; | ||
|
||
@XmlAccessorType(XmlAccessType.FIELD) | ||
@XmlType(name = "", propOrder = { | ||
"prop" | ||
}) | ||
@XmlRootElement(name = "version-tree") | ||
public class VersionTree { | ||
|
||
@XmlElement | ||
protected Prop prop; | ||
|
||
/** | ||
* Gets the value of the prop property. | ||
* | ||
* @return | ||
* possible object is | ||
* {@link Prop } | ||
* | ||
*/ | ||
public Prop getProp() { | ||
return prop; | ||
} | ||
|
||
/** | ||
* Sets the value of the prop property. | ||
* | ||
* @param value | ||
* allowed object is | ||
* {@link Prop } | ||
* | ||
*/ | ||
public void setProp(Prop value) { | ||
this.prop = value; | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
src/main/java/com/github/sardine/report/VersionTreeReport.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,59 @@ | ||
package com.github.sardine.report; | ||
|
||
import com.github.sardine.DavResource; | ||
import com.github.sardine.model.*; | ||
import com.github.sardine.util.SardineUtil; | ||
import org.w3c.dom.Element; | ||
|
||
import javax.xml.namespace.QName; | ||
import java.net.URISyntaxException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Set; | ||
import java.util.logging.Logger; | ||
|
||
public class VersionTreeReport extends SardineReport<List<DavResource>> | ||
{ | ||
|
||
private static final Logger log = Logger.getLogger(SardineReport.class.getName()); | ||
|
||
private final Set<QName> properties; | ||
|
||
public VersionTreeReport(Set<QName> properties) | ||
{ | ||
this.properties = properties; | ||
} | ||
|
||
@Override | ||
public Object toJaxb() | ||
{ | ||
Prop prop = new Prop(); | ||
List<Element> any = prop.getAny(); | ||
for (QName entry : properties) | ||
{ | ||
any.add(SardineUtil.createElement(entry)); | ||
} | ||
|
||
VersionTree versionTree = new VersionTree(); | ||
versionTree.setProp(prop); | ||
return versionTree; | ||
} | ||
|
||
@Override | ||
public List<DavResource> fromMultistatus(Multistatus multistatus) | ||
{ | ||
List<Response> responses = multistatus.getResponse(); | ||
List<DavResource> resources = new ArrayList<DavResource>(responses.size()); | ||
for (Response response : responses) { | ||
try | ||
{ | ||
resources.add(new DavResource(response)); | ||
} | ||
catch (URISyntaxException e) | ||
{ | ||
log.warning(String.format("Ignore resource with invalid URI %s", response.getHref().get(0))); | ||
} | ||
} | ||
return resources; | ||
} | ||
} |
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