Skip to content

Commit

Permalink
Splitted the 'WebDAVServer' class file into smaller files
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienCastex committed Jun 4, 2017
1 parent 8f8af70 commit 1f1d13c
Show file tree
Hide file tree
Showing 31 changed files with 1,658 additions and 451 deletions.
2 changes: 1 addition & 1 deletion lib/server/MethodCallArgs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { BasicPrivilege } from '../user/privilege/IPrivilegeManager';
import { IResource, ReturnCallback } from '../resource/IResource';
import { XMLElement } from '../helper/XML';
import { WebDAVServer } from '../server/WebDAVServer';
import { WebDAVServer } from './webDAVServer/WebDAVServer';
import { FSPath } from '../manager/FSManager';
import { IUser } from '../user/IUser';
import * as http from 'http';
Expand Down
2 changes: 1 addition & 1 deletion lib/server/export.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ export * from './WebDAVServerOptions';
export * from './HTTPCodes';
export * from './MethodCallArgs';
export * from './WebDAVRequest';
export * from './WebDAVServer';
export * from './webDAVServer/WebDAVServer';
2 changes: 1 addition & 1 deletion lib/server/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ __export(require("./WebDAVServerOptions"));
__export(require("./HTTPCodes"));
__export(require("./MethodCallArgs"));
__export(require("./WebDAVRequest"));
__export(require("./WebDAVServer"));
__export(require("./webDAVServer/WebDAVServer"));
6 changes: 6 additions & 0 deletions lib/server/webDAVServer/BeforeAfter.1.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { MethodCallArgs, WebDAVRequest } from '../WebDAVRequest';
export declare function beforeRequest(manager: WebDAVRequest): void;
export declare function afterRequest(manager: WebDAVRequest): void;
export declare function invokeBARequest(collection: WebDAVRequest[], base: MethodCallArgs, callback: any): void;
export declare function invokeBeforeRequest(base: MethodCallArgs, callback: any): void;
export declare function invokeAfterRequest(base: MethodCallArgs, callback: any): void;
40 changes: 40 additions & 0 deletions lib/server/webDAVServer/BeforeAfter.1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function beforeRequest(manager) {
this.beforeManagers.push(manager);
}
exports.beforeRequest = beforeRequest;
function afterRequest(manager) {
this.afterManagers.push(manager);
}
exports.afterRequest = afterRequest;
function invokeBARequest(collection, base, callback) {
function callCallback() {
if (callback)
process.nextTick(callback);
}
if (collection.length === 0) {
callCallback();
return;
}
base.callback = next;
var nb = collection.length + 1;
function next() {
--nb;
if (nb === 0) {
callCallback();
}
else
process.nextTick(function () { return collection[collection.length - nb](base, next); });
}
next();
}
exports.invokeBARequest = invokeBARequest;
function invokeBeforeRequest(base, callback) {
this.invokeBARequest(this.beforeManagers, base, callback);
}
exports.invokeBeforeRequest = invokeBeforeRequest;
function invokeAfterRequest(base, callback) {
this.invokeBARequest(this.afterManagers, base, callback);
}
exports.invokeAfterRequest = invokeAfterRequest;
6 changes: 6 additions & 0 deletions lib/server/webDAVServer/BeforeAfter.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { MethodCallArgs, WebDAVRequest } from '../WebDAVRequest';
export declare function beforeRequest(manager: WebDAVRequest): void;
export declare function afterRequest(manager: WebDAVRequest): void;
export declare function invokeBARequest(collection: WebDAVRequest[], base: MethodCallArgs, callback: any): void;
export declare function invokeBeforeRequest(base: MethodCallArgs, callback: any): void;
export declare function invokeAfterRequest(base: MethodCallArgs, callback: any): void;
40 changes: 40 additions & 0 deletions lib/server/webDAVServer/BeforeAfter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function beforeRequest(manager) {
this.beforeManagers.push(manager);
}
exports.beforeRequest = beforeRequest;
function afterRequest(manager) {
this.afterManagers.push(manager);
}
exports.afterRequest = afterRequest;
function invokeBARequest(collection, base, callback) {
function callCallback() {
if (callback)
process.nextTick(callback);
}
if (collection.length === 0) {
callCallback();
return;
}
base.callback = next;
var nb = collection.length + 1;
function next() {
--nb;
if (nb === 0) {
callCallback();
}
else
process.nextTick(function () { return collection[collection.length - nb](base, next); });
}
next();
}
exports.invokeBARequest = invokeBARequest;
function invokeBeforeRequest(base, callback) {
this.invokeBARequest(this.beforeManagers, base, callback);
}
exports.invokeBeforeRequest = invokeBeforeRequest;
function invokeAfterRequest(base, callback) {
this.invokeBARequest(this.afterManagers, base, callback);
}
exports.invokeAfterRequest = invokeAfterRequest;
50 changes: 50 additions & 0 deletions lib/server/webDAVServer/Persistence.1.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/// <reference types="node" />
import { MethodCallArgs, WebDAVRequest } from './WebDAVRequest';
import { WebDAVServerOptions } from './WebDAVServerOptions';
import { SerializedObject } from '../manager/ISerializer';
import { IResource, ReturnCallback } from '../resource/IResource';
import { HTTPAuthentication } from '../user/authentication/HTTPAuthentication';
import { IPrivilegeManager } from '../user/privilege/IPrivilegeManager';
import { FSManager, FSPath } from '../manager/FSManager';
import { IUserManager } from '../user/IUserManager';
import * as http from 'http';
export { WebDAVServerOptions } from './WebDAVServerOptions';
export declare type WebDAVServerStartCallback = (server?: http.Server) => void;
export interface IResourceTreeNode {
r?: IResource;
resource?: IResource;
c?: ResourceTreeNode[];
children?: ResourceTreeNode[];
}
export declare type ResourceTreeNode = IResourceTreeNode | IResource | IResourceTreeNode[] | IResource[];
export declare class WebDAVServer {
httpAuthentication: HTTPAuthentication;
privilegeManager: IPrivilegeManager;
rootResource: IResource;
userManager: IUserManager;
options: WebDAVServerOptions;
methods: object;
protected beforeManagers: WebDAVRequest[];
protected afterManagers: WebDAVRequest[];
protected unknownMethod: WebDAVRequest;
protected server: http.Server;
constructor(options?: WebDAVServerOptions);
getResourceFromPath(path: FSPath | string[] | string, callback: ReturnCallback<IResource>): any;
getResourceFromPath(path: FSPath | string[] | string, rootResource: IResource, callback: ReturnCallback<IResource>): any;
addResourceTree(resoureceTree: ResourceTreeNode, callback: (e: Error) => void): any;
addResourceTree(rootResource: IResource, resoureceTree: ResourceTreeNode, callback: (e: Error) => void): any;
onUnknownMethod(unknownMethod: WebDAVRequest): void;
start(port: number): any;
start(callback: WebDAVServerStartCallback): any;
start(port: number, callback: WebDAVServerStartCallback): any;
stop(callback: () => void): void;
load(obj: SerializedObject, managers: FSManager[], callback: (error: Error) => void): void;
save(callback: (error: Error, obj: any) => void): void;
method(name: string, manager: WebDAVRequest): void;
beforeRequest(manager: WebDAVRequest): void;
afterRequest(manager: WebDAVRequest): void;
protected normalizeMethodName(method: string): string;
protected invokeBARequest(collection: WebDAVRequest[], base: MethodCallArgs, callback: any): void;
protected invokeBeforeRequest(base: MethodCallArgs, callback: any): void;
protected invokeAfterRequest(base: MethodCallArgs, callback: any): void;
}
Loading

0 comments on commit 1f1d13c

Please sign in to comment.