![]() |
![]() |
|
| Index | Recent Threads | Unanswered Threads | Who's Online | Help |
|
|
| No member browsing this thread |
|
Thread Status: Active Total posts in this thread: 33
|
|
| Author |
|
|
Newbie Joined: Nov 27, 2008 Post Count: 17 Status: Offline |
Hi, I have been playing around with the ldap datastore and it is very easy to use .I would like to know if it is possible to LDAP SearchControls, I have noticied that when querying for an entry (with JPA or JDO) it goes one leaf down, but I need to serach the whole ldap tree SearchControls.SUBTREE_SCOPEThanks, azevedo |
||
|
|
Novice Joined: Jul 2, 2008 Post Count: 36 Status: Offline |
Hi, no, that is not possible yet. I'll investigate if it is easy to implement. Regards, Stefan |
||
|
|
Novice Joined: Jul 2, 2008 Post Count: 36 Status: Offline |
Right now the DN is just constructed using the attribute and value of the primary-key field as RDN and the value of the "dn" extension of the class as parent. Here is what we need to do: - Query/Search is easy to change, just add a SearchControl. - For fetch, update and delete it is necessary to search for the entry first, but it's also easy to change. - For insert I would suggest keep the current implementation. This means that new objects are created directly under the entry defined in the "dn" extension. Do you have another idea? To make the the search scope configurable I would suggest to add an "searchScope" extension with possible values sub, one or base: <class ...>Could you file an issue, please? I could finish the implementation tomorrow. |
||
|
|
Expert UK Joined: Mar 13, 2004 Post Count: 5686 Status: Offline |
I have noticied that when querying for an entry (with JPA or JDO) it goes one leaf down, but I need to serach the whole ldap tree for a specifique uid. Is this yet possible? When querying via pm.getObjectById(id);will obviously go through the whole database. The "id" is unique for a class, and so it searches for an instance of that class with the right key. The point here is not to add features that are specific to a datastore when there is a generic mechanism. So why not provide an example of what you are doing? then we can understand it ---------------------------------------- -Andy ![]() ![]() |
||
|
|
Newbie Joined: Nov 27, 2008 Post Count: 17 Status: Offline |
Hi, Do you want me to create it as an improvement or a new feature? Thanks, azevedo |
||
|
|
Newbie Joined: Nov 27, 2008 Post Count: 17 Status: Offline |
I have noticied that when querying for an entry (with JPA or JDO) it goes one leaf down, but I need to serach the whole ldap tree for a specifique uid. Is this yet possible? When querying via pm.getObjectById(id);will obviously go through the whole database. The "id" is unique for a class, and so it searches for an instance of that class with the right key. The point here is not to add features that are specific to a datastore when there is a generic mechanism. So why not provide an example of what you are doing? then we can understand it Hi, I will provide an example, before opening a issue azevedo |
||
|
|
Newbie Joined: Nov 27, 2008 Post Count: 17 Status: Offline |
Hi, Here an example, I have the LDAP tree ass root DN o=umc, under that root dn I have a lot of o dns So above you can see how the ldap tree is structred. Now I need to search for uniqueID azevedo on the tree. Here the Person.java file Here the codes of my queries: Person person = new Person();From the Error you see that the uniqueID is appened at the end of the dn specified in the Person.java javax.jdo.Query query = pm.newQuery("javax.jdo.query.JDOQL", "SELECT FROM lu.ept.dt.ldap.Person WHERE uniqueID == \"azevedo\"");With this query it doesn't find the user in the LDAP tree, I have no error log. And here a getObjectById(id) as you suggest So it looks like the LDAP search is not searching the whole LDAP tree it just goes one leaf below, I changed in Person.java the entry An the two first queries worked, the user was found with all its attributes, and the last query (getObjectById(id)) did return the same error. I hope it is clear, for you and I think the suggestion of seelmann to add a <extension vendor-name="datanucleus" key="searchScope" value="sub" />Thanks, azevedo |
||
|
|
Expert UK Joined: Mar 13, 2004 Post Count: 5686 Status: Offline |
So calling pm.getObjectById results in an incorrect query of LDAP so that it doesn't find the object. This implies a change internal to "store.ldap" and the query sent to LDAP, and doesn't imply exposing LDAP internals to the user (via some "searchControl"). If the user persists an object, they then should be able to call getObjectById on the id ... without having to configure database specifics, this is the whole point of JDO. ---------------------------------------- -Andy ![]() ![]() |
||
|
|
Newbie Joined: Nov 27, 2008 Post Count: 17 Status: Offline |
So calling pm.getObjectById results in an incorrect query of LDAP so that it doesn't find the object. This implies a change internal to "store.ldap" and the query sent to LDAP, and doesn't imply exposing LDAP internals to the user (via some "searchControl"). If the user persists an object, they then should be able to call getObjectById on the id ... without having to configure database specifics, this is the whole point of JDO. Hi, I have been looking at the store.ldap source files and the dn used for queries and search is construct using the value in the extension like in my case @Extension(vendorName="DataNucleus", key="dn", value="retailerName=default,o=Users,o=UMC")So, If I am correct for the getObjectById in the LDAPPersistenceHandler.java the method fetchObject has to be changed. I noticied that this String dn = LDAPUtils.getDistinguishedNameForObject(sm);is creating the dn and in my case it is the wrong dn. The JDOQL query excutes the LDAPUtils.getObjectsOfCandidateType method which calls ctx.search. I noticied that the query is done on the wohle leaf and than filter is applied in the in-memory. So, I think is best to implment a ctx.search with a filter like and set directly SearchControls.SUBTREE_SCOPE ctx.search("dc=example", "uid=user", SearchControls)So it will return the single user if any. Bye, azevedo |
||
|
|
Novice Joined: Jul 2, 2008 Post Count: 36 Status: Offline |
Hi Andy, it depends on the structure of the directory and IMO the user has to configure it. In LDAP there are different ways to structure data. Some choose a 'flat' hierarchy and just put e.g. all user entries into one container entry, this case is already supported by store.ldap: ou=usersOthers model the tree like their organisational structure, so the users are on different locations in the tree (just think like the files in a file system): ou=usersI think the user has to configure which kind of directory structure s/he has. Regards, Stefan |
||
|
|
|
|
|
Current timezone is GMT May 17, 2012 12:02:57 PM |