Permalink
Browse files

added callback with an exception for each method of every interface. …

…Started work on redis backend for DAVACL
  • Loading branch information...
mikedeboer committed Feb 3, 2013
1 parent b3f50f4 commit 674e554141179f3257a5af9fe577eff5d6acbda9
@@ -8,6 +8,7 @@
"use strict";
var Base = require("./../../shared/base");
+var Exc = require("./../../shared/exceptions");
/**
* CardDAV Backend Interface
@@ -36,7 +37,7 @@ var jsCardDAV_iBackend = module.exports = Base.extend({
* @param string principalUri
* @return array
*/
- getAddressBooksForUser: function(principalUri, callback) {},
+ getAddressBooksForUser: function(principalUri, callback) { callback(Exc.notImplementedYet()); },
/**
* Updates an addressbook's properties
@@ -49,7 +50,7 @@ var jsCardDAV_iBackend = module.exports = Base.extend({
* @see Sabre\DAV\IProperties::updateProperties
* @return bool|array
*/
- updateAddressBook: function(addressBookId, mutations, callback) {},
+ updateAddressBook: function(addressBookId, mutations, callback) { callback(Exc.notImplementedYet()); },
/**
* Creates a new address book
@@ -59,15 +60,15 @@ var jsCardDAV_iBackend = module.exports = Base.extend({
* @param array properties
* @return void
*/
- createAddressBook: function(principalUri, url, properties, callback) {},
+ createAddressBook: function(principalUri, url, properties, callback) { callback(Exc.notImplementedYet()); },
/**
* Deletes an entire addressbook and all its contents
*
* @param mixed addressBookId
* @return void
*/
- deleteAddressBook: function(addressBookId, callback) {},
+ deleteAddressBook: function(addressBookId, callback) { callback(Exc.notImplementedYet()); },
/**
* Returns all cards for a specific addressbook id.
@@ -88,7 +89,7 @@ var jsCardDAV_iBackend = module.exports = Base.extend({
* @param mixed addressbookId
* @return array
*/
- getCards: function(addressbookId, callback) {},
+ getCards: function(addressbookId, callback) { callback(Exc.notImplementedYet()); },
/**
* Returns a specfic card.
@@ -100,7 +101,7 @@ var jsCardDAV_iBackend = module.exports = Base.extend({
* @param string cardUri
* @return array
*/
- getCard: function(addressBookId, cardUri, callback) {},
+ getCard: function(addressBookId, cardUri, callback) { callback(Exc.notImplementedYet()); },
/**
* Creates a new card.
@@ -127,7 +128,7 @@ var jsCardDAV_iBackend = module.exports = Base.extend({
* @param string cardData
* @return string|null
*/
- createCard: function(addressBookId, cardUri, cardData, callback) {},
+ createCard: function(addressBookId, cardUri, cardData, callback) { callback(Exc.notImplementedYet()); },
/**
* Updates a card.
@@ -154,7 +155,7 @@ var jsCardDAV_iBackend = module.exports = Base.extend({
* @param string cardData
* @return string|null
*/
- updateCard: function(addressBookId, cardUri, cardData, callback) {},
+ updateCard: function(addressBookId, cardUri, cardData, callback) { callback(Exc.notImplementedYet()); },
/**
* Deletes a card
@@ -163,5 +164,5 @@ var jsCardDAV_iBackend = module.exports = Base.extend({
* @param string cardUri
* @return bool
*/
- deleteCard: function(addressBookId, cardUri, callback) {}
+ deleteCard: function(addressBookId, cardUri, callback) { callback(Exc.notImplementedYet()); }
});
@@ -8,6 +8,7 @@
"use strict";
var Base = require("./../../shared/base");
+var Exc = require("./../../shared/exceptions");
/**
* The iCollection Interface
@@ -24,28 +25,28 @@ var jsDAV_iCollection = module.exports = Base.extend({
* @param resource data Initial payload
* @return void
*/
- createFile: function() {},
+ createFile: function(name, vcardData, callback) { callback(Exc.notImplementedYet()); },
/**
* Creates a new subdirectory
*
* @param string name
* @return void
*/
- createDirectory: function() {},
+ createDirectory: function(name, callback) { callback(Exc.notImplementedYet()); },
/**
* Returns a specific child node, referenced by its name
*
* @param string name
* @return jsDAV_INode
*/
- getChild: function() {},
+ getChild: function(name, callback) { callback(Exc.notImplementedYet()); },
/**
* Returns an array with all the child nodes
*
* @return jsDAV_INode[]
*/
- getChildren: function() {}
+ getChildren: function(callback) { callback(Exc.notImplementedYet()); }
});
@@ -8,6 +8,7 @@
"use strict";
var Base = require("./../../shared/base");
+var Exc = require("./../../shared/exceptions");
/**
* The iExtendedCollection interface.
@@ -24,5 +25,5 @@ var jsDAV_iExtendedCollection = module.exports = Base.extend({
* @param array properties
* @return void
*/
- createExtendedCollection: function() {}
+ createExtendedCollection: function(name, resourceType, properties, callback) { callback(Exc.notImplementedYet()); }
});
@@ -8,6 +8,7 @@
"use strict";
var Base = require("./../../shared/base");
+var Exc = require("./../../shared/exceptions");
/**
* This interface represents a file or leaf in the tree.
@@ -20,10 +21,10 @@ var jsDAV_iFile = module.exports = Base.extend({
*
* The data argument is a readable stream resource.
*
- * @param resource $data
+ * @param resource data
* @return void
*/
- put: function() {},
+ put: function(data, callback) { callback(Exc.notImplementedYet()); },
/**
* Returns the data
@@ -32,7 +33,7 @@ var jsDAV_iFile = module.exports = Base.extend({
*
* @return mixed
*/
- get: function() {},
+ get: function(callback) { callback(Exc.notImplementedYet()); },
/**
* Returns the mime-type for a file
@@ -41,7 +42,7 @@ var jsDAV_iFile = module.exports = Base.extend({
*
* @return void
*/
- getContentType: function() {},
+ getContentType: function(callback) { callback(Exc.notImplementedYet()); },
/**
* Returns the ETag for a file
@@ -52,12 +53,12 @@ var jsDAV_iFile = module.exports = Base.extend({
*
* @return void
*/
- getETag: function() {},
+ getETag: function(callback) { callback(Exc.notImplementedYet()); },
/**
* Returns the size of the node, in bytes
*
* @return int
*/
- getSize: function() {}
+ getSize: function(callback) { callback(Exc.notImplementedYet()); }
});
@@ -9,11 +9,13 @@
var jsDAV_Property = require("./../property");
+var Exc = require("./../../shared/exceptions");
+
var jsDAV_Property_iHref = module.exports = jsDAV_Property.extend({
/**
* getHref
*
* @return {string}
*/
- getHref: function() {}
+ getHref: function() { throw Exc.notImplementedYet(); }
});
@@ -9,6 +9,8 @@
var jsDAV_iNode = require("./iNode");
+var Exc = require("./../../shared/exceptions");
+
/**
* Implement this class to support locking
*/
@@ -18,21 +20,21 @@ var jsDAV_iLockable = module.exports = jsDAV_iNode.extend({
*
* @return jsDAV_Locks_LockInfo[]
*/
- getLocks: function() {},
+ getLocks: function(callback) { callback(Exc.notImplementedYet()); },
/**
* Creates a new lock on the file.
*
* @param {jsDAV_Locks_LockInfo} lockInfo The lock information
* @return void
*/
- lock: function() {},
+ lock: function(lockInfo, callback) { callback(Exc.notImplementedYet()); },
/**
* Unlocks a file
*
* @param {jsDAV_Locks_LockInfo} lockInfo The lock information
* @return void
*/
- unlock: function() {}
+ unlock: function(lockInfo, callback) { callback(Exc.notImplementedYet()); }
});
@@ -8,6 +8,7 @@
"use strict";
var Base = require("./../../shared/base");
+var Exc = require("./../../shared/exceptions");
/**
* The iNode interface is the base interface, and the parent class of both
@@ -19,34 +20,34 @@ var jsDAV_iNode = module.exports = Base.extend({
*
* @return void
*/
- "delete": function() {},
+ "delete": function(callback) { callback(Exc.notImplementedYet()); },
/**
* Returns the name of the node
*
* @return string
*/
- getName: function() {},
+ getName: function() { throw Exc.notImplementedYet(); },
/**
* Renames the node
*
- * @param string $name The new name
+ * @param string name The new name
* @return void
*/
- setName: function() {},
+ setName: function(name, callback) { callback(Exc.notImplementedYet()); },
/**
* Returns the last modification time, as a unix timestamp
*
* @return int
*/
- getLastModified: function() {},
+ getLastModified: function(callback) { callback(Exc.notImplementedYet()); },
/**
* Returns whether a node exists or not
*
* @return {Boolean}
*/
- exists: function() {}
+ exists: function(callback) { callback(Exc.notImplementedYet()); }
});
@@ -9,6 +9,8 @@
var jsDAV_iNode = require("./iNode");
+var Exc = require("./../../shared/exceptions");
+
/**
* iProperties interface
*
@@ -34,14 +36,14 @@ var jsDAV_iProperties = module.exports = jsDAV_iNode.extend({
* failures. In this case an array should be returned with the following
* structure:
*
- * array(
- * 403 => array(
- * '{DAV:}displayname' => null,
- * ),
- * 424 => array(
- * '{DAV:}owner' => null,
- * )
- * )
+ * {
+ * "403": {
+ * "{DAV:}displayname": null
+ * },
+ * "424": {
+ * "{DAV:}owner": null
+ * }
+ * }
*
* In this example it was forbidden to update {DAV:}displayname.
* (403 Forbidden), which in turn also caused {DAV:}owner to fail
@@ -50,9 +52,7 @@ var jsDAV_iProperties = module.exports = jsDAV_iNode.extend({
* @param {Object} properties
* @return bool|array
*/
- updateProperties: function(properties, cbupdateprops) {
- cbupdateprops();
- },
+ updateProperties: function(properties, callback) { callback(Exc.notImplementedYet()); },
/**
* Returns a list of properties for this nodes.
@@ -65,7 +65,5 @@ var jsDAV_iProperties = module.exports = jsDAV_iNode.extend({
* @param {Object} properties
* @return void
*/
- getProperties: function(properties, cbgetprops) {
- cbgetprops();
- }
+ getProperties: function(properties, callback) { callback(Exc.notImplementedYet()); }
});
@@ -8,6 +8,7 @@
"use strict";
var Base = require("./../../shared/base");
+var Exc = require("./../../shared/exceptions");
/**
* iQuota interface
@@ -23,5 +24,5 @@ var jsDAV_iQuota = module.exports = Base.extend({
* This method MUST return an array with 2 values, the first being the total used space,
* the second the available space (in bytes)
*/
- getQuotaInfo: function(cbquotainf) {}
+ getQuotaInfo: function(callback) { callback(Exc.notImplementedYet()); }
});
Oops, something went wrong.

0 comments on commit 674e554

Please sign in to comment.