>> Hmm.. maybe its more to do with what an implemention
>> supports e.g. some implemetations may not support
>> regexp match so its not a user preference.
>
>That's true, but it may also be relevant to have as a preference. EG
>for small LDAP directories, doing a soundex match may be reasonable,
>but for enormous ones, it might not.
>
Ok.
>> I was thinking that the query interface could be used to
>> get child cards in an asynchronous manner, we know
>> when all have been received because the query result
>> will tell us. This is a response to the fact the the
>> nsIAbDirectory.getChildCards could be implemented
>> asychronously notifying RDF indirectly making it
>> impossible to know when all the cards have been
>> recieved.
>
>Couldn't you just have the query code assert a "querycompleted"
>property into the RDF datasource when it's done? Then the absence or
>presence of that property would be enough to know.
>
Yes it could, good point.
>> Just had a thought; some context may be required
>> if multiple queries are performed using the same
>> listener object.
>
>Yes, this seems likely. In fact, after I came up with the design for
>the LDAP datasource in JavaScript, I realized that it probably can't
>be written in C++ using the LDAP XPCOM wrapper as it now stands. The
>datasource keeps track of multiple queries by using the fact the JS
>functions are lexically closed to bind the original query to the
>callback. At some point, we'll probably need to add "nsISupports
>aContext" args to various methods in the XPCOM wrapper so that it can
>support this model from C++.
>
Yep.
Attached is a revamped set of nsIAbDirectoryQuery*
interfaces. Decided the nsIProperties interface was
not suitable.
Considered using arrays but used nsISupportsArray
for corresponding attributes instead. My UML
knowledge is very limited, but i presume its
correct (I have used a really cool java based
UML editor called Argo,http://www.ArgoUML.org/,
plug plug)
We plan to use this interface and do a MAPI outlook
implementation (in addition to implemeting the card and
directory interfaces) such that an Open Office SDBC driver
can be written to perform queries on address directories
from SQL statements and create result sets from these.
Open Office currently lacks address support so cannot
perform mail merges :-(
This should also give a significant boost to getting
organisational LDAP address book functionality working
and integrated into the address book framework so that
equivalent 4.x functionality can be acheived.
FYI, here is an interesting submission which proposes
the representatint of vCard objects in RDF:
http://www.w3.org/Submission/2001/04/
Paul.
| ? + ? = To question
----------------\
Paul Sandoz
x19219
+353-1-8199219
#include "nsISupports.idl"
#include "nsISupportsArray.idl"
[scriptable, uuid(0E846276-1DD2-11B2-95AD-96B1397240AC)]
interface nsIAbDirectoryQueryProperty : nsISupports
{
/**
* The property which should be matched
*
* For example 'primaryEmail' or 'homePhone'
* for card properties.
*
* Two further properties are defined that
* do not exist as properties on a card.
* 'card:URI' which represents the URI property
* of the card as an RDF resource
* 'card:nsIAbCard' which represents the interface
* of a card component
*
*/
attribute string name;
};
[scriptable, uuid(3A6E0C0C-1DD2-11B2-B23D-EA3A8CCB333C)]
interface nsIAbDirectoryQueryPropertyValue : nsIAbDirectoryQueryProperty
{
/**
* The value of the property
*
*/
attribute wstring value;
};
[scriptable, uuid(418EEDA8-1DD2-11B2-8FB5-905EF30BC9F6)]
interface nsIAbDirectoryQueryMatchItem : nsIAbDirectoryQueryProperty
{
/**
* List of defined match types
*
*/
const long matchContains = 0;
const long matchDoesNotContain = 1;
const long matchIs = 2;
const long matchIsNot = 3;
const long matchBeginsWith = 4;
const long matchEndsWith = 6;
const long matchSoundsLike = 7;
const long matchRegExp = 8;
/**
* The type of match, like 4.x search parameters
* contains, does not contain
* is, is not
* begins with, ends with
* sounds like (?)
*
*/
attribute long matchType;
/**
* The match value
*
*/
attribute wstring matchValue;
};
[scriptable, uuid(41EC291E-1DD2-11B2-B583-C44757081F64)]
interface nsIAbDirectoryQueryArguments : nsISupports
{
/**
* The list of match items which will
* be matched against instances of
* cards
*
* nsISupportsArray<nsIAbDirectoryQueryMatchItem>
*
*/
attribute nsISupportsArray matchItems;
/**
* List of defined match items types
*
*/
const long matchItemsOneOrMore = 0;
const long matchItemsAll = 1;
/**
* Defines how multiple match items should
* be treated for a query result
* Match one or more (or)
* Match all (and)
*
*/
attribute long matchItemsType
/**
* Defines if sub directories should be
* queried
*
*/
attribute boolean querySubDirectories;
/**
* The list of properties which should
* be returned if a match occurs on a card
*
* nsISupportsArray<nsIAbDirectoryQueryProperty>
*
*/
attribute nsISupportsArray returnProperties;
};
[scriptable, uuid(4241C46E-1DD2-11B2-978D-A2FBD0A72AC2)]
interface nsIAbDirectoryQuery : nsISupports
{
/**
* Initiates a query on a directory and
* sub-directories for properties on cards
*
* @param arguments
* The properties and values to match
* Value could of type nsIAbDirectoryQueryMatchItem
* for matches other than ?contains?
* @param listener
* The listener which will obtain individual
* query results
* @param resultLimit
* Limits the results returned to a specifed
* maximum value
* @return
* Unique number representing the context ID of
* the query
*
*/
long doQuery (in nsIAbDirectoryQueryArguments arguments,
in nsIAbDirectoryQueryResultListener listener,
in long resultLimit);
/**
* Stops an existing query operation if
* operation is asynchronous
*
* @param contextID
* The unique number returned from
* the doQuery methods
*
*/
void stopQuery (in long contextID);
};
[scriptable, uuid(4290E508-1DD2-11B2-AC3E-9597BBCB25D7)]
interface nsIAbDirectoryQueryResultListener : nsISupports
{
/**
* Called when a match is found. May be
* called from a different thread to the
* one that initiates the query
*
* @param result
* A individual result associated returned
* from a query
*/
void onQueryItem (in nsIAbDirectoryQueryResult result);
};
[scriptable, uuid(42E600BA-1DD2-11B2-BC39-C363AC0C93E3)]
interface nsIAbDirectoryQueryResult : nsISupports
{
/**
* The context ID of the query
*
*/
readonly attribute long contextID;
/**
* The context of the query which
* corresponds to the arguments that
* define the query
*
*/
readonly attribute nsIAbDirectoryQueryArguments context
/**
* List of defined query results
*
*/
const long queryResultMatch = 0;
const long queryResultComplete = 1;
const long queryResultStopped = 2;
const long queryResultError = 3;
/**
* The type of result
*
* Identifies a query entry, the query has finished
* or that an error has occured
*/
readonly attribute long type;
/**
* The result of a singular match for a card
*
* Only valid when the attribute type is
* of 'query match'
*
* nsISupportsArray<nsIAbDirectoryQueryPropertyValue>
* Multiple entries corresponding to card
* properties
* nsISupportsArray<nsIAbCard>
* Only one entry makese sense
*
*/
readonly attribute nsISupportsArray result;
};
query.gif