1 29 30 package com.caucho.jcr.file; 31 32 import com.caucho.jcr.base.BaseNode; 33 import com.caucho.jcr.base.BaseNodeType; 34 import com.caucho.vfs.Path; 35 36 import javax.jcr.PathNotFoundException; 37 import javax.jcr.Property; 38 import javax.jcr.RepositoryException; 39 import javax.jcr.Session; 40 import javax.jcr.nodetype.NodeType; 41 42 45 public class FileContentNode extends BaseNode { 46 private FileSession _session; 47 private Path _path; 48 49 FileContentNode(FileSession session, Path path) 50 { 51 _session = session; 52 _path = path; 53 } 54 55 58 public String getPath() 59 throws RepositoryException 60 { 61 return _path.getPath() + "/" + getName(); 62 } 63 64 67 public String getName() 68 throws RepositoryException 69 { 70 return "jcr:content"; 71 } 72 73 76 public NodeType getPrimaryNodeType() 77 { 78 return BaseNodeType.NT_RESOURCE; 79 } 80 81 84 public Property getProperty(String relPath) 85 throws PathNotFoundException, 86 RepositoryException 87 { 88 if (relPath.equals("jcr:data")) { 89 return new FileDataProperty(_path); 90 } 91 else 92 return super.getProperty(relPath); 93 } 94 95 98 public Session getSession() 99 throws RepositoryException 100 { 101 return _session; 102 } 103 104 public String toString() 105 { 106 return "FileContentNode[" + _path + "]"; 107 } 108 } 109 | Popular Tags |