<artifactId>com.springsource.org.apache.commons.io</artifactId>
</dependency>
<artifactId>com.springsource.org.apache.commons.io</artifactId>
</dependency>
- <dependency>
- <groupId>javax.activation</groupId>
- <artifactId>com.springsource.javax.activation</artifactId>
- </dependency>
-
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.xml</artifactId>
</dependency>
<artifactId>org.springframework.xml</artifactId>
</dependency>
- <dependency>
- <groupId>javax.activation</groupId>
- <artifactId>com.springsource.javax.activation</artifactId>
- </dependency>
-
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
import java.util.Calendar;
import java.util.List;
import java.util.Calendar;
import java.util.List;
-import javax.activation.MimetypesFileTypeMap;
import javax.jcr.Node;
import javax.jcr.Property;
import javax.jcr.RepositoryException;
import javax.jcr.Node;
import javax.jcr.Property;
import javax.jcr.RepositoryException;
import javax.jcr.version.VersionHistory;
import javax.jcr.version.VersionIterator;
import javax.jcr.version.VersionHistory;
import javax.jcr.version.VersionIterator;
-import org.apache.commons.io.FilenameUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.argeo.ArgeoException;
import org.springframework.core.io.Resource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.argeo.ArgeoException;
import org.springframework.core.io.Resource;
+/**
+ * Bridge Spring resources and JCR folder / files semantics (nt:folder / nt:file),
+ * supporting versioning as well.
+ */
public class JcrResourceAdapter {
private final static Log log = LogFactory.getLog(JcrResourceAdapter.class);
public class JcrResourceAdapter {
private final static Log log = LogFactory.getLog(JcrResourceAdapter.class);
try {
if (!session().itemExists(path)) {
try {
if (!session().itemExists(path)) {
- String type = new MimetypesFileTypeMap()
- .getContentType(FilenameUtils.getName(path));
+ String type = null;
+ // FIXME: using javax.activation leads to conflict between Java
+ // 1.5 and 1.6 (since javax.activation was included in Java 1.6)
+ // String type = new MimetypesFileTypeMap()
+ // .getContentType(FilenameUtils.getName(path));
create(path, in, type);
return;
}
create(path, in, type);
return;
}
protected InputStream fromVersion(Version version)
throws RepositoryException {
Node frozenNode = version.getNode("jcr:frozenNode");
protected InputStream fromVersion(Version version)
throws RepositoryException {
Node frozenNode = version.getNode("jcr:frozenNode");
- InputStream in = frozenNode.getNode("jcr:content").getProperty(
- "jcr:data").getStream();
+ InputStream in = frozenNode.getNode("jcr:content")
+ .getProperty("jcr:data").getStream();