import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.argeo.ArgeoException;
/**
* Bridge Spring resources and JCR folder / files semantics (nt:folder /
public void create(String path, InputStream in, String mimeType) {
try {
if (session().itemExists(path)) {
- throw new ArgeoException("Node " + path + " already exists.");
+ throw new ArgeoJcrException("Node " + path + " already exists.");
}
int index = path.lastIndexOf('/');
parentPath = "/";
String fileName = path.substring(index + 1);
if (!session().itemExists(parentPath))
- throw new ArgeoException("Parent folder of node " + path
+ throw new ArgeoJcrException("Parent folder of node " + path
+ " does not exist: " + parentPath);
Node folderNode = (Node) session().getItem(parentPath);
if (log.isDebugEnabled())
log.debug("Created " + path);
} catch (Exception e) {
- throw new ArgeoException("Cannot create node for " + path, e);
+ throw new ArgeoJcrException("Cannot create node for " + path, e);
}
}
if (log.isDebugEnabled())
log.debug("Updated " + path);
} catch (Exception e) {
- throw new ArgeoException("Cannot update node " + path, e);
+ throw new ArgeoJcrException("Cannot update node " + path, e);
}
}
public List<Calendar> listVersions(String path) {
if (!versioning)
- throw new ArgeoException("Versioning is not activated");
+ throw new ArgeoJcrException("Versioning is not activated");
try {
List<Calendar> versions = new ArrayList<Calendar>();
}
return versions;
} catch (Exception e) {
- throw new ArgeoException("Cannot list version of node " + path, e);
+ throw new ArgeoJcrException("Cannot list version of node " + path, e);
}
}
Property property = node.getProperty(Property.JCR_DATA);
return property.getBinary().getStream();
} catch (Exception e) {
- throw new ArgeoException("Cannot retrieve " + path, e);
+ throw new ArgeoJcrException("Cannot retrieve " + path, e);
}
}
public synchronized InputStream retrieve(String path, Integer revision) {
if (!versioning)
- throw new ArgeoException("Versioning is not activated");
+ throw new ArgeoJcrException("Versioning is not activated");
try {
Node fileNode = (Node) session().getItem(path);
count++;
}
} catch (Exception e) {
- throw new ArgeoException("Cannot retrieve version " + revision
+ throw new ArgeoJcrException("Cannot retrieve version " + revision
+ " of " + path, e);
}
- throw new ArgeoException("Version " + revision
+ throw new ArgeoJcrException("Version " + revision
+ " does not exist for node " + path);
}