1 package org
.argeo
.jcr
.fs
;
4 import java
.io
.IOException
;
6 import java
.nio
.file
.FileSystem
;
7 import java
.nio
.file
.LinkOption
;
8 import java
.nio
.file
.Path
;
9 import java
.nio
.file
.WatchEvent
.Kind
;
10 import java
.nio
.file
.WatchEvent
.Modifier
;
11 import java
.nio
.file
.WatchKey
;
12 import java
.nio
.file
.WatchService
;
13 import java
.util
.Iterator
;
15 import javax
.jcr
.Node
;
16 import javax
.jcr
.RepositoryException
;
18 public class JcrPath
implements Path
{
19 private JcrFileSystem filesSystem
;
24 public JcrPath(JcrFileSystem filesSystem
, Node node
) {
26 this.filesSystem
= filesSystem
;
31 public FileSystem
getFileSystem() {
36 public boolean isAbsolute() {
37 return path
.startsWith("/");
41 public Path
getRoot() {
43 return new JcrPath(filesSystem
, node
.getSession().getRootNode());
44 } catch (RepositoryException e
) {
45 throw new JcrFsException("Cannot get root", e
);
50 public Path
getFileName() {
55 public Path
getParent() {
56 // TODO Auto-generated method stub
61 public int getNameCount() {
62 // TODO Auto-generated method stub
67 public Path
getName(int index
) {
68 // TODO Auto-generated method stub
73 public Path
subpath(int beginIndex
, int endIndex
) {
74 // TODO Auto-generated method stub
79 public boolean startsWith(Path other
) {
80 // TODO Auto-generated method stub
85 public boolean startsWith(String other
) {
86 // TODO Auto-generated method stub
91 public boolean endsWith(Path other
) {
92 // TODO Auto-generated method stub
97 public boolean endsWith(String other
) {
98 // TODO Auto-generated method stub
103 public Path
normalize() {
104 // TODO Auto-generated method stub
109 public Path
resolve(Path other
) {
110 // TODO Auto-generated method stub
115 public Path
resolve(String other
) {
116 // TODO Auto-generated method stub
121 public Path
resolveSibling(Path other
) {
122 // TODO Auto-generated method stub
127 public Path
resolveSibling(String other
) {
128 // TODO Auto-generated method stub
133 public Path
relativize(Path other
) {
134 // TODO Auto-generated method stub
140 // TODO Auto-generated method stub
145 public Path
toAbsolutePath() {
146 // TODO Auto-generated method stub
151 public Path
toRealPath(LinkOption
... options
) throws IOException
{
152 // TODO Auto-generated method stub
157 public File
toFile() {
158 throw new UnsupportedOperationException();
162 public WatchKey
register(WatchService watcher
, Kind
<?
>[] events
,
163 Modifier
... modifiers
) throws IOException
{
164 // TODO Auto-generated method stub
169 public WatchKey
register(WatchService watcher
, Kind
<?
>... events
)
171 // TODO Auto-generated method stub
176 public Iterator
<Path
> iterator() {
177 // TODO Auto-generated method stub
182 public int compareTo(Path other
) {
183 // TODO Auto-generated method stub
187 public Node
getNode() {
188 if (!isAbsolute())// TODO default dir
189 throw new JcrFsException("Cannot get node from relative path");
192 node
= filesSystem
.getSession().getNode(path
);
194 } catch (RepositoryException e
) {
195 throw new JcrFsException("Cannot get node", e
);