]> git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.server.jcr/src/org/argeo/jcr/fs/JcrPath.java
Working Argeo 2 deployment (with UI)
[lgpl/argeo-commons.git] / org.argeo.server.jcr / src / org / argeo / jcr / fs / JcrPath.java
1 package org.argeo.jcr.fs;
2
3 import java.io.File;
4 import java.io.IOException;
5 import java.net.URI;
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;
14
15 import javax.jcr.Node;
16 import javax.jcr.RepositoryException;
17
18 public class JcrPath implements Path {
19 private JcrFileSystem filesSystem;
20 private String path;
21
22 private Node node;
23
24 public JcrPath(JcrFileSystem filesSystem, Node node) {
25 super();
26 this.filesSystem = filesSystem;
27 this.node = node;
28 }
29
30 @Override
31 public FileSystem getFileSystem() {
32 return filesSystem;
33 }
34
35 @Override
36 public boolean isAbsolute() {
37 return path.startsWith("/");
38 }
39
40 @Override
41 public Path getRoot() {
42 try {
43 return new JcrPath(filesSystem, node.getSession().getRootNode());
44 } catch (RepositoryException e) {
45 throw new JcrFsException("Cannot get root", e);
46 }
47 }
48
49 @Override
50 public Path getFileName() {
51 return null;
52 }
53
54 @Override
55 public Path getParent() {
56 // TODO Auto-generated method stub
57 return null;
58 }
59
60 @Override
61 public int getNameCount() {
62 // TODO Auto-generated method stub
63 return 0;
64 }
65
66 @Override
67 public Path getName(int index) {
68 // TODO Auto-generated method stub
69 return null;
70 }
71
72 @Override
73 public Path subpath(int beginIndex, int endIndex) {
74 // TODO Auto-generated method stub
75 return null;
76 }
77
78 @Override
79 public boolean startsWith(Path other) {
80 // TODO Auto-generated method stub
81 return false;
82 }
83
84 @Override
85 public boolean startsWith(String other) {
86 // TODO Auto-generated method stub
87 return false;
88 }
89
90 @Override
91 public boolean endsWith(Path other) {
92 // TODO Auto-generated method stub
93 return false;
94 }
95
96 @Override
97 public boolean endsWith(String other) {
98 // TODO Auto-generated method stub
99 return false;
100 }
101
102 @Override
103 public Path normalize() {
104 // TODO Auto-generated method stub
105 return null;
106 }
107
108 @Override
109 public Path resolve(Path other) {
110 // TODO Auto-generated method stub
111 return null;
112 }
113
114 @Override
115 public Path resolve(String other) {
116 // TODO Auto-generated method stub
117 return null;
118 }
119
120 @Override
121 public Path resolveSibling(Path other) {
122 // TODO Auto-generated method stub
123 return null;
124 }
125
126 @Override
127 public Path resolveSibling(String other) {
128 // TODO Auto-generated method stub
129 return null;
130 }
131
132 @Override
133 public Path relativize(Path other) {
134 // TODO Auto-generated method stub
135 return null;
136 }
137
138 @Override
139 public URI toUri() {
140 // TODO Auto-generated method stub
141 return null;
142 }
143
144 @Override
145 public Path toAbsolutePath() {
146 // TODO Auto-generated method stub
147 return null;
148 }
149
150 @Override
151 public Path toRealPath(LinkOption... options) throws IOException {
152 // TODO Auto-generated method stub
153 return null;
154 }
155
156 @Override
157 public File toFile() {
158 throw new UnsupportedOperationException();
159 }
160
161 @Override
162 public WatchKey register(WatchService watcher, Kind<?>[] events,
163 Modifier... modifiers) throws IOException {
164 // TODO Auto-generated method stub
165 return null;
166 }
167
168 @Override
169 public WatchKey register(WatchService watcher, Kind<?>... events)
170 throws IOException {
171 // TODO Auto-generated method stub
172 return null;
173 }
174
175 @Override
176 public Iterator<Path> iterator() {
177 // TODO Auto-generated method stub
178 return null;
179 }
180
181 @Override
182 public int compareTo(Path other) {
183 // TODO Auto-generated method stub
184 return 0;
185 }
186
187 public Node getNode() {
188 if (!isAbsolute())// TODO default dir
189 throw new JcrFsException("Cannot get node from relative path");
190 try {
191 if (node == null)
192 node = filesSystem.getSession().getNode(path);
193 return node;
194 } catch (RepositoryException e) {
195 throw new JcrFsException("Cannot get node", e);
196 }
197 }
198
199 }