diff options
author | Derrell Lipman <derrell@samba.org> | 2006-10-15 21:09:42 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:21:03 -0500 |
commit | 3df891a5af0137b0215235cad6f06446df160782 (patch) | |
tree | 1d2508b07217b77f166184ff222c35cde247df23 /services/resources.esp | |
parent | 3433468e12e6ecbe849a377a65bd2baaf5415b72 (diff) | |
download | samba-3df891a5af0137b0215235cad6f06446df160782.tar.gz samba-3df891a5af0137b0215235cad6f06446df160782.tar.bz2 samba-3df891a5af0137b0215235cad6f06446df160782.zip |
r19295: ldbbrowse: the search tab is now doing something vaguely reasonable.
(This used to be commit 039069b3fd10e2ea614c385c6b432b235e1c226b)
Diffstat (limited to 'services/resources.esp')
-rw-r--r-- | services/resources.esp | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/services/resources.esp b/services/resources.esp index d4a77f7907..d491ed5701 100644 --- a/services/resources.esp +++ b/services/resources.esp @@ -28,15 +28,6 @@ function _resourcesCreate() /* We'll maintain our own count of the number of open resources */ o.resourceList.count = 0; - /* - * Resource types - */ - o.Type = new Object(); - o.Type.ldb = 1; /* database handle */ - o.Type.tid = 2; /* tree id */ - o.Type.fid = 3; /* file id */ - /* etc., etc., etc. */ - /* * Set a new saved resource. @@ -48,7 +39,7 @@ function _resourcesCreate() { /* Yup. */ error.setOrigin(jsonrpc.Constant.ErrorOrigin.Server); - error.setError(JsonRpcError_ResourceError, + error.setError(jsonrpc.Constant.ErrorCode.ResourceError, "Session limit on resources (" + RESOURCE_LIMIT + ") exceeded."); @@ -81,7 +72,7 @@ function _resourcesCreate() /* * Get a previously-saved resource */ - function _get(resourceId, type, error) + function _get(resourceId, error) { /* Does the specified resource id exist? */ if (! this.resourceList[resourceId]) @@ -96,22 +87,40 @@ function _resourcesCreate() /* Retrieve the resource */ var r = this.resourceList[resourceId]; - /* Is the specified resource the correct type? */ - if (r.type != type) - { - /* Nope. */ - error.setOrigin(jsonrpc.Constant.ErrorOrigin.Server); - error.setError(jsonrpc.Constant.ErrorCode.ResourceError, - "Incorrect type for specified resource id."); - return error; - } - /* Give 'em what they came for! */ return r.resource; } o.get = _get; /* + * Find a previously-saved resource + */ + function _find(type, error) + { + /* Does the specified resource id exist? */ + for (var resourceId in this.resourceList) + { + /* Retrieve the resource */ + var r = this.resourceList[resourceId]; + + /* Ignore "id" and "count" integer fields */ + if (typeof(r) == "object") + { + /* Is the specified resource the correct type? */ + if (r.type == type) + { + /* Yup, this is the one they want. */ + return resourceId; + } + } + } + + /* It wasn't found. */ + return undefined; + } + o.find = _find; + + /* * Release a previously-saved resource, allowing it to be freed */ function _release(resourceId, error) |