Skip to content

Commit 581719b

Browse files
committed
2.3.863
1 parent 0fe2e80 commit 581719b

File tree

57 files changed

+2413
-1894
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2413
-1894
lines changed

deltav/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.ithit.webdav.samples</groupId>
88
<artifactId>deltav</artifactId>
9-
<version>2.2.710</version>
9+
<version>2.3.863</version>
1010
<packaging>war</packaging>
1111

1212
<properties>
@@ -88,7 +88,7 @@
8888
<dependency>
8989
<groupId>com.ithit.webdav</groupId>
9090
<artifactId>webdav-server</artifactId>
91-
<version>2.2.710</version>
91+
<version>2.3.863</version>
9292
</dependency>
9393

9494
<dependency>
@@ -128,7 +128,7 @@
128128
<goal>copy-resources</goal>
129129
</goals>
130130
<configuration>
131-
<outputDirectory>${project.build.directory}/deltav-2.2.710/META-INF</outputDirectory>
131+
<outputDirectory>${project.build.directory}/deltav-2.3.863/META-INF</outputDirectory>
132132
<overwrite>true</overwrite>
133133
<resources>
134134
<resource>
@@ -207,7 +207,7 @@
207207
<server>filesystem</server>
208208
<port>11021</port>
209209
<path>/</path>
210-
<warSourceDirectory>target/deltav-2.2.710</warSourceDirectory>
210+
<warSourceDirectory>target/deltav-2.3.863</warSourceDirectory>
211211
</configuration>
212212
</plugin>
213213
<plugin>

deltav/src/main/java/com/ithit/webdav/samples/deltavservlet/CustomFolderGetHandler.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ public void processRequest(HttpServletRequest request, HttpServletResponse respo
3838
PrintStream stream = new PrintStream(response.getOutputStream(), true, charset);
3939
Path path = Paths.get(WebDavServlet.getRealPath(), pathToHTML);
4040
String context = WebDavServlet.getContext() + "/";
41+
String wsContext = context.replaceFirst("/", "");
42+
int ind = wsContext.lastIndexOf("/");
43+
if (ind >= 0) {
44+
wsContext = new StringBuilder(wsContext).replace(ind, ind + 1, "\\/").toString();
45+
}
4146
for (String line : Files.readAllLines(path, StandardCharsets.UTF_8)) {
4247
String contextRootString = "<%context root%>";
4348
if (line.contains(contextRootString)) {
@@ -51,6 +56,10 @@ public void processRequest(HttpServletRequest request, HttpServletResponse respo
5156
if (line.contains(versionNumber)) {
5257
line = line.replace(versionNumber, version);
5358
}
59+
String ws = "<%ws root%>";
60+
if (line.contains(ws)) {
61+
line = line.replace(ws, wsContext);
62+
}
5463
stream.println(line);
5564
}
5665
stream.flush();

deltav/src/main/java/com/ithit/webdav/samples/deltavservlet/DataAccess.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ public class DataAccess {
3535

3636
/**
3737
* Initialize {@link DataAccess} with {@link WebDavEngine}
38-
*.
38+
* .
39+
*
3940
* @param engine {@link WebDavEngine}.
4041
*/
4142
DataAccess(WebDavEngine engine) {
@@ -88,6 +89,7 @@ private Connection getConnection() throws ServerException {
8889

8990
/**
9091
* Returns default table space in which DB is stored.
92+
*
9193
* @return Returns default table space in which DB is stored.
9294
*/
9395
String getDefaultTableSpace() {
@@ -96,6 +98,7 @@ String getDefaultTableSpace() {
9698

9799
/**
98100
* Returns total bytes used by DB.
101+
*
99102
* @return Returns total bytes used by DB.
100103
*/
101104
long getTotalBytes() {
@@ -271,9 +274,9 @@ List<Property> readProperties(String sql, Object... args) throws ServerException
271274
/**
272275
* Read DB for {@link VersionImpl}.
273276
*
274-
* @param sql Query executed against Lock table.
277+
* @param sql Query executed against Lock table.
275278
* @param itemPath Path to the HierarchyItemImpl.
276-
* @param args Query arguments.
279+
* @param args Query arguments.
277280
* @return Property.
278281
* @throws ServerException in case of DB exception.
279282
*/
@@ -482,7 +485,6 @@ FolderImpl getFolderImpl(HierarchyItem item) throws ServerException {
482485

483486
/**
484487
* Interface that helps to read object from DB.
485-
*
486488
*/
487489
interface ElementReader<T> {
488490
/**
@@ -501,7 +503,7 @@ interface ElementReader<T> {
501503
*
502504
* @return List of {@link HierarchyItemImpl} objects. Each item is a {@link FileImpl} item.
503505
*/
504-
List<HierarchyItemImpl> getFiles() {
506+
List<HierarchyItemImpl> getFiles() {
505507
try {
506508
return readItems("SELECT ID," +
507509
" Parent," +
@@ -525,11 +527,12 @@ List<HierarchyItemImpl> getFiles() {
525527

526528
/**
527529
* Gets {@link HierarchyItem} from DB by id and specified path.
528-
* @param id File id.
530+
*
531+
* @param id File id.
529532
* @param path Path of file.
530533
* @return HierarchyItem.
531534
*/
532-
HierarchyItem getFile(int id, String path) {
535+
HierarchyItem getFile(int id, String path) {
533536
HierarchyItem result = null;
534537
try {
535538
List<HierarchyItemImpl> hierarchyItems = readItems("SELECT ID," +

deltav/src/main/java/com/ithit/webdav/samples/deltavservlet/DownloadUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class DownloadUtil {
2525
* @param blob Blob to write to the stream.
2626
* @param startIndex Zero-bazed byte offset in file content at which to begin copying bytes to the output stream.
2727
* @param count Number of bytes to be written to the output stream.
28-
* @throws IOException In case of blob reading exception.
28+
* @throws IOException In case of blob reading exception.
2929
* @throws SQLException In case of an error.
3030
*/
3131
static void readBlob(Logger logger, OutputStream output, Blob blob, long startIndex, long count) throws SQLException, IOException {

deltav/src/main/java/com/ithit/webdav/samples/deltavservlet/FileImpl.java

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,20 @@ public class FileImpl extends HierarchyItemImpl implements
4545
/**
4646
* Initializes a new instance of the {@link FileImpl} class.
4747
*
48-
* @param id Id of the item in DB.
49-
* @param parentId Id of the parent item in DB.
50-
* @param name Name of hierarchy item.
51-
* @param path Relative to WebDAV root folder path.
52-
* @param created Creation time of the hierarchy item.
53-
* @param modified Modification time of the hierarchy item.
54-
* @param lastChunkSaved Last byte saved.
55-
* @param totalContentLength Length of the file.
56-
* @param versionControlled Whether file version controlled.
57-
* @param checkedOut Determines whether item is in checked-in or checked-out state.
58-
* @param checkInDuringUnlock Whether we need check in file during unlock.
48+
* @param id Id of the item in DB.
49+
* @param parentId Id of the parent item in DB.
50+
* @param name Name of hierarchy item.
51+
* @param path Relative to WebDAV root folder path.
52+
* @param created Creation time of the hierarchy item.
53+
* @param modified Modification time of the hierarchy item.
54+
* @param lastChunkSaved Last byte saved.
55+
* @param totalContentLength Length of the file.
56+
* @param versionControlled Whether file version controlled.
57+
* @param checkedOut Determines whether item is in checked-in or checked-out state.
58+
* @param checkInDuringUnlock Whether we need check in file during unlock.
5959
* @param checkInOnFileComplete Whether to checking on file complete.
60-
* @param autoVersion Auto versioning rule.
61-
* @param engine Instance of current {@link WebDavEngine}.
60+
* @param autoVersion Auto versioning rule.
61+
* @param engine Instance of current {@link WebDavEngine}.
6262
*/
6363
FileImpl(int id, int parentId, String name,
6464
String path, long created, long modified, long lastChunkSaved,
@@ -112,10 +112,10 @@ public void delete() throws LockedException, MultistatusException, ServerExcepti
112112
ensureHasToken();
113113

114114
deleteThisItem();
115-
getEngine().notifyRefresh(getParent(getPath()));
115+
getEngine().getWebSocketServer().notifyRefresh(getParent(getPath()));
116116
try {
117-
getEngine().getIndexer().deleteIndex(this);
118-
} catch (Exception ex){
117+
getEngine().getSearchFacade().getIndexer().deleteIndex(this);
118+
} catch (Exception ex) {
119119
getEngine().getLogger().logError("Errors during indexing.", ex);
120120
}
121121
}
@@ -215,13 +215,13 @@ public void copyTo(Folder folder, String destName, boolean deep)
215215
} else {
216216
copy = copyThisItem(destFolder, null, destName);
217217
}
218-
getEngine().notifyRefresh(folder.getPath());
218+
getEngine().getWebSocketServer().notifyRefresh(folder.getPath());
219219
try {
220220
if (copy != null) {
221221
newID = copy.getId();
222222
}
223-
getEngine().getIndexer().indexFile(destName, newID, null, this);
224-
} catch (Exception ex){
223+
getEngine().getSearchFacade().getIndexer().indexFile(destName, newID, null, this);
224+
} catch (Exception ex) {
225225
getEngine().getLogger().logError("Errors during indexing.", ex);
226226
}
227227
}
@@ -346,10 +346,10 @@ public long write(InputStream content, String contentType, long startIndex, long
346346
if (os != null)
347347
os.close();
348348
}
349-
getEngine().notifyRefresh(getParent(getPath()));
349+
getEngine().getWebSocketServer().notifyRefresh(getParent(getPath()));
350350
try {
351-
getEngine().getIndexer().indexFile(getName(), getId(), getId(), this);
352-
} catch (Exception ex){
351+
getEngine().getSearchFacade().getIndexer().indexFile(getName(), getId(), getId(), this);
352+
} catch (Exception ex) {
353353
getEngine().getLogger().logError("Errors during indexing.", ex);
354354
}
355355
return totalSaved;
@@ -384,11 +384,11 @@ public void moveTo(Folder folder, String destName)
384384
} else {
385385
moveThisItem(destFolder, destName, parent);
386386
}
387-
getEngine().notifyRefresh(getParent(getPath()));
388-
getEngine().notifyRefresh(folder.getPath());
387+
getEngine().getWebSocketServer().notifyRefresh(getParent(getPath()));
388+
getEngine().getWebSocketServer().notifyRefresh(folder.getPath());
389389
try {
390-
getEngine().getIndexer().indexFile(destName, getId(), getId(), this);
391-
} catch (Exception ex){
390+
getEngine().getSearchFacade().getIndexer().indexFile(destName, getId(), getId(), this);
391+
} catch (Exception ex) {
392392
getEngine().getLogger().logError("Errors during indexing.", ex);
393393
}
394394
}
@@ -525,6 +525,7 @@ public String checkIn() throws ServerException, LockedException {
525525

526526
/**
527527
* Creates new version of the file in the DB.
528+
*
528529
* @param newVersionNumber New version number.
529530
* @return Path to the new version.
530531
* @throws ServerException in case of DB errors.
@@ -561,6 +562,7 @@ private String createNewVersion(int newVersionNumber) throws ServerException {
561562

562563
/**
563564
* Updates CheckedOut filed in the Repository table to the specified value.
565+
*
564566
* @param value Value to set.
565567
* @throws ServerException in case of DB errors.
566568
*/
@@ -660,6 +662,7 @@ public AutoVersion getAutoVersion() throws ServerException {
660662

661663
/**
662664
* Sets auth versioning mode for this item.
665+
*
663666
* @param value Auto versioning mode.
664667
* @throws ServerException in case of an error.
665668
*/
@@ -773,6 +776,7 @@ public void setCreatorDisplayName(String name) throws ServerException {
773776

774777
/**
775778
* Loads file content input stream for indexing.
779+
*
776780
* @param id File id
777781
* @return InputStream for indexing.
778782
*/

deltav/src/main/java/com/ithit/webdav/samples/deltavservlet/FolderImpl.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ private HierarchyItemImpl createChild(String name, byte itemType) throws ServerE
144144
item = new FileImpl(newId, getId(), name, getPath() + name,
145145
now, now, now, 0, false, false, false, false, getEngine().getAutoVersionMode(), getEngine());
146146
}
147-
getEngine().notifyRefresh(getPath());
147+
getEngine().getWebSocketServer().notifyRefresh(getPath());
148148
return item;
149149

150150
}
@@ -229,15 +229,15 @@ public void moveTo(Folder folder, String destName)
229229
if (mr.getResponses().length > 0)
230230
throw mr;
231231
try {
232-
getEngine().getIndexer().deleteIndex(this);
233-
getEngine().getIndexer().indexFile(newDestFolder.getName(), newDestFolder.getId(), null, this);
234-
} catch (Exception ex){
232+
getEngine().getSearchFacade().getIndexer().deleteIndex(this);
233+
getEngine().getSearchFacade().getIndexer().indexFile(newDestFolder.getName(), newDestFolder.getId(), null, this);
234+
} catch (Exception ex) {
235235
getEngine().getLogger().logError("Errors during indexing.", ex);
236236
}
237237
// delete this folder
238238
deleteThisItem();
239-
getEngine().notifyDelete(getPath());
240-
getEngine().notifyRefresh(folder.getPath());
239+
getEngine().getWebSocketServer().notifyDelete(getPath());
240+
getEngine().getWebSocketServer().notifyRefresh(folder.getPath());
241241
}
242242

243243
@Override
@@ -266,8 +266,8 @@ public void copyTo(Folder folder, String destName, boolean deep)
266266
}
267267

268268
try {
269-
getEngine().getIndexer().indexFile(newDestFolder.getName(), newDestFolder.getId(), null, this);
270-
} catch (Exception ex){
269+
getEngine().getSearchFacade().getIndexer().indexFile(newDestFolder.getName(), newDestFolder.getId(), null, this);
270+
} catch (Exception ex) {
271271
getEngine().getLogger().logError("Errors during indexing.", ex);
272272
}
273273

@@ -285,7 +285,7 @@ public void copyTo(Folder folder, String destName, boolean deep)
285285
}
286286
}
287287

288-
getEngine().notifyRefresh(folder.getPath());
288+
getEngine().getWebSocketServer().notifyRefresh(folder.getPath());
289289
if (mr.getResponses().length > 0)
290290
throw mr;
291291

@@ -321,13 +321,13 @@ public void delete() throws ServerException, LockedException, MultistatusExcepti
321321
throw mx;
322322
else {
323323
try {
324-
getEngine().getIndexer().deleteIndex(this);
325-
} catch (Exception ex){
324+
getEngine().getSearchFacade().getIndexer().deleteIndex(this);
325+
} catch (Exception ex) {
326326
getEngine().getLogger().logError("Errors during indexing.", ex);
327327
}
328328
deleteThisItem();
329329
}
330-
getEngine().notifyDelete(getPath());
330+
getEngine().getWebSocketServer().notifyDelete(getPath());
331331
}
332332

333333
/**
@@ -389,18 +389,18 @@ protected HierarchyItemImpl createItemCopy(int id, int parentId, String name, St
389389
*
390390
* @param searchString A phrase to search.
391391
* @param options Search parameters.
392-
* @param propNames List of properties to retrieve with the children. They will be queried by the engine later.
392+
* @param propNames List of properties to retrieve with the children. They will be queried by the engine later.
393393
* @return ist of {@link HierarchyItem} satisfying the search parameters or empty list.
394394
*/
395395
@Override
396396
public List<HierarchyItem> search(String searchString, SearchOptions options, List<Property> propNames) {
397397
List<HierarchyItem> results = new LinkedList<>();
398-
Searcher searcher = getEngine().getSearcher();
398+
SearchFacade.Searcher searcher = getEngine().getSearchFacade().getSearcher();
399399
if (searcher == null) {
400400
return results;
401401
}
402402
boolean snippet = false;
403-
for (Property pr: propNames) {
403+
for (Property pr : propNames) {
404404
if (SNIPPET.equalsIgnoreCase(pr.getName())) {
405405
snippet = true;
406406
break;
@@ -416,9 +416,9 @@ public List<HierarchyItem> search(String searchString, SearchOptions options, Li
416416
" START WITH id = ? " +
417417
" CONNECT BY id = PRIOR parent and parent!= prior id)", entry.getKey());
418418
String[] pathParts = path.split("/");
419-
pathParts = Arrays.copyOf(pathParts, pathParts.length-1);
419+
pathParts = Arrays.copyOf(pathParts, pathParts.length - 1);
420420
StringBuilder pathBuilder = new StringBuilder();
421-
for (int i = pathParts.length - 1 ; i>=0 ; i--) {
421+
for (int i = pathParts.length - 1; i >= 0; i--) {
422422
if (Objects.equals(pathParts[i], "")) {
423423
continue;
424424
}

0 commit comments

Comments
 (0)