public Property getProperty(String s) throws PathNotFoundException, RepositoryException {
VFSValueFactoryImpl valueFactory = (VFSValueFactoryImpl) session.getValueFactory();
if (s.equals(Constants.JCR_DATA)) {
Value value = null;
value = valueFactory.createValue(new VFSBinaryImpl(content));
return new VFSPropertyImpl(new Name(s, "", ""), this, session, value) {
public long getLength() throws ValueFormatException, RepositoryException {
try {
return content.getSize();
} catch (FileSystemException e) {
return -1L;
}
}
public InputStream getStream() throws ValueFormatException, RepositoryException {
try {
return content.getInputStream();
} catch (FileSystemException e) {
return null;
}
}
public String getName() throws RepositoryException {
return Constants.JCR_DATA;
}
public PropertyDefinition getDefinition() throws RepositoryException {
return NodeTypeRegistry.getInstance().getNodeType(Constants.NT_RESOURCE).getPropertyDefinition(Constants.JCR_DATA);
}
};
} else if (s.equals(Constants.JCR_MIMETYPE)) {
String s1 = null;
try {
s1 = content.getContentInfo().getContentType();
} catch (FileSystemException e) {
throw new RepositoryException("Error while retrieving file's content type", e);
}
if (s1 == null) {
s1 = MimetypesFileTypeMap.getDefaultFileTypeMap().getContentType("."+content.getFile().getName().getExtension());
}
Value value = valueFactory.createValue(s1);
return new VFSPropertyImpl(new Name(s, "", ""), this, session, value) {
public String getString() throws ValueFormatException, RepositoryException {
try {
String s1 = content.getContentInfo().getContentType();
if (s1 == null) {
return MimetypesFileTypeMap.getDefaultFileTypeMap().getContentType("."+content.getFile().getName().getExtension());